import wx import wx.wizard as wiz import sys import os import gettext import string import subprocess import time from subprocess import Popen import commands from wx.lib.mixins.listctrl import CheckListCtrlMixin import wx.lib.filebrowsebutton as filebrowse cat = gettext.GNUTranslations(open(sys.argv[1])) _ = cat.gettext global command_log command_log = '' global FinalArgs FinalArgs = ['','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',''] #global client_pxe_cfg_filename #client_pxe_cfg_filename = '' global PXE_CFG_Files PXE_CFG_Files = [] global Labels Labels = [] #global selected_hosts, selected_clients, lenghth #---------------------------------------------------------------------- ClonezillaStartSaveArgs = { 1: ("-q", _('msg_ocs_param_q')), 2: ("-c", _('msg_ocs_param_c')), 3: ("-nogui", _('msg_ocs_param_nogui')), 4: ("-a", _('msg_ocs_param_a')), 5: ("-f", _('msg_ocs_param_f')), 6: ("-s", _('msg_ocs_param_s')), 7: ("-ntfs-ok", _('msg_ocs_param_notfs_ok')), } #---------------------------------------------------------------------- ClonezillaStartRestoreArgs = { 1: ("-g auto", _('msg_ocs_param_g_auto')), 2: ("-x", _('msg_ocs_param_x')), 3: ("-brdcst", _('msg_ocs_param_broadcast')), 4: ("-v", _('msg_ocs_param_v')), 5: ("-nogui", _('msg_ocs_param_nogui')), 6: ("-c", _('msg_ocs_param_c')), 7: ("-u", _('msg_ocs_param_u')), 8: ("-t", _('msg_ocs_param_t')), 9: ("-j0", _('msg_ocs_param_j0')), 10: ("-ns", _('msg_ocs_param_ns')), 11: ("-k", _('msg_ocs_param_k')), 12: ("-r", _('msg_ocs_param_r')), 13: ("-e", _('msg_ocs_param_e')), 14: ("-f", _('msg_ocs_param_f')), 15: ("-s", _('msg_ocs_param_s')), 16: ("-a", _('msg_ocs_param_a')), 17: ("-o", _('msg_ocs_param_o')), 18: ("-hn0", _('msg_ocs_param_hn0')), 19: ("-hn1", _('msg_ocs_param_hn1')), } #---------------------------------------------------------------------- class CSSCheckListCtrl(wx.ListCtrl, CheckListCtrlMixin): def __init__(self, parent, log): wx.ListCtrl.__init__(self, parent, -1, style=wx.LC_REPORT) CheckListCtrlMixin.__init__(self) self.log = log self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) def OnItemActivated(self, evt): self.ToggleItem(evt.m_itemIndex) # this is called by the base class when an item is checked/unchecked def OnCheckItem(self, index, flag): data = self.GetItemData(index) arg = ClonezillaStartSaveArgs[data][0] if flag: FinalArgs[index+3] = arg else: FinalArgs[index+3] = '' #---------------------------------------------------------------------- class CSRCheckListCtrl(wx.ListCtrl, CheckListCtrlMixin): def __init__(self, parent, log): wx.ListCtrl.__init__(self, parent, -1, style=wx.LC_REPORT) CheckListCtrlMixin.__init__(self) self.log = log self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) def OnItemActivated(self, evt): self.ToggleItem(evt.m_itemIndex) # this is called by the base class when an item is checked/unchecked def OnCheckItem(self, index, flag): data = self.GetItemData(index) arg = ClonezillaStartRestoreArgs[data][0] if flag: if index == 18: FinalArgs[index+4] = arg else: FinalArgs[index+3] = arg else: if index == 18: FinalArgs[index+4] = '' else: FinalArgs[index+3] = '' #---------------------------------------------------------------------- def makePageTitle(wizPg, title): sizer = wx.BoxSizer(wx.VERTICAL) wizPg.SetSizer(sizer) title = wx.StaticText(wizPg, -1, title) title.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD)) sizer.Add(title, 0, wx.ALIGN_CENTRE|wx.ALL, 5) sizer.Add(wx.StaticLine(wizPg, -1), 0, wx.EXPAND|wx.ALL, 5) return sizer #---------------------------------------------------------------------- class WizardBasePage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): return self.next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class SetAllClientsPage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) self.cb = wx.CheckBox(self, -1, _('msg_title_set_all_clients')) self.cb.SetValue(True) self.sizer.Add(self.cb, 0, wx.ALL, 5) FinalArgs[1] = '-nl' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): next = self.next if self.cb.GetValue(): FinalArgs[1] = '-nl' next = next.GetNext() else: FinalArgs[1] = '-h' return next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class SelectOneClientPage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) self.selected_hosts = [] self.selected_clients = '' self.lenghth = 0 self.filename_temp = [] file = open("/home/chris/ip_list", "r") ip_list = file.read() tokens = ("%s" % ip_list).split() self.lenghth = len(tokens) for i in range(0,len(tokens)): self.selected_hosts.insert(len(tokens),"") i = i+1 file.close() rb = wx.RadioBox( self, -1, _('msg_choose_mode'), (35, 50), (260,590), tokens, 1, wx.RA_SPECIFY_COLS ) self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) FinalArgs[1] = '-h' FinalArgs[2] = "\"" + tokens[0] + "\"" def EvtRadioBox(self, event): FinalArgs[2] = "" FinalArgs[2] = "\"" + event.GetString() + "\"" def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): next = self.next return next def GetPrev(self): FinalArgs[1] = "" FinalArgs[2] = "" return self.prev #---------------------------------------------------------------------- class SelectClientsPage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) self.selected_hosts = [] self.selected_clients = '' self.lenghth = 0 self.filename_temp = [] g = open("/home/chris/ip_list", "r") ip_list = g.read() tokens = ("%s" % ip_list).split() self.lenghth = len(tokens) for i in range(0,len(tokens)): self.selected_hosts.insert(len(tokens),"") i = i+1 g.close() lb = wx.CheckListBox(self, -1, (35,50), (290,250), tokens) self.Bind(wx.EVT_CHECKLISTBOX, self.EvtCheckListBox, lb) lb.SetSelection(0) counts = lb.GetCount() self.lb = lb pos = lb.GetPosition().x + lb.GetSize().width + 25 def EvtCheckListBox(self, event): j = 0 index = event.GetSelection() label = self.lb.GetString(index) if self.lb.IsChecked(index): del self.selected_hosts[index] self.selected_hosts.insert(index,label) if not (self.lb.IsChecked(index)): self.selected_hosts.remove(label) self.selected_hosts.insert(index,'') self.lb.SetSelection(index) #so that (un)checking also selects (moves the highlight) self.selected_clients = '' clients_pxe_cfg_filename = '' self.filename_temp = [] while j < self.lenghth: if self.selected_hosts[j] != '': self.selected_clients = self.selected_clients + self.selected_hosts[j] + ' ' ip = self.selected_hosts[j] ip_divide = ("%s" % ip).split(".") clients_pxe_cfg_filename = string.upper("%x" % int(ip_divide[0],10) + "%x" % int(ip_divide[1],10) + "%x" % int(ip_divide[2],10) + "%x" % int(ip_divide[3],10)) self.filename_temp.append(clients_pxe_cfg_filename) j = j+1 self.selected_clients = '\"' + self.selected_clients + '\"' FinalArgs[2] = self.selected_clients def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): global PXE_CFG_Files if self.selected_clients == '\"\"' or self.selected_clients == '': FinalArgs[1] = '-nl' FinalArgs[2] = '' else: FinalArgs[1] = '-h' PXE_CFG_Files[:] = self.filename_temp[:] return self.next def GetPrev(self): self.selected_clients = '' clients_pxe_cfg_filename = '' self.filename_temp = [] return self.prev #---------------------------------------------------------------------- class RemoteLinuxGraPage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self, -1, _('msg_remote_linux_graphic'),(50,100)) FinalArgs[0] = '/opt/drbl/sbin/dcs' FinalArgs[3] = 'remote-linux-gra' self.j = 0 self.command = '' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): global command_log self.j = self.j + 1 for i in range(0,36): if FinalArgs[i] != '' and self.j == 2: self.command = self.command + FinalArgs[i] + ' ' if self.j == 2: command_log = os.popen('sudo %s' % self.command).read() return self.next def GetPrev(self): prev = self.prev prev = prev.GetPrev() return prev #---------------------------------------------------------------------- class RemoteLinuxTxtPage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self, -1, _('msg_remote_linux_text'),(50,100)) FinalArgs[0] = '/opt/drbl/sbin/dcs' FinalArgs[3] = 'remote-linux-txt' self.j = 0 self.command = '' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): global command_log self.j = self.j + 1 for i in range(0,36): if FinalArgs[i] != '' and self.j == 2: self.command = self.command + FinalArgs[i] + ' ' if self.j == 2: command_log = os.popen('sudo %s' % self.command).read() return self.next def GetPrev(self): prev = self.prev prev = prev.GetPrev() return prev #---------------------------------------------------------------------- class TerminalPage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self, -1, _('msg_thin_client'),(50,100)) FinalArgs[0] = '/opt/drbl/sbin/dcs' FinalArgs[3] = 'terminal' self.j = 0 self.command = '' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): global command_log self.j = self.j + 1 for i in range(0,36): if FinalArgs[i] != '' and self.j == 2: self.command = self.command + FinalArgs[i] + ' ' if self.j == 2: command_log = os.popen('sudo %s' % self.command).read() return self.next def GetPrev(self): prev = self.prev prev = prev.GetPrev() return prev #---------------------------------------------------------------------- class RemoteMemTestPage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self, -1, _('msg_remote_memtest'),(50,100)) FinalArgs[0] = '/opt/drbl/sbin/dcs' FinalArgs[3] = 'remote-memtest' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): global command_log self.j = self.j + 1 for i in range(0,36): if FinalArgs[i] != '' and self.j == 2: self.command = self.command + FinalArgs[i] + ' ' if self.j == 2: command_log = os.popen('sudo %s' % self.command).read() return self.next def GetPrev(self): prev = self.prev prev = prev.GetPrev() return prev #---------------------------------------------------------------------- class RemotefdosPage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self, -1, _('msg_remote_fdos'),(50,100)) FinalArgs[0] = '/opt/drbl/sbin/dcs' FinalArgs[3] = 'remote-fdos' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): global command_log self.j = self.j + 1 for i in range(0,36): if FinalArgs[i] != '' and self.j == 2: self.command = self.command + FinalArgs[i] + ' ' if self.j == 2: command_log = os.popen('sudo %s' % self.command).read() return self.next def GetPrev(self): prev = self.prev prev = prev.GetPrev() return prev #---------------------------------------------------------------------- class ClonezillaStartSavePage1(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) ModeList = [_('msg_clonezilla_save_disk'), _('msg_clonezilla_save_parts')] rb = wx.RadioBox( self, -1, _('msg_choose_mode'), (35, 50), (260,90), ModeList, 1, wx.RA_SPECIFY_COLS ) self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) FinalArgs[0] = '/opt/drbl/sbin/drbl-ocs -b' FinalArgs[12] = 'startdisk' FinalArgs[13] = 'save' def EvtRadioBox(self, event): if event.GetInt() == 0: FinalArgs[12] = 'startdisk' FinalArgs[13] = 'save' if event.GetInt() == 1: FinalArgs[12] = 'startpart' FinalArgs[13] = 'save' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): return self.next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class ClonezillaStartSavePage2(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self,-1,_('msg_ask_if_input_save_image_name_in_server'),wx.DLG_PNT(self, 5, 20),wx.DLG_SZE(self, 210, 300),wx.TE_MULTILINE) self.cb = wx.CheckBox(self, -1, 'YES',(20,130)) # not translated self.cb.SetValue(True) def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): next = self.next if not self.cb.GetValue(): next = next.GetNext() return next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class ClonezillaStartSavePage3(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self, -1, _('msg_input_image_name'), (10, 160)) self.text_img = wx.TextCtrl(self, -1, '', (10, 180), size=(200, -1)) wx.StaticText(self, -1, _('msg_input_device_name'), (10, 210)) self.text_dev = wx.TextCtrl(self, -1, '', (10, 230), size=(190, -1)) def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): FinalArgs[14] = self.text_img.GetValue() FinalArgs[15] = self.text_dev.GetValue() return self.next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class ClonezillaStartSavePage4(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) self.list = CSSCheckListCtrl(self, title) sizer = wx.BoxSizer() sizer.Add(self.list, 1, wx.EXPAND) self.SetSizer(sizer) self.list.InsertColumn(0, _('argument')) #not translated self.list.InsertColumn(1, _('meannings'), wx.LIST_FORMAT_LEFT) #not translated for key, data in ClonezillaStartSaveArgs.iteritems(): index = self.list.InsertStringItem(sys.maxint, data[0]) self.list.SetStringItem(index, 1, data[1]) self.list.SetItemData(index, key) self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE) self.list.SetColumnWidth(1, wx.LIST_AUTOSIZE) self.list.CheckItem(0) self.list.CheckItem(1) def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): next = self.next if self.list.IsChecked(0) == self.list.IsChecked(1) == self.list.IsChecked(2) == self.list.IsChecked(3) == self.list.IsChecked(4) == self.list.IsChecked(5) == 0: next = 0 return next def GetPrev(self): prev = self.prev prev = prev.GetPrev() return prev #---------------------------------------------------------------------- class ClonezillaStartSavePage5(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) ArgList = [_('msg_ocs_param_p_choose'), _('msg_ocs_param_p_true'), _('msg_ocs_param_p_poweroff'), _('msg_ocs_param_p_reboot')] rb = wx.RadioBox( self, -1, _('msg_choose_post_mode_after_clone'), (35,50), (290,150), ArgList, 1, wx.RA_SPECIFY_COLS ) self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) rb.SetSelection(3) FinalArgs[9] = '-p reboot' def EvtRadioBox(self, event): if event.GetSelection() == 0: FinalArgs[9] = '-p choose' if event.GetSelection() == 1: FinalArgs[9] = '-p true' if event.GetSelection() == 2: FinalArgs[9] = '-p poweroff' if event.GetSelection() == 3: FinalArgs[9] = '-p reboot' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): return self.next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class ClonezillaStartSavePage6(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) ArgList = [ _('msg_ocs_param_z0'), _('msg_ocs_param_z1'), _('msg_ocs_param_z2'), _('msg_ocs_param_z3')] rb = wx.RadioBox(self, -1, _('msg_choose_post_mode_after_clone'), (35,50), (340,150), ArgList, 1, wx.RA_SPECIFY_COLS) self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) rb.SetSelection(3) FinalArgs[10] = '-z3' self.j = 0 self.command = '' def EvtRadioBox(self, event): if event.GetSelection() == 0: FinalArgs[10] = '-z0' if event.GetSelection() == 1: FinalArgs[10] = '-z1' if event.GetSelection() == 2: FinalArgs[10] = '-z2' if event.GetSelection() == 3: FinalArgs[10] = '-z3' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): global command_log self.j = self.j + 1 if FinalArgs[1] == '-nl': FinalArgs[1] = '' if self.j == 2: for i in range(0,36): if FinalArgs[i] != '': self.command = self.command + FinalArgs[i] + ' ' #print 'popen starts' #fo = os.popen('sudo %s' % self.command) #print '3 seconds..' #time.sleep(3) #print ('this is fo: %s' % fo) #command_log = command_log + fo.readline() #------------------------------------------------------------------------------------------------------------------------- #test = Popen(['sudo', '%s'.strip() % self.command], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) #time.sleep(5) #print self.command #print test.stdout.read() #while : #time.sleep(1) #print test.readline() #------------------------------------------------------- file = open('tmp.log','w') os.system('sudo %s > tmp.log' % self.command) time.sleep(6) file.close() file = open('tmp.log') while True: line = file.readline() if len(line) == 0: # Zero length indicates EOF break command_log = command_log + line file.close() os.remove('tmp.log') return self.next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class ClonezillaStartRestorePage1(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) ModeList = [_('msg_clonezilla_restore_disk'), _('msg_clonezilla_restore_parts')] rb = wx.RadioBox(self, -1, _('msg_choose_mode'), (35, 50), (260,90), ModeList, 1, wx.RA_SPECIFY_COLS) self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) FinalArgs[0] = '/opt/drbl/sbin/drbl-ocs -b' FinalArgs[32] = 'startdisk' def EvtRadioBox(self, event): if event.GetInt() == 0: FinalArgs[32] = 'startdisk' if event.GetInt() == 1: FinalArgs[32] = 'startpart' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): return self.next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class ClonezillaStartRestorePage2(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) self.list = CSRCheckListCtrl(self, title) sizer = wx.BoxSizer() sizer.Add(self.list, 1, wx.EXPAND) self.SetSizer(sizer) self.list.InsertColumn(0, _('argument')) #not translated self.list.InsertColumn(1, _('meannings'), wx.LIST_FORMAT_LEFT) #not translated for key, data in ClonezillaStartRestoreArgs.iteritems(): index = self.list.InsertStringItem(sys.maxint, data[0]) self.list.SetStringItem(index, 1, data[1]) self.list.SetItemData(index, key) self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE) self.list.SetColumnWidth(1, wx.LIST_AUTOSIZE) self.list.CheckItem(0) self.list.CheckItem(1) def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): j = 0 check_sum = 0 next = self.next for j in range(0,18): check_sum = check_sum + self.list.IsChecked(j) if check_sum == 0: # if user didn't check any box, then return NULL. next = 0 if (self.list.IsChecked(17) or self.list.IsChecked(18)): next = self.next else: next = next.GetNext() next = next.GetNext() return next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class ClonezillaStartRestorePage3(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self,-1,_('msg_write_MS_WIN_is_necessary'),wx.DLG_PNT(self, 5, 20),wx.DLG_SZE(self, 210, 300),wx.TE_MULTILINE) def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): return self.next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class ClonezillaStartRestorePage4(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self, -1, _('msg_What_the_win_hostname_prefix'), (5, 80)) self.text = wx.TextCtrl(self, -1, "PC", (5, 110), size=(200, -1)) def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): if FinalArgs[20] == '-hn0' and FinalArgs[22] == '-hn1': FinalArgs[21] = FinalArgs[23] = self.text.GetValue() elif FinalArgs[20] == '-hn0'and FinalArgs[22] != '-hn1': FinalArgs[21] = self.text.GetValue() elif FinalArgs[22] == '-hn1' and FinalArgs[20] != '-hn0': FinalArgs[23] = self.text.GetValue() elif FinalArgs[20] != '-hn0' and FinalArgs[22] != '-hn1': FinalArgs[21] = FinalArgs[23] = '' return self.next def GetPrev(self): prev = self.prev return prev #---------------------------------------------------------------------- class ClonezillaStartRestorePage5(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) ModeList = [_('msg_ocs_param_y0'), _('msg_ocs_param_y1'), _('msg_ocs_param_y2'), _('msg_ocs_param_skip')] wx.StaticText(self,-1,_('msg_if_always_provide_clonezilla_srv'),wx.DLG_PNT(self, 5, 20),wx.DLG_SZE(self, 210, 300),wx.TE_MULTILINE) rb = wx.RadioBox(self, -1, '', (5,150), wx.DefaultSize, ModeList, 1, wx.RA_SPECIFY_COLS) self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) rb.SetSelection(3) def EvtRadioBox(self, event): if event.GetInt() == 0: FinalArgs[24] = '-y0' elif event.GetInt() == 1: FinalArgs[24] = '-y1' elif event.GetInt() == 2: FinalArgs[24] = '-y2' elif event.GetInt() == 3: FinalArgs[24] = '' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): return self.next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class ClonezillaStartRestorePage6(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) ArgList = [_('msg_ocs_param_p_choose'), _('msg_ocs_param_p_true'), _('msg_ocs_param_p_poweroff'), _('msg_ocs_param_p_reboot')] rb = wx.RadioBox(self, -1, _('msg_choose_post_mode_after_clone'), (35,50), (290,150), ArgList, 1, wx.RA_SPECIFY_COLS) self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) rb.SetSelection(3) FinalArgs[25] = '-p reboot' def EvtRadioBox(self, event): if event.GetSelection() == 0: FinalArgs[25] = '-p choose' if event.GetSelection() == 1: FinalArgs[25] = '-p true' if event.GetSelection() == 2: FinalArgs[25] = '-p poweroff' if event.GetSelection() == 3: FinalArgs[25] = '-p reboot' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): next = self.next if FinalArgs[32] == 'startpart' and FinalArgs[9] == '-u': next = next.GetNext() elif FinalArgs[9] == '-u': next = next.GetNext() next = next.GetNext() return next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class ClonezillaStartRestorePage7(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self, -1, _('msg_choose_the_image_to_restore'), (5,80)) self.fbb = filebrowse.FileBrowseButton(self, -1, pos=(50,150), size=(350, -1), buttonText='browse', toolTip='Type filename or click browse to choose file', fileMask='*.img', changeCallback = self.fbbCallback) def fbbCallback(self, evt): FinalArgs[34] = evt.GetString() def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): next = self.next if FinalArgs[32] == 'startpart': next = next.GetNext() elif FinalArgs[32] == 'startdisk': next = self.next return next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class ClonezillaStartRestorePage8a(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self, -1, _('msg_choose_the_disks_to_restore'), (5,80)) self.text = wx.TextCtrl(self, -1, "hda", (5, 110), size=(200, -1)) def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): next = self.next if FinalArgs[9] == '-u': FinalArgs[35] = '' next = next.GetNext() elif FinalArgs[9] == '' and FinalArgs[32] == 'startdisk': FinalArgs[35] = self.text.GetValue() next = next.GetNext() elif FinalArgs[9] == '' and FinalArgs[32] == 'startpart': next = self.next return next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class ClonezillaStartRestorePage8b(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self, -1, _('msg_choose_the_parts_to_restore'), (5,80)) self.text = wx.TextCtrl(self, -1, "hda", (5, 110), size=(200, -1)) def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): next = self.next if FinalArgs[9] == '-u': FinalArgs[35] = '' next = next.GetNext() elif FinalArgs[9] == '' and FinalArgs[32] == 'startdisk': next = self.next elif FinalArgs[9] == '' and FinalArgs[32] == 'startpart': FinalArgs[35] = self.text.GetValue() next = next.GetNext() return next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class ClonezillaStartRestorePage9a(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) ModeList = [_('msg_multicast_restore'), _('msg_unicast_restore')] rb = wx.RadioBox(self, -1, _('msg_choose_the_mode_to_restore_disk'), (35,50), (290,150), ModeList, 1, wx.RA_SPECIFY_COLS) self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) FinalArgs[33] = 'multicast_restore' def EvtRadioBox(self, event): if event.GetInt() == 0: FinalArgs[33] = 'multicast_restore' if event.GetInt() == 1: FinalArgs[33] = 'restore' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): next = self.next if FinalArgs[9] == '-u': FinalArgs[33] = 'restore' next = next.GetNext() next = next.GetNext() elif FinalArgs[9]=='' and FinalArgs[32] == 'startpart': next = self.next elif FinalArgs[9]=='' and FinalArgs[32] == 'startdisk' and FinalArgs[33] == 'restore': next = next.GetNext() next = next.GetNext() next = next.GetNext() elif FinalArgs[9]=='' and FinalArgs[32] == 'startdisk' and FinalArgs[33] == 'multicast_restore': next = next.GetNext() return next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class ClonezillaStartRestorePage9b(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) ModeList = [_('msg_multicast_restore'), _('msg_unicast_restore')] rb = wx.RadioBox(self, -1, _('msg_choose_the_mode_to_restore_parts'), (35,50), (290,150), ModeList, 1, wx.RA_SPECIFY_COLS) self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) FinalArgs[33] = 'multicast_restore' def EvtRadioBox(self, event): if event.GetInt() == 0: FinalArgs[33] = 'multicast_restore' if event.GetInt() == 1: FinalArgs[33] = 'restore' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): next = self.next if FinalArgs[9] == '-u': FinalArgs[33] = 'restore' next = next.GetNext() #next = next.GetNext() #next = next.GetNext() elif FinalArgs[9] =='' and FinalArgs[32] == 'startdisk': next = self.next elif FinalArgs[9] =='' and FinalArgs[32] == 'startpart' and FinalArgs[33] == 'restore': next = next.GetNext() next = next.GetNext() elif FinalArgs[9] =='' and FinalArgs[32] == 'startpart' and FinalArgs[33] == 'multicast_restore': next = self.next return next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class ClonezillaStartRestorePage10(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) ModeList = [_('msg_clients_time_to_wait'), _('msg_time_to_wait'), _('msg_clients_to_wait')] rb = wx.RadioBox(self, -1, _('msg_choose_mode'), (35,50), (350, 150), ModeList, 1, wx.RA_SPECIFY_COLS) self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) FinalArgs[26] = '--clients-to-wait' FinalArgs[28] = '--max-time-to-wait' def EvtRadioBox(self, event): if event.GetInt() == 0: FinalArgs[26] = '--clients-to-wait' FinalArgs[28] = '--max-time-to-wait' elif event.GetInt() == 1: FinalArgs[26] = '' FinalArgs[28] = '--max-time-to-wait' elif event.GetInt() == 2: FinalArgs[26] = '--clients-to-wait' FinalArgs[28] = '' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): next = self.next if FinalArgs[33] == 'restore': FinalArgs[26] = '' FinalArgs[28] = '' next = self.next if FinalArgs[26] == '' and FinalArgs[28] != '': next = next.GetNext() return next def GetPrev(self): prev = self.prev if FinalArgs[32] == 'startdisk': prev = prev.GetPrev() prev = prev.GetPrev() elif FinalArgs[32] == 'startpart': prev = self.prev return prev #---------------------------------------------------------------------- class ClonezillaStartRestorePage11(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self, -1, _('msg_how_many_clients_to_restore'), (20, 80)) self.text = wx.TextCtrl(self, -1, '5', (20, 110), size=(200, -1)) def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): next = self.next if FinalArgs[26] != '': FinalArgs[27] = self.text.GetValue() next = self.next if FinalArgs[28] == '': next = next.GetNext() return next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class ClonezillaStartRestorePage12(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) self.j = 0 self.command = '' wx.StaticText(self, -1, _('msg_max_time_to_wait_sec'), (20, 80)) self.text = wx.TextCtrl(self, -1, "300", (20, 110), size=(200, -1)) def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): if FinalArgs[28] != '': FinalArgs[29] = self.text.GetValue() global command_log self.j = self.j + 1 if FinalArgs[1] == '-nl': FinalArgs[1] = '' if self.j == 2: for i in range(0,36): if FinalArgs[i] != '': self.command = self.command + FinalArgs[i] + ' ' file = open('tmp.log','w') os.system('sudo %s > tmp.log' % self.command) time.sleep(6) file.close() file = open('tmp.log') while True: line = file.readline() if len(line) == 0: # Zero length indicates EOF break command_log = command_log + line file.close() os.remove('tmp.log') return self.next def GetPrev(self): return self.prev #---------------------------------------------------------------------- #class ClonezillaStartRestorePage13(wiz.PyWizardPage): #def __init__(self, parent, title): #wiz.PyWizardPage.__init__(self, parent) #self.next = self.prev = None #self.sizer = makePageTitle(self, title) #def SetNext(self, next): #self.next = next #def SetPrev(self, prev): #self.prev = prev #def GetNext(self): #return self.next #def GetPrev(self): #return self.prev #---------------------------------------------------------------------- class ClonezillaSelectPage1(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) ModeList = [_('msg_ocs_param_y0'), _('msg_ocs_param_y1'), _('msg_ocs_param_y2'), _('msg_ocs_param_skip')] wx.StaticText(self,-1,_('msg_if_always_provide_clonezilla_srv'),wx.DLG_PNT(self, 5, 20),wx.DLG_SZE(self, 210, 300),wx.TE_MULTILINE) rb = wx.RadioBox(self, -1, '', (5,100), wx.DefaultSize, ModeList, 1, wx.RA_SPECIFY_COLS) self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) rb.SetSelection(1) FinalArgs[0] = '/opt/drbl/sbin/drbl-ocs -b' FinalArgs[5] = '-y1' def EvtRadioBox(self, event): if event.GetInt() == 0: FinalArgs[5] = '-y0' elif event.GetInt() == 1: FinalArgs[5] = '-y1' elif event.GetInt() == 2: FinalArgs[5] = '-y2' elif event.GetInt() == 3: FinalArgs[5] = '' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): return self.next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class ClonezillaSelectPage2(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) ArgList = [_('msg_ocs_param_p_choose'), _('msg_ocs_param_p_true'), _('msg_ocs_param_p_poweroff'), _('msg_ocs_param_p_reboot')] rb = wx.RadioBox(self, -1, _('msg_choose_post_mode_after_clone'), (35,50), (290,150), ArgList, 1, wx.RA_SPECIFY_COLS) self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) rb.SetSelection(0) self.j = 0 self.command = '' FinalArgs[6] = '-p choose' def EvtRadioBox(self, event): if event.GetSelection() == 0: FinalArgs[6] = '-p choose' if event.GetSelection() == 1: FinalArgs[6] = '-p true' if event.GetSelection() == 2: FinalArgs[6] = '-p poweroff' if event.GetSelection() == 3: FinalArgs[6] = '-p reboot' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): FinalArgs[7] = 'select_in_client' global command_log self.j = self.j + 1 for i in range(0,36): if FinalArgs[i] != '' and self.j == 2: self.command = self.command + FinalArgs[i] + ' ' if self.j == 2: command_log = os.popen('sudo %s' % self.command).read() return self.next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class ClonezillaStopPage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self, -1, _('msg_clonezilla_stop'),(50,100)) self.j = 0 self.command = '' FinalArgs[0] = '/opt/drbl/sbin/dcs' FinalArgs[3] = 'clonezilla-stop' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): global command_log self.j = self.j + 1 for i in range(0,36): if FinalArgs[i] != '' and self.j == 2: self.command = self.command + FinalArgs[i] + ' ' if self.j == 2: command_log = os.popen('sudo %s' % self.command).read() return self.next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class LocalPage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self, -1, _('msg_local'),(50,100)) self.command = '' self.j = 0 FinalArgs[0] = '/opt/drbl/sbin/dcs' FinalArgs[3] = 'local' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): global command_log self.j = self.j + 1 for i in range(0,36): if FinalArgs[i] != '' and self.j == 2: self.command = self.command + FinalArgs[i] + ' ' if self.j == 2: command_log = os.popen('sudo %s' % self.command).read() return self.next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class RebootPage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self, -1, _('msg_reboot'),(50,100)) self.command = '' self.j = 0 FinalArgs[0] = '/opt/drbl/sbin/dcs' FinalArgs[3] = 'reboot' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): global command_log self.j = self.j + 1 for i in range(0,36): if FinalArgs[i] != '' and self.j == 2: self.command = self.command + FinalArgs[i] + ' ' if self.j == 2: command_log = os.popen('sudo %s' % self.command).read() return self.next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class ShutdownPage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self, -1, _('msg_shutdown'),(50,100)) self.command = '' self.j = 0 FinalArgs[0] = '/opt/drbl/sbin/dcs' FinalArgs[3] = 'shutdown' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): global command_log self.j = self.j + 1 for i in range(0,36): if FinalArgs[i] != '' and self.j == 2: self.command = self.command + FinalArgs[i] + ' ' if self.j == 2: command_log = os.popen('sudo %s' % self.command).read() return self.next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class WakeOnLanPage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self, -1, _('msg_Wake_on_LAN'), (50,100)) self.command = 0 self.j = 0 FinalArgs[0] = '/opt/drbl/sbin/dcs' FinalArgs[3] = 'Wake-on-LAN' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): global command_log self.j = self.j + 1 for i in range(0,36): if FinalArgs[i] != '' and self.j == 2: self.command = self.command + FinalArgs[i] + ' ' if self.j == 2: command_log = os.popen('sudo %s' % self.command).read() return self.next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class SwitchPXEMenuPage1(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) ModeList = [_('msg_hide_pxe_menus'), _('msg_reveal_pxe_menus'), _('msg_setdefault_pxe_menu')] rb = wx.RadioBox(self, -1, _('msg_choose_the_action'), (35, 50), (260,90), ModeList, 1, wx.RA_SPECIFY_COLS) self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) self.command = '' self.j = 0 FinalArgs[0] = '/opt/drbl/bin/hide_reveal_pxe_img' FinalArgs[3] = 'hide' def EvtRadioBox(self, event): if event.GetInt() == 0: FinalArgs[0] = '/opt/drbl/bin/hide_reveal_pxe_img' FinalArgs[3] = 'hide' elif event.GetInt() == 1: FinalArgs[0] = '/opt/drbl/bin/hide_reveal_pxe_img' FinalArgs[3] = 'reveal' elif event.GetInt() == 2: FinalArgs[0] = '/opt/drbl/sbin/set-default-pxe-img' FinalArgs[3] = '-i' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): global Labels index = 0 next = self.next self.j = self.j + 1 if self.j == 2: if FinalArgs[3] == 'hide': file = open('/tftpboot/nbi_img/pxelinux.cfg/default') content = file.read() for word in content.split(): if word == 'label': if content.split()[index + 4] != '#': Labels.append(content.split()[index + 1]) index = index + 1 print Labels[:] file.close() elif FinalArgs[3] == 'reveal': file = open('/tftpboot/nbi_img/pxelinux.cfg/default') content = file.read() for word in content.split(): if word == 'label': if content.split()[index + 4] == '#': Labels.append(content.split()[index + 1]) index = index + 1 file.close() elif FinalArgs[3] == '-i': file = open('/tftpboot/nbi_img/pxelinux.cfg/default') content = file.read() for word in content.split(): if word == 'label': if content.split()[index + 2] == 'MENU' and content.split()[index + 3] == 'DEFAULT': Labels.append(content.split()[index + 1]) index = index + 1 file.close() next = next.GetNext() return next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class SwitchPXEMenuPage2(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) self.j = 0 b = wx.Button(self, -1, "Choose The Labels You Want To Hide/Reveal (MultiChoices)", (50,50)) self.Bind(wx.EVT_BUTTON, self.OnButton, b) def OnButton(self, evt): global Labels dlg = wx.MultiChoiceDialog(self, _('msg_hide_reveal'), 'Lables:', Labels) if (dlg.ShowModal() == wx.ID_OK): selections = dlg.GetSelections() self.selected_labels = [Labels[x] for x in selections] #self.log.write("Selections: %s -> %s\n" % (selections, strings)) dlg.Destroy() def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): global command_log next = self.next self.j = self.j + 1 if self.j == 2: if FinalArgs[1] == '' and FinalArgs[3] != '-i': for i in range(0,len(self.selected_labels)): os.system('/opt/drbl/sbin/hide_reveal_pxe_img %s %s /tftpboot/nbi_img/pxelinux.cfg/default' % (self.selected_labels, FinalArgs[3])) command_log = '%s ' % FinalArgs[3] + '%s ' % self.selected_labels + 'in /tftpboot/nbi_img/pxelinux.cfg/default\n' file = open('/tftpboot/nbi_img/pxelinux.cfg/clients_tmp').read() if len(file.split()) != 0: for i in (0,len(file.split())): os.system('rm -f %s' % file.split()) file.close() command_log = 'clean all clients specific PXE config files\n' next = next.GetNext() if FinalArgs[1] == '-h' and FinalArgs != '-i': for i in range(0,len(PXE_CFG_Files)): os.system('cp /tftpboot/nbi_img/pxelinux.cfg/default /tftpboot/nbi_img/pxelinux.cfg/%s' % PXE_CFG_Files) for i in range(0,len(self.selected_labels)): os.system('/opt/drbl/sbin/hide_reveal_pxe_img %s %s /tftpboot/nbi_img/pxelinux.cfg/%s' % (self.selected_labels, FinalArgs[3], PXE_CFG_Files)) command_log = '%s Label : %s in /tftpboot/nbi_img/pxelinux.cfg/%s\n' % (FinalArgs[3], self.selected_labels, PXE_CFG_Files) file = open('/tftpboot/nbi_img/pxelinux.cfg/clients_tmp','w') if PXE_CFG_Files not in client_temp.read().split(): file.write('%s ' % PXE_CFG_Files) file.close next = next.GetNext() #if FinalArgs[3] == '-i': #for #next = next.GetNext() return next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class SwitchPXEMenuPage3(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) self.j = 0 b = wx.Button(self, -1, "Choose The Labels You Want To Set as Default (Single Choice)", (50,50)) self.Bind(wx.EVT_BUTTON, self.OnButton, b) def OnButton(self, evt): global Labels dlg = wx.SingleChoiceDialog(self, _('msg_setdefault_title'), "Lables:", Labels, wx.CHOICEDLG_STYLE) if dlg.ShowModal() == wx.ID_OK: self.selected_label = dlg.GetStringSelection() #self.log.WriteText('You selected: %s\n' % dlg.GetStringSelection()) dlg.Destroy() def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): global command_log self.j = self.j + 1 if self.j == 2: if FinalArgs[1] == '' and FinalArgs[3] == '-i': command = os.open('/opt/drbl/sbin/set-default-pxe-img -i %s' % self.selected_label).read() command_log = command_log + command if FinalArgs[1] == '-h' and FinalArgs[3] == '-i': os.system('/opt/drbl/sbin/set-default-pxe-img -i %s' % self.selected_label) for i in range(0,len(PXE_CFG_Files)): os.system('cp /tftpboot/nbi_img/pxelinux.cfg/default /tftpboot/nbi_img/pxelinux.cfg/default/%s' % PXE_CFG_Files) command_log = command_log + 'Copy /tftpboot/nbi_img/pxelinux.cfg/default /tftpboot/nbi_img/pxelinux.cfg/default/%s' % PXE_CFG_Files return self.next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class SwitchPXEMenuPage4(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) self.tc = wx.TextCtrl(self, -1,'', pos=(35,50), size=(350, 250), style=wx.TE_MULTILINE|wx.TE_READONLY) global command_log self.b1 = wx.Button(self, -1, 'detail', pos=(400,250)) self.b2 = wx.Button(self, -1, 'command..', pos=(400,200)) self.Bind(wx.EVT_BUTTON, self.OnButtonDetail, self.b1) self.Bind(wx.EVT_BUTTON, self.OnButtonCommand, self.b2) def OnButtonDetail(self, evt): self.tc.WriteText('%s' % command_log) self.b1.Enable(False) def OnButtonCommand(self, evt): final_command = '' for i in range(0,36): if FinalArgs[i] != '': final_command = final_command + FinalArgs[i] + ' ' self.tc.WriteText('%s' % final_command) self.b2.Enable(False) def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev #---------------------------------------------------------------------- class DRBLModePage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) ModeList = [_('msg_drbl_mode_0'), _('msg_drbl_mode_1'), _('msg_drbl_mode_2')] wx.StaticText(self,-1,_('msg_drbl_mode_switch_long'),wx.DLG_PNT(self, 5, 20),wx.DLG_SZE(self, 210, 300),wx.TE_MULTILINE) rb = wx.RadioBox(self, -1, '', (5,305), wx.DefaultSize, ModeList, 1, wx.RA_SPECIFY_COLS) self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) FinalArgs[0] = '/opt/drbl/sbin/tune-clientdir-opt' FinalArgs[1] = '-d' FinalArgs[2] = '0' def EvtRadioBox(self, event): if event.GetInt() == 0: FinalArgs[2] = '0' elif event.GetInt() == 1: FinalArgs[2] = '1' elif event.GetInt() == 2: FinalArgs[2] = '2' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): return self.next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class ClonezillaModePage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) ModeList = [_('msg_clonezilla_mode_0'), _('msg_clonezilla_mode_1'), _('msg_clonezilla_mode_2')] wx.StaticText(self,-1,_('msg_clonezilla_mode_switch_long'),wx.DLG_PNT(self, 5, 20),wx.DLG_SZE(self, 210, 200),wx.TE_MULTILINE) rb = wx.RadioBox(self, -1, '', (5,205), wx.DefaultSize, ModeList, 1, wx.RA_SPECIFY_COLS) self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) FinalArgs[0] = '/opt/drbl/sbin/tune-clientdir-opt' FinalArgs[1] = '-z' FinalArgs[2] = '0' def EvtRadioBox(self, event): if event.GetInt() == 0: FinalArgs[2] = '0' elif event.GetInt() == 1: FinalArgs[2] = '1' elif event.GetInt() == 2: FinalArgs[2] = '2' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): return self.next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class GenTemplateFilePage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self, -1, _('msg_gen_template_files'),(50,100)) FinalArgs[0] = '/opt/drbl/sbin/gen_ssi_files' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): return self.next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class LoginSwitchPage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) ModeList = [_('msg_normal_login'), _('msg_auto_login'), _('msg_timed_login')] wx.StaticText(self, -1, _('msg_login_switch'),(50,35)) rb = wx.RadioBox(self, -1, _('msg_choose_action'), (35, 50), (250,200), ModeList, 1, wx.RA_SPECIFY_COLS) self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) FinalArgs[0] = '/opt/drbl/sbin/drbl-login-switch' FinalArgs[3] = '-n' def EvtRadioBox(self, event): if event.GetInt() == 0: FinalArgs[3] = '-n' FinalArgs[4] = '' FinalArgs[5] = '' elif event.GetInt() == 1: FinalArgs[0] = '/opt/drbl/sbin/drbl-client-switch' FinalArgs[3] = 'remote-linux-gra' FinalArgs[4] = '\n/opt/drbl/sbin/drbl-login-switch' FinalArgs[5] = '-a' elif event.GetInt() == 2: FinalArgs[0] = '/opt/drbl/sbin/drbl-client-switch' FinalArgs[3] = 'remote-linux-gra' FinalArgs[4] = '\n/opt/drbl/sbin/drbl-login-switch' FinalArgs[5] = '-t' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): next = self.next if FinalArgs[3] == '-n': next = next.GetNext() return next #def GetPrev(self): #prev = self.prev #prev = prev.GetPrev() #return prev #---------------------------------------------------------------------- class ClientReAutoLoginPage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self, -1, _('msg_client_reautologin'),(50,100)) FinalArgs[0] = '/opt/drbl/sbin/drbl-client-reautologin' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): return self.next def GetPrev(self): prev = self.prev prev = prev.GetPrev() return prev #---------------------------------------------------------------------- class CleanAutoLoginAccountPage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self, -1, _('msg_clean_autologin_account'),(50,100)) FinalArgs[0] = '/opt/drbl/sbin/drbl-clean-autologin-account' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): return self.next def GetPrev(self): prev = self.prev prev = prev.GetPrev() return prev #---------------------------------------------------------------------- class ResetAutoLoginAccountPage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self, -1, _('msg_reset_autologin_account')) FinalArgs[0] = '/opt/drbl/sbin/drbl-user-env-reset' FinalArgs[1] = '--auto-login' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): return self.next #---------------------------------------------------------------------- class SwitchDRBLServPage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) 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')] wx.StaticText(self, -1, _('msg_switch_drbl_service'),(50,35)) rb = wx.RadioBox(self, -1, _('msg_choose_action'), (35, 50), (250,200), ModeList, 1, wx.RA_SPECIFY_COLS) self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) FinalArgs[0] = '/opt/drbl/sbin/drbl-all-service' FinalArgs[1] = 'start' def EvtRadioBox(self, event): if event.GetInt() == 0: FinalArgs[1] = 'start' elif event.GetInt() == 1: FinalArgs[1] = 'stop' elif event.GetInt() == 2: FinalArgs[1] = 'restart' elif event.GetInt() == 3: FinalArgs[1] = 'add' elif event.GetInt() == 4: FinalArgs[1] = 'del' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): return self.next #---------------------------------------------------------------------- class ReDeployPage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) wx.StaticText(self, -1, _('msg_re_deploy'),(50,100)) FinalArgs[0] = '/opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf' def SetNext(self, next): self.next = next def SetPrev(self, prev): self.prev = prev def GetNext(self): return self.next def GetPrev(self): return self.prev #---------------------------------------------------------------------- class FinalPage(wiz.PyWizardPage): def __init__(self, parent, title): wiz.PyWizardPage.__init__(self, parent) self.next = self.prev = None self.sizer = makePageTitle(self, title) self.tc = wx.TextCtrl(self, -1,'', pos=(35,50), size=(350, 250), style=wx.TE_MULTILINE|wx.TE_READONLY) self.b1 = wx.Button(self, -1, 'detail', pos=(400,250)) self.b2 = wx.Button(self, -1, 'command..', pos=(400,200)) self.Bind(wx.EVT_BUTTON, self.OnButtonDetail, self.b1) self.Bind(wx.EVT_BUTTON, self.OnButtonCommand, self.b2) def OnButtonDetail(self, evt): self.tc.WriteText('%s' % command_log) self.b1.Enable(False) def OnButtonCommand(self, evt): final_command = '' for i in range(0,36): if FinalArgs[i] != '': final_command = final_command + FinalArgs[i] + ' ' self.tc.WriteText('%s' % final_command) self.b2.Enable(False) def SetNext(self, next): self.next = next def GetNext(self): return self.next #---------------------------------------------------------------------- class MainFrame(wx.Frame): def __init__(self, parent, id): wx.Frame.__init__(self, parent, id, 'DRBL Config Wizard', (250,100), (700,400), style=wx.CAPTION) #wx.NO_FULL_REPAINT_ON_RESIZE self.scroll = wx.ScrolledWindow(self, -1) self.scroll.SetScrollbars(1, 1, 550, 400) FunctionList = [_('msg_remote_linux_graphic'), _('msg_remote_linux_text'), _('msg_thin_client') , _('msg_remote_memtest'), _('msg_remote_fdos'), _('msg_clonezilla_start_save') , _('msg_clonezilla_start_restore'), _('msg_clonezilla_selec_in_client'), _('msg_clonezilla_stop') , _('msg_local'), _('msg_reboot'), _('msg_shutdown'), _('msg_Wake_on_LAN') , _('msg_switch_pxe_menu'), _('msg_switch_pxe_bg_mode'), _('msg_drbl_mode_switch') , _('msg_clonezilla_mode_switch'), _('msg_gen_template_files'), _('msg_login_switch') , _('msg_client_reautologin'), _('msg_clean_autologin_account'), _('msg_reset_autologin_account') , _('msg_switch_drbl_service'), _('msg_re_deploy'), _('msg_clean_dhcpd_lease') , _('msg_regenerate_nfs_nis_nat_config')] rb = wx.RadioBox(self.scroll, -1, '', (35,20), (0,0), FunctionList, 2, wx.RA_SPECIFY_COLS|wx.NO_BORDER) self.scroll.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) rb.SetSelection(0) self.b1 = wx.Button(self.scroll, wx.ID_OK, pos=(600, 360)) # not translated self.b2 = wx.Button(self.scroll, wx.ID_EXIT, pos=(500, 360)) self.scroll.Bind(wx.EVT_BUTTON, self.RemoteLinuxGraWizard, self.b1) self.scroll.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.b2) self.scroll.Bind(wx.EVT_CLOSE, self.OnCloseWindow) def EvtRadioBox(self, event): if event.GetSelection() == 0: self.scroll.Bind(wx.EVT_BUTTON, self.RemoteLinuxGraWizard, self.b1) if event.GetSelection() == 1: self.scroll.Bind(wx.EVT_BUTTON, self.RemoteLinuxTxtWizard, self.b1) if event.GetSelection() == 2: self.scroll.Bind(wx.EVT_BUTTON, self.TerminalWizard, self.b1) if event.GetSelection() == 3: self.scroll.Bind(wx.EVT_BUTTON, self.RemoteMemTestWizard, self.b1) if event.GetSelection() == 4: self.scroll.Bind(wx.EVT_BUTTON, self.RemotefdosWizard, self.b1) if event.GetSelection() == 5: self.scroll.Bind(wx.EVT_BUTTON, self.ClonezillaStartSaveWizard, self.b1) if event.GetSelection() == 6: self.scroll.Bind(wx.EVT_BUTTON, self.ClonezillaStartRestoreWizard, self.b1) if event.GetSelection() == 7: self.scroll.Bind(wx.EVT_BUTTON, self.ClonezillaSelectWizard, self.b1) if event.GetSelection() == 8: self.scroll.Bind(wx.EVT_BUTTON, self.ClonezillaStopWizard, self.b1) if event.GetSelection() == 9: self.scroll.Bind(wx.EVT_BUTTON, self.LocalWizard, self.b1) if event.GetSelection() == 10: self.scroll.Bind(wx.EVT_BUTTON, self.RebootWizard, self.b1) if event.GetSelection() == 11: self.scroll.Bind(wx.EVT_BUTTON, self.ShutdownWizard, self.b1) if event.GetSelection() == 12: self.scroll.Bind(wx.EVT_BUTTON, self.WakeOnLanWizard, self.b1) if event.GetSelection() == 13: self.scroll.Bind(wx.EVT_BUTTON, self.SwitchPXEMenuWizard, self.b1) if event.GetSelection() == 14: self.scroll.Bind(wx.EVT_BUTTON, self.SwitchPXEModeWizard, self.b1) if event.GetSelection() == 15: self.scroll.Bind(wx.EVT_BUTTON, self.DRBLModeWizard, self.b1) if event.GetSelection() == 16: self.scroll.Bind(wx.EVT_BUTTON, self.ClonezillaModeWizard, self.b1) if event.GetSelection() == 17: self.scroll.Bind(wx.EVT_BUTTON, self.GenTemplateFileWizard, self.b1) if event.GetSelection() == 18: self.scroll.Bind(wx.EVT_BUTTON, self.LoginSwitchWizard, self.b1) if event.GetSelection() == 19: self.scroll.Bind(wx.EVT_BUTTON, self.ClientReAutoLoginWizard, self.b1) if event.GetSelection() == 20: self.scroll.Bind(wx.EVT_BUTTON, self.CleanAutoLoginAccountWizard, self.b1) if event.GetSelection() == 21: self.scroll.Bind(wx.EVT_BUTTON, self.ResetAutoLoginAccountWizard, self.b1) if event.GetSelection() == 22: self.scroll.Bind(wx.EVT_BUTTON, self.SwitchDRBLServWizard, self.b1) if event.GetSelection() == 23: self.scroll.Bind(wx.EVT_BUTTON, self.ReDeployWizard, self.b1) if event.GetSelection() == 24: self.scroll.Bind(wx.EVT_BUTTON, self.CleanDHCPLeaseWizard, self.b1) if event.GetSelection() == 25: self.scroll.Bind(wx.EVT_BUTTON, self.Regenerate3NWizard, self.b1) #---------------------------------------------------------------------- def OnCloseWindow(self, event): self.Destroy() #---------------------------------------------------------------------- def OnCloseMe(self, event): self.Close(True) #------------------------------Wizard Modules-------------------------- def RemoteLinuxGraWizard(self,evt): wizard = wiz.Wizard(self, -1, 'RemoteLinuxGraWizard', pos = (350,200)) page1 = SetAllClientsPage(wizard, '') page2 = SelectClientsPage(wizard, '') page3 = RemoteLinuxGraPage(wizard, '') page4 = FinalPage(wizard, '') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) if wizard.RunWizard(page1): #wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: #wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules-------------------------- def RemoteLinuxTxtWizard(self,evt): wizard = wiz.Wizard(self, -1, 'RemoteLinuxTextWizard', pos = (350,200)) page1 = SetAllClientsPage(wizard, '') page2 = SelectClientsPage(wizard, '') page3 = RemoteLinuxTxtPage(wizard, '') page4 = FinalPage(wizard, '') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) if wizard.RunWizard(page1): #wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: #wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules-------------------------- def TerminalWizard(self,evt): wizard = wiz.Wizard(self, -1, 'TerminalWizard', pos = (350,200)) page1 = SetAllClientsPage(wizard, '') page2 = SelectClientsPage(wizard, '') page3 = TerminalPage(wizard, '') page4 = FinalPage(wizard, '') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) if wizard.RunWizard(page1): #wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: #wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules-------------------------- def RemoteMemTestWizard(self,evt): wizard = wiz.Wizard(self, -1, 'RemoteMemTestWizard', pos = (500,200)) page1 = SetAllClientsPage(wizard, '') page2 = SelectClientsPage(wizard, '') page3 = RemoteMemTestPage(wizard, '') page4 = FinalPage(wizard, '') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) if wizard.RunWizard(page1): #wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: #wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules-------------------------- def RemotefdosWizard(self,evt): wizard = wiz.Wizard(self, -1, 'RemotefdosWizard', pos = (500,200)) page1 = SetAllClientsPage(wizard, '') page2 = SelectClientsPage(wizard, '') page3 = RemotefdosPage(wizard,'') page4 = FinalPage(wizard,'') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) if wizard.RunWizard(page1): wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules-------------------------- def ClonezillaStartSaveWizard(self,evt): wizard = wiz.Wizard(self, -1, 'ClonezillaStartSaveWizard', pos = (500,200)) page1 = SetAllClientsPage(wizard, '') page2 = SelectClientsPage(wizard, '') page3 = ClonezillaStartSavePage1(wizard, '') page4 = ClonezillaStartSavePage2(wizard, '') page5 = ClonezillaStartSavePage3(wizard, '') page6 = ClonezillaStartSavePage4(wizard, '') page7 = ClonezillaStartSavePage5(wizard, '') page8 = ClonezillaStartSavePage6(wizard, '') page9 = FinalPage(wizard,'') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) page4.SetPrev(page3) page4.SetNext(page5) page5.SetPrev(page4) page5.SetNext(page6) page6.SetPrev(page5) page6.SetNext(page7) page7.SetPrev(page6) page7.SetNext(page8) page8.SetPrev(page7) page8.SetNext(page9) if wizard.RunWizard(page1): wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules-------------------------- def ClonezillaStartRestoreWizard(self,evt): wizard = wiz.Wizard(self, -1, 'ClonezillaStartRestoreWizard', pos = (500,200)) page1 = SetAllClientsPage(wizard, '') page2 = SelectClientsPage(wizard, '') page3 = ClonezillaStartRestorePage1(wizard, 'ClonezillaStartRestorePage1') page4 = ClonezillaStartRestorePage2(wizard, 'ClonezillaStartRestorePage2') page5 = ClonezillaStartRestorePage3(wizard, 'ClonezillaStartRestorePage3') page6 = ClonezillaStartRestorePage4(wizard, 'ClonezillaStartRestorePage4') page7 = ClonezillaStartRestorePage5(wizard, 'ClonezillaStartRestorePage5') page8 = ClonezillaStartRestorePage6(wizard, 'ClonezillaStartRestorePage6') page9 = ClonezillaStartRestorePage7(wizard, 'ClonezillaStartRestorePage7') page10 = ClonezillaStartRestorePage8a(wizard, 'ClonezillaStartRestorePage8a') page11 = ClonezillaStartRestorePage8b(wizard, 'ClonezillaStartRestorePage8b') page12 = ClonezillaStartRestorePage9a(wizard, 'ClonezillaStartRestorePage9a') page13 = ClonezillaStartRestorePage9b(wizard, 'ClonezillaStartRestorePage9b') page14 = ClonezillaStartRestorePage10(wizard, 'ClonezillaStartRestorePage10') page15 = ClonezillaStartRestorePage11(wizard, 'ClonezillaStartRestorePage11') page16 = ClonezillaStartRestorePage12(wizard, 'ClonezillaStartRestorePage12') page17 = FinalPage(wizard,'FinalPage') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) page4.SetPrev(page3) page4.SetNext(page5) page5.SetPrev(page4) page5.SetNext(page6) page6.SetPrev(page4) page6.SetNext(page7) page7.SetPrev(page4) page7.SetNext(page8) page8.SetPrev(page7) page8.SetNext(page9) page9.SetPrev(page8) page9.SetNext(page10) page10.SetPrev(page9) page10.SetNext(page11) page11.SetPrev(page9) page11.SetNext(page12) page12.SetPrev(page10) page12.SetNext(page13) page13.SetPrev(page11) page13.SetNext(page14) page14.SetPrev(page13) page14.SetNext(page15) page15.SetPrev(page14) page15.SetNext(page16) page16.SetPrev(page14) page16.SetNext(page17) #page17.SetPrev(page16) #page17.SetNext(page18) if wizard.RunWizard(page1): wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules-------------------------- def ClonezillaSelectWizard(self,evt): wizard = wiz.Wizard(self, -1, 'ClonezillaSelectWizard', pos = (500,200)) page1 = SetAllClientsPage(wizard, '') page2 = SelectClientsPage(wizard, '') page3 = ClonezillaSelectPage1(wizard, '') page4 = ClonezillaSelectPage2(wizard, '') page5 = FinalPage(wizard, '') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) page4.SetPrev(page3) page4.SetNext(page5) if wizard.RunWizard(page1): wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules-------------------------- def ClonezillaStopWizard(self,evt): wizard = wiz.Wizard(self, -1, 'ClonezillaStopWizard', pos = (500,200)) page1 = SetAllClientsPage(wizard, '') page2 = SelectClientsPage(wizard, '') page3 = ClonezillaStopPage(wizard, '') page4 = FinalPage(wizard, '') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) if wizard.RunWizard(page1): wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules-------------------------- def LocalWizard(self,evt): wizard = wiz.Wizard(self, -1, 'LocalWizard', pos = (500,200)) page1 = SetAllClientsPage(wizard, '') page2 = SelectClientsPage(wizard, '') page3 = LocalPage(wizard, '') page4 = FinalPage(wizard, '') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) if wizard.RunWizard(page1): wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules-------------------------- def RebootWizard(self,evt): wizard = wiz.Wizard(self, -1, 'RebootWizard', pos = (500,200)) page1 = SetAllClientsPage(wizard, '') page2 = SelectClientsPage(wizard, '') page3 = RebootPage(wizard, '') page4 = FinalPage(wizard, '') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) if wizard.RunWizard(page1): wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules-------------------------- def ShutdownWizard(self,evt): wizard = wiz.Wizard(self, -1, 'ShutdownWizard', pos = (500,200)) page1 = SetAllClientsPage(wizard, '') page2 = SelectClientsPage(wizard, '') page3 = ShutdownPage(wizard, '') page4 = FinalPage(wizard, '') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) if wizard.RunWizard(page1): wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules----------------------------- def WakeOnLanWizard(self,evt): wizard = wiz.Wizard(self, -1, 'WakeOnLanWizard', pos = (500,200)) page1 = SetAllClientsPage(wizard, '') page2 = SelectClientsPage(wizard, '') page3 = WakeOnLanPage(wizard, '') page4 = FinalPage(wizard, '') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) if wizard.RunWizard(page1): wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules----------------------------- def SwitchPXEMenuWizard(self,evt): wizard = wiz.Wizard(self, -1, 'SwitchPXEMenuWizard', pos = (500,200)) page1 = SetAllClientsPage(wizard, '') page2 = SelectClientsPage(wizard, '') page3 = SwitchPXEMenuPage1(wizard, '') page4 = SwitchPXEMenuPage2(wizard, '') page5 = SwitchPXEMenuPage3(wizard, '') page6 = SwitchPXEMenuPage4(wizard, '') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) page4.SetPrev(page3) page4.SetNext(page5) page5.SetPrev(page4) page5.SetNext(page6) if wizard.RunWizard(page1): wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules----------------------------- def SwitchPXEModeWizard(self,evt): wizard = wiz.Wizard(self, -1, 'SwitchPXEModeWizard', pos = (500,200)) page1 = SetAllClientsPage(wizard, '') page2 = SelectOnePage(wizard, '') page3 = SwitchPXEModePage(wizard, '') page4 = FinalPage(wizard, '') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) if wizard.RunWizard(page1): wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules----------------------------- def DRBLModeWizard(self,evt): wizard = wiz.Wizard(self, -1, 'DRBLModeWizard', pos = (500,200)) page1 = DRBLModePage(wizard, '') page2 = FinalPage(wizard, '') self.page1 = page1 wizard.SetPageSize((500,400)) page1.SetNext(page2) page2.SetPrev(page1) if wizard.RunWizard(page1): wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules----------------------------- def ClonezillaModeWizard(self,evt): wizard = wiz.Wizard(self, -1, 'ClonezillaModeWizard', pos = (500,200)) page1 = ClonezillaModePage(wizard, '') page2 = FinalPage(wizard, '') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) if wizard.RunWizard(page1): wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules----------------------------- def GenTemplateFileWizard(self,evt): wizard = wiz.Wizard(self, -1, 'GenTemplateFileWizard', pos = (500,200)) page1 = GenTemplateFilePage(wizard, '') page2 = FinalPage(wizard, '') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) if wizard.RunWizard(page1): wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules----------------------------- def LoginSwitchWizard(self,evt): wizard = wiz.Wizard(self, -1, 'LoginSwitchWizard', pos = (500,200)) page1 = LoginSwitchPage(wizard, '') page2 = SetAllClientsPage(wizard, '') page3 = SelectClientsPage(wizard, '') page4 = FinalPage(wizard, '') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) if wizard.RunWizard(page1): wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules----------------------------- def ClientReAutoLoginWizard(self,evt): wizard = wiz.Wizard(self, -1, ' ClientReAutoLogin', pos = (500,200)) page1 = SetAllClientsPage(wizard, '') page2 = SelectClientsPage(wizard, '') page3 = ClientReAutoLoginPage(wizard, '') page4 = FinalPage(wizard, '') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) if wizard.RunWizard(page1): wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules----------------------------- def CleanAutoLoginAccountWizard(self,evt): wizard = wiz.Wizard(self, -1, 'CleanAutoLoginAccount', pos = (500,200)) page1 = SetAllClientsPage(wizard, '') page2 = SelectOneClientPage(wizard, '') page3 = CleanAutoLoginAccountPage(wizard, '') page4 = FinalPage(wizard, '') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) if wizard.RunWizard(page1): wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules----------------------------- def ResetAutoLoginAccountWizard(self,evt): wizard = wiz.Wizard(self, -1, 'ResetAutoLoginAccount', pos = (500,200)) #page1 = SetAllClientsPage(wizard, '') #page2 = SelectOneClientPage(wizard, '') page1 = ResetAutoLoginAccountPage(wizard, '') page2 = FinalPage(wizard, '') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) #page2.SetPrev(page1) #page2.SetNext(page3) #page3.SetPrev(page2) #page3.SetNext(page4) if wizard.RunWizard(page1): wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules----------------------------- def SwitchDRBLServWizard(self,evt): wizard = wiz.Wizard(self, -1, 'SwitchDRBLServWizard', pos = (500,200)) page1 = SwitchDRBLServPage(wizard, '') page2 = FinalPage(wizard, '') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) if wizard.RunWizard(page1): wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules----------------------------- def ReDeployWizard(self,evt): wizard = wiz.Wizard(self, -1, 'ReDeployWizard', pos = (500,200)) page1 = SetAllClientsPage(wizard, '') page2 = SelectClientsPage(wizard, '') page3 = ReDeployPage(wizard, '') page4 = FinalPage(wizard, '') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) if wizard.RunWizard(page1): wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules----------------------------- def CleanDHCPLeaseWizard(self,evt): wizard = wiz.Wizard(self, -1, 'CleanDHCPLeaseWizard', pos = (500,200)) page1 = SetAllClientsPage(wizard, '') page2 = SelectClientsPage(wizard, '') page3 = CleanDHCPLeasePage(wizard, '') page4 = FinalPage(wizard, '') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) if wizard.RunWizard(page1): wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------Wizard Modules----------------------------- def Regenerate3NWizard(self,evt): wizard = wiz.Wizard(self, -1, 'Regenerate3NWizard', pos = (500,200)) page1 = SetAllClientsPage(wizard, '') page2 = SelectClientsPage(wizard, '') page3 = Regenerate3NPage(wizard, '') page4 = FinalPage(wizard, '') self.page1 = page1 wizard.SetPageSize((500,300)) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) if wizard.RunWizard(page1): wx.MessageBox(_('success'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' else: wx.MessageBox(_('cancel'), "That's all folks!", wx.CENTRE | wx.NO_DEFAULT, self) for i in range(0,36): FinalArgs[i] = '' #------------------------------------------------------------------------ if __name__ == '__main__': app = wx.PySimpleApp() frame = MainFrame(parent=None, id=-1) frame.Show() app.MainLoop()