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