[18] | 1 | import wx, sys, os, gettext, string, time |
---|
| 2 | import wx.wizard as wiz |
---|
| 3 | from wx.lib.mixins.listctrl import CheckListCtrlMixin |
---|
| 4 | import wx.lib.filebrowsebutton as filebrowse |
---|
| 5 | import wx.lib.layoutf as layoutf |
---|
| 6 | |
---|
| 7 | cat = gettext.GNUTranslations(open('langs/%s.mo' % os.getenv('LANG'))) |
---|
| 8 | _ = cat.gettext |
---|
| 9 | |
---|
| 10 | global FinalArgs |
---|
| 11 | FinalArgs = [] |
---|
| 12 | for i in range(0,37): |
---|
| 13 | FinalArgs.insert(i,'') |
---|
| 14 | |
---|
| 15 | #---------------------------------------------------------------------- |
---|
| 16 | ClonezillaStartSaveArgs = { |
---|
| 17 | 1: ("-q", _('msg_ocs_param_q')), |
---|
| 18 | 2: ("-c", _('msg_ocs_param_c')), |
---|
| 19 | 3: ("-nogui", _('msg_ocs_param_nogui')), |
---|
| 20 | 4: ("-a", _('msg_ocs_param_a')), |
---|
| 21 | 5: ("-f", _('msg_ocs_param_f')), |
---|
| 22 | 6: ("-s", _('msg_ocs_param_s')), |
---|
| 23 | 7: ("-ntfs-ok", _('msg_ocs_param_notfs_ok')), |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | #---------------------------------------------------------------------- |
---|
| 27 | ClonezillaStartRestoreArgs = { |
---|
| 28 | 1: ("-g auto", _('msg_ocs_param_g_auto')), |
---|
| 29 | 2: ("-x", _('msg_ocs_param_x')), |
---|
| 30 | 3: ("-brdcst", _('msg_ocs_param_broadcast')), |
---|
| 31 | 4: ("-v", _('msg_ocs_param_v')), |
---|
| 32 | 5: ("-nogui", _('msg_ocs_param_nogui')), |
---|
| 33 | 6: ("-c", _('msg_ocs_param_c')), |
---|
| 34 | 7: ("-u", _('msg_ocs_param_u')), |
---|
| 35 | 8: ("-t", _('msg_ocs_param_t')), |
---|
| 36 | 9: ("-j0", _('msg_ocs_param_j0')), |
---|
| 37 | 10: ("-ns", _('msg_ocs_param_ns')), |
---|
| 38 | 11: ("-k", _('msg_ocs_param_k')), |
---|
| 39 | 12: ("-r", _('msg_ocs_param_r')), |
---|
| 40 | 13: ("-e", _('msg_ocs_param_e')), |
---|
| 41 | 14: ("-f", _('msg_ocs_param_f')), |
---|
| 42 | 15: ("-s", _('msg_ocs_param_s')), |
---|
| 43 | 16: ("-a", _('msg_ocs_param_a')), |
---|
| 44 | 17: ("-o0", _('msg_ocs_param_o0')), |
---|
| 45 | 18: ("-o1", _('msg_ocs_param_o1')), |
---|
| 46 | 19: ("-hn0", _('msg_ocs_param_hn0')), |
---|
| 47 | 20: ("-hn1", _('msg_ocs_param_hn1')), |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | #---------------------------------------------------------------------- |
---|
| 51 | class CSSCheckListCtrl(wx.ListCtrl, CheckListCtrlMixin): |
---|
| 52 | def __init__(self, parent, log): |
---|
| 53 | wx.ListCtrl.__init__(self, parent, -1, style=wx.LC_REPORT) |
---|
| 54 | CheckListCtrlMixin.__init__(self) |
---|
| 55 | self.log = log |
---|
| 56 | self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) |
---|
| 57 | |
---|
| 58 | def OnItemActivated(self, evt): |
---|
| 59 | self.ToggleItem(evt.m_itemIndex) |
---|
| 60 | |
---|
| 61 | # this is called by the base class when an item is checked/unchecked |
---|
| 62 | def OnCheckItem(self, index, flag): |
---|
| 63 | data = self.GetItemData(index) |
---|
| 64 | arg = ClonezillaStartSaveArgs[data][0] |
---|
| 65 | if flag: |
---|
| 66 | FinalArgs[index+3] = arg |
---|
| 67 | else: |
---|
| 68 | FinalArgs[index+3] = '' |
---|
| 69 | |
---|
| 70 | #---------------------------------------------------------------------- |
---|
| 71 | class CSRCheckListCtrl(wx.ListCtrl, CheckListCtrlMixin): |
---|
| 72 | def __init__(self, parent, log): |
---|
| 73 | wx.ListCtrl.__init__(self, parent, -1, style=wx.LC_REPORT) |
---|
| 74 | CheckListCtrlMixin.__init__(self) |
---|
| 75 | self.log = log |
---|
| 76 | self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) |
---|
| 77 | |
---|
| 78 | def OnItemActivated(self, evt): |
---|
| 79 | self.ToggleItem(evt.m_itemIndex) |
---|
| 80 | |
---|
| 81 | # this is called by the base class when an item is checked/unchecked |
---|
| 82 | def OnCheckItem(self, index, flag): |
---|
| 83 | data = self.GetItemData(index) |
---|
| 84 | arg = ClonezillaStartRestoreArgs[data][0] |
---|
| 85 | if flag: |
---|
| 86 | if index == 19: |
---|
| 87 | FinalArgs[index+4] = arg |
---|
| 88 | else: |
---|
| 89 | FinalArgs[index+3] = arg |
---|
| 90 | else: |
---|
| 91 | if index == 19: |
---|
| 92 | FinalArgs[index+4] = '' |
---|
| 93 | else: |
---|
| 94 | FinalArgs[index+3] = '' |
---|
| 95 | |
---|
| 96 | #---------------------------------------------------------------------- |
---|
| 97 | def makePageTitle(wizPg, title): |
---|
| 98 | sizer = wx.BoxSizer(wx.VERTICAL) |
---|
| 99 | wizPg.SetSizer(sizer) |
---|
| 100 | title = wx.StaticText(wizPg, -1, title) |
---|
| 101 | title.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD)) |
---|
| 102 | sizer.Add(title, 0, wx.ALIGN_CENTRE|wx.ALL, 5) |
---|
| 103 | sizer.Add(wx.StaticLine(wizPg, -1), 0, wx.EXPAND|wx.ALL, 5) |
---|
| 104 | return sizer |
---|
| 105 | |
---|
| 106 | #---------------------------------------------------------------------- |
---|
| 107 | class SetAllClientsPage(wiz.PyWizardPage): |
---|
| 108 | def __init__(self, parent, title): |
---|
| 109 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 110 | self.next = self.prev = None |
---|
| 111 | self.sizer = makePageTitle(self, title) |
---|
| 112 | |
---|
| 113 | wx.StaticText(self, -1, _('msg_select_all_clients_or_select_part_them'), pos=(10,60), size=(400,100), style=wx.TE_MULTILINE) |
---|
| 114 | wx.StaticText(self, -1, _('msg_set_all_clients_des'), pos=(10,80), size=(400,100), style=wx.TE_MULTILINE) |
---|
| 115 | ox = ['Yes', 'No'] |
---|
| 116 | self.rb = wx.RadioBox(self, -1, _('msg_set_all_clients'), (10,150), (250,75), ox, 1, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 117 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, self.rb) |
---|
| 118 | FinalArgs[1] = '-nl' |
---|
| 119 | |
---|
| 120 | def EvtRadioBox(self, event): |
---|
| 121 | if event.GetSelection() == 0: |
---|
| 122 | FinalArgs[1] = '-nl' |
---|
| 123 | if event.GetSelection() == 1: |
---|
| 124 | FinalArgs[1] = '-h' |
---|
| 125 | |
---|
| 126 | def SetNext(self, next): |
---|
| 127 | self.next = next |
---|
| 128 | |
---|
| 129 | def GetNext(self): |
---|
| 130 | next = self.next |
---|
| 131 | if self.rb.GetSelection()==0: |
---|
| 132 | next = next.GetNext() |
---|
| 133 | return next |
---|
| 134 | |
---|
| 135 | #---------------------------------------------------------------------- |
---|
| 136 | class SelectClientsPage(wiz.PyWizardPage): |
---|
| 137 | def __init__(self, parent, title): |
---|
| 138 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 139 | self.next = self.prev = None |
---|
| 140 | self.sizer = makePageTitle(self, title) |
---|
| 141 | |
---|
| 142 | self.SelectedClientsArray = [] |
---|
| 143 | self.SelectedClientsStr = '' |
---|
| 144 | self.fuse_next = self.fuse_prev = 0 |
---|
| 145 | |
---|
| 146 | AllClientsArray = os.popen('sudo /opt/drbl/bin/get-client-ip-list').read().split('\n') |
---|
| 147 | AllClientsArray.remove('') |
---|
| 148 | self.lb = wx.CheckListBox(self, -1, (10,50), (470,250), AllClientsArray) |
---|
| 149 | self.Bind(wx.EVT_CHECKLISTBOX, self.EvtCheckListBox, self.lb) |
---|
| 150 | self.lb.SetSelection(0) |
---|
| 151 | |
---|
| 152 | def EvtCheckListBox(self, event): |
---|
| 153 | global PXE_CFG |
---|
| 154 | index = event.GetSelection() |
---|
| 155 | label = self.lb.GetString(index) |
---|
| 156 | if self.lb.IsChecked(index): |
---|
| 157 | self.SelectedClientsArray.append(label) |
---|
| 158 | if not (self.lb.IsChecked(index)): |
---|
| 159 | self.SelectedClientsArray.remove(label) |
---|
| 160 | self.lb.SetSelection(index) #so that (un)checking also selects (moves the highlight) |
---|
| 161 | self.SelectedClientsStr = '' |
---|
| 162 | PXE_CFG = [] |
---|
| 163 | for x in self.SelectedClientsArray: |
---|
| 164 | self.SelectedClientsStr = x + ' ' + self.SelectedClientsStr |
---|
| 165 | SinglePXECfgFileName = string.upper('%02x' % int(x.split('.')[0],10) + '%02x' % int(x.split('.')[1],10) + '%02x' % int(x.split('.')[2],10) + '%02x' % int(x.split('.')[3],10)) |
---|
| 166 | PXE_CFG.append(SinglePXECfgFileName) |
---|
| 167 | self.SelectedClientsStr = '\"' + self.SelectedClientsStr + '\"' |
---|
| 168 | #print self.SelectedClientsStr |
---|
| 169 | #print PXE_CFG[:] |
---|
| 170 | |
---|
| 171 | def SetNext(self, next): |
---|
| 172 | self.next = next |
---|
| 173 | |
---|
| 174 | def SetPrev(self, prev): |
---|
| 175 | self.prev = prev |
---|
| 176 | |
---|
| 177 | def GetNext(self): |
---|
| 178 | global PXE_CFG |
---|
| 179 | command = command_log = '' |
---|
| 180 | next = self.next |
---|
| 181 | self.fuse_prev = 0 |
---|
| 182 | self.fuse_next = self.fuse_next + 1 |
---|
| 183 | if self.fuse_next == 2: |
---|
| 184 | if FinalArgs[1] == '-nl': |
---|
| 185 | FinalArgs[2] = '' |
---|
| 186 | PXE_CFG = [] |
---|
| 187 | elif (self.SelectedClientsStr == '\"\"') or (self.SelectedClientsStr == ''): |
---|
| 188 | war = wx.MessageDialog(self, 'YOU MUST CHOOSE ONE!!', 'WARNNING!!', wx.OK|wx.ICON_INFORMATION) |
---|
| 189 | war.ShowModal() |
---|
| 190 | war.Destroy() |
---|
| 191 | return self |
---|
| 192 | else: |
---|
| 193 | FinalArgs[2] = self.SelectedClientsStr |
---|
| 194 | #print FinalArgs[2] |
---|
| 195 | #print PXE_CFG[:] |
---|
| 196 | if (FinalArgs[3] == 'remote-linux-gra') or (FinalArgs[3] == 'remote-linux-txt') or (FinalArgs[3] == 'terminal') or (FinalArgs[3] == 'remote-memtest') or (FinalArgs[3] == 'remote-fdos') or (FinalArgs[3] == 'remote-local') or (FinalArgs[3] == 'local') or (FinalArgs[3] == 'Wake-on-LAN'): |
---|
| 197 | for i in range(0,4): |
---|
| 198 | if FinalArgs[i] != '': |
---|
| 199 | command = command + FinalArgs[i] + ' ' |
---|
| 200 | FinalCommand.SetLabel('%s' % command) |
---|
| 201 | CommandLog.WriteText(os.popen('sudo %s' % command).read()) |
---|
| 202 | elif (FinalArgs[3] == 'reboot') or (FinalArgs[3] == 'shutdown'): |
---|
| 203 | for i in range(0,4): |
---|
| 204 | if FinalArgs[i] != '': |
---|
| 205 | command = command + FinalArgs[i] + ' ' |
---|
| 206 | file = open('tmp.log','w') |
---|
| 207 | os.system('sudo %s > tmp.log' % command) |
---|
| 208 | file.close() |
---|
| 209 | file = open('tmp.log') |
---|
| 210 | while True: |
---|
| 211 | line = file.readline() |
---|
| 212 | if len(line) == 0: # Zero length indicates EOF |
---|
| 213 | break |
---|
| 214 | command_log = command_log + line |
---|
| 215 | file.close() |
---|
| 216 | os.remove('tmp.log') |
---|
| 217 | FinalCommand.SetLabel('%s' % command) |
---|
| 218 | CommandLog.WriteText('%s' % command_log) |
---|
| 219 | elif (FinalArgs[0] == '/opt/drbl/sbin/drbl-client-reautologin'): |
---|
| 220 | if FinalArgs[1] == '-nl': |
---|
| 221 | FinalArgs[1] = '' |
---|
| 222 | FinalCommand.SetLabel('%s' % command) |
---|
| 223 | CommandLog.WriteText(os.popen('sudo %s' % FinalArgs[0]).read()) |
---|
| 224 | else: |
---|
| 225 | FinalCommand.SetLabel('%s %s %s' % (FinalArgs[0], FinalArgs[1], FinalArgs[2])) |
---|
| 226 | CommandLog.WriteText(os.popen('sudo %s %s %s' % (FinalArgs[0], FinalArgs[1], FinalArgs[2])).read()) |
---|
| 227 | return next |
---|
| 228 | |
---|
| 229 | def GetPrev(self): |
---|
| 230 | self.fuse_next = 0 |
---|
| 231 | return self.prev |
---|
| 232 | |
---|
| 233 | #---------------------------------------------------------------------- |
---|
| 234 | class ClonezillaStartSavePage1(wiz.PyWizardPage): |
---|
| 235 | def __init__(self, parent, title): |
---|
| 236 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 237 | self.next = self.prev = None |
---|
| 238 | self.sizer = makePageTitle(self, title) |
---|
| 239 | self.fuse_prev = 0 |
---|
| 240 | |
---|
| 241 | ModeList = [_('msg_clonezilla_save_disk'), _('msg_clonezilla_save_parts')] |
---|
| 242 | rb = wx.RadioBox(self, -1, _('msg_choose_mode'), (35, 50), (260,90), ModeList, 1, wx.RA_SPECIFY_COLS) |
---|
| 243 | |
---|
| 244 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 245 | FinalArgs[0] = '/opt/drbl/sbin/drbl-ocs -b' |
---|
| 246 | FinalArgs[12] = 'startdisk' |
---|
| 247 | FinalArgs[13] = 'save' |
---|
| 248 | |
---|
| 249 | def EvtRadioBox(self, event): |
---|
| 250 | if event.GetInt() == 0: |
---|
| 251 | FinalArgs[12] = 'startdisk' |
---|
| 252 | FinalArgs[13] = 'save' |
---|
| 253 | if event.GetInt() == 1: |
---|
| 254 | FinalArgs[12] = 'startparts' |
---|
| 255 | FinalArgs[13] = 'save' |
---|
| 256 | |
---|
| 257 | def SetNext(self, next): |
---|
| 258 | self.next = next |
---|
| 259 | |
---|
| 260 | def SetPrev(self, prev): |
---|
| 261 | self.prev = prev |
---|
| 262 | |
---|
| 263 | def GetNext(self): |
---|
| 264 | self.fuse_prev = 0 |
---|
| 265 | return self.next |
---|
| 266 | |
---|
| 267 | def GetPrev(self): |
---|
| 268 | self.fuse_prev = self.fuse_prev + 1 |
---|
| 269 | if self.fuse_prev == 1: |
---|
| 270 | prev = self.prev |
---|
| 271 | if FinalArgs[1] == '-nl': |
---|
| 272 | prev = prev.GetPrev() |
---|
| 273 | return prev |
---|
| 274 | |
---|
| 275 | #---------------------------------------------------------------------- |
---|
| 276 | class ClonezillaStartSavePage2(wiz.PyWizardPage): |
---|
| 277 | def __init__(self, parent, title): |
---|
| 278 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 279 | self.next = self.prev = None |
---|
| 280 | self.sizer = makePageTitle(self, title) |
---|
| 281 | self.fuse_next = 0 |
---|
| 282 | global CSSP2rb |
---|
| 283 | |
---|
| 284 | choice = [_('msg_now_input_in_server'), _('msg_later_input_in_client')] |
---|
| 285 | wx.StaticText(self, -1, _('msg_ask_if_input_save_image_name_in_server'), (10,60),(470,100), style=wx.TE_MULTILINE) |
---|
| 286 | CSSP2rb = wx.RadioBox(self, -1, _('msg_choose_action'), (10,120), (210,80), choice, 1, wx.RA_SPECIFY_COLS) |
---|
| 287 | CSSP2rb.SetSelection(0) |
---|
| 288 | |
---|
| 289 | def SetNext(self, next): |
---|
| 290 | self.next = next |
---|
| 291 | |
---|
| 292 | def SetPrev(self, prev): |
---|
| 293 | self.prev = prev |
---|
| 294 | |
---|
| 295 | def GetNext(self): |
---|
| 296 | self.fuse_next = self.fuse_next + 1 |
---|
| 297 | next = self.next |
---|
| 298 | if self.fuse_next == 2: |
---|
| 299 | if CSSP2rb.GetSelection() == 1: |
---|
| 300 | next = next.GetNext() |
---|
| 301 | return next |
---|
| 302 | |
---|
| 303 | def GetPrev(self): |
---|
| 304 | self.fuse_next = 0 |
---|
| 305 | return self.prev |
---|
| 306 | |
---|
| 307 | #---------------------------------------------------------------------- |
---|
| 308 | class ClonezillaStartSavePage3(wiz.PyWizardPage): |
---|
| 309 | def __init__(self, parent, title): |
---|
| 310 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 311 | self.next = self.prev = None |
---|
| 312 | self.sizer = makePageTitle(self, title) |
---|
| 313 | self.fuse_next = self.fuse_prev = 0 |
---|
| 314 | |
---|
| 315 | wx.StaticText(self, -1, _('msg_input_image_name'), (10, 160)) |
---|
| 316 | self.text_img = wx.TextCtrl(self, -1, '', (10, 180), size=(200, -1)) |
---|
| 317 | wx.StaticText(self, -1, _('msg_input_device_name'), (10, 210)) |
---|
| 318 | self.text_dev = wx.TextCtrl(self, -1, '', (10, 230), size=(190, -1)) |
---|
| 319 | |
---|
| 320 | def SetNext(self, next): |
---|
| 321 | self.next = next |
---|
| 322 | |
---|
| 323 | def SetPrev(self, prev): |
---|
| 324 | self.prev = prev |
---|
| 325 | |
---|
| 326 | def GetNext(self): |
---|
| 327 | global CSSP2rb |
---|
| 328 | self.fuse_next = self.fuse_next + 1 |
---|
| 329 | self.fuse_prev = 0 |
---|
| 330 | if self.fuse_next == 2: |
---|
| 331 | if CSSP2rb.GetSelection() == 1: |
---|
| 332 | FinalArgs[14] = '' |
---|
| 333 | FinalArgs[15] = '' |
---|
| 334 | #print ('FinalArgs[14] is %s, FinalArgs[15] is %s' % (FinalArgs[14], FinalArgs[15])) |
---|
| 335 | elif self.text_img.GetValue() == '' or self.text_dev.GetValue() == '': |
---|
| 336 | warnning = wx.MessageDialog(self, 'YOU MUST ENTER SOMETHING!!', 'WARNNING', wx.OK|wx.ICON_INFORMATION) |
---|
| 337 | warnning.ShowModal() |
---|
| 338 | warnning.Destroy() |
---|
| 339 | return self |
---|
| 340 | else: |
---|
| 341 | FinalArgs[14] = self.text_img.GetValue() |
---|
| 342 | FinalArgs[15] = self.text_dev.GetValue() |
---|
| 343 | #print ('FinalArgs[14] is %s, FinalArgs[15] is %s' % (FinalArgs[14], FinalArgs[15])) |
---|
| 344 | return self.next |
---|
| 345 | |
---|
| 346 | def GetPrev(self): |
---|
| 347 | self.fuse_next = 0 |
---|
| 348 | return self.prev |
---|
| 349 | |
---|
| 350 | #---------------------------------------------------------------------- |
---|
| 351 | class ClonezillaStartSavePage4(wiz.PyWizardPage): |
---|
| 352 | def __init__(self, parent, title): |
---|
| 353 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 354 | self.next = self.prev = None |
---|
| 355 | self.sizer = makePageTitle(self, title) |
---|
| 356 | self.fuse_next = self.fuse_prev = 0 |
---|
| 357 | |
---|
| 358 | ox = [_('msg_yes'), _('msg_no')] |
---|
| 359 | wx.StaticText(self, -1, _('msg_skip_set_advanced_extra_param'), (10,60), (470,100), wx.TE_MULTILINE) |
---|
| 360 | rb = wx.RadioBox(self, -1, _('msg_choose_action'), (10,100), (100,50), ox, 1, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 361 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 362 | rb.SetSelection(1) |
---|
| 363 | self.SkipExtraParam = 'no' |
---|
| 364 | |
---|
| 365 | def EvtRadioBox(self, event): |
---|
| 366 | if event.GetSelection() == 0: |
---|
| 367 | self.SkipExtraParam = 'yes' |
---|
| 368 | else: |
---|
| 369 | self.SkipExtraParam = 'no' |
---|
| 370 | |
---|
| 371 | def SetNext(self, next): |
---|
| 372 | self.next = next |
---|
| 373 | |
---|
| 374 | def SetPrev(self, prev): |
---|
| 375 | self.prev = prev |
---|
| 376 | |
---|
| 377 | def GetNext(self): |
---|
| 378 | global CSSP2rb |
---|
| 379 | next = self.next |
---|
| 380 | command = command_log = '' |
---|
| 381 | self.fuse_prev = 0 |
---|
| 382 | self.fuse_next = self.fuse_next + 1 |
---|
| 383 | if self.fuse_next == 2: |
---|
| 384 | if self.SkipExtraParam == 'yes': |
---|
| 385 | if CSSP2rb.GetSelection() == 1: |
---|
| 386 | if FinalArgs[1] == '-nl': |
---|
| 387 | command = ('%s %s %s' % (FinalArgs[0], FinalArgs[12], FinalArgs[13])) |
---|
| 388 | elif FinalArgs[1] == '-h': |
---|
| 389 | command = ('%s %s %s %s %s' % (FinalArgs[0], FinalArgs[1], FinalArgs[2], FinalArgs[12], FinalArgs[13])) |
---|
| 390 | elif CSSP2rb.GetSelection() == 0: |
---|
| 391 | if FinalArgs[1] == '-nl': |
---|
| 392 | command = ('%s %s %s %s %s' % (FinalArgs[0], FinalArgs[12], FinalArgs[13], FinalArgs[14], FinalArgs[15])) |
---|
| 393 | elif FinalArgs[1] == '-h': |
---|
| 394 | command = ('%s %s %s %s %s %s %s' % (FinalArgs[0], FinalArgs[1], FinalArgs[2], FinalArgs[12], FinalArgs[13], FinalArgs[14], FinalArgs[15])) |
---|
| 395 | file = open('tmp.log','w') |
---|
| 396 | os.system('sudo %s > tmp.log' % command) |
---|
| 397 | time.sleep(6) |
---|
| 398 | file.close() |
---|
| 399 | file = open('tmp.log') |
---|
| 400 | while True: |
---|
| 401 | line = file.readline() |
---|
| 402 | if len(line) == 0: # Zero length indicates EOF |
---|
| 403 | break |
---|
| 404 | command_log = command_log + line |
---|
| 405 | file.close() |
---|
| 406 | os.remove('tmp.log') |
---|
| 407 | FinalCommand.SetLabel('%s' % command) |
---|
| 408 | CommandLog.WriteText('%s' % command_log) |
---|
| 409 | for i in range(0,3): |
---|
| 410 | next = next.GetNext() |
---|
| 411 | return next |
---|
| 412 | |
---|
| 413 | def GetPrev(self): |
---|
| 414 | self.fuse_next = 0 |
---|
| 415 | self.fuse_prev = self.fuse_prev + 1 |
---|
| 416 | prev = self.prev |
---|
| 417 | if self.fuse_prev == 1: |
---|
| 418 | if FinalArgs[14] == '' and FinalArgs[15] == '': |
---|
| 419 | prev = prev.GetPrev() |
---|
| 420 | return prev |
---|
| 421 | |
---|
| 422 | |
---|
| 423 | #---------------------------------------------------------------------- |
---|
| 424 | class ClonezillaStartSavePage5(wiz.PyWizardPage): |
---|
| 425 | def __init__(self, parent, title): |
---|
| 426 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 427 | self.next = self.prev = None |
---|
| 428 | self.sizer = makePageTitle(self, title) |
---|
| 429 | self.fuse_next = self.fuse_prev = 0 |
---|
| 430 | |
---|
| 431 | self.list = CSSCheckListCtrl(self, title) |
---|
| 432 | sizer = wx.BoxSizer() |
---|
| 433 | sizer.Add(self.list, 1, wx.EXPAND) |
---|
| 434 | self.SetSizer(sizer) |
---|
| 435 | |
---|
| 436 | self.list.InsertColumn(0, _('argument')) #not translated |
---|
| 437 | self.list.InsertColumn(1, _('meannings'), wx.LIST_FORMAT_LEFT) #not translated |
---|
| 438 | |
---|
| 439 | for key, data in ClonezillaStartSaveArgs.iteritems(): |
---|
| 440 | index = self.list.InsertStringItem(sys.maxint, data[0]) |
---|
| 441 | self.list.SetStringItem(index, 1, data[1]) |
---|
| 442 | self.list.SetItemData(index, key) |
---|
| 443 | |
---|
| 444 | self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE) |
---|
| 445 | self.list.SetColumnWidth(1, wx.LIST_AUTOSIZE) |
---|
| 446 | |
---|
| 447 | self.list.CheckItem(0) |
---|
| 448 | self.list.CheckItem(1) |
---|
| 449 | |
---|
| 450 | def SetNext(self, next): |
---|
| 451 | self.next = next |
---|
| 452 | |
---|
| 453 | def SetPrev(self, prev): |
---|
| 454 | self.prev = prev |
---|
| 455 | |
---|
| 456 | def GetNext(self): |
---|
| 457 | self.fuse_prev = 0 |
---|
| 458 | return self.next |
---|
| 459 | |
---|
| 460 | def GetPrev(self): |
---|
| 461 | return self.prev |
---|
| 462 | |
---|
| 463 | #---------------------------------------------------------------------- |
---|
| 464 | class ClonezillaStartSavePage6(wiz.PyWizardPage): |
---|
| 465 | def __init__(self, parent, title): |
---|
| 466 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 467 | self.next = self.prev = None |
---|
| 468 | self.sizer = makePageTitle(self, title) |
---|
| 469 | |
---|
| 470 | ArgList = [_('msg_ocs_param_p_choose'), _('msg_ocs_param_p_true'), _('msg_ocs_param_p_poweroff'), _('msg_ocs_param_p_reboot')] |
---|
| 471 | rb = wx.RadioBox(self, -1, _('msg_choose_post_mode_after_clone'), (10,100), (250,100), ArgList, 1, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 472 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 473 | rb.SetSelection(0) |
---|
| 474 | FinalArgs[10] = '-p choose' |
---|
| 475 | |
---|
| 476 | def EvtRadioBox(self, event): |
---|
| 477 | if event.GetSelection() == 0: |
---|
| 478 | FinalArgs[10] = '-p choose' |
---|
| 479 | if event.GetSelection() == 1: |
---|
| 480 | FinalArgs[10] = '-p true' |
---|
| 481 | if event.GetSelection() == 2: |
---|
| 482 | FinalArgs[10] = '-p poweroff' |
---|
| 483 | if event.GetSelection() == 3: |
---|
| 484 | FinalArgs[10] = '-p reboot' |
---|
| 485 | |
---|
| 486 | def SetNext(self, next): |
---|
| 487 | self.next = next |
---|
| 488 | |
---|
| 489 | def SetPrev(self, prev): |
---|
| 490 | self.prev = prev |
---|
| 491 | |
---|
| 492 | def GetNext(self): |
---|
| 493 | return self.next |
---|
| 494 | |
---|
| 495 | def GetPrev(self): |
---|
| 496 | return self.prev |
---|
| 497 | |
---|
| 498 | #---------------------------------------------------------------------- |
---|
| 499 | class ClonezillaStartSavePage7(wiz.PyWizardPage): |
---|
| 500 | def __init__(self, parent, title): |
---|
| 501 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 502 | self.next = self.prev = None |
---|
| 503 | self.sizer = makePageTitle(self, title) |
---|
| 504 | self.fuse_next = 0 |
---|
| 505 | |
---|
| 506 | ArgList = [ _('msg_ocs_param_z0'), _('msg_ocs_param_z1'), _('msg_ocs_param_z2'), _('msg_ocs_param_z3')] |
---|
| 507 | rb = wx.RadioBox(self, -1, _('msg_choose_post_mode_after_clone'), (10,100), (300,100), ArgList, 1, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 508 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 509 | rb.SetSelection(3) |
---|
| 510 | FinalArgs[11] = '-z3' |
---|
| 511 | |
---|
| 512 | def EvtRadioBox(self, event): |
---|
| 513 | if event.GetSelection() == 0: |
---|
| 514 | FinalArgs[11] = '-z0' |
---|
| 515 | if event.GetSelection() == 1: |
---|
| 516 | FinalArgs[11] = '-z1' |
---|
| 517 | if event.GetSelection() == 2: |
---|
| 518 | FinalArgs[11] = '-z2' |
---|
| 519 | if event.GetSelection() == 3: |
---|
| 520 | FinalArgs[11] = '-z3' |
---|
| 521 | |
---|
| 522 | def SetNext(self, next): |
---|
| 523 | self.next = next |
---|
| 524 | |
---|
| 525 | def SetPrev(self, prev): |
---|
| 526 | self.prev = prev |
---|
| 527 | |
---|
| 528 | def GetNext(self): |
---|
| 529 | command = command_log = '' |
---|
| 530 | self.fuse_next = self.fuse_next + 1 |
---|
| 531 | if self.fuse_next == 2: |
---|
| 532 | if FinalArgs[1] == '-nl': |
---|
| 533 | FinalArgs[1] = '' |
---|
| 534 | for i in range(0,20): |
---|
| 535 | if FinalArgs[i] != '': |
---|
| 536 | command = command + FinalArgs[i] + ' ' |
---|
| 537 | file = open('tmp.log','w') |
---|
| 538 | os.system('sudo %s > tmp.log' % command) |
---|
| 539 | time.sleep(6) |
---|
| 540 | file.close() |
---|
| 541 | file = open('tmp.log') |
---|
| 542 | while True: |
---|
| 543 | line = file.readline() |
---|
| 544 | if len(line) == 0: # Zero length indicates EOF |
---|
| 545 | break |
---|
| 546 | command_log = command_log + line |
---|
| 547 | file.close() |
---|
| 548 | os.remove('tmp.log') |
---|
| 549 | FinalCommand.SetLabel('%s' % command) |
---|
| 550 | CommandLog.WriteText('%s' % command_log) |
---|
| 551 | return self.next |
---|
| 552 | |
---|
| 553 | def GetPrev(self): |
---|
| 554 | self.fuse_next = 0 |
---|
| 555 | return self.prev |
---|
| 556 | |
---|
| 557 | #---------------------------------------------------------------------- |
---|
| 558 | class ClonezillaStartRestorePage1(wiz.PyWizardPage): |
---|
| 559 | def __init__(self, parent, title): |
---|
| 560 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 561 | self.next = self.prev = None |
---|
| 562 | self.sizer = makePageTitle(self, title) |
---|
| 563 | self.fuse_next = self.fuse_prev = 0 |
---|
| 564 | |
---|
| 565 | ModeList = [_('msg_clonezilla_restore_disk'), _('msg_clonezilla_restore_parts')] |
---|
| 566 | rb = wx.RadioBox(self, -1, _('msg_choose_mode'), (35, 50), (260,90), ModeList, 1, wx.RA_SPECIFY_COLS | wx.NO_BORDER) |
---|
| 567 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 568 | FinalArgs[0] = '/opt/drbl/sbin/drbl-ocs -b' |
---|
| 569 | FinalArgs[33] = 'startdisk' |
---|
| 570 | |
---|
| 571 | def EvtRadioBox(self, event): |
---|
| 572 | if event.GetInt() == 0: |
---|
| 573 | FinalArgs[33] = 'startdisk' |
---|
| 574 | if event.GetInt() == 1: |
---|
| 575 | FinalArgs[33] = 'startparts' |
---|
| 576 | |
---|
| 577 | def SetNext(self, next): |
---|
| 578 | self.next = next |
---|
| 579 | |
---|
| 580 | def SetPrev(self, prev): |
---|
| 581 | self.prev = prev |
---|
| 582 | |
---|
| 583 | def GetNext(self): |
---|
| 584 | self.fuse_prev = 0 |
---|
| 585 | #self.fuse_next = self.fuse_next + 1 |
---|
| 586 | #if self.fuse_next == 2: |
---|
| 587 | #print ('ClonezillaRestorePage1: FinalArgs[33] is %s' % FinalArgs[33]) |
---|
| 588 | return self.next |
---|
| 589 | |
---|
| 590 | def GetPrev(self): |
---|
| 591 | prev = self.prev |
---|
| 592 | self.fuse_next = 0 |
---|
| 593 | self.fuse_prev = self.fuse_prev + 1 |
---|
| 594 | if self.fuse_prev == 1: |
---|
| 595 | if FinalArgs[1] == '-nl': |
---|
| 596 | prev = prev.GetPrev() |
---|
| 597 | return prev |
---|
| 598 | |
---|
| 599 | #---------------------------------------------------------------------- |
---|
| 600 | class ClonezillaStartRestorePage2(wiz.PyWizardPage): |
---|
| 601 | def __init__(self, parent, title): |
---|
| 602 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 603 | self.next = self.prev = None |
---|
| 604 | self.sizer = makePageTitle(self, title) |
---|
| 605 | self.fuse_next = 0 |
---|
| 606 | |
---|
| 607 | self.list = CSRCheckListCtrl(self, title) |
---|
| 608 | sizer = wx.BoxSizer() |
---|
| 609 | sizer.Add(self.list, 1, wx.EXPAND) |
---|
| 610 | self.SetSizer(sizer) |
---|
| 611 | |
---|
| 612 | self.list.InsertColumn(0, _('argument')) #not translated |
---|
| 613 | self.list.InsertColumn(1, _('meannings'), wx.LIST_FORMAT_LEFT) #not translated |
---|
| 614 | |
---|
| 615 | for key, data in ClonezillaStartRestoreArgs.iteritems(): |
---|
| 616 | index = self.list.InsertStringItem(sys.maxint, data[0]) |
---|
| 617 | self.list.SetStringItem(index, 1, data[1]) |
---|
| 618 | self.list.SetItemData(index, key) |
---|
| 619 | |
---|
| 620 | self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE) |
---|
| 621 | self.list.SetColumnWidth(1, wx.LIST_AUTOSIZE) |
---|
| 622 | |
---|
| 623 | self.list.CheckItem(0) |
---|
| 624 | self.list.CheckItem(1) |
---|
| 625 | |
---|
| 626 | def SetNext(self, next): |
---|
| 627 | self.next = next |
---|
| 628 | |
---|
| 629 | def SetPrev(self, prev): |
---|
| 630 | self.prev = prev |
---|
| 631 | |
---|
| 632 | def GetNext(self): |
---|
| 633 | next = self.next |
---|
| 634 | self.fuse_next = self.fuse_next + 1 |
---|
| 635 | if self.fuse_next == 2: |
---|
| 636 | if not (self.list.IsChecked(18) or self.list.IsChecked(19)): |
---|
| 637 | next = next.GetNext() |
---|
| 638 | next = next.GetNext() |
---|
| 639 | #print ('ClonezillaRestorePage2: arguments are : %s' % FinalArgs[3:24]) |
---|
| 640 | return next |
---|
| 641 | |
---|
| 642 | def GetPrev(self): |
---|
| 643 | self.fuse_next = 0 |
---|
| 644 | return self.prev |
---|
| 645 | |
---|
| 646 | #---------------------------------------------------------------------- |
---|
| 647 | class ClonezillaStartRestorePage3(wiz.PyWizardPage): |
---|
| 648 | def __init__(self, parent, title): |
---|
| 649 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 650 | self.next = self.prev = None |
---|
| 651 | self.sizer = makePageTitle(self, title) |
---|
| 652 | |
---|
| 653 | wx.StaticText(self,-1 ,_('msg_write_MS_WIN_is_necessary'), (10, 60), (470, 200), wx.TE_MULTILINE) |
---|
| 654 | |
---|
| 655 | def SetNext(self, next): |
---|
| 656 | self.next = next |
---|
| 657 | |
---|
| 658 | def SetPrev(self, prev): |
---|
| 659 | self.prev = prev |
---|
| 660 | |
---|
| 661 | def GetNext(self): |
---|
| 662 | return self.next |
---|
| 663 | |
---|
| 664 | def GetPrev(self): |
---|
| 665 | return self.prev |
---|
| 666 | |
---|
| 667 | #---------------------------------------------------------------------- |
---|
| 668 | class ClonezillaStartRestorePage4(wiz.PyWizardPage): |
---|
| 669 | def __init__(self, parent, title): |
---|
| 670 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 671 | self.next = self.prev = None |
---|
| 672 | self.sizer = makePageTitle(self, title) |
---|
| 673 | self.fuse_next = 0 |
---|
| 674 | |
---|
| 675 | wx.StaticText(self, -1, _('msg_What_the_win_hostname_prefix'), (5, 80)) |
---|
| 676 | self.text = wx.TextCtrl(self, -1, "PC", (5, 110), size=(200, -1)) |
---|
| 677 | |
---|
| 678 | def SetNext(self, next): |
---|
| 679 | self.next = next |
---|
| 680 | |
---|
| 681 | def SetPrev(self, prev): |
---|
| 682 | self.prev = prev |
---|
| 683 | |
---|
| 684 | def GetNext(self): |
---|
| 685 | self.fuse_next = self.fuse_next + 1 |
---|
| 686 | if self.fuse_next == 2: |
---|
| 687 | if FinalArgs[21] == '-hn0': |
---|
| 688 | FinalArgs[22] = self.text.GetValue() |
---|
| 689 | else: |
---|
| 690 | FinalArgs[22] = '' |
---|
| 691 | if FinalArgs[23] == '-hn1': |
---|
| 692 | FinalArgs[24] = self.text.GetValue() |
---|
| 693 | else: |
---|
| 694 | FinalArgs[24] = '' |
---|
| 695 | #print ('ClonezillaRestorePage4 : FinalArgs[21-24] are %s' % FinalArgs[21:25]) |
---|
| 696 | #print ('FinalArgs[22] is %s, FinalArgs[24] is %s' % (FinalArgs[22], FinalArgs[24])) |
---|
| 697 | return self.next |
---|
| 698 | |
---|
| 699 | def GetPrev(self): |
---|
| 700 | self.fuse_next = 0 |
---|
| 701 | return self.prev |
---|
| 702 | |
---|
| 703 | #---------------------------------------------------------------------- |
---|
| 704 | class ClonezillaStartRestorePage5(wiz.PyWizardPage): |
---|
| 705 | def __init__(self, parent, title): |
---|
| 706 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 707 | self.next = self.prev = None |
---|
| 708 | self.sizer = makePageTitle(self, title) |
---|
| 709 | self.fuse_next = self.fuse_prev = 0 |
---|
| 710 | |
---|
| 711 | ModeList = [_('msg_ocs_param_y0'), _('msg_ocs_param_y1'), _('msg_ocs_param_y2'), _('msg_ocs_param_skip')] |
---|
| 712 | wx.StaticText(self, -1, _('msg_if_always_provide_clonezilla_srv'), (10, 60), (470, 200),wx.TE_MULTILINE) |
---|
| 713 | rb = wx.RadioBox(self, -1, '', (10,100), wx.DefaultSize, ModeList, 1, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 714 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 715 | rb.SetSelection(3) |
---|
| 716 | |
---|
| 717 | def EvtRadioBox(self, event): |
---|
| 718 | if event.GetInt() == 0: |
---|
| 719 | FinalArgs[25] = '-y0' |
---|
| 720 | elif event.GetInt() == 1: |
---|
| 721 | FinalArgs[25] = '-y1' |
---|
| 722 | elif event.GetInt() == 2: |
---|
| 723 | FinalArgs[25] = '-y2' |
---|
| 724 | elif event.GetInt() == 3: |
---|
| 725 | FinalArgs[25] = '' |
---|
| 726 | |
---|
| 727 | def SetNext(self, next): |
---|
| 728 | self.next = next |
---|
| 729 | |
---|
| 730 | def SetPrev(self, prev): |
---|
| 731 | self.prev = prev |
---|
| 732 | |
---|
| 733 | def GetNext(self): |
---|
| 734 | self.fuse_prev = 0 |
---|
| 735 | #self.fuse_next = self.fuse_next + 1 |
---|
| 736 | #if self.fuse_next == 2: |
---|
| 737 | #print ('ClonezillaRestorePage5 : FinalArgs[25](-y) is %s' % FinalArgs[25]) |
---|
| 738 | return self.next |
---|
| 739 | |
---|
| 740 | def GetPrev(self): |
---|
| 741 | prev = self.prev |
---|
| 742 | self.fuse_next = 0 |
---|
| 743 | self.fuse_prev = self.fuse_prev + 1 |
---|
| 744 | if self.fuse_prev == 1: |
---|
| 745 | if FinalArgs[21] == '' and FinalArgs[23] == '': |
---|
| 746 | prev = prev.GetPrev() |
---|
| 747 | prev = prev.GetPrev() |
---|
| 748 | return prev |
---|
| 749 | |
---|
| 750 | #---------------------------------------------------------------------- |
---|
| 751 | class ClonezillaStartRestorePage6(wiz.PyWizardPage): |
---|
| 752 | def __init__(self, parent, title): |
---|
| 753 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 754 | self.next = self.prev = None |
---|
| 755 | self.sizer = makePageTitle(self, title) |
---|
| 756 | self.fuse_prev = self.fuse_next = 0 |
---|
| 757 | |
---|
| 758 | ArgList = [_('msg_ocs_param_p_choose'), _('msg_ocs_param_p_true'), _('msg_ocs_param_p_poweroff'), _('msg_ocs_param_p_reboot')] |
---|
| 759 | rb = wx.RadioBox(self, -1, _('msg_choose_post_mode_after_clone'), (10,100), (250,100), ArgList, 1, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 760 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 761 | rb.SetSelection(3) |
---|
| 762 | FinalArgs[26] = '-p reboot' |
---|
| 763 | |
---|
| 764 | def EvtRadioBox(self, event): |
---|
| 765 | if event.GetSelection() == 0: |
---|
| 766 | FinalArgs[26] = '-p choose' |
---|
| 767 | if event.GetSelection() == 1: |
---|
| 768 | FinalArgs[26] = '-p true' |
---|
| 769 | if event.GetSelection() == 2: |
---|
| 770 | FinalArgs[26] = '-p poweroff' |
---|
| 771 | if event.GetSelection() == 3: |
---|
| 772 | FinalArgs[26] = '-p reboot' |
---|
| 773 | |
---|
| 774 | def SetNext(self, next): |
---|
| 775 | self.next = next |
---|
| 776 | |
---|
| 777 | def SetPrev(self, prev): |
---|
| 778 | self.prev = prev |
---|
| 779 | |
---|
| 780 | def GetNext(self): |
---|
| 781 | command = command_log = '' |
---|
| 782 | next = self.next |
---|
| 783 | self.fuse_prev = 0 |
---|
| 784 | self.fuse_next = self.fuse_next + 1 |
---|
| 785 | if self.fuse_next == 2: |
---|
| 786 | if FinalArgs[9] == '-u': |
---|
| 787 | if FinalArgs[1] == '-nl': |
---|
| 788 | FinalArgs[1] = '' |
---|
| 789 | FinalArgs[27] = FinalArgs[29] = '' |
---|
| 790 | FinalArgs[34] = 'restore' |
---|
| 791 | for i in range(0,37): |
---|
| 792 | if FinalArgs[i] != '': |
---|
| 793 | command = command + FinalArgs[i] + ' ' |
---|
| 794 | #print ('ClonezillaRestorePage6 : FinalArgs[26] (-z) is %s' % FinalArgs[26]) |
---|
| 795 | #print ('FinalCommands : %s' % command) |
---|
| 796 | file = open('tmp.log','w') |
---|
| 797 | os.system('sudo %s > tmp.log' % command) |
---|
| 798 | time.sleep(6) |
---|
| 799 | file.close() |
---|
| 800 | file = open('tmp.log') |
---|
| 801 | while True: |
---|
| 802 | line = file.readline() |
---|
| 803 | if len(line) == 0: # Zero length indicates EOF |
---|
| 804 | break |
---|
| 805 | command_log = command_log + line |
---|
| 806 | file.close() |
---|
| 807 | os.remove('tmp.log') |
---|
| 808 | FinalCommand.SetLabel('%s' % command) |
---|
| 809 | CommandLog.WriteText('%s' % command_log) |
---|
| 810 | for i in range(0,8): |
---|
| 811 | next = next.GetNext() |
---|
| 812 | #else: |
---|
| 813 | #print ('ClonezillaRestorePage6 : FinalArgs[26] (-z) is %s' % FinalArgs[26]) |
---|
| 814 | return next |
---|
| 815 | |
---|
| 816 | def GetPrev(self): |
---|
| 817 | prev = self.prev |
---|
| 818 | self.fuse_next = 0 |
---|
| 819 | self.fuse_prev = self.fuse_prev + 1 |
---|
| 820 | if self.fuse_prev == 1: |
---|
| 821 | FinalArgs[34] = 'multicast_restore' |
---|
| 822 | return prev |
---|
| 823 | |
---|
| 824 | #---------------------------------------------------------------------- |
---|
| 825 | class ClonezillaStartRestorePage7(wiz.PyWizardPage): |
---|
| 826 | def __init__(self, parent, title): |
---|
| 827 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 828 | self.next = self.prev = None |
---|
| 829 | self.sizer = makePageTitle(self, title) |
---|
| 830 | self.fuse_next = 0 |
---|
| 831 | |
---|
| 832 | wx.StaticText(self, -1, _('msg_choose_the_image_to_restore'), (5,80)) |
---|
| 833 | self.fbb = filebrowse.FileBrowseButton(self, -1, pos=(50,150), size=(350, -1), buttonText='browse', |
---|
| 834 | toolTip='Enter the img name or click browse button to choose img', fileMask='*.img', changeCallback = self.fbbCallback) |
---|
| 835 | |
---|
| 836 | def fbbCallback(self, evt): |
---|
| 837 | FinalArgs[35] = evt.GetString() |
---|
| 838 | |
---|
| 839 | def SetNext(self, next): |
---|
| 840 | self.next = next |
---|
| 841 | |
---|
| 842 | def SetPrev(self, prev): |
---|
| 843 | self.prev = prev |
---|
| 844 | |
---|
| 845 | def GetNext(self): |
---|
| 846 | next = self.next |
---|
| 847 | self.fuse_next = self.fuse_next + 1 |
---|
| 848 | if self.fuse_next == 2: |
---|
| 849 | if FinalArgs[9] == '-u': |
---|
| 850 | FinalArgs[35] = '' |
---|
| 851 | next = next.GetNext() |
---|
| 852 | #print ('ClonezillaRestorePage7 : FinalArgs[9] = -u') |
---|
| 853 | elif (FinalArgs[35] == '') or (os.path.exists(FinalArgs[35]) == 'False'): |
---|
| 854 | warnning = wx.MessageDialog(self, 'Image File Not Found!', 'WARNNING', wx.OK|wx.ICON_INFORMATION) |
---|
| 855 | warnning.ShowModal() |
---|
| 856 | warnning.Destroy() |
---|
| 857 | return self |
---|
| 858 | elif FinalArgs[33] == 'startparts': |
---|
| 859 | next = next.GetNext() |
---|
| 860 | #print ('ClonezillaRestorePage7 : FinalArgs[33] = startparts') |
---|
| 861 | #print ('ClonezillaRestorePage7 : FinalArgs[35] is %s' % FinalArgs[35]) |
---|
| 862 | return next |
---|
| 863 | |
---|
| 864 | def GetPrev(self): |
---|
| 865 | self.fuse_next = 0 |
---|
| 866 | return self.prev |
---|
| 867 | |
---|
| 868 | #---------------------------------------------------------------------- |
---|
| 869 | class ClonezillaStartRestorePage8a(wiz.PyWizardPage): |
---|
| 870 | def __init__(self, parent, title): |
---|
| 871 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 872 | self.next = self.prev = None |
---|
| 873 | self.sizer = makePageTitle(self, title) |
---|
| 874 | self.fuse_next = self.fuse_prev = 0 |
---|
| 875 | |
---|
| 876 | wx.StaticText(self, -1, _('msg_choose_the_disks_to_restore'), (5,80)) |
---|
| 877 | self.text = wx.TextCtrl(self, -1, "sda", (5, 110), size=(200, -1)) |
---|
| 878 | |
---|
| 879 | def SetNext(self, next): |
---|
| 880 | self.next = next |
---|
| 881 | |
---|
| 882 | def SetPrev(self, prev): |
---|
| 883 | self.prev = prev |
---|
| 884 | |
---|
| 885 | def GetNext(self): |
---|
| 886 | next = self.next |
---|
| 887 | self.fuse_prev = 0 |
---|
| 888 | self.fuse_next = self.fuse_next + 1 |
---|
| 889 | if self.fuse_next == 2: |
---|
| 890 | if FinalArgs[9] == '-u': |
---|
| 891 | next = next.GetNext() |
---|
| 892 | FinalArgs[36] = '' |
---|
| 893 | #print ('ClonezillaRestorePage8a : FinalArgs[9] = -u') |
---|
| 894 | elif FinalArgs[33] == 'startdisk': |
---|
| 895 | if self.text.GetValue() == '': |
---|
| 896 | warnning = wx.MessageDialog(self, 'Disks Not Found!', 'WARNNING', wx.OK|wx.ICON_INFORMATION) |
---|
| 897 | warnning.ShowModal() |
---|
| 898 | warnning.Destroy() |
---|
| 899 | return self |
---|
| 900 | else: |
---|
| 901 | FinalArgs[36] = self.text.GetValue() |
---|
| 902 | next = next.GetNext() |
---|
| 903 | #print ('ClonezillaRestorePage8a : FinalArgs[33] = startdisk, FinalArgs[36] is %s' % FinalArgs[36]) |
---|
| 904 | return next |
---|
| 905 | |
---|
| 906 | def GetPrev(self): |
---|
| 907 | prev = self.prev |
---|
| 908 | self.fuse_next = 0 |
---|
| 909 | self.fuse_prev = self.fuse_prev + 1 |
---|
| 910 | if self.fuse_prev == 1: |
---|
| 911 | FinalArgs[36] = '' |
---|
| 912 | return prev |
---|
| 913 | |
---|
| 914 | #---------------------------------------------------------------------- |
---|
| 915 | class ClonezillaStartRestorePage8b(wiz.PyWizardPage): |
---|
| 916 | def __init__(self, parent, title): |
---|
| 917 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 918 | self.next = self.prev = None |
---|
| 919 | self.sizer = makePageTitle(self, title) |
---|
| 920 | self.fuse_next = self.fuse_prev = 0 |
---|
| 921 | |
---|
| 922 | wx.StaticText(self, -1, _('msg_choose_the_parts_to_restore'), (5,80)) |
---|
| 923 | self.text = wx.TextCtrl(self, -1, "sda", (5, 110), size=(200, -1)) |
---|
| 924 | |
---|
| 925 | def SetNext(self, next): |
---|
| 926 | self.next = next |
---|
| 927 | |
---|
| 928 | def SetPrev(self, prev): |
---|
| 929 | self.prev = prev |
---|
| 930 | |
---|
| 931 | def GetNext(self): |
---|
| 932 | next = self.next |
---|
| 933 | self.fuse_prev = 0 |
---|
| 934 | self.fuse_next = self.fuse_next + 1 |
---|
| 935 | if self.fuse_next == 2: |
---|
| 936 | if FinalArgs[9] == '-u': |
---|
| 937 | next = next.GetNext() |
---|
| 938 | FinalArgs[36] = '' |
---|
| 939 | #print ('ClonezillaRestorePage8b : FinalArgs[9] = -u') |
---|
| 940 | elif FinalArgs[33] == 'startparts': |
---|
| 941 | if self.text.GetValue() == '': |
---|
| 942 | warnning = wx.MessageDialog(self, 'Partitions Not Found', 'WARNNING', wx.OK|wx.ICON_INFORMATION) |
---|
| 943 | warnning.ShowModal() |
---|
| 944 | warnning.Destroy() |
---|
| 945 | return self |
---|
| 946 | else: |
---|
| 947 | FinalArgs[36] = self.text.GetValue() |
---|
| 948 | next = next.GetNext() |
---|
| 949 | #print ('ClonezillaRestorePage8b : FinalArgs[33] = startparts, FinalArgs[36] is %s' % FinalArgs[36]) |
---|
| 950 | return next |
---|
| 951 | |
---|
| 952 | def GetPrev(self): |
---|
| 953 | prev = self.prev |
---|
| 954 | self.fuse_next = 0 |
---|
| 955 | self.fuse_prev = self.fuse_prev + 1 |
---|
| 956 | if self.fuse_prev == 1: |
---|
| 957 | if FinalArgs[33] == 'startparts': |
---|
| 958 | FinalArgs[36] = '' |
---|
| 959 | prev = prev.GetPrev() |
---|
| 960 | return prev |
---|
| 961 | |
---|
| 962 | #---------------------------------------------------------------------- |
---|
| 963 | class ClonezillaStartRestorePage9a(wiz.PyWizardPage): |
---|
| 964 | def __init__(self, parent, title): |
---|
| 965 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 966 | self.next = self.prev = None |
---|
| 967 | self.sizer = makePageTitle(self, title) |
---|
| 968 | self.fuse_next = self.fuse_prev = 0 |
---|
| 969 | |
---|
| 970 | ModeList = [_('msg_multicast_restore'), _('msg_unicast_restore')] |
---|
| 971 | rb = wx.RadioBox(self, -1, _('msg_choose_the_mode_to_restore_disk'), (35,50), (290,150), ModeList, 1, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 972 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 973 | FinalArgs[34] = 'multicast_restore' |
---|
| 974 | |
---|
| 975 | def EvtRadioBox(self, event): |
---|
| 976 | if event.GetInt() == 0: |
---|
| 977 | FinalArgs[34] = 'multicast_restore' |
---|
| 978 | if event.GetInt() == 1: |
---|
| 979 | FinalArgs[34] = 'restore' |
---|
| 980 | |
---|
| 981 | def SetNext(self, next): |
---|
| 982 | self.next = next |
---|
| 983 | |
---|
| 984 | def SetPrev(self, prev): |
---|
| 985 | self.prev = prev |
---|
| 986 | |
---|
| 987 | def GetNext(self): |
---|
| 988 | command = command_log = '' |
---|
| 989 | next = self.next |
---|
| 990 | self.fuse_prev = 0 |
---|
| 991 | self.fuse_next = self.fuse_next + 1 |
---|
| 992 | if self.fuse_next == 2: |
---|
| 993 | if FinalArgs[33] == 'startdisk': |
---|
| 994 | if FinalArgs[9] != '-u' and FinalArgs[34] == 'restore': |
---|
| 995 | if FinalArgs[1] == '-nl': |
---|
| 996 | FinalArgs[1] = '' |
---|
| 997 | FinalArgs[27] = FinalArgs[29] = '' |
---|
| 998 | for i in range(0,37): |
---|
| 999 | if FinalArgs[i] != '': |
---|
| 1000 | command = command + FinalArgs[i] + ' ' |
---|
| 1001 | #print ('ClonezillaStartRestorePage9a : FinalArgs[9] is empty, FinalArgs[34] is %s' % FinalArgs[34]) |
---|
| 1002 | #print ('FinalCommands : %s' % command) |
---|
| 1003 | file = open('tmp.log','w') |
---|
| 1004 | os.system('sudo %s > tmp.log' % command) |
---|
| 1005 | time.sleep(6) |
---|
| 1006 | file.close() |
---|
| 1007 | file = open('tmp.log') |
---|
| 1008 | while True: |
---|
| 1009 | line = file.readline() |
---|
| 1010 | if len(line) == 0: # Zero length indicates EOF |
---|
| 1011 | break |
---|
| 1012 | command_log = command_log + line |
---|
| 1013 | file.close() |
---|
| 1014 | os.remove('tmp.log') |
---|
| 1015 | FinalCommand.SetLabel('%s' % command) |
---|
| 1016 | CommandLog.WriteText('%s' % command_log) |
---|
| 1017 | #CommandLog.WriteText(os.popen('sudo %s' % command).read()) |
---|
| 1018 | for i in range(0,4): |
---|
| 1019 | next = next.GetNext() |
---|
| 1020 | else: |
---|
| 1021 | next = next.GetNext() |
---|
| 1022 | #print ('ClonezillaStartRestorePage9a : FinalArgs[34] is %s (should be multicast_restore)' % FinalArgs[34]) |
---|
| 1023 | return next |
---|
| 1024 | |
---|
| 1025 | def GetPrev(self): |
---|
| 1026 | prev = self.prev |
---|
| 1027 | self.fuse_next = 0 |
---|
| 1028 | self.fuse_prev = self.fuse_prev + 1 |
---|
| 1029 | if self.fuse_prev == 1: |
---|
| 1030 | if FinalArgs[33] == 'startdisk': |
---|
| 1031 | FinalArgs[27] = '--clients-to-wait' |
---|
| 1032 | FinalArgs[29] = '--max-time-to-wait' |
---|
| 1033 | prev = prev.GetPrev() |
---|
| 1034 | return prev |
---|
| 1035 | |
---|
| 1036 | #---------------------------------------------------------------------- |
---|
| 1037 | class ClonezillaStartRestorePage9b(wiz.PyWizardPage): |
---|
| 1038 | def __init__(self, parent, title): |
---|
| 1039 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 1040 | self.next = self.prev = None |
---|
| 1041 | self.sizer = makePageTitle(self, title) |
---|
| 1042 | self.fuse_next = self.fuse_prev = 0 |
---|
| 1043 | |
---|
| 1044 | ModeList = [_('msg_multicast_restore'), _('msg_unicast_restore')] |
---|
| 1045 | rb = wx.RadioBox(self, -1, _('msg_choose_the_mode_to_restore_parts'), (35,50), (290,150), ModeList, 1, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 1046 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 1047 | FinalArgs[34] = 'multicast_restore' |
---|
| 1048 | |
---|
| 1049 | def EvtRadioBox(self, event): |
---|
| 1050 | if event.GetInt() == 0: |
---|
| 1051 | FinalArgs[34] = 'multicast_restore' |
---|
| 1052 | if event.GetInt() == 1: |
---|
| 1053 | FinalArgs[34] = 'restore' |
---|
| 1054 | |
---|
| 1055 | def SetNext(self, next): |
---|
| 1056 | self.next = next |
---|
| 1057 | |
---|
| 1058 | def SetPrev(self, prev): |
---|
| 1059 | self.prev = prev |
---|
| 1060 | |
---|
| 1061 | def GetNext(self): |
---|
| 1062 | command = command_log = '' |
---|
| 1063 | next = self.next |
---|
| 1064 | self.fuse_prev = 0 |
---|
| 1065 | self.fuse_next = self.fuse_next + 1 |
---|
| 1066 | if self.fuse_next == 2: |
---|
| 1067 | if FinalArgs[33] == 'startparts': |
---|
| 1068 | if FinalArgs[9] != '-u' and FinalArgs[34] == 'restore': |
---|
| 1069 | if FinalArgs[1] == '-nl': |
---|
| 1070 | FinalArgs[1] = '' |
---|
| 1071 | FinalArgs[27] = FinalArgs[29] = '' |
---|
| 1072 | for i in range(0,37): |
---|
| 1073 | if FinalArgs[i] != '': |
---|
| 1074 | command = command + FinalArgs[i] + ' ' |
---|
| 1075 | #print ('ClonezillaStartRestorePage9b : FinalArgs[9] is empty, FinalArgs[34] is %s' % FinalArgs[34]) |
---|
| 1076 | #print ('FinalCommands : %s' % command) |
---|
| 1077 | file = open('tmp.log','w') |
---|
| 1078 | os.system('sudo %s > tmp.log' % command) |
---|
| 1079 | time.sleep(6) |
---|
| 1080 | file.close() |
---|
| 1081 | file = open('tmp.log') |
---|
| 1082 | while True: |
---|
| 1083 | line = file.readline() |
---|
| 1084 | if len(line) == 0: # Zero length indicates EOF |
---|
| 1085 | break |
---|
| 1086 | command_log = command_log + line |
---|
| 1087 | file.close() |
---|
| 1088 | os.remove('tmp.log') |
---|
| 1089 | FinalCommand.SetLabel('%s' % command) |
---|
| 1090 | CommandLog.WriteText('%s' % command_log) |
---|
| 1091 | #CommandLog.WriteText(os.popen('sudo %s' % command).read()) |
---|
| 1092 | for i in range(0,3): |
---|
| 1093 | next = next.GetNext() |
---|
| 1094 | #else: |
---|
| 1095 | #print ('ClonezillaStartRestorePage9b : FinalArgs[34] is %s (should be multicast_restore)' % FinalArgs[34]) |
---|
| 1096 | return next |
---|
| 1097 | |
---|
| 1098 | def GetPrev(self): |
---|
| 1099 | prev = self.prev |
---|
| 1100 | self.fuse_next = 0 |
---|
| 1101 | self.fuse_prev = self.fuse_prev + 1 |
---|
| 1102 | if self.fuse_prev == 1: |
---|
| 1103 | if FinalArgs[33] == 'startparts': |
---|
| 1104 | prev = prev.GetPrev() |
---|
| 1105 | return prev |
---|
| 1106 | |
---|
| 1107 | #---------------------------------------------------------------------- |
---|
| 1108 | class ClonezillaStartRestorePage10(wiz.PyWizardPage): |
---|
| 1109 | def __init__(self, parent, title): |
---|
| 1110 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 1111 | self.next = self.prev = None |
---|
| 1112 | self.sizer = makePageTitle(self, title) |
---|
| 1113 | self.fuse_next = self.fuse_prev = 0 |
---|
| 1114 | |
---|
| 1115 | ModeList = [_('msg_clients_time_to_wait'), _('msg_time_to_wait'), _('msg_clients_to_wait')] |
---|
| 1116 | rb = wx.RadioBox(self, -1, _('msg_choose_mode'), (10,60), (200, 100), ModeList, 1, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 1117 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 1118 | FinalArgs[27] = '--clients-to-wait' |
---|
| 1119 | FinalArgs[29] = '--max-time-to-wait' |
---|
| 1120 | |
---|
| 1121 | def EvtRadioBox(self, event): |
---|
| 1122 | if event.GetInt() == 0: |
---|
| 1123 | FinalArgs[27] = '--clients-to-wait' |
---|
| 1124 | FinalArgs[29] = '--max-time-to-wait' |
---|
| 1125 | elif event.GetInt() == 1: |
---|
| 1126 | FinalArgs[27] = '' |
---|
| 1127 | FinalArgs[29] = '--max-time-to-wait' |
---|
| 1128 | elif event.GetInt() == 2: |
---|
| 1129 | FinalArgs[27] = '--clients-to-wait' |
---|
| 1130 | FinalArgs[29] = '' |
---|
| 1131 | |
---|
| 1132 | def SetNext(self, next): |
---|
| 1133 | self.next = next |
---|
| 1134 | |
---|
| 1135 | def SetPrev(self, prev): |
---|
| 1136 | self.prev = prev |
---|
| 1137 | |
---|
| 1138 | def GetNext(self): |
---|
| 1139 | next = self.next |
---|
| 1140 | self.fuse_prev = 0 |
---|
| 1141 | self.fuse_next = self.fuse_next + 1 |
---|
| 1142 | if self.fuse_next == 2: |
---|
| 1143 | if FinalArgs[27] == '' and FinalArgs[29] != '': |
---|
| 1144 | next = next.GetNext() |
---|
| 1145 | #print ('ClonezillaRestorePage10 : just time-to-wait') |
---|
| 1146 | #elif FinalArgs[27] != '' and FinalArgs[29] == '': |
---|
| 1147 | #print ('ClonezillaRestorePage10 : just clients-to-wait') |
---|
| 1148 | #elif FinalArgs[27] != '' and FinalArgs[29] != '': |
---|
| 1149 | #print ('ClonezillaRestorePage10 : both time-to-wait and clients-to-wait') |
---|
| 1150 | return next |
---|
| 1151 | |
---|
| 1152 | def GetPrev(self): |
---|
| 1153 | prev = self.prev |
---|
| 1154 | self.fuse_next = 0 |
---|
| 1155 | self.fuse_prev = self.fuse_prev + 1 |
---|
| 1156 | if self.fuse_prev == 1: |
---|
| 1157 | if FinalArgs[33] == 'startdisk': |
---|
| 1158 | prev = prev.GetPrev() |
---|
| 1159 | return prev |
---|
| 1160 | #---------------------------------------------------------------------- |
---|
| 1161 | class ClonezillaStartRestorePage11(wiz.PyWizardPage): |
---|
| 1162 | def __init__(self, parent, title): |
---|
| 1163 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 1164 | self.next = self.prev = None |
---|
| 1165 | self.sizer = makePageTitle(self, title) |
---|
| 1166 | self.fuse_next = self.fuse_prev = 0 |
---|
| 1167 | |
---|
| 1168 | wx.StaticText(self, -1, _('msg_how_many_clients_to_restore'), (10, 80)) |
---|
| 1169 | self.text = wx.TextCtrl(self, -1, '5', (20, 110), size=(200, -1)) |
---|
| 1170 | |
---|
| 1171 | def SetNext(self, next): |
---|
| 1172 | self.next = next |
---|
| 1173 | |
---|
| 1174 | def SetPrev(self, prev): |
---|
| 1175 | self.prev = prev |
---|
| 1176 | |
---|
| 1177 | def GetNext(self): |
---|
| 1178 | command = command_log = '' |
---|
| 1179 | next = self.next |
---|
| 1180 | self.fuse_prev = 0 |
---|
| 1181 | self.fuse_next = self.fuse_next + 1 |
---|
| 1182 | if self.fuse_next == 2: |
---|
| 1183 | if self.text.GetValue() == '': |
---|
| 1184 | warnning = wx.MessageDialog(self, 'YOU MUST ENTER SOMETHING!!', 'WARNNING', wx.OK|wx.ICON_INFORMATION) |
---|
| 1185 | warnning.ShowModal() |
---|
| 1186 | warnning.Destroy() |
---|
| 1187 | return self |
---|
| 1188 | if FinalArgs[27] != '' and FinalArgs[29] == '': |
---|
| 1189 | FinalArgs[28] = self.text.GetValue() |
---|
| 1190 | if FinalArgs[1] == '-nl': |
---|
| 1191 | FinalArgs[1] = '' |
---|
| 1192 | for i in range(0,37): |
---|
| 1193 | if FinalArgs[i] != '': |
---|
| 1194 | command = command + FinalArgs[i] + ' ' |
---|
| 1195 | #print ('FinalCommands : %s' % command) |
---|
| 1196 | file = open('tmp.log','w') |
---|
| 1197 | os.system('sudo %s > tmp.log' % command) |
---|
| 1198 | time.sleep(6) |
---|
| 1199 | file.close() |
---|
| 1200 | file = open('tmp.log') |
---|
| 1201 | while True: |
---|
| 1202 | line = file.readline() |
---|
| 1203 | if len(line) == 0: # Zero length indicates EOF |
---|
| 1204 | break |
---|
| 1205 | command_log = command_log + line |
---|
| 1206 | file.close() |
---|
| 1207 | os.remove('tmp.log') |
---|
| 1208 | FinalCommand.SetLabel('%s' % command) |
---|
| 1209 | CommandLog.WriteText('%s' % command_log) |
---|
| 1210 | elif FinalArgs[27] != '' and FinalArgs[29] != '': |
---|
| 1211 | FinalArgs[28] = self.text.GetValue() |
---|
| 1212 | return next |
---|
| 1213 | |
---|
| 1214 | def GetPrev(self): |
---|
| 1215 | prev = self.prev |
---|
| 1216 | self.fuse_next = 0 |
---|
| 1217 | self.fuse_prev = self.fuse_prev + 1 |
---|
| 1218 | if self.fuse_prev == 1: |
---|
| 1219 | FinalArgs[28] = '' |
---|
| 1220 | return prev |
---|
| 1221 | |
---|
| 1222 | #---------------------------------------------------------------------- |
---|
| 1223 | class ClonezillaStartRestorePage12(wiz.PyWizardPage): |
---|
| 1224 | def __init__(self, parent, title): |
---|
| 1225 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 1226 | self.next = self.prev = None |
---|
| 1227 | self.sizer = makePageTitle(self, title) |
---|
| 1228 | self.fuse_next = self.fuse_prev = 0 |
---|
| 1229 | |
---|
| 1230 | wx.StaticText(self, -1, _('msg_max_time_to_wait_sec'), pos=(10, 60), size=(475, 200), style=wx.TE_MULTILINE) |
---|
| 1231 | self.text = wx.TextCtrl(self, -1, "300", (10, 150), size=(100, -1)) |
---|
| 1232 | |
---|
| 1233 | def SetNext(self, next): |
---|
| 1234 | self.next = next |
---|
| 1235 | |
---|
| 1236 | def SetPrev(self, prev): |
---|
| 1237 | self.prev = prev |
---|
| 1238 | |
---|
| 1239 | def GetNext(self): |
---|
| 1240 | command = command_log = '' |
---|
| 1241 | next = self.next |
---|
| 1242 | self.fuse_prev = 0 |
---|
| 1243 | self.fuse_next = self.fuse_next + 1 |
---|
| 1244 | if self.fuse_next == 2: |
---|
| 1245 | if self.text.GetValue() == '': |
---|
| 1246 | warnning = wx.MessageDialog(self, 'YOU MUST ENTER SOMETHING!!', 'WARNNING', wx.OK|wx.ICON_INFORMATION) |
---|
| 1247 | warnning.ShowModal() |
---|
| 1248 | warnning.Destroy() |
---|
| 1249 | return self |
---|
| 1250 | FinalArgs[30] = self.text.GetValue() |
---|
| 1251 | if FinalArgs[1] == '-nl': |
---|
| 1252 | FinalArgs[1] = '' |
---|
| 1253 | for i in range(0,37): |
---|
| 1254 | if FinalArgs[i] != '': |
---|
| 1255 | command = command + FinalArgs[i] + ' ' |
---|
| 1256 | #print ('FinalCommands : %s' % command) |
---|
| 1257 | file = open('tmp.log','w') |
---|
| 1258 | os.system('sudo %s > tmp.log' % command) |
---|
| 1259 | time.sleep(6) |
---|
| 1260 | file.close() |
---|
| 1261 | file = open('tmp.log') |
---|
| 1262 | while True: |
---|
| 1263 | line = file.readline() |
---|
| 1264 | if len(line) == 0: # Zero length indicates EOF |
---|
| 1265 | break |
---|
| 1266 | command_log = command_log + line |
---|
| 1267 | file.close() |
---|
| 1268 | os.remove('tmp.log') |
---|
| 1269 | FinalCommand.SetLabel('%s' % command) |
---|
| 1270 | CommandLog.WriteText('%s' % command_log) |
---|
| 1271 | return next |
---|
| 1272 | |
---|
| 1273 | def GetPrev(self): |
---|
| 1274 | prev = self.prev |
---|
| 1275 | self.fuse_next = 0 |
---|
| 1276 | self.fuse_prev = self.fuse_prev + 1 |
---|
| 1277 | if self.fuse_prev == 1: |
---|
| 1278 | FinalArgs[30] = '' |
---|
| 1279 | if FinalArgs[27] == '': |
---|
| 1280 | prev = prev.GetPrev() |
---|
| 1281 | return prev |
---|
| 1282 | |
---|
| 1283 | #---------------------------------------------------------------------- |
---|
| 1284 | class ClonezillaSelectPage1(wiz.PyWizardPage): |
---|
| 1285 | def __init__(self, parent, title): |
---|
| 1286 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 1287 | self.next = self.prev = None |
---|
| 1288 | self.sizer = makePageTitle(self, title) |
---|
| 1289 | self.fuse_prev = 0 |
---|
| 1290 | |
---|
| 1291 | ModeList = [_('msg_ocs_param_y0'), _('msg_ocs_param_y1'), _('msg_ocs_param_y2'), _('msg_ocs_param_skip')] |
---|
| 1292 | wx.StaticText(self,-1,_('msg_if_always_provide_clonezilla_srv'), (10, 60), (470, 200),wx.TE_MULTILINE) |
---|
| 1293 | rb = wx.RadioBox(self, -1, '', (10,100), wx.DefaultSize, ModeList, 1, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 1294 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 1295 | rb.SetSelection(1) |
---|
| 1296 | FinalArgs[0] = '/opt/drbl/sbin/drbl-ocs -b' |
---|
| 1297 | FinalArgs[5] = '-y1' |
---|
| 1298 | FinalArgs[7] = 'select_in_client' |
---|
| 1299 | |
---|
| 1300 | def EvtRadioBox(self, event): |
---|
| 1301 | if event.GetInt() == 0: |
---|
| 1302 | FinalArgs[5] = '-y0' |
---|
| 1303 | elif event.GetInt() == 1: |
---|
| 1304 | FinalArgs[5] = '-y1' |
---|
| 1305 | elif event.GetInt() == 2: |
---|
| 1306 | FinalArgs[5] = '-y2' |
---|
| 1307 | elif event.GetInt() == 3: |
---|
| 1308 | FinalArgs[5] = '' |
---|
| 1309 | |
---|
| 1310 | def SetNext(self, next): |
---|
| 1311 | self.next = next |
---|
| 1312 | |
---|
| 1313 | def SetPrev(self, prev): |
---|
| 1314 | self.prev = prev |
---|
| 1315 | |
---|
| 1316 | def GetNext(self): |
---|
| 1317 | self.fuse_prev = 0 |
---|
| 1318 | return self.next |
---|
| 1319 | |
---|
| 1320 | def GetPrev(self): |
---|
| 1321 | self.fuse_prev = self.fuse_prev + 1 |
---|
| 1322 | if self.fuse_prev == 1: |
---|
| 1323 | prev = self.prev |
---|
| 1324 | if FinalArgs[1] == '-nl': |
---|
| 1325 | prev = prev.GetPrev() |
---|
| 1326 | return prev |
---|
| 1327 | |
---|
| 1328 | #---------------------------------------------------------------------- |
---|
| 1329 | class ClonezillaSelectPage2(wiz.PyWizardPage): |
---|
| 1330 | def __init__(self, parent, title): |
---|
| 1331 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 1332 | self.next = self.prev = None |
---|
| 1333 | self.sizer = makePageTitle(self, title) |
---|
| 1334 | self.fuse_next = 0 |
---|
| 1335 | |
---|
| 1336 | ArgList = [_('msg_ocs_param_p_choose'), _('msg_ocs_param_p_true'), _('msg_ocs_param_p_poweroff'), _('msg_ocs_param_p_reboot')] |
---|
| 1337 | rb = wx.RadioBox(self, -1, _('msg_choose_post_mode_after_clone'), (10,60), (470,200), ArgList, 1, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 1338 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 1339 | rb.SetSelection(0) |
---|
| 1340 | FinalArgs[6] = '-p choose' |
---|
| 1341 | |
---|
| 1342 | def EvtRadioBox(self, event): |
---|
| 1343 | if event.GetSelection() == 0: |
---|
| 1344 | FinalArgs[6] = '-p choose' |
---|
| 1345 | if event.GetSelection() == 1: |
---|
| 1346 | FinalArgs[6] = '-p true' |
---|
| 1347 | if event.GetSelection() == 2: |
---|
| 1348 | FinalArgs[6] = '-p poweroff' |
---|
| 1349 | if event.GetSelection() == 3: |
---|
| 1350 | FinalArgs[6] = '-p reboot' |
---|
| 1351 | |
---|
| 1352 | def SetNext(self, next): |
---|
| 1353 | self.next = next |
---|
| 1354 | |
---|
| 1355 | def SetPrev(self, prev): |
---|
| 1356 | self.prev = prev |
---|
| 1357 | |
---|
| 1358 | def GetNext(self): |
---|
| 1359 | command = '' |
---|
| 1360 | self.fuse_next = self.fuse_next + 1 |
---|
| 1361 | if self.fuse_next == 2: |
---|
| 1362 | for i in range(0,8): |
---|
| 1363 | if FinalArgs[i] != '': |
---|
| 1364 | command = command + FinalArgs[i] + ' ' |
---|
| 1365 | FinalCommand.SetLabel('%s' % command) |
---|
| 1366 | CommandLog.WriteText(os.popen('sudo %s' % command).read()) |
---|
| 1367 | return self.next |
---|
| 1368 | |
---|
| 1369 | def GetPrev(self): |
---|
| 1370 | self.fuse_next = 0 |
---|
| 1371 | return self.prev |
---|
| 1372 | |
---|
| 1373 | #---------------------------------------------------------------------- |
---|
| 1374 | class SwitchPXEMenuPage1(wiz.PyWizardPage): |
---|
| 1375 | def __init__(self, parent, title): |
---|
| 1376 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 1377 | self.next = self.prev = None |
---|
| 1378 | self.sizer = makePageTitle(self, title) |
---|
| 1379 | self.fuse_next = self.fuse_prev = 0 |
---|
| 1380 | |
---|
| 1381 | ModeList = [_('msg_hide_pxe_menus'), _('msg_reveal_pxe_menus'), _('msg_setdefault_pxe_menu')] |
---|
| 1382 | rb = wx.RadioBox(self, -1, _('msg_choose_the_action'), (10, 60), (470,200), ModeList, 1, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 1383 | |
---|
| 1384 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 1385 | FinalArgs[0] = '/opt/drbl/bin/hide_reveal_pxe_img' |
---|
| 1386 | FinalArgs[3] = 'hide' |
---|
| 1387 | |
---|
| 1388 | def EvtRadioBox(self, event): |
---|
| 1389 | if event.GetSelection() == 0: |
---|
| 1390 | FinalArgs[0] = '/opt/drbl/bin/hide_reveal_pxe_img' |
---|
| 1391 | FinalArgs[3] = 'hide' |
---|
| 1392 | if event.GetSelection() == 1: |
---|
| 1393 | FinalArgs[0] = '/opt/drbl/bin/hide_reveal_pxe_img' |
---|
| 1394 | FinalArgs[3] = 'reveal' |
---|
| 1395 | if event.GetSelection() == 2: |
---|
| 1396 | FinalArgs[0] = '/opt/drbl/sbin/set-default-pxe-img' |
---|
| 1397 | FinalArgs[3] = '-i' |
---|
| 1398 | |
---|
| 1399 | def SetNext(self, next): |
---|
| 1400 | self.next = next |
---|
| 1401 | |
---|
| 1402 | def SetPrev(self, prev): |
---|
| 1403 | self.prev = prev |
---|
| 1404 | |
---|
| 1405 | def GetNext(self): |
---|
| 1406 | self.fuse_prev = 0 |
---|
| 1407 | next = self.next |
---|
| 1408 | self.fuse_next = self.fuse_next + 1 |
---|
| 1409 | if self.fuse_next == 2: |
---|
| 1410 | if FinalArgs[3] == '-i': |
---|
| 1411 | next = next.GetNext() |
---|
| 1412 | return next |
---|
| 1413 | |
---|
| 1414 | def GetPrev(self): |
---|
| 1415 | self.fuse_next = 0 |
---|
| 1416 | self.fuse_prev = self.fuse_prev + 1 |
---|
| 1417 | if self.fuse_prev == 1: |
---|
| 1418 | prev = self.prev |
---|
| 1419 | if FinalArgs[1] == '-nl': |
---|
| 1420 | prev = prev.GetPrev() |
---|
| 1421 | return prev |
---|
| 1422 | |
---|
| 1423 | #---------------------------------------------------------------------- |
---|
| 1424 | class SwitchPXEMenuPage2(wiz.PyWizardPage): |
---|
| 1425 | def __init__(self, parent, title): |
---|
| 1426 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 1427 | self.next = self.prev = None |
---|
| 1428 | self.sizer = makePageTitle(self, title) |
---|
| 1429 | |
---|
| 1430 | self.fuse_next = self.fuse_prev = index = 0 |
---|
| 1431 | self.AllLabelsArray = [] |
---|
| 1432 | self.SelectedLabelsArray = [] |
---|
| 1433 | |
---|
| 1434 | file = open('/tftpboot/nbi_img/pxelinux.cfg/default') |
---|
| 1435 | content = file.read() |
---|
| 1436 | for word in content.split(): |
---|
| 1437 | if word == 'label': |
---|
| 1438 | self.AllLabelsArray.append(content.split()[index + 1]) |
---|
| 1439 | index = index + 1 |
---|
| 1440 | file.close() |
---|
| 1441 | |
---|
| 1442 | self.LabelBox = wx.CheckListBox(self, -1, (10,60), (470,250), self.AllLabelsArray) |
---|
| 1443 | self.Bind(wx.EVT_CHECKLISTBOX, self.EvtCheckListBox, self.LabelBox) |
---|
| 1444 | self.LabelBox.SetSelection(0) |
---|
| 1445 | |
---|
| 1446 | def EvtCheckListBox(self, event): |
---|
| 1447 | index = event.GetSelection() |
---|
| 1448 | label = self.LabelBox.GetString(index) |
---|
| 1449 | if self.LabelBox.IsChecked(index): |
---|
| 1450 | self.SelectedLabelsArray.append(label) |
---|
| 1451 | if not (self.LabelBox.IsChecked(index)): |
---|
| 1452 | self.SelectedLabelsArray.remove(label) |
---|
| 1453 | self.LabelBox.SetSelection(index) #so that (un)checking also selects (moves the highlight) |
---|
| 1454 | #print self.SelectedLabelsArray[:] |
---|
| 1455 | |
---|
| 1456 | def SetNext(self, next): |
---|
| 1457 | self.next = next |
---|
| 1458 | |
---|
| 1459 | def SetPrev(self, prev): |
---|
| 1460 | self.prev = prev |
---|
| 1461 | |
---|
| 1462 | def GetNext(self): |
---|
| 1463 | next = self.next |
---|
| 1464 | self.fuse_prev = 0 |
---|
| 1465 | self.fuse_next = self.fuse_next + 1 |
---|
| 1466 | if self.fuse_next == 2: |
---|
| 1467 | if (FinalArgs[3] == 'hide') or (FinalArgs[3] == 'reveal'): |
---|
| 1468 | if FinalArgs[1] == '-nl': |
---|
| 1469 | for k in range(0,len(self.SelectedLabelsArray[:])): |
---|
| 1470 | os.system('sudo rm -f /tftpboot/nbi_img/pxelinux.cfg/1* 2* 3* 4* 5* 6* 7* 8* 9* 0* A* B* C* D* E* F*') |
---|
| 1471 | CommandLog.WriteText('remove all the pxe_cfg files under /tftpboot/nbi_img/pxelinux.cfg/, except default!\n') |
---|
| 1472 | CommandLog.WriteText(os.popen('sudo %s %s %s' % (FinalArgs[0], self.SelectedLabelsArray[k], FinalArgs[3])).read()) |
---|
| 1473 | else: |
---|
| 1474 | for i in range(0, len(PXE_CFG[:])): |
---|
| 1475 | for k in range(0, len(self.SelectedLabelsArray[:])): |
---|
| 1476 | if ((len(self.SelectedLabelsArray[:]) == len(self.AllLabelsArray[:])) and (FinalArgs[3] == 'hide')): |
---|
| 1477 | warnning = wx.MessageDialog(self, 'YOU CANNOT HIDE ALL LABELS', 'WARNNING', wx.OK|wx.ICON_INFORMATION) |
---|
| 1478 | warnning.ShowModal() |
---|
| 1479 | warnning.Destroy() |
---|
| 1480 | return self |
---|
| 1481 | elif os.path.exists('/tftpboot/nbi_img/pxelinux.cfg/%s' % PXE_CFG[i]): |
---|
| 1482 | CommandLog.WriteText(os.popen('sudo %s %s %s /tftpboot/nbi_img/pxelinux.cfg/%s' % (FinalArgs[0], self.SelectedLabelsArray[k], FinalArgs[3], PXE_CFG[i])).read()) |
---|
| 1483 | CommandLog.WriteText('%s %s %s /tftpboot/nbi_img/pxelinux.cfg/%s' % (FinalArgs[0], self.SelectedLabelsArray[k], FinalArgs[3], PXE_CFG[i])) |
---|
| 1484 | else: |
---|
| 1485 | os.system('sudo cp /tftpboot/nbi_img/pxelinux.cfg/default /tftpboot/nbi_img/pxelinux.cfg/%s' % PXE_CFG[i]) |
---|
| 1486 | CommandLog.WriteText('copy /tftpboot/nbi_img/pxelinux.cfg/default to %s\n' % PXE_CFG[i]) |
---|
| 1487 | CommandLog.WriteText(os.popen('sudo %s %s %s /tftpboot/nbi_img/pxelinux.cfg/%s' % (FinalArgs[0], self.SelectedLabelsArray[k], FinalArgs[3], PXE_CFG[i])).read()) |
---|
| 1488 | CommandLog.WriteText('%s -c /tftpboot/nbi_img/pxelinux.cfg/%s -i %s %s' % (FinalArgs[0], PXE_CFG[i] ,self.SelectedLabelsArray[k], FinalArgs[3])) |
---|
| 1489 | next = next.GetNext() |
---|
| 1490 | return next |
---|
| 1491 | |
---|
| 1492 | def GetPrev(self): |
---|
| 1493 | prev = self.prev |
---|
| 1494 | self.fuse_next = 0 |
---|
| 1495 | return prev |
---|
| 1496 | |
---|
| 1497 | #---------------------------------------------------------------------- |
---|
| 1498 | class SwitchPXEMenuPage3(wiz.PyWizardPage): |
---|
| 1499 | def __init__(self, parent, title): |
---|
| 1500 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 1501 | self.next = self.prev = None |
---|
| 1502 | self.sizer = makePageTitle(self, title) |
---|
| 1503 | |
---|
| 1504 | self.fuse_next = self.fuse_prev = index = 0 |
---|
| 1505 | AllLabelsArray = [] |
---|
| 1506 | |
---|
| 1507 | file = open('/tftpboot/nbi_img/pxelinux.cfg/default') |
---|
| 1508 | content = file.read() |
---|
| 1509 | for word in content.split(): |
---|
| 1510 | if word == 'label': |
---|
| 1511 | AllLabelsArray.append(content.split()[index + 1]) |
---|
| 1512 | index = index + 1 |
---|
| 1513 | file.close() |
---|
| 1514 | |
---|
| 1515 | self.LabelBox = wx.RadioBox(self, -1, _('msg_setdefault_list_des'), (10,60), (470,250), AllLabelsArray, 1, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 1516 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, self.LabelBox) |
---|
| 1517 | self.LabelBox.SetSelection(0) |
---|
| 1518 | self.SelectedLabel = AllLabelsArray[0] |
---|
| 1519 | |
---|
| 1520 | def EvtRadioBox(self, event): |
---|
| 1521 | self.SelectedLabel = event.GetString() |
---|
| 1522 | #print self.SelectedLabel |
---|
| 1523 | |
---|
| 1524 | def SetNext(self, next): |
---|
| 1525 | self.next = next |
---|
| 1526 | |
---|
| 1527 | def SetPrev(self, prev): |
---|
| 1528 | self.prev = prev |
---|
| 1529 | |
---|
| 1530 | def GetNext(self): |
---|
| 1531 | self.fuse_prev = 0 |
---|
| 1532 | self.fuse_next = self.fuse_next + 1 |
---|
| 1533 | if self.fuse_next == 2: |
---|
| 1534 | if (FinalArgs[1] == '-nl') and (FinalArgs[3] == '-i'): |
---|
| 1535 | os.system('sudo rm -f /tftpboot/nbi_img/pxelinux.cfg/1* 2* 3* 4* 5* 6* 7* 8* 9* 0* A* B* C* D* E* F*') |
---|
| 1536 | CommandLog.WriteText('remove all the pxe_cfg files under /tftpboot/nbi_img/pxelinux.cfg/, except default!\n') |
---|
| 1537 | CommandLog.WriteText(os.popen('sudo %s %s %s' % (FinalArgs[0], FinalArgs[3], self.SelectedLabel)).read()) |
---|
| 1538 | elif (FinalArgs[1] == '-h') and (FinalArgs[3] == '-i'): |
---|
| 1539 | for i in range(0, len(PXE_CFG[:])): |
---|
| 1540 | if os.path.exists('/tftpboot/nbi_img/pxelinux.cfg/%s' % PXE_CFG[i]): |
---|
| 1541 | CommandLog.WriteText(os.popen('sudo %s -c /tftpboot/nbi_img/pxelinux.cfg/%s %s %s' % (FinalArgs[0], PXE_CFG[i], FinalArgs[3], self.SelectedLabel)).read()) |
---|
| 1542 | else: |
---|
| 1543 | os.system('sudo cp /tftpboot/nbi_img/pxelinux.cfg/default /tftpboot/nbi_img/pxelinux.cfg/%s' % PXE_CFG[i]) |
---|
| 1544 | CommandLog.WriteText(os.popen('%s -c /tftpboot/nbi_img/pxelinux.cfg/%s %s %s' % (FinalArgs[0], PXE_CFG[i], FinalArgs[3], self.SelectedLabel)).read()) |
---|
| 1545 | return self.next |
---|
| 1546 | |
---|
| 1547 | def GetPrev(self): |
---|
| 1548 | prev = self.prev |
---|
| 1549 | self.fuse_next = 0 |
---|
| 1550 | self.fuse_prev = self.fuse_prev + 1 |
---|
| 1551 | if self.fuse_prev == 1: |
---|
| 1552 | if FinalArgs[3] == '-i': |
---|
| 1553 | prev = prev.GetPrev() |
---|
| 1554 | return prev |
---|
| 1555 | |
---|
| 1556 | #---------------------------------------------------------------------- |
---|
| 1557 | class SwitchPXEModePage(wiz.PyWizardPage): |
---|
| 1558 | def __init__(self, parent, title): |
---|
| 1559 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 1560 | self.next = self.prev = None |
---|
| 1561 | self.sizer = makePageTitle(self, title) |
---|
| 1562 | self.fuse_next = self.fuse_prev = 0 |
---|
| 1563 | |
---|
| 1564 | ModeList = [_('msg_pxemenu_text'), _('msg_pxemenu_graphic')] |
---|
| 1565 | rb = wx.RadioBox(self, -1, '', (10,150), wx.DefaultSize, ModeList, 1, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 1566 | |
---|
| 1567 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 1568 | FinalArgs[0] = '/opt/drbl/sbin/switch-pxe-bg-mode' |
---|
| 1569 | FinalArgs[5] = '-m' |
---|
| 1570 | FinalArgs[6] = 'text' |
---|
| 1571 | |
---|
| 1572 | def EvtRadioBox(self, event): |
---|
| 1573 | if event.GetSelection() == 0: |
---|
| 1574 | FinalArgs[6] = 'text' |
---|
| 1575 | if event.GetSelection() == 1: |
---|
| 1576 | FinalArgs[6] = 'graphic' |
---|
| 1577 | |
---|
| 1578 | def SetNext(self, next): |
---|
| 1579 | self.next = next |
---|
| 1580 | |
---|
| 1581 | def SetPrev(self, prev): |
---|
| 1582 | self.prev = prev |
---|
| 1583 | |
---|
| 1584 | def GetNext(self): |
---|
| 1585 | self.fuse_prev = 0 |
---|
| 1586 | self.fuse_next = self.fuse_next + 1 |
---|
| 1587 | if self.fuse_next == 2: |
---|
| 1588 | if FinalArgs[1] == '-nl': |
---|
| 1589 | CommandLog.WriteText(os.popen('sudo %s %s %s' % (FinalArgs[0], FinalArgs[5], FinalArgs[6])).read()) |
---|
| 1590 | else: |
---|
| 1591 | for i in range(0,len(PXE_CFG[:])): |
---|
| 1592 | CommandLog.WriteText(os.popen('sudo %s -c /tftpboot/nbi_img/pxelinux.cfg/%s %s %s' % (FinalArgs[0], PXE_CFG[i], FinalArgs[5], FinalArgs[6])).read()) |
---|
| 1593 | return self.next |
---|
| 1594 | |
---|
| 1595 | def GetPrev(self): |
---|
| 1596 | self.fuse_next = 0 |
---|
| 1597 | self.fuse_prev = self.fuse_prev + 1 |
---|
| 1598 | if self.fuse_prev == 1: |
---|
| 1599 | prev = self.prev |
---|
| 1600 | if FinalArgs[1] == '-nl': |
---|
| 1601 | prev = prev.GetPrev() |
---|
| 1602 | return prev |
---|
| 1603 | |
---|
| 1604 | #---------------------------------------------------------------------- |
---|
| 1605 | class DRBLModePage(wiz.PyWizardPage): |
---|
| 1606 | def __init__(self, parent, title): |
---|
| 1607 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 1608 | self.next = self.prev = None |
---|
| 1609 | self.sizer = makePageTitle(self, title) |
---|
| 1610 | |
---|
| 1611 | ModeList = [_('msg_drbl_mode_0'), _('msg_drbl_mode_1'), _('msg_drbl_mode_2')] |
---|
| 1612 | wx.StaticText(self,-1,_('msg_drbl_mode_switch_long'),wx.DLG_PNT(self, 5, 20),wx.DLG_SZE(self, 320, 300),wx.TE_MULTILINE) |
---|
| 1613 | rb = wx.RadioBox(self, -1, '', (10,220), wx.DefaultSize, ModeList, 1, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 1614 | self.fuse_next = self.fuse_prev = 0 |
---|
| 1615 | |
---|
| 1616 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 1617 | FinalArgs[0] = '/opt/drbl/sbin/tune-clientdir-opt' |
---|
| 1618 | FinalArgs[1] = '-d' |
---|
| 1619 | FinalArgs[2] = '0' |
---|
| 1620 | |
---|
| 1621 | def EvtRadioBox(self, event): |
---|
| 1622 | if event.GetSelection() == 0: |
---|
| 1623 | FinalArgs[2] = '0' |
---|
| 1624 | if event.GetSelection() == 1: |
---|
| 1625 | FinalArgs[2] = '1' |
---|
| 1626 | if event.GetSelection() == 2: |
---|
| 1627 | FinalArgs[2] = '2' |
---|
| 1628 | |
---|
| 1629 | def SetNext(self, next): |
---|
| 1630 | self.next = next |
---|
| 1631 | |
---|
| 1632 | def SetPrev(self, prev): |
---|
| 1633 | self.prev = prev |
---|
| 1634 | |
---|
| 1635 | def GetNext(self): |
---|
| 1636 | command = '' |
---|
| 1637 | self.fuse_prev = 0 |
---|
| 1638 | self.fuse_next = self.fuse_next + 1 |
---|
| 1639 | if self.fuse_next == 2: |
---|
| 1640 | for i in range(0,3): |
---|
| 1641 | command = command + FinalArgs[i] + ' ' |
---|
| 1642 | CommandLog.WriteText(os.popen('sudo %s' % command).read()) |
---|
| 1643 | return self.next |
---|
| 1644 | |
---|
| 1645 | def GetPrev(self): |
---|
| 1646 | self.fuse_next = 0 |
---|
| 1647 | self.fuse_prev = self.fuse_prev + 1 |
---|
| 1648 | if self.fuse_prev == 1: |
---|
| 1649 | prev = self.prev |
---|
| 1650 | if FinalArgs[1] == '-nl': |
---|
| 1651 | prev = prev.GetPrev() |
---|
| 1652 | return prev |
---|
| 1653 | |
---|
| 1654 | #---------------------------------------------------------------------- |
---|
| 1655 | class ClonezillaModePage(wiz.PyWizardPage): |
---|
| 1656 | def __init__(self, parent, title): |
---|
| 1657 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 1658 | self.next = self.prev = None |
---|
| 1659 | self.sizer = makePageTitle(self, title) |
---|
| 1660 | self.fuse_next = self.fuse_prev = 0 |
---|
| 1661 | |
---|
| 1662 | ModeList = [_('msg_clonezilla_mode_0'), _('msg_clonezilla_mode_1'), _('msg_clonezilla_mode_2')] |
---|
| 1663 | wx.StaticText(self,-1,_('msg_clonezilla_mode_switch_long'), (10, 60), (475, 300),wx.TE_MULTILINE) |
---|
| 1664 | rb = wx.RadioBox(self, -1, '', (10,180), wx.DefaultSize, ModeList, 1, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 1665 | |
---|
| 1666 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 1667 | FinalArgs[0] = '/opt/drbl/sbin/tune-clientdir-opt' |
---|
| 1668 | FinalArgs[1] = '-z' |
---|
| 1669 | FinalArgs[2] = '0' |
---|
| 1670 | |
---|
| 1671 | def EvtRadioBox(self, event): |
---|
| 1672 | if event.GetInt() == 0: |
---|
| 1673 | FinalArgs[2] = '0' |
---|
| 1674 | elif event.GetInt() == 1: |
---|
| 1675 | FinalArgs[2] = '1' |
---|
| 1676 | elif event.GetInt() == 2: |
---|
| 1677 | FinalArgs[2] = '2' |
---|
| 1678 | |
---|
| 1679 | def SetNext(self, next): |
---|
| 1680 | self.next = next |
---|
| 1681 | |
---|
| 1682 | def SetPrev(self, prev): |
---|
| 1683 | self.prev = prev |
---|
| 1684 | |
---|
| 1685 | def GetNext(self): |
---|
| 1686 | command = '' |
---|
| 1687 | self.fuse_prev = 0 |
---|
| 1688 | self.fuse_next = self.fuse_next + 1 |
---|
| 1689 | if self.fuse_next == 2: |
---|
| 1690 | for i in range(0,3): |
---|
| 1691 | command = command + FinalArgs[i] + ' ' |
---|
| 1692 | CommandLog.WriteText(os.popen('sudo %s' % command).read()) |
---|
| 1693 | return self.next |
---|
| 1694 | |
---|
| 1695 | def GetPrev(self): |
---|
| 1696 | self.fuse_next = 0 |
---|
| 1697 | self.fuse_prev = self.fuse_prev + 1 |
---|
| 1698 | if self.fuse_prev == 1: |
---|
| 1699 | prev = self.prev |
---|
| 1700 | if FinalArgs[1] == '-nl': |
---|
| 1701 | prev = prev.GetPrev() |
---|
| 1702 | return prev |
---|
| 1703 | |
---|
| 1704 | #---------------------------------------------------------------------- |
---|
| 1705 | class LoginSwitchPage(wiz.PyWizardPage): |
---|
| 1706 | def __init__(self, parent, title): |
---|
| 1707 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 1708 | self.next = self.prev = None |
---|
| 1709 | self.sizer = makePageTitle(self, title) |
---|
| 1710 | self.fuse_next = self.fuse_prev = 0 |
---|
| 1711 | |
---|
| 1712 | ModeList = [_('msg_normal_login'), _('msg_auto_login'), _('msg_timed_login')] |
---|
| 1713 | wx.StaticText(self, -1, _('msg_login_switch'),(10,60)) |
---|
| 1714 | rb = wx.RadioBox(self, -1, _('msg_choose_action'), (10, 120), (200, 200),ModeList, 1, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 1715 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 1716 | FinalArgs[0] = '/opt/drbl/sbin/drbl-login-switch' |
---|
| 1717 | FinalArgs[3] = '-n' |
---|
| 1718 | |
---|
| 1719 | def EvtRadioBox(self, event): |
---|
| 1720 | if event.GetSelection() == 0: |
---|
| 1721 | FinalArgs[0] = '/opt/drbl/sbin/drbl-login-switch' |
---|
| 1722 | FinalArgs[3] = '-n' |
---|
| 1723 | FinalArgs[4] = '' |
---|
| 1724 | FinalArgs[5] = '' |
---|
| 1725 | if event.GetSelection() == 1: |
---|
| 1726 | FinalArgs[0] = '/opt/drbl/sbin/drbl-client-switch' |
---|
| 1727 | FinalArgs[3] = 'remote-linux-gra' |
---|
| 1728 | FinalArgs[4] = '/opt/drbl/sbin/drbl-login-switch' |
---|
| 1729 | FinalArgs[5] = '-a' |
---|
| 1730 | if event.GetSelection() == 2: |
---|
| 1731 | FinalArgs[0] = '/opt/drbl/sbin/drbl-client-switch' |
---|
| 1732 | FinalArgs[3] = 'remote-linux-gra' |
---|
| 1733 | FinalArgs[4] = '/opt/drbl/sbin/drbl-login-switch' |
---|
| 1734 | FinalArgs[5] = '-t' |
---|
| 1735 | |
---|
| 1736 | def SetNext(self, next): |
---|
| 1737 | self.next = next |
---|
| 1738 | |
---|
| 1739 | def SetPrev(self, prev): |
---|
| 1740 | self.prev = prev |
---|
| 1741 | |
---|
| 1742 | def GetNext(self): |
---|
| 1743 | next = self.next |
---|
| 1744 | self.fuse_prev = 0 |
---|
| 1745 | self.fuse_next = self.fuse_next + 1 |
---|
| 1746 | if self.fuse_next == 2: |
---|
| 1747 | if FinalArgs[3] == '-n': |
---|
| 1748 | FinalArgs[1] = FinalArgs[2] = '' |
---|
| 1749 | CommandLog.WriteText(os.popen('sudo %s %s' % (FinalArgs[0], FinalArgs[3])).read()) |
---|
| 1750 | elif (FinalArgs[3] != '-n') and (FinalArgs[1] == '-nl'): |
---|
| 1751 | CommandLog.WriteText(os.popen('sudo %s %s %s' % (FinalArgs[0], FinalArgs[1], FinalArgs[3])).read()) |
---|
| 1752 | CommandLog.WriteText(os.popen('sudo %s %s' % (FinalArgs[4], FinalArgs[5])).read()) |
---|
| 1753 | elif (FinalArgs[3] != '-n') and (FinalArgs[1] == '-h'): |
---|
| 1754 | CommandLog.WriteText(os.popen('sudo %s %s %s %s' % (FinalArgs[0], FinalArgs[1], FinalArgs[2], FinalArgs[3])).read()) |
---|
| 1755 | CommandLog.WriteText(os.popen('sudo %s %s' % (FinalArgs[4], FinalArgs[5])).read()) |
---|
| 1756 | return next |
---|
| 1757 | |
---|
| 1758 | def GetPrev(self): |
---|
| 1759 | self.fuse_next = 0 |
---|
| 1760 | self.fuse_prev = self.fuse_prev + 1 |
---|
| 1761 | if self.fuse_prev == 1: |
---|
| 1762 | prev = self.prev |
---|
| 1763 | if FinalArgs[1] == '-nl': |
---|
| 1764 | prev = prev.GetPrev() |
---|
| 1765 | return prev |
---|
| 1766 | |
---|
| 1767 | #---------------------------------------------------------------------- |
---|
| 1768 | class CleanAutoLoginAccountPage(wiz.PyWizardPage): |
---|
| 1769 | def __init__(self, parent, title): |
---|
| 1770 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 1771 | self.next = self.prev = None |
---|
| 1772 | self.sizer = makePageTitle(self, title) |
---|
| 1773 | |
---|
| 1774 | wx.StaticText(self, -1, _('msg_clean_autologin_account'),(50,100)) |
---|
| 1775 | FinalArgs[0] = '/opt/drbl/sbin/drbl-clean-autologin-account' |
---|
| 1776 | |
---|
| 1777 | def SetNext(self, next): |
---|
| 1778 | self.next = next |
---|
| 1779 | |
---|
| 1780 | def SetPrev(self, prev): |
---|
| 1781 | self.prev = prev |
---|
| 1782 | |
---|
| 1783 | def GetNext(self): |
---|
| 1784 | return self.next |
---|
| 1785 | |
---|
| 1786 | def GetPrev(self): |
---|
| 1787 | prev = self.prev |
---|
| 1788 | prev = prev.GetPrev() |
---|
| 1789 | return prev |
---|
| 1790 | |
---|
| 1791 | #---------------------------------------------------------------------- |
---|
| 1792 | class SwitchDRBLServPage(wiz.PyWizardPage): |
---|
| 1793 | def __init__(self, parent, title): |
---|
| 1794 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 1795 | self.next = self.prev = None |
---|
| 1796 | self.sizer = makePageTitle(self, title) |
---|
| 1797 | self.fuse_next = 0 |
---|
| 1798 | |
---|
| 1799 | ModeList = [_('msg_start_drbl_all_services'), _('msg_stop_drbl_all_services'), _('msg_restart_drbl_all_services'), _('msg_add_drbl_all_services'), _('msg_del_drbl_all_services')] |
---|
| 1800 | wx.StaticText(self, -1, _('msg_switch_drbl_service'),(10,60)) |
---|
| 1801 | rb = wx.RadioBox(self, -1, _('msg_choose_action'), (10, 120), (250,200), ModeList, 1, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 1802 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 1803 | FinalArgs[0] = '/opt/drbl/sbin/drbl-all-service' |
---|
| 1804 | FinalArgs[1] = 'start' |
---|
| 1805 | |
---|
| 1806 | def EvtRadioBox(self, event): |
---|
| 1807 | if event.GetSelection() == 0: |
---|
| 1808 | FinalArgs[1] = 'start' |
---|
| 1809 | if event.GetSelection() == 1: |
---|
| 1810 | FinalArgs[1] = 'stop' |
---|
| 1811 | if event.GetSelection() == 2: |
---|
| 1812 | FinalArgs[1] = 'restart' |
---|
| 1813 | if event.GetSelection() == 3: |
---|
| 1814 | FinalArgs[1] = 'add' |
---|
| 1815 | if event.GetSelection() == 4: |
---|
| 1816 | FinalArgs[1] = 'del' |
---|
| 1817 | |
---|
| 1818 | def SetNext(self, next): |
---|
| 1819 | self.next = next |
---|
| 1820 | |
---|
| 1821 | def GetNext(self): |
---|
| 1822 | command = '' |
---|
| 1823 | self.fuse_next = self.fuse_next + 1 |
---|
| 1824 | if self.fuse_next == 2: |
---|
| 1825 | for i in range(0,3): |
---|
| 1826 | command = command + FinalArgs[i] + ' ' |
---|
| 1827 | FinalCommand.SetLabel('%s' % command) |
---|
| 1828 | CommandLog.WriteText(os.popen('sudo %s' % command).read()) |
---|
| 1829 | return self.next |
---|
| 1830 | |
---|
| 1831 | #---------------------------------------------------------------------- |
---|
| 1832 | class FinalPage(wiz.PyWizardPage): |
---|
| 1833 | def __init__(self, parent, title): |
---|
| 1834 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 1835 | self.next = self.prev = None |
---|
| 1836 | self.sizer = makePageTitle(self, title) |
---|
| 1837 | global FinalCommand, CommandLog |
---|
| 1838 | |
---|
| 1839 | FinalCommand = wx.StaticText(self, -1, '', pos=(10,60), size=(400,100)) |
---|
| 1840 | CommandLog = wx.TextCtrl(self, -1, '', pos=(10,100), size=(470,200), style=wx.TE_MULTILINE|wx.TE_READONLY) |
---|
| 1841 | |
---|
| 1842 | def SetNext(self, next): |
---|
| 1843 | self.next = next |
---|
| 1844 | |
---|
| 1845 | def GetNext(self): |
---|
| 1846 | return self.next |
---|
| 1847 | |
---|
| 1848 | #---------------------------------------------------------------------- |
---|
| 1849 | class MainFrame(wx.Frame): |
---|
| 1850 | def __init__(self): |
---|
| 1851 | wx.Frame.__init__(self, parent=None, title=_('msg_nchc_title'), size=(850,500)) |
---|
| 1852 | self.SetAutoLayout(True) |
---|
| 1853 | |
---|
| 1854 | FunctionList = [_('msg_remote_linux_graphic'), _('msg_remote_linux_text'), _('msg_thin_client') |
---|
| 1855 | , _('msg_remote_memtest'), _('msg_remote_fdos'), _('msg_start_clonezilla_save_mode') |
---|
| 1856 | , _('msg_start_clonezilla_restore_mode'), _('msg_clonezilla_selec_in_client'), _('msg_clonezilla_stop') |
---|
| 1857 | , _('msg_local'), _('msg_reboot'), _('msg_shutdown'), _('msg_Wake_on_LAN') |
---|
| 1858 | , _('msg_switch_pxe_menu'), _('msg_switch_pxe_bg_mode'), _('msg_drbl_mode_switch') |
---|
| 1859 | , _('msg_clonezilla_mode_switch'), _('msg_gen_template_files'), _('msg_login_switch') |
---|
| 1860 | , _('msg_client_reautologin'), _('msg_reset_autologin_account') |
---|
| 1861 | , _('msg_switch_drbl_service'), _('msg_re_deploy'), _('msg_clean_dhcpd_lease') |
---|
| 1862 | , _('msg_regenerate_nfs_nis_nat_config')] |
---|
| 1863 | |
---|
| 1864 | self.panelA = wx.Panel(self) |
---|
| 1865 | self.panelA.SetBackgroundColour(wx.RED) |
---|
| 1866 | self.panelA.SetConstraints(layoutf.Layoutf('t=t#1;l=l10#1;b%b15#1;r=r10#1',(self,))) |
---|
| 1867 | |
---|
| 1868 | self.panelB = wx.Panel(self) |
---|
| 1869 | self.panelB.SetBackgroundColour(wx.BLUE) |
---|
| 1870 | self.panelB.SetConstraints(layoutf.Layoutf('t_5#2;l=l10#1;b%b90#1;r=r10#1',(self,self.panelA))) |
---|
| 1871 | |
---|
| 1872 | self.panelC = wx.Panel(self) |
---|
| 1873 | self.panelC.SetBackgroundColour(wx.GREEN) |
---|
| 1874 | self.panelC.SetConstraints(layoutf.Layoutf('t_5#2;l=l10#1;b=b10#1;r=r10#1',(self,self.panelB))) |
---|
| 1875 | |
---|
| 1876 | text = wx.StaticText(self.panelA, -1, _('TEST'), wx.DefaultPosition, (500,65), style=wx.TE_MULTILINE) |
---|
| 1877 | font = wx.Font(10, wx.SWISS, wx.BOLD, wx.NORMAL) |
---|
| 1878 | text.SetFont(font) |
---|
| 1879 | text.SetConstraints(layoutf.Layoutf('X%X50#1;Y=Y#1;h*;w%w50#1', (self.panelA,))) |
---|
| 1880 | |
---|
| 1881 | rb = wx.RadioBox(self.panelB, -1, '', wx.DefaultPosition, wx.DefaultSize, FunctionList, 2, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 1882 | rb.SetConstraints(layoutf.Layoutf('X=X#1;Y=Y#1;h*;w%w90#1', (self.panelB,))) |
---|
| 1883 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 1884 | rb.SetSelection(0) |
---|
| 1885 | |
---|
| 1886 | self.b_ok = wx.Button(self.panelC, wx.ID_OK) |
---|
| 1887 | self.b_ok.SetSize(self.b_ok.GetBestSize()) |
---|
| 1888 | self.b_ok.SetConstraints(layoutf.Layoutf('X%X150#1;Y=Y#1;h*;w*', (self.panelC,))) |
---|
| 1889 | self.b_exit = wx.Button(self.panelC, wx.ID_EXIT) |
---|
| 1890 | self.b_exit.SetSize(self.b_exit.GetBestSize()) |
---|
| 1891 | self.b_exit.SetConstraints(layoutf.Layoutf('X%X50#1;Y=Y#1;h*;w*', (self.panelC,))) |
---|
| 1892 | |
---|
| 1893 | self.Bind(wx.EVT_BUTTON, self.RemoteLinuxGraWizard, self.b_ok) |
---|
| 1894 | self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.b_exit) |
---|
| 1895 | self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) |
---|
| 1896 | |
---|
| 1897 | def EvtRadioBox(self, event): |
---|
| 1898 | if event.GetSelection() == 0: |
---|
| 1899 | self.scroll.Bind(wx.EVT_BUTTON, self.RemoteLinuxGraWizard, self.b_ok) |
---|
| 1900 | if event.GetSelection() == 1: |
---|
| 1901 | self.scroll.Bind(wx.EVT_BUTTON, self.RemoteLinuxTxtWizard, self.b_ok) |
---|
| 1902 | if event.GetSelection() == 2: |
---|
| 1903 | self.scroll.Bind(wx.EVT_BUTTON, self.TerminalWizard, self.b_ok) |
---|
| 1904 | if event.GetSelection() == 3: |
---|
| 1905 | self.scroll.Bind(wx.EVT_BUTTON, self.RemoteMemTestWizard, self.b_ok) |
---|
| 1906 | if event.GetSelection() == 4: |
---|
| 1907 | self.scroll.Bind(wx.EVT_BUTTON, self.RemotefdosWizard, self.b_ok) |
---|
| 1908 | if event.GetSelection() == 5: |
---|
| 1909 | self.scroll.Bind(wx.EVT_BUTTON, self.ClonezillaStartSaveWizard, self.b_ok) |
---|
| 1910 | if event.GetSelection() == 6: |
---|
| 1911 | self.scroll.Bind(wx.EVT_BUTTON, self.ClonezillaStartRestoreWizard, self.b_ok) |
---|
| 1912 | if event.GetSelection() == 7: |
---|
| 1913 | self.scroll.Bind(wx.EVT_BUTTON, self.ClonezillaSelectWizard, self.b_ok) |
---|
| 1914 | if event.GetSelection() == 8: |
---|
| 1915 | self.scroll.Bind(wx.EVT_BUTTON, self.ClonezillaStopWizard, self.b_ok) |
---|
| 1916 | if event.GetSelection() == 9: |
---|
| 1917 | self.scroll.Bind(wx.EVT_BUTTON, self.LocalWizard, self.b_ok) |
---|
| 1918 | if event.GetSelection() == 10: |
---|
| 1919 | self.scroll.Bind(wx.EVT_BUTTON, self.RebootWizard, self.b_ok) |
---|
| 1920 | if event.GetSelection() == 11: |
---|
| 1921 | self.scroll.Bind(wx.EVT_BUTTON, self.ShutdownWizard, self.b_ok) |
---|
| 1922 | if event.GetSelection() == 12: |
---|
| 1923 | self.scroll.Bind(wx.EVT_BUTTON, self.WakeOnLANWizard, self.b_ok) |
---|
| 1924 | if event.GetSelection() == 13: |
---|
| 1925 | self.scroll.Bind(wx.EVT_BUTTON, self.SwitchPXEMenuWizard, self.b_ok) |
---|
| 1926 | if event.GetSelection() == 14: |
---|
| 1927 | self.scroll.Bind(wx.EVT_BUTTON, self.SwitchPXEModeWizard, self.b_ok) |
---|
| 1928 | if event.GetSelection() == 15: |
---|
| 1929 | self.scroll.Bind(wx.EVT_BUTTON, self.DRBLModeWizard, self.b_ok) |
---|
| 1930 | if event.GetSelection() == 16: |
---|
| 1931 | self.scroll.Bind(wx.EVT_BUTTON, self.ClonezillaModeWizard, self.b_ok) |
---|
| 1932 | if event.GetSelection() == 17: |
---|
| 1933 | self.scroll.Bind(wx.EVT_BUTTON, self.GenTemplateFileWizard, self.b_ok) |
---|
| 1934 | if event.GetSelection() == 18: |
---|
| 1935 | self.scroll.Bind(wx.EVT_BUTTON, self.LoginSwitchWizard, self.b_ok) |
---|
| 1936 | if event.GetSelection() == 19: |
---|
| 1937 | self.scroll.Bind(wx.EVT_BUTTON, self.ClientReAutoLoginWizard, self.b_ok) |
---|
| 1938 | if event.GetSelection() == 20: |
---|
| 1939 | self.scroll.Bind(wx.EVT_BUTTON, self.CleanAutoLoginAccountWizard, self.b_ok) |
---|
| 1940 | if event.GetSelection() == 21: |
---|
| 1941 | self.scroll.Bind(wx.EVT_BUTTON, self.ResetAutoLoginAccountWizard, self.b_ok) |
---|
| 1942 | if event.GetSelection() == 22: |
---|
| 1943 | self.scroll.Bind(wx.EVT_BUTTON, self.SwitchDRBLServWizard, self.b_ok) |
---|
| 1944 | if event.GetSelection() == 23: |
---|
| 1945 | self.scroll.Bind(wx.EVT_BUTTON, self.ReDeployWizard, self.b_ok) |
---|
| 1946 | if event.GetSelection() == 24: |
---|
| 1947 | self.scroll.Bind(wx.EVT_BUTTON, self.CleanDHCPLeaseWizard, self.b_ok) |
---|
| 1948 | if event.GetSelection() == 25: |
---|
| 1949 | self.scroll.Bind(wx.EVT_BUTTON, self.Regenerate3NWizard, self.b_ok) |
---|
| 1950 | |
---|
| 1951 | def OnWizCancel(self, evt): |
---|
| 1952 | con = wx.MessageBox("Do you wnat to cancel this wizard?", "Confirm Again!", wx.CENTRE | wx.YES_NO | wx.ICON_QUESTION) |
---|
| 1953 | if con == wx.NO: |
---|
| 1954 | evt.Veto() |
---|
| 1955 | |
---|
| 1956 | #---------------------------------------------------------------------- |
---|
| 1957 | def OnCloseWindow(self, event): |
---|
| 1958 | self.Destroy() |
---|
| 1959 | #---------------------------------------------------------------------- |
---|
| 1960 | def OnCloseMe(self, event): |
---|
| 1961 | self.Close(True) |
---|
| 1962 | |
---|
| 1963 | #------------------------------Wizard Modules-------------------------- |
---|
| 1964 | def RemoteLinuxGraWizard(self,evt): |
---|
| 1965 | wizard = wiz.Wizard(self, -1, _('msg_remote_linux_graphic')) |
---|
| 1966 | |
---|
| 1967 | page1 = SetAllClientsPage(wizard, _('msg_title_set_all_clients')) |
---|
| 1968 | page2 = SelectClientsPage(wizard, _('msg_select_clients')) |
---|
| 1969 | page3 = FinalPage(wizard, _('msg_done')) |
---|
| 1970 | FinalArgs[0] = '/opt/drbl/sbin/dcs' |
---|
| 1971 | FinalArgs[3] = 'remote-linux-gra' |
---|
| 1972 | |
---|
| 1973 | self.page1 = page1 |
---|
| 1974 | #wizard.FitToPage(page1) |
---|
| 1975 | wizard.SetPageSize((500,300)) |
---|
| 1976 | |
---|
| 1977 | page1.SetNext(page2) |
---|
| 1978 | page2.SetPrev(page1) |
---|
| 1979 | page2.SetNext(page3) |
---|
| 1980 | |
---|
| 1981 | if wizard.RunWizard(page1): |
---|
| 1982 | for i in range(0,36): |
---|
| 1983 | FinalArgs[i] = '' |
---|
| 1984 | else: |
---|
| 1985 | for i in range(0,36): |
---|
| 1986 | FinalArgs[i] = '' |
---|
| 1987 | |
---|
| 1988 | #------------------------------Wizard Modules-------------------------- |
---|
| 1989 | def RemoteLinuxTxtWizard(self,evt): |
---|
| 1990 | wizard = wiz.Wizard(self, -1, _('msg_remote_linux_text'), pos = (350,200)) |
---|
| 1991 | |
---|
| 1992 | page1 = SetAllClientsPage(wizard, _('msg_title_set_all_clients')) |
---|
| 1993 | page2 = SelectClientsPage(wizard, _('msg_select_clients')) |
---|
| 1994 | page3 = FinalPage(wizard, _('msg_done')) |
---|
| 1995 | FinalArgs[0] = '/opt/drbl/sbin/dcs' |
---|
| 1996 | FinalArgs[3] = 'remote-linux-txt' |
---|
| 1997 | |
---|
| 1998 | self.page1 = page1 |
---|
| 1999 | wizard.SetPageSize((500,300)) |
---|
| 2000 | |
---|
| 2001 | page1.SetNext(page2) |
---|
| 2002 | page2.SetPrev(page1) |
---|
| 2003 | page2.SetNext(page3) |
---|
| 2004 | |
---|
| 2005 | if wizard.RunWizard(page1): |
---|
| 2006 | for i in range(0,36): |
---|
| 2007 | FinalArgs[i] = '' |
---|
| 2008 | else: |
---|
| 2009 | for i in range(0,36): |
---|
| 2010 | FinalArgs[i] = '' |
---|
| 2011 | |
---|
| 2012 | #------------------------------Wizard Modules-------------------------- |
---|
| 2013 | def TerminalWizard(self,evt): |
---|
| 2014 | wizard = wiz.Wizard(self, -1, _('msg_thin_client'), pos = (350,200)) |
---|
| 2015 | |
---|
| 2016 | page1 = SetAllClientsPage(wizard, _('msg_title_set_all_clients')) |
---|
| 2017 | page2 = SelectClientsPage(wizard, _('msg_select_clients')) |
---|
| 2018 | page3 = FinalPage(wizard, _('msg_done')) |
---|
| 2019 | FinalArgs[0] = '/opt/drbl/sbin/dcs' |
---|
| 2020 | FinalArgs[3] = 'terminal' |
---|
| 2021 | |
---|
| 2022 | self.page1 = page1 |
---|
| 2023 | wizard.SetPageSize((500,300)) |
---|
| 2024 | |
---|
| 2025 | page1.SetNext(page2) |
---|
| 2026 | page2.SetPrev(page1) |
---|
| 2027 | page2.SetNext(page3) |
---|
| 2028 | |
---|
| 2029 | if wizard.RunWizard(page1): |
---|
| 2030 | for i in range(0,36): |
---|
| 2031 | FinalArgs[i] = '' |
---|
| 2032 | else: |
---|
| 2033 | for i in range(0,36): |
---|
| 2034 | FinalArgs[i] = '' |
---|
| 2035 | |
---|
| 2036 | #------------------------------Wizard Modules-------------------------- |
---|
| 2037 | def RemoteMemTestWizard(self,evt): |
---|
| 2038 | wizard = wiz.Wizard(self, -1, _('msg_remote_memtest'), pos = (500,200)) |
---|
| 2039 | |
---|
| 2040 | page1 = SetAllClientsPage(wizard, _('msg_title_set_all_clients')) |
---|
| 2041 | page2 = SelectClientsPage(wizard, _('msg_select_clients')) |
---|
| 2042 | page3 = FinalPage(wizard, _('msg_done')) |
---|
| 2043 | FinalArgs[0] = '/opt/drbl/sbin/dcs' |
---|
| 2044 | FinalArgs[3] = 'remote-memtest' |
---|
| 2045 | |
---|
| 2046 | self.page1 = page1 |
---|
| 2047 | wizard.SetPageSize((500,300)) |
---|
| 2048 | |
---|
| 2049 | page1.SetNext(page2) |
---|
| 2050 | page2.SetPrev(page1) |
---|
| 2051 | page2.SetNext(page3) |
---|
| 2052 | |
---|
| 2053 | if wizard.RunWizard(page1): |
---|
| 2054 | for i in range(0,36): |
---|
| 2055 | FinalArgs[i] = '' |
---|
| 2056 | else: |
---|
| 2057 | for i in range(0,36): |
---|
| 2058 | FinalArgs[i] = '' |
---|
| 2059 | |
---|
| 2060 | #------------------------------Wizard Modules-------------------------- |
---|
| 2061 | def RemotefdosWizard(self,evt): |
---|
| 2062 | wizard = wiz.Wizard(self, -1, _('msg_remote_fdos'), pos = (500,200)) |
---|
| 2063 | |
---|
| 2064 | page1 = SetAllClientsPage(wizard, _('msg_title_set_all_clients')) |
---|
| 2065 | page2 = SelectClientsPage(wizard, _('msg_select_clients')) |
---|
| 2066 | page3 = FinalPage(wizard,_('msg_done')) |
---|
| 2067 | FinalArgs[0] = '/opt/drbl/sbin/dcs' |
---|
| 2068 | FinalArgs[3] = 'remote-fdos' |
---|
| 2069 | |
---|
| 2070 | self.page1 = page1 |
---|
| 2071 | wizard.SetPageSize((500,300)) |
---|
| 2072 | |
---|
| 2073 | page1.SetNext(page2) |
---|
| 2074 | page2.SetPrev(page1) |
---|
| 2075 | page2.SetNext(page3) |
---|
| 2076 | |
---|
| 2077 | if wizard.RunWizard(page1): |
---|
| 2078 | for i in range(0,36): |
---|
| 2079 | FinalArgs[i] = '' |
---|
| 2080 | else: |
---|
| 2081 | for i in range(0,36): |
---|
| 2082 | FinalArgs[i] = '' |
---|
| 2083 | |
---|
| 2084 | #------------------------------Wizard Modules-------------------------- |
---|
| 2085 | def ClonezillaStartSaveWizard(self,evt): |
---|
| 2086 | wizard = wiz.Wizard(self, -1, _('msg_start_clonezilla_save_mode'), pos = (500,200)) |
---|
| 2087 | |
---|
| 2088 | page1 = SetAllClientsPage(wizard, _('msg_title_set_all_clients')) |
---|
| 2089 | page2 = SelectClientsPage(wizard, _('msg_select_clients')) |
---|
| 2090 | page3 = ClonezillaStartSavePage1(wizard, _('msg_choose_mode')) |
---|
| 2091 | page4 = ClonezillaStartSavePage2(wizard, _('msg_title_input_save_image_name_in_server')) |
---|
| 2092 | page5 = ClonezillaStartSavePage3(wizard, _('msg_input_image_name')) |
---|
| 2093 | page6 = ClonezillaStartSavePage4(wizard, _('msg_clonezilla_advanced_extra_param')) |
---|
| 2094 | page7 = ClonezillaStartSavePage5(wizard, _('msg_clonezilla_advanced_extra_param')) |
---|
| 2095 | page8 = ClonezillaStartSavePage6(wizard, _('msg_clonezilla_advanced_extra_param')) |
---|
| 2096 | page9 = ClonezillaStartSavePage7(wizard, _('msg_clonezilla_advanced_extra_param')) |
---|
| 2097 | page10 = FinalPage(wizard, _('msg_done')) |
---|
| 2098 | |
---|
| 2099 | self.page1 = page1 |
---|
| 2100 | wizard.SetPageSize((500,300)) |
---|
| 2101 | |
---|
| 2102 | page1.SetNext(page2) |
---|
| 2103 | page2.SetPrev(page1) |
---|
| 2104 | page2.SetNext(page3) |
---|
| 2105 | page3.SetPrev(page2) |
---|
| 2106 | page3.SetNext(page4) |
---|
| 2107 | page4.SetPrev(page3) |
---|
| 2108 | page4.SetNext(page5) |
---|
| 2109 | page5.SetPrev(page4) |
---|
| 2110 | page5.SetNext(page6) |
---|
| 2111 | page6.SetPrev(page5) |
---|
| 2112 | page6.SetNext(page7) |
---|
| 2113 | page7.SetPrev(page6) |
---|
| 2114 | page7.SetNext(page8) |
---|
| 2115 | page8.SetPrev(page7) |
---|
| 2116 | page8.SetNext(page9) |
---|
| 2117 | page9.SetPrev(page8) |
---|
| 2118 | page9.SetNext(page10) |
---|
| 2119 | |
---|
| 2120 | if wizard.RunWizard(page1): |
---|
| 2121 | for i in range(0,36): |
---|
| 2122 | FinalArgs[i] = '' |
---|
| 2123 | else: |
---|
| 2124 | wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) |
---|
| 2125 | for i in range(0,36): |
---|
| 2126 | FinalArgs[i] = '' |
---|
| 2127 | |
---|
| 2128 | #------------------------------Wizard Modules-------------------------- |
---|
| 2129 | def ClonezillaStartRestoreWizard(self,evt): |
---|
| 2130 | wizard = wiz.Wizard(self, -1, _('msg_start_clonezilla_restore_mode'), pos = (500,200)) |
---|
| 2131 | |
---|
| 2132 | page1 = SetAllClientsPage(wizard, _('msg_title_set_all_clients')) |
---|
| 2133 | page2 = SelectClientsPage(wizard, _('msg_select_clients')) |
---|
| 2134 | page3 = ClonezillaStartRestorePage1(wizard, _('msg_choose_mode')) |
---|
| 2135 | page4 = ClonezillaStartRestorePage2(wizard, _('msg_clonezilla_advanced_extra_param')) |
---|
| 2136 | page5 = ClonezillaStartRestorePage3(wizard, _('msg_change_hostname_of_MS_WIN_on_the_fly')) |
---|
| 2137 | page6 = ClonezillaStartRestorePage4(wizard, _('msg_What_the_win_hostname_prefix')) |
---|
| 2138 | page7 = ClonezillaStartRestorePage5(wizard, _('msg_clonezilla_advanced_extra_param')) |
---|
| 2139 | page8 = ClonezillaStartRestorePage6(wizard, _('msg_clonezilla_advanced_extra_param')) |
---|
| 2140 | page9 = ClonezillaStartRestorePage7(wizard, _('msg_choose_the_image_to_restore')) |
---|
| 2141 | page10 = ClonezillaStartRestorePage8a(wizard, _('msg_choose_the_disks_to_restore')) |
---|
| 2142 | page11 = ClonezillaStartRestorePage8b(wizard, _('msg_choose_the_parts_to_restore')) |
---|
| 2143 | page12 = ClonezillaStartRestorePage9a(wizard, _('msg_choose_mode')) |
---|
| 2144 | page13 = ClonezillaStartRestorePage9b(wizard, _('msg_choose_mode')) |
---|
| 2145 | page14 = ClonezillaStartRestorePage10(wizard, _('msg_clonezilla_advanced_extra_param')) |
---|
| 2146 | page15 = ClonezillaStartRestorePage11(wizard, _('msg_clonezilla_advanced_extra_param')) |
---|
| 2147 | page16 = ClonezillaStartRestorePage12(wizard, _('msg_clonezilla_advanced_extra_param')) |
---|
| 2148 | page17 = FinalPage(wizard, _('msg_done')) |
---|
| 2149 | |
---|
| 2150 | self.page1 = page1 |
---|
| 2151 | wizard.SetPageSize((500,300)) |
---|
| 2152 | |
---|
| 2153 | page1.SetNext(page2) |
---|
| 2154 | page2.SetPrev(page1) |
---|
| 2155 | page2.SetNext(page3) |
---|
| 2156 | page3.SetPrev(page2) |
---|
| 2157 | page3.SetNext(page4) |
---|
| 2158 | page4.SetPrev(page3) |
---|
| 2159 | page4.SetNext(page5) |
---|
| 2160 | page5.SetPrev(page4) |
---|
| 2161 | page5.SetNext(page6) |
---|
| 2162 | page6.SetPrev(page5) |
---|
| 2163 | page6.SetNext(page7) |
---|
| 2164 | page7.SetPrev(page6) |
---|
| 2165 | page7.SetNext(page8) |
---|
| 2166 | page8.SetPrev(page7) |
---|
| 2167 | page8.SetNext(page9) |
---|
| 2168 | page9.SetPrev(page8) |
---|
| 2169 | page9.SetNext(page10) |
---|
| 2170 | page10.SetPrev(page9) |
---|
| 2171 | page10.SetNext(page11) |
---|
| 2172 | page11.SetPrev(page10) |
---|
| 2173 | page11.SetNext(page12) |
---|
| 2174 | page12.SetPrev(page11) |
---|
| 2175 | page12.SetNext(page13) |
---|
| 2176 | page13.SetPrev(page12) |
---|
| 2177 | page13.SetNext(page14) |
---|
| 2178 | page14.SetPrev(page13) |
---|
| 2179 | page14.SetNext(page15) |
---|
| 2180 | page15.SetPrev(page14) |
---|
| 2181 | page15.SetNext(page16) |
---|
| 2182 | page16.SetPrev(page15) |
---|
| 2183 | page16.SetNext(page17) |
---|
| 2184 | |
---|
| 2185 | if wizard.RunWizard(page1): |
---|
| 2186 | for i in range(0,36): |
---|
| 2187 | FinalArgs[i] = '' |
---|
| 2188 | else: |
---|
| 2189 | wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) |
---|
| 2190 | for i in range(0,36): |
---|
| 2191 | FinalArgs[i] = '' |
---|
| 2192 | |
---|
| 2193 | #------------------------------Wizard Modules-------------------------- |
---|
| 2194 | def ClonezillaSelectWizard(self,evt): |
---|
| 2195 | wizard = wiz.Wizard(self, -1, _('msg_clonezilla_selec_in_client'), pos = (500,200)) |
---|
| 2196 | |
---|
| 2197 | page1 = SetAllClientsPage(wizard, _('msg_title_set_all_clients')) |
---|
| 2198 | page2 = SelectClientsPage(wizard, _('msg_select_clients')) |
---|
| 2199 | page3 = ClonezillaSelectPage1(wizard, _('msg_clonezilla_advanced_extra_param')) |
---|
| 2200 | page4 = ClonezillaSelectPage2(wizard, _('msg_clonezilla_advanced_extra_param')) |
---|
| 2201 | page5 = FinalPage(wizard, '') |
---|
| 2202 | |
---|
| 2203 | self.page1 = page1 |
---|
| 2204 | wizard.SetPageSize((500,300)) |
---|
| 2205 | |
---|
| 2206 | page1.SetNext(page2) |
---|
| 2207 | page2.SetPrev(page1) |
---|
| 2208 | page2.SetNext(page3) |
---|
| 2209 | page3.SetPrev(page2) |
---|
| 2210 | page3.SetNext(page4) |
---|
| 2211 | page4.SetPrev(page3) |
---|
| 2212 | page4.SetNext(page5) |
---|
| 2213 | |
---|
| 2214 | if wizard.RunWizard(page1): |
---|
| 2215 | for i in range(0,36): |
---|
| 2216 | FinalArgs[i] = '' |
---|
| 2217 | else: |
---|
| 2218 | wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) |
---|
| 2219 | for i in range(0,36): |
---|
| 2220 | FinalArgs[i] = '' |
---|
| 2221 | |
---|
| 2222 | #------------------------------Wizard Modules-------------------------- |
---|
| 2223 | def ClonezillaStopWizard(self,evt): |
---|
| 2224 | wizard = wiz.Wizard(self, -1, _('msg_clonezilla_stop'), pos = (500,200)) |
---|
| 2225 | |
---|
| 2226 | page1 = SetAllClientsPage(wizard, _('msg_title_set_all_clients')) |
---|
| 2227 | page2 = SelectClientsPage(wizard, _('msg_select_clients')) |
---|
| 2228 | page3 = FinalPage(wizard, _('msg_done')) |
---|
| 2229 | FinalArgs[0] = '/opt/drbl/sbin/dcs' |
---|
| 2230 | FinalArgs[3] = 'clonezilla-stop' |
---|
| 2231 | |
---|
| 2232 | self.page1 = page1 |
---|
| 2233 | wizard.SetPageSize((500,300)) |
---|
| 2234 | |
---|
| 2235 | page1.SetNext(page2) |
---|
| 2236 | page2.SetPrev(page1) |
---|
| 2237 | page2.SetNext(page3) |
---|
| 2238 | |
---|
| 2239 | if wizard.RunWizard(page1): |
---|
| 2240 | for i in range(0,36): |
---|
| 2241 | FinalArgs[i] = '' |
---|
| 2242 | else: |
---|
| 2243 | wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) |
---|
| 2244 | for i in range(0,36): |
---|
| 2245 | FinalArgs[i] = '' |
---|
| 2246 | |
---|
| 2247 | #------------------------------Wizard Modules-------------------------- |
---|
| 2248 | def LocalWizard(self,evt): |
---|
| 2249 | wizard = wiz.Wizard(self, -1, _('msg_local'), pos = (500,200)) |
---|
| 2250 | |
---|
| 2251 | page1 = SetAllClientsPage(wizard, _('msg_title_set_all_clients')) |
---|
| 2252 | page2 = SelectClientsPage(wizard, _('msg_select_clients')) |
---|
| 2253 | page3 = FinalPage(wizard, _('msg_done')) |
---|
| 2254 | FinalArgs[0] = '/opt/drbl/sbin/dcs' |
---|
| 2255 | FinalArgs[3] = 'local' |
---|
| 2256 | |
---|
| 2257 | self.page1 = page1 |
---|
| 2258 | wizard.SetPageSize((500,300)) |
---|
| 2259 | |
---|
| 2260 | page1.SetNext(page2) |
---|
| 2261 | page2.SetPrev(page1) |
---|
| 2262 | page2.SetNext(page3) |
---|
| 2263 | |
---|
| 2264 | if wizard.RunWizard(page1): |
---|
| 2265 | for i in range(0,36): |
---|
| 2266 | FinalArgs[i] = '' |
---|
| 2267 | else: |
---|
| 2268 | wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) |
---|
| 2269 | for i in range(0,36): |
---|
| 2270 | FinalArgs[i] = '' |
---|
| 2271 | |
---|
| 2272 | #------------------------------Wizard Modules-------------------------- |
---|
| 2273 | def RebootWizard(self,evt): |
---|
| 2274 | wizard = wiz.Wizard(self, -1, _('msg_reboot'), pos = (500,200)) |
---|
| 2275 | |
---|
| 2276 | page1 = SetAllClientsPage(wizard, _('msg_title_set_all_clients')) |
---|
| 2277 | page2 = SelectClientsPage(wizard, _('msg_select_clients')) |
---|
| 2278 | page3 = FinalPage(wizard, _('msg_done')) |
---|
| 2279 | FinalArgs[0] = '/opt/drbl/sbin/dcs' |
---|
| 2280 | FinalArgs[3] = 'reboot' |
---|
| 2281 | |
---|
| 2282 | self.page1 = page1 |
---|
| 2283 | wizard.SetPageSize((500,300)) |
---|
| 2284 | |
---|
| 2285 | page1.SetNext(page2) |
---|
| 2286 | page2.SetPrev(page1) |
---|
| 2287 | page2.SetNext(page3) |
---|
| 2288 | |
---|
| 2289 | if wizard.RunWizard(page1): |
---|
| 2290 | for i in range(0,36): |
---|
| 2291 | FinalArgs[i] = '' |
---|
| 2292 | else: |
---|
| 2293 | wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) |
---|
| 2294 | for i in range(0,36): |
---|
| 2295 | FinalArgs[i] = '' |
---|
| 2296 | |
---|
| 2297 | #------------------------------Wizard Modules-------------------------- |
---|
| 2298 | def ShutdownWizard(self,evt): |
---|
| 2299 | wizard = wiz.Wizard(self, -1, _('msg_shutdown'), pos = (500,200)) |
---|
| 2300 | |
---|
| 2301 | page1 = SetAllClientsPage(wizard, _('msg_title_set_all_clients')) |
---|
| 2302 | page2 = SelectClientsPage(wizard, _('msg_select_clients')) |
---|
| 2303 | page3 = FinalPage(wizard, _('msg_done')) |
---|
| 2304 | FinalArgs[0] = '/opt/drbl/sbin/dcs' |
---|
| 2305 | FinalArgs[3] = 'shutdown' |
---|
| 2306 | |
---|
| 2307 | self.page1 = page1 |
---|
| 2308 | wizard.SetPageSize((500,300)) |
---|
| 2309 | |
---|
| 2310 | page1.SetNext(page2) |
---|
| 2311 | page2.SetPrev(page1) |
---|
| 2312 | page2.SetNext(page3) |
---|
| 2313 | |
---|
| 2314 | if wizard.RunWizard(page1): |
---|
| 2315 | for i in range(0,36): |
---|
| 2316 | FinalArgs[i] = '' |
---|
| 2317 | else: |
---|
| 2318 | wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) |
---|
| 2319 | for i in range(0,36): |
---|
| 2320 | FinalArgs[i] = '' |
---|
| 2321 | |
---|
| 2322 | #------------------------------Wizard Modules----------------------------- |
---|
| 2323 | def WakeOnLANWizard(self,evt): |
---|
| 2324 | wizard = wiz.Wizard(self, -1, _('msg_Wake_on_LAN'), pos = (500,200)) |
---|
| 2325 | |
---|
| 2326 | page1 = SetAllClientsPage(wizard, _('msg_title_set_all_clients')) |
---|
| 2327 | page2 = SelectClientsPage(wizard, _('msg_select_clients')) |
---|
| 2328 | page3 = FinalPage(wizard, _('msg_done')) |
---|
| 2329 | FinalArgs[0] = '/opt/drbl/sbin/dcs' |
---|
| 2330 | FinalArgs[3] = 'Wake-on-LAN' |
---|
| 2331 | |
---|
| 2332 | self.page1 = page1 |
---|
| 2333 | wizard.SetPageSize((500,300)) |
---|
| 2334 | |
---|
| 2335 | page1.SetNext(page2) |
---|
| 2336 | page2.SetPrev(page1) |
---|
| 2337 | page2.SetNext(page3) |
---|
| 2338 | |
---|
| 2339 | if wizard.RunWizard(page1): |
---|
| 2340 | for i in range(0,36): |
---|
| 2341 | FinalArgs[i] = '' |
---|
| 2342 | else: |
---|
| 2343 | wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) |
---|
| 2344 | for i in range(0,36): |
---|
| 2345 | FinalArgs[i] = '' |
---|
| 2346 | |
---|
| 2347 | #------------------------------Wizard Modules----------------------------- |
---|
| 2348 | def SwitchPXEMenuWizard(self,evt): |
---|
| 2349 | wizard = wiz.Wizard(self, -1, _('msg_switch_pxe_menu'), pos = (500,200)) |
---|
| 2350 | |
---|
| 2351 | page1 = SetAllClientsPage(wizard, _('msg_title_set_all_clients')) |
---|
| 2352 | page2 = SelectClientsPage(wizard, _('msg_select_clients')) |
---|
| 2353 | page3 = SwitchPXEMenuPage1(wizard, _('msg_choose_the_action')) |
---|
| 2354 | page4 = SwitchPXEMenuPage2(wizard, _('msg_hide_reveal')) |
---|
| 2355 | page5 = SwitchPXEMenuPage3(wizard, _('msg_setdefault_pxe_menu')) |
---|
| 2356 | page6 = FinalPage(wizard, _('msg_done')) |
---|
| 2357 | |
---|
| 2358 | self.page1 = page1 |
---|
| 2359 | wizard.SetPageSize((500,300)) |
---|
| 2360 | |
---|
| 2361 | page1.SetNext(page2) |
---|
| 2362 | page2.SetPrev(page1) |
---|
| 2363 | page2.SetNext(page3) |
---|
| 2364 | page3.SetPrev(page2) |
---|
| 2365 | page3.SetNext(page4) |
---|
| 2366 | page4.SetPrev(page3) |
---|
| 2367 | page4.SetNext(page5) |
---|
| 2368 | page5.SetPrev(page4) |
---|
| 2369 | page5.SetNext(page6) |
---|
| 2370 | |
---|
| 2371 | if wizard.RunWizard(page1): |
---|
| 2372 | for i in range(0,36): |
---|
| 2373 | FinalArgs[i] = '' |
---|
| 2374 | else: |
---|
| 2375 | wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) |
---|
| 2376 | for i in range(0,36): |
---|
| 2377 | FinalArgs[i] = '' |
---|
| 2378 | |
---|
| 2379 | #------------------------------Wizard Modules----------------------------- |
---|
| 2380 | def SwitchPXEModeWizard(self,evt): |
---|
| 2381 | wizard = wiz.Wizard(self, -1, _('msg_switch_pxe_bg_mode'), pos = (500,200)) |
---|
| 2382 | |
---|
| 2383 | page1 = SetAllClientsPage(wizard, _('msg_title_set_all_clients')) |
---|
| 2384 | page2 = SelectClientsPage(wizard, _('msg_select_clients')) |
---|
| 2385 | page3 = SwitchPXEModePage(wizard, _('msg_switch_pxe_bg_mode')) |
---|
| 2386 | page4 = FinalPage(wizard, _('msg_done')) |
---|
| 2387 | |
---|
| 2388 | self.page1 = page1 |
---|
| 2389 | wizard.SetPageSize((500,300)) |
---|
| 2390 | |
---|
| 2391 | page1.SetNext(page2) |
---|
| 2392 | page2.SetPrev(page1) |
---|
| 2393 | page2.SetNext(page3) |
---|
| 2394 | page3.SetPrev(page2) |
---|
| 2395 | page3.SetNext(page4) |
---|
| 2396 | |
---|
| 2397 | if wizard.RunWizard(page1): |
---|
| 2398 | for i in range(0,36): |
---|
| 2399 | FinalArgs[i] = '' |
---|
| 2400 | else: |
---|
| 2401 | wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) |
---|
| 2402 | for i in range(0,36): |
---|
| 2403 | FinalArgs[i] = '' |
---|
| 2404 | |
---|
| 2405 | #------------------------------Wizard Modules----------------------------- |
---|
| 2406 | def DRBLModeWizard(self,evt): |
---|
| 2407 | wizard = wiz.Wizard(self, -1, _('msg_drbl_mode_switch'), pos = (500,200)) |
---|
| 2408 | |
---|
| 2409 | page1 = DRBLModePage(wizard, _('msg_drbl_mode_switch')) |
---|
| 2410 | page2 = FinalPage(wizard, _('msg_done')) |
---|
| 2411 | |
---|
| 2412 | self.page1 = page1 |
---|
| 2413 | wizard.SetPageSize((500,330)) |
---|
| 2414 | |
---|
| 2415 | page1.SetNext(page2) |
---|
| 2416 | |
---|
| 2417 | if wizard.RunWizard(page1): |
---|
| 2418 | for i in range(0,36): |
---|
| 2419 | FinalArgs[i] = '' |
---|
| 2420 | else: |
---|
| 2421 | wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) |
---|
| 2422 | for i in range(0,36): |
---|
| 2423 | FinalArgs[i] = '' |
---|
| 2424 | |
---|
| 2425 | #------------------------------Wizard Modules----------------------------- |
---|
| 2426 | def ClonezillaModeWizard(self,evt): |
---|
| 2427 | wizard = wiz.Wizard(self, -1, _('msg_clonezilla_mode_switch'), pos = (500,200)) |
---|
| 2428 | |
---|
| 2429 | page1 = ClonezillaModePage(wizard, _('msg_clonezilla_mode_switch')) |
---|
| 2430 | page2 = FinalPage(wizard, _('msg_done')) |
---|
| 2431 | |
---|
| 2432 | self.page1 = page1 |
---|
| 2433 | wizard.SetPageSize((500,300)) |
---|
| 2434 | |
---|
| 2435 | page1.SetNext(page2) |
---|
| 2436 | |
---|
| 2437 | if wizard.RunWizard(page1): |
---|
| 2438 | for i in range(0,36): |
---|
| 2439 | FinalArgs[i] = '' |
---|
| 2440 | else: |
---|
| 2441 | wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) |
---|
| 2442 | for i in range(0,36): |
---|
| 2443 | FinalArgs[i] = '' |
---|
| 2444 | |
---|
| 2445 | #------------------------------Wizard Modules----------------------------- |
---|
| 2446 | def GenTemplateFileWizard(self,evt): |
---|
| 2447 | wizard = wiz.Wizard(self, -1, _('msg_gen_template_files'), pos = (500,200)) |
---|
| 2448 | |
---|
| 2449 | page1 = FinalPage(wizard, _('msg_done')) |
---|
| 2450 | FinalCommand.SetLabel('/opt/drbl/sbin/gen_ssi_files') |
---|
| 2451 | CommandLog.WriteText(os.popen('sudo /opt/drbl/sbin/gen_ssi_files').read()) |
---|
| 2452 | |
---|
| 2453 | self.page1 = page1 |
---|
| 2454 | wizard.SetPageSize((500,300)) |
---|
| 2455 | |
---|
| 2456 | if wizard.RunWizard(page1): |
---|
| 2457 | for i in range(0,36): |
---|
| 2458 | FinalArgs[i] = '' |
---|
| 2459 | else: |
---|
| 2460 | wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) |
---|
| 2461 | for i in range(0,36): |
---|
| 2462 | FinalArgs[i] = '' |
---|
| 2463 | |
---|
| 2464 | #------------------------------Wizard Modules----------------------------- |
---|
| 2465 | def LoginSwitchWizard(self,evt): |
---|
| 2466 | wizard = wiz.Wizard(self, -1, _('msg_login_switch'), pos = (500,200)) |
---|
| 2467 | |
---|
| 2468 | page1 = SetAllClientsPage(wizard, _('msg_title_set_all_clients')) |
---|
| 2469 | page2 = SelectClientsPage(wizard, _('msg_select_clients')) |
---|
| 2470 | page3 = LoginSwitchPage(wizard, _('msg_login_switch')) |
---|
| 2471 | page4 = FinalPage(wizard, _('msg_done')) |
---|
| 2472 | |
---|
| 2473 | self.page1 = page1 |
---|
| 2474 | wizard.SetPageSize((500,300)) |
---|
| 2475 | |
---|
| 2476 | page1.SetNext(page2) |
---|
| 2477 | page2.SetPrev(page1) |
---|
| 2478 | page2.SetNext(page3) |
---|
| 2479 | page3.SetPrev(page2) |
---|
| 2480 | page3.SetNext(page4) |
---|
| 2481 | |
---|
| 2482 | if wizard.RunWizard(page1): |
---|
| 2483 | for i in range(0,36): |
---|
| 2484 | FinalArgs[i] = '' |
---|
| 2485 | else: |
---|
| 2486 | wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) |
---|
| 2487 | for i in range(0,36): |
---|
| 2488 | FinalArgs[i] = '' |
---|
| 2489 | |
---|
| 2490 | #------------------------------Wizard Modules----------------------------- |
---|
| 2491 | def ClientReAutoLoginWizard(self,evt): |
---|
| 2492 | wizard = wiz.Wizard(self, -1, _('msg_client_reautologin'), pos = (500,200)) |
---|
| 2493 | |
---|
| 2494 | page1 = SetAllClientsPage(wizard, _('msg_title_set_all_clients')) |
---|
| 2495 | page2 = SelectClientsPage(wizard, _('msg_select_clients')) |
---|
| 2496 | page3 = FinalPage(wizard, _('msg_done')) |
---|
| 2497 | FinalArgs[0] = '/opt/drbl/sbin/drbl-client-reautologin' |
---|
| 2498 | |
---|
| 2499 | self.page1 = page1 |
---|
| 2500 | wizard.SetPageSize((500,300)) |
---|
| 2501 | |
---|
| 2502 | page1.SetNext(page2) |
---|
| 2503 | page2.SetPrev(page1) |
---|
| 2504 | page2.SetNext(page3) |
---|
| 2505 | |
---|
| 2506 | if wizard.RunWizard(page1): |
---|
| 2507 | for i in range(0,36): |
---|
| 2508 | FinalArgs[i] = '' |
---|
| 2509 | else: |
---|
| 2510 | wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) |
---|
| 2511 | for i in range(0,36): |
---|
| 2512 | FinalArgs[i] = '' |
---|
| 2513 | |
---|
| 2514 | #------------------------------Wizard Modules----------------------------- |
---|
| 2515 | def CleanAutoLoginAccountWizard(self,evt): |
---|
| 2516 | wizard = wiz.Wizard(self, -1, _('msg_clean_autologin_account'), pos = (500,200)) |
---|
| 2517 | |
---|
| 2518 | page1 = FinalPage(wizard, _('msg_done')) |
---|
| 2519 | FinalCommand.SetLabel('/opt/drbl/sbin/drbl-clean-autologin-account') |
---|
| 2520 | CommandLog.WriteText(os.popen('yes y | sudo /opt/drbl/sbin/drbl-clean-autologin-account').read()) |
---|
| 2521 | |
---|
| 2522 | self.page1 = page1 |
---|
| 2523 | wizard.SetPageSize((500,300)) |
---|
| 2524 | |
---|
| 2525 | if wizard.RunWizard(page1): |
---|
| 2526 | for i in range(0,36): |
---|
| 2527 | FinalArgs[i] = '' |
---|
| 2528 | else: |
---|
| 2529 | wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) |
---|
| 2530 | for i in range(0,36): |
---|
| 2531 | FinalArgs[i] = '' |
---|
| 2532 | |
---|
| 2533 | #------------------------------Wizard Modules----------------------------- |
---|
| 2534 | def ResetAutoLoginAccountWizard(self,evt): |
---|
| 2535 | wizard = wiz.Wizard(self, -1, _('msg_reset_autologin_account'), pos = (500,200)) |
---|
| 2536 | |
---|
| 2537 | page1 = FinalPage(wizard, _('msg_done')) |
---|
| 2538 | FinalCommand.SetLabel('/opt/drbl/sbin/drbl-user-env-reset --auto-login') |
---|
| 2539 | CommandLog.WriteText(os.popen('yes y | sudo /opt/drbl/sbin/drbl-user-env-reset --auto-login').read()) |
---|
| 2540 | |
---|
| 2541 | self.page1 = page1 |
---|
| 2542 | wizard.SetPageSize((500,300)) |
---|
| 2543 | |
---|
| 2544 | if wizard.RunWizard(page1): |
---|
| 2545 | for i in range(0,36): |
---|
| 2546 | FinalArgs[i] = '' |
---|
| 2547 | else: |
---|
| 2548 | wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) |
---|
| 2549 | for i in range(0,36): |
---|
| 2550 | FinalArgs[i] = '' |
---|
| 2551 | |
---|
| 2552 | #------------------------------Wizard Modules----------------------------- |
---|
| 2553 | def SwitchDRBLServWizard(self,evt): |
---|
| 2554 | wizard = wiz.Wizard(self, -1, _('msg_switch_drbl_service'), pos = (500,200)) |
---|
| 2555 | |
---|
| 2556 | page1 = SwitchDRBLServPage(wizard, _('msg_switch_drbl_service')) |
---|
| 2557 | page2 = FinalPage(wizard, _('msg_done')) |
---|
| 2558 | |
---|
| 2559 | self.page1 = page1 |
---|
| 2560 | wizard.SetPageSize((500,300)) |
---|
| 2561 | |
---|
| 2562 | page1.SetNext(page2) |
---|
| 2563 | |
---|
| 2564 | if wizard.RunWizard(page1): |
---|
| 2565 | for i in range(0,36): |
---|
| 2566 | FinalArgs[i] = '' |
---|
| 2567 | else: |
---|
| 2568 | wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) |
---|
| 2569 | for i in range(0,36): |
---|
| 2570 | FinalArgs[i] = '' |
---|
| 2571 | |
---|
| 2572 | #------------------------------Wizard Modules----------------------------- |
---|
| 2573 | def ReDeployWizard(self,evt): |
---|
| 2574 | wizard = wiz.Wizard(self, -1, _('msg_re_deploy'), pos = (500,200)) |
---|
| 2575 | |
---|
| 2576 | page1 = FinalPage(wizard, _('msg_done')) |
---|
| 2577 | FinalCommand.SetLabel('/opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf') |
---|
| 2578 | CommandLog.WriteText(os.popen('yes y | sudo /opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf').read()) |
---|
| 2579 | |
---|
| 2580 | self.page1 = page1 |
---|
| 2581 | wizard.SetPageSize((500,300)) |
---|
| 2582 | |
---|
| 2583 | if wizard.RunWizard(page1): |
---|
| 2584 | for i in range(0,36): |
---|
| 2585 | FinalArgs[i] = '' |
---|
| 2586 | else: |
---|
| 2587 | wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) |
---|
| 2588 | for i in range(0,36): |
---|
| 2589 | FinalArgs[i] = '' |
---|
| 2590 | |
---|
| 2591 | #------------------------------Wizard Modules----------------------------- |
---|
| 2592 | def CleanDHCPLeaseWizard(self,evt): |
---|
| 2593 | wizard = wiz.Wizard(self, -1, _('msg_clean_dhcpd_lease'), pos = (500,200)) |
---|
| 2594 | |
---|
| 2595 | page1 = FinalPage(wizard, _('msg_done')) |
---|
| 2596 | FinalCommand.SetLabel('/opt/drbl/sbin/clean-dhcpd-lease') |
---|
| 2597 | CommandLog.WriteText(os.popen('sudo /opt/drbl/sbin/clean-dhcpd-lease').read()) |
---|
| 2598 | |
---|
| 2599 | self.page1 = page1 |
---|
| 2600 | wizard.SetPageSize((500,300)) |
---|
| 2601 | |
---|
| 2602 | if wizard.RunWizard(page1): |
---|
| 2603 | for i in range(0,36): |
---|
| 2604 | FinalArgs[i] = '' |
---|
| 2605 | else: |
---|
| 2606 | wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) |
---|
| 2607 | for i in range(0,36): |
---|
| 2608 | FinalArgs[i] = '' |
---|
| 2609 | |
---|
| 2610 | #------------------------------Wizard Modules----------------------------- |
---|
| 2611 | def Regenerate3NWizard(self,evt): |
---|
| 2612 | wizard = wiz.Wizard(self, -1, _('msg_regenerate_nfs_nis_nat_config'), pos = (500,200)) |
---|
| 2613 | |
---|
| 2614 | page1 = FinalPage(wizard, _('msg_done')) |
---|
| 2615 | FinalCommand.SetLabel('/opt/drbl/sbin/drbl-3n-conf generate') |
---|
| 2616 | CommandLog.WriteText(os.popen('sudo /opt/drbl/sbin/drbl-3n-conf generate').read()) |
---|
| 2617 | |
---|
| 2618 | self.page1 = page1 |
---|
| 2619 | wizard.SetPageSize((500,300)) |
---|
| 2620 | |
---|
| 2621 | if wizard.RunWizard(page1): |
---|
| 2622 | for i in range(0,36): |
---|
| 2623 | FinalArgs[i] = '' |
---|
| 2624 | else: |
---|
| 2625 | wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) |
---|
| 2626 | for i in range(0,36): |
---|
| 2627 | FinalArgs[i] = '' |
---|
| 2628 | |
---|
| 2629 | #------------------------------------------------------------------------ |
---|
| 2630 | if __name__ == '__main__': |
---|
| 2631 | app = wx.PySimpleApp() |
---|
| 2632 | frame = MainFrame() |
---|
| 2633 | frame.Centre() |
---|
| 2634 | frame.Show() |
---|
| 2635 | app.MainLoop() |
---|
| 2636 | |
---|