[20] | 1 | import wx, sys, os, gettext, string, time |
---|
| 2 | import wx.wizard as wiz |
---|
| 3 | from config import generate_ip_list, drbl_ocs, all_clonezilla_save_opt, clonezilla_disk_part, server_client_input, client_action_after_save, compress_mode |
---|
| 4 | |
---|
| 5 | cat = gettext.GNUTranslations(open('../langs/%s.mo' % os.getenv('LANG'))) |
---|
| 6 | _ = cat.gettext |
---|
| 7 | |
---|
| 8 | global selected_clients, selected_disk_parts_save_opt, selected_clonezilla_save_opt, selected_server_client_opt |
---|
| 9 | globla selected_img_dev_name, selected_client_action, selected_compress_mode |
---|
| 10 | selected_clients = ['-nl',''] |
---|
| 11 | selected_disk_parts_save_opt = ['','save'] |
---|
| 12 | selected_clonezilla_save_opt = [] |
---|
| 13 | selected_server_client_opt = [''] # not count |
---|
| 14 | selected_img_dev_name = ['',''] |
---|
| 15 | selected_client_action = [''] |
---|
| 16 | selected_compress_mode = [''] |
---|
| 17 | |
---|
| 18 | #---------------------------------------------------------------------- |
---|
| 19 | def makePageTitle(wizPg, title): |
---|
| 20 | sizer = wx.BoxSizer(wx.VERTICAL) |
---|
| 21 | wizPg.SetSizer(sizer) |
---|
| 22 | title = wx.StaticText(wizPg, -1, title) |
---|
| 23 | title.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD)) |
---|
| 24 | sizer.Add(title, 0, wx.ALIGN_CENTRE|wx.ALL, 5) |
---|
| 25 | sizer.Add(wx.StaticLine(wizPg, -1), 0, wx.EXPAND|wx.ALL, 5) |
---|
| 26 | return sizer |
---|
| 27 | |
---|
| 28 | #---------------------------------------------------------------------- |
---|
| 29 | class checklistCtrl(wx.ListCtrl, CheckListCtrlMixin): |
---|
| 30 | def __init__(self, parent, log): |
---|
| 31 | wx.ListCtrl.__init__(self, parent, -1, style=wx.LC_REPORT) |
---|
| 32 | CheckListCtrlMixin.__init__(self) |
---|
| 33 | self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) |
---|
| 34 | |
---|
| 35 | def OnItemActivated(self, evt): |
---|
| 36 | self.ToggleItem(evt.m_itemIndex) |
---|
| 37 | |
---|
| 38 | def OnCheckItem(self, index, flag): |
---|
| 39 | data = self.GetItemData(index) |
---|
| 40 | arg = all_clonezilla_save_opt[data][0] |
---|
| 41 | if flag: |
---|
| 42 | selected_clonezilla_save_opt.append(arg) |
---|
| 43 | else: |
---|
| 44 | selected_clonezilla_save_opt.remove(arg) |
---|
| 45 | |
---|
| 46 | #----------------------------------------------------------------------- |
---|
| 47 | class setAllClientsPage(wiz.PyWizardPage): |
---|
| 48 | def __init__(self, parent, title): |
---|
| 49 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 50 | self.next = self.prev = None |
---|
| 51 | self.sizer = makePageTitle(self, title) |
---|
| 52 | self.fuse_next = 0 |
---|
| 53 | |
---|
| 54 | wx.StaticText(self, -1, _('msg_select_all_clients_or_select_part_them'), pos=(10,60), size=(500,100), style=wx.TE_MULTILINE) |
---|
| 55 | wx.StaticText(self, -1, _('msg_set_all_clients_des'), pos=(10,80), size=(500,100), style=wx.TE_MULTILINE) |
---|
| 56 | ox = ['Yes', 'No'] |
---|
| 57 | self.rb = wx.RadioBox(self, -1, _('msg_set_all_clients'), (10,150), (250,75), ox, 1, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 58 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, self.rb) |
---|
| 59 | |
---|
| 60 | def EvtRadioBox(self, event): |
---|
| 61 | if event.GetSelection() == 0: |
---|
| 62 | selected_clients[0] = '-nl' |
---|
| 63 | if event.GetSelection() == 1: |
---|
| 64 | selected_clients[0] = '-h' |
---|
| 65 | |
---|
| 66 | def SetNext(self, next): |
---|
| 67 | self.next = next |
---|
| 68 | |
---|
| 69 | def SetPrev(self, prev): |
---|
| 70 | self.prev = prev |
---|
| 71 | |
---|
| 72 | def GetNext(self): |
---|
| 73 | next = self.next |
---|
| 74 | self.fuse_next = self.fuse_next + 1 |
---|
| 75 | if self.fuse_next == 2: |
---|
| 76 | if self.rb.GetSelection() == 0: |
---|
| 77 | next = next.GetNext() |
---|
| 78 | return next |
---|
| 79 | |
---|
| 80 | def GetPrev(self): |
---|
| 81 | self.fuse_next = 0 |
---|
| 82 | prev = self.prev |
---|
| 83 | return prev |
---|
| 84 | |
---|
| 85 | #----------------------------------------------------------------------- |
---|
| 86 | class selectClientsPage(wiz.PyWizardPage): |
---|
| 87 | def __init__(self, parent, title): |
---|
| 88 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 89 | self.next = self.prev = None |
---|
| 90 | self.sizer = makePageTitle(self, title) |
---|
| 91 | |
---|
| 92 | self.SelectedClientsArray = [] |
---|
| 93 | self.SelectedClientsStr = '' |
---|
| 94 | self.fuse_next = self.fuse_prev = 0 |
---|
| 95 | |
---|
| 96 | AllClientsArray = os.popen(generate_ip_list).read().split('\n') |
---|
| 97 | AllClientsArray.remove('') |
---|
| 98 | self.lb = wx.CheckListBox(self, -1, (10,50), (470,250), AllClientsArray) |
---|
| 99 | self.Bind(wx.EVT_CHECKLISTBOX, self.EvtCheckListBox, self.lb) |
---|
| 100 | self.lb.SetSelection(0) |
---|
| 101 | |
---|
| 102 | def EvtCheckListBox(self, event): |
---|
| 103 | index = event.GetSelection() |
---|
| 104 | label = self.lb.GetString(index) |
---|
| 105 | if self.lb.IsChecked(index): |
---|
| 106 | self.SelectedClientsArray.append(label) |
---|
| 107 | if not (self.lb.IsChecked(index)): |
---|
| 108 | self.SelectedClientsArray.remove(label) |
---|
| 109 | self.lb.SetSelection(index) #so that (un)checking also selects (moves the highlight) |
---|
| 110 | |
---|
| 111 | def SetNext(self, next): |
---|
| 112 | self.next = next |
---|
| 113 | |
---|
| 114 | def SetPrev(self, prev): |
---|
| 115 | self.prev = prev |
---|
| 116 | |
---|
| 117 | def GetNext(self): |
---|
| 118 | next = self.next |
---|
| 119 | self.fuse_prev = 0 |
---|
| 120 | self.fuse_next = self.fuse_next + 1 |
---|
| 121 | if self.fuse_next == 2: |
---|
| 122 | if selected_clients[0] == '-h': |
---|
| 123 | if len(self.SelectedClientsArray)==0): |
---|
| 124 | war = wx.MessageDialog(self, 'YOU MUST CHOOSE ONE!!', 'WARNNING!!', wx.OK|wx.ICON_INFORMATION) |
---|
| 125 | war.ShowModal() |
---|
| 126 | war.Destroy() |
---|
| 127 | return self |
---|
| 128 | else: |
---|
| 129 | for x in self.SelectedClientsArray: |
---|
| 130 | self.SelectedClientsStr = x + ' ' + self.SelectedClientsStr |
---|
| 131 | self.SelectedClientsStr = '\"' + self.SelectedClientsStr + '\"' |
---|
| 132 | selected_clients[1] = self.SelectedClientsStr |
---|
| 133 | return next |
---|
| 134 | |
---|
| 135 | def GetPrev(self): |
---|
| 136 | prev = self.prev |
---|
| 137 | self.fuse_next = 0 |
---|
| 138 | return prev |
---|
| 139 | |
---|
| 140 | #----------------------------------------------------------------------- |
---|
| 141 | class clonezillaSavePage1(wiz.PyWizardPage): |
---|
| 142 | def __init__(self, parent, title): |
---|
| 143 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 144 | self.next = self.prev = None |
---|
| 145 | self.sizer = makePageTitle(self, title) |
---|
| 146 | self.fuse_prev = 0 |
---|
| 147 | |
---|
| 148 | list = [] |
---|
| 149 | for i in range(0, len(clonezilla_disk_part)): |
---|
| 150 | list.append(clonezilla_disk_part[i][0] + ' ' + clonezilla_disk_part[i][1]) |
---|
| 151 | |
---|
| 152 | rb = wx.RadioBox(self, -1, _('msg_choose_mode'), (35, 50), (260,90), ModeList, 1, wx.RA_SPECIFY_COLS) |
---|
| 153 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 154 | |
---|
| 155 | def EvtRadioBox(self, event): |
---|
| 156 | selected_disk_parts_save_opt[0] = clonezilla_disk_part[event.GetSelection()][0] |
---|
| 157 | |
---|
| 158 | def SetNext(self, next): |
---|
| 159 | self.next = next |
---|
| 160 | |
---|
| 161 | def SetPrev(self, prev): |
---|
| 162 | self.prev = prev |
---|
| 163 | |
---|
| 164 | def GetNext(self): |
---|
| 165 | self.fuse_prev = 0 |
---|
| 166 | return self.next |
---|
| 167 | |
---|
| 168 | def GetPrev(self): |
---|
| 169 | self.fuse_prev = self.fuse_prev + 1 |
---|
| 170 | if self.fuse_prev == 1: |
---|
| 171 | prev = self.prev |
---|
| 172 | if selected_clients[0] == '-nl': |
---|
| 173 | prev = prev.GetPrev() |
---|
| 174 | return prev |
---|
| 175 | |
---|
| 176 | #----------------------------------------------------------------------- |
---|
| 177 | class clonezillaSavePage2(wiz.PyWizardPage): |
---|
| 178 | def __init__(self, parent, title): |
---|
| 179 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 180 | self.next = self.prev = None |
---|
| 181 | self.sizer = makePageTitle(self, title) |
---|
| 182 | self.fuse_next = 0 |
---|
| 183 | |
---|
| 184 | list = [] |
---|
| 185 | for i in range(0, len(server_client)): |
---|
| 186 | list.append(server_client[i][0]) |
---|
| 187 | |
---|
| 188 | rb = wx.RadioBox(self, -1, _('msg_choose_mode'), (35, 50), (260,90), list, 1, wx.RA_SPECIFY_COLS) |
---|
| 189 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 190 | |
---|
| 191 | def EvtRadioBox(self, event): |
---|
| 192 | selected_server_client_opt[0] = server_client[event.GetSelection()][0] |
---|
| 193 | |
---|
| 194 | def SetNext(self, next): |
---|
| 195 | self.next = next |
---|
| 196 | |
---|
| 197 | def SetPrev(self, prev): |
---|
| 198 | self.prev = prev |
---|
| 199 | |
---|
| 200 | def GetNext(self): |
---|
| 201 | next = self.next |
---|
| 202 | self.fuse_next = self.fuse_next + 1 |
---|
| 203 | if self.fuse_next == 2: |
---|
| 204 | if selected_server_client_opt[0] == server_client[1][0]: |
---|
| 205 | next = next.GetNext() |
---|
| 206 | return next |
---|
| 207 | |
---|
| 208 | def GetPrev(self): |
---|
| 209 | self.fuse_next = 0 |
---|
| 210 | return self.prev |
---|
| 211 | |
---|
| 212 | #---------------------------------------------------------------------- |
---|
| 213 | class clonezillaSavePage3(wiz.PyWizardPage): |
---|
| 214 | def __init__(self, parent, title): |
---|
| 215 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 216 | self.next = self.prev = None |
---|
| 217 | self.sizer = makePageTitle(self, title) |
---|
| 218 | self.fuse_next = self.fuse_prev = 0 |
---|
| 219 | |
---|
| 220 | wx.StaticText(self, -1, _('msg_input_image_name'), (10, 160)) |
---|
| 221 | self.text_img = wx.TextCtrl(self, -1, '', (10, 180), size=(200, -1)) |
---|
| 222 | wx.StaticText(self, -1, _('msg_input_device_name'), (10, 210)) |
---|
| 223 | self.text_dev = wx.TextCtrl(self, -1, '', (10, 230), size=(190, -1)) |
---|
| 224 | |
---|
| 225 | def SetNext(self, next): |
---|
| 226 | self.next = next |
---|
| 227 | |
---|
| 228 | def SetPrev(self, prev): |
---|
| 229 | self.prev = prev |
---|
| 230 | |
---|
| 231 | def GetNext(self): |
---|
| 232 | self.fuse_prev = 0 |
---|
| 233 | if self.fuse_next == 2: |
---|
| 234 | if selected_server_client_opt[0] == server_client[1][0]: |
---|
| 235 | selected_img_dev_name[0] = selected_img_dev_name[1] = '' |
---|
| 236 | #print ('selected_img_dev_name[0] is %s, selected_img_dev_name[1] is %s' % (selected_img_dev_name[0], selected_img_dev_name[1])) |
---|
| 237 | elif self.text_img.GetValue() == '' or self.text_dev.GetValue() == '': |
---|
| 238 | warnning = wx.MessageDialog(self, 'YOU MUST ENTER SOMETHING!!', 'WARNNING', wx.OK|wx.ICON_INFORMATION) |
---|
| 239 | warnning.ShowModal() |
---|
| 240 | warnning.Destroy() |
---|
| 241 | return self |
---|
| 242 | else: |
---|
| 243 | selected_img_dev_name[0] = self.text_img.GetValue() |
---|
| 244 | selected_img_dev_name[1] = self.text_dev.GetValue() |
---|
| 245 | print ('selected_img_dev_name[0] is %s, selected_img_dev_name[1] is %s' % (selected_img_dev_name[0], selected_img_dev_name[1])) |
---|
| 246 | return self.next |
---|
| 247 | |
---|
| 248 | def GetPrev(self): |
---|
| 249 | self.fuse_next = 0 |
---|
| 250 | return self.prev |
---|
| 251 | |
---|
| 252 | #---------------------------------------------------------------------- |
---|
| 253 | class clonezillaSavePage4(wiz.PyWizardPage): |
---|
| 254 | def __init__(self, parent, title): |
---|
| 255 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 256 | self.next = self.prev = None |
---|
| 257 | self.sizer = makePageTitle(self, title) |
---|
| 258 | self.fuse_next = self.fuse_prev = 0 |
---|
| 259 | |
---|
| 260 | ox = [_('msg_yes'), _('msg_no')] |
---|
| 261 | wx.StaticText(self, -1, _('msg_skip_set_advanced_extra_param'), (10,60), (470,100), wx.TE_MULTILINE) |
---|
| 262 | rb = wx.RadioBox(self, -1, _('msg_choose_action'), (10,100), (100,50), ox, 1, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 263 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 264 | rb.SetSelection(1) |
---|
| 265 | self.SkipExtraParam = 'no' |
---|
| 266 | |
---|
| 267 | def EvtRadioBox(self, event): |
---|
| 268 | if event.GetSelection() == 0: |
---|
| 269 | self.SkipExtraParam = 'yes' |
---|
| 270 | else: |
---|
| 271 | self.SkipExtraParam = 'no' |
---|
| 272 | |
---|
| 273 | def SetNext(self, next): |
---|
| 274 | self.next = next |
---|
| 275 | |
---|
| 276 | def SetPrev(self, prev): |
---|
| 277 | self.prev = prev |
---|
| 278 | |
---|
| 279 | def GetNext(self): |
---|
| 280 | next = self.next |
---|
| 281 | command = command_log = '' |
---|
| 282 | self.fuse_prev = 0 |
---|
| 283 | self.fuse_next = self.fuse_next + 1 |
---|
| 284 | if self.fuse_next == 2: |
---|
| 285 | if self.SkipExtraParam == 'yes': |
---|
| 286 | if selected_server_client_opt[0] == server_client[1][0]: |
---|
| 287 | command = ('%s %s %s' % (drbl_ocs, selected_clients[0], selected_clients[1])) |
---|
| 288 | else: |
---|
| 289 | command = ('%s %s %s %s %s' % (drbl_ocs, selected_clients[0], selected_clients[1], selected_img_dev_name[0], selected_img_dev_name[1])) |
---|
| 290 | file = open('tmp.log','w') |
---|
| 291 | os.system('sudo %s > tmp.log' % command) |
---|
| 292 | time.sleep(6) |
---|
| 293 | file.close() |
---|
| 294 | file = open('tmp.log') |
---|
| 295 | while True: |
---|
| 296 | line = file.readline() |
---|
| 297 | if len(line) == 0: # Zero length indicates EOF |
---|
| 298 | break |
---|
| 299 | command_log = command_log + line |
---|
| 300 | file.close() |
---|
| 301 | os.remove('tmp.log') |
---|
| 302 | FinalCommand.SetLabel('%s' % command) |
---|
| 303 | CommandLog.WriteText('%s' % command_log) |
---|
| 304 | for i in range(0,3): |
---|
| 305 | next = next.GetNext() |
---|
| 306 | return next |
---|
| 307 | |
---|
| 308 | def GetPrev(self): |
---|
| 309 | self.fuse_next = 0 |
---|
| 310 | self.fuse_prev = self.fuse_prev + 1 |
---|
| 311 | prev = self.prev |
---|
| 312 | if self.fuse_prev == 1: |
---|
| 313 | if selected_img_dev_name[0] == '' and selected_img_dev_name[1] == '': |
---|
| 314 | prev = prev.GetPrev() |
---|
| 315 | return prev |
---|
| 316 | |
---|
| 317 | #---------------------------------------------------------------------- |
---|
| 318 | class clonezillaSavePage5(wiz.PyWizardPage): |
---|
| 319 | def __init__(self, parent, title): |
---|
| 320 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 321 | self.next = self.prev = None |
---|
| 322 | self.sizer = makePageTitle(self, title) |
---|
| 323 | self.fuse_next = self.fuse_prev = 0 |
---|
| 324 | |
---|
| 325 | self.list = checkListCtrl(self, title) |
---|
| 326 | sizer = wx.BoxSizer() |
---|
| 327 | sizer.Add(self.list, 1, wx.EXPAND) |
---|
| 328 | self.SetSizer(sizer) |
---|
| 329 | |
---|
| 330 | self.list.InsertColumn(0, _('argument')) #not translated |
---|
| 331 | self.list.InsertColumn(1, _('meannings'), wx.LIST_FORMAT_LEFT) #not translated |
---|
| 332 | |
---|
| 333 | for key, data in selected_clonezilla_save_opt.iteritems(): |
---|
| 334 | index = self.list.InsertStringItem(sys.maxint, data[0]) |
---|
| 335 | self.list.SetStringItem(index, 1, data[1]) |
---|
| 336 | self.list.SetItemData(index, key) |
---|
| 337 | |
---|
| 338 | self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE) |
---|
| 339 | self.list.SetColumnWidth(1, wx.LIST_AUTOSIZE) |
---|
| 340 | |
---|
| 341 | self.list.CheckItem(0) |
---|
| 342 | self.list.CheckItem(1) |
---|
| 343 | |
---|
| 344 | def SetNext(self, next): |
---|
| 345 | self.next = next |
---|
| 346 | |
---|
| 347 | def SetPrev(self, prev): |
---|
| 348 | self.prev = prev |
---|
| 349 | |
---|
| 350 | def GetNext(self): |
---|
| 351 | self.fuse_prev = 0 |
---|
| 352 | return self.next |
---|
| 353 | |
---|
| 354 | def GetPrev(self): |
---|
| 355 | return self.prev |
---|
| 356 | |
---|
| 357 | #---------------------------------------------------------------------- |
---|
| 358 | class clonezillaSavePage6(wiz.PyWizardPage): |
---|
| 359 | def __init__(self, parent, title): |
---|
| 360 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 361 | self.next = self.prev = None |
---|
| 362 | self.sizer = makePageTitle(self, title) |
---|
| 363 | |
---|
| 364 | list = [] |
---|
| 365 | for i in range(0, len(client_action_after_save)): |
---|
| 366 | list.append(client_action_after_save[i][0] + ' ' + client_action_after_save[i][1]) |
---|
| 367 | rb = wx.RadioBox(self, -1, _('msg_choose_post_mode_after_clone'), (10,100), (250,100), list, 1, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 368 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 369 | rb.SetSelection(0) |
---|
| 370 | selected_client_action[0] = '-p choose' |
---|
| 371 | |
---|
| 372 | def EvtRadioBox(self, event): |
---|
| 373 | selected_client_action[0] = client_action_after_save[event.GetSelection()][0] |
---|
| 374 | |
---|
| 375 | def SetNext(self, next): |
---|
| 376 | self.next = next |
---|
| 377 | |
---|
| 378 | def SetPrev(self, prev): |
---|
| 379 | self.prev = prev |
---|
| 380 | |
---|
| 381 | def GetNext(self): |
---|
| 382 | return self.next |
---|
| 383 | |
---|
| 384 | def GetPrev(self): |
---|
| 385 | return self.prev |
---|
| 386 | |
---|
| 387 | #---------------------------------------------------------------------- |
---|
| 388 | class clonezillaSavePage7(wiz.PyWizardPage): |
---|
| 389 | def __init__(self, parent, title): |
---|
| 390 | wiz.PyWizardPage.__init__(self, parent) |
---|
| 391 | self.next = self.prev = None |
---|
| 392 | self.sizer = makePageTitle(self, title) |
---|
| 393 | self.fuse_next = 0 |
---|
| 394 | |
---|
| 395 | list = [] |
---|
| 396 | for i in range(0, len(compress_mode)): |
---|
| 397 | list.append(compress_mode[i][0] + ' ' + compress_mode[i][1]) |
---|
| 398 | rb = wx.RadioBox(self, -1, _('msg_choose_post_mode_after_clone'), (10,100), (300,100), list, 1, wx.RA_SPECIFY_COLS|wx.NO_BORDER) |
---|
| 399 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) |
---|
| 400 | rb.SetSelection(3) |
---|
| 401 | selected_compress_mode = '-z3' |
---|
| 402 | |
---|
| 403 | def EvtRadioBox(self, event): |
---|
| 404 | selected_compress_mode[0] = compress_mode[event.GetSelection()][0] |
---|
| 405 | |
---|
| 406 | def SetNext(self, next): |
---|
| 407 | self.next = next |
---|
| 408 | |
---|
| 409 | def SetPrev(self, prev): |
---|
| 410 | self.prev = prev |
---|
| 411 | |
---|
| 412 | def GetNext(self): |
---|
| 413 | command = command_log = '' |
---|
| 414 | self.fuse_next = self.fuse_next + 1 |
---|
| 415 | if self.fuse_next == 2: |
---|
| 416 | if selected_clients[0] == '-nl': |
---|
| 417 | selected_clients[0] = '' |
---|
| 418 | command = drbl_ocs + selected_clonezilla_save_opt + selected_client_action[0] + selected_compress_mode[0] + selected_clients[0] + selected_clients[1] + selected_disk_parts_save_opt |
---|
| 419 | #if FinalArgs[i] != '': |
---|
| 420 | #command = command + FinalArgs[i] + ' ' |
---|
| 421 | file = open('tmp.log','w') |
---|
| 422 | os.system('%s > tmp.log' % command) |
---|
| 423 | time.sleep(6) |
---|
| 424 | file.close() |
---|
| 425 | file = open('tmp.log') |
---|
| 426 | while True: |
---|
| 427 | line = file.readline() |
---|
| 428 | if len(line) == 0: # Zero length indicates EOF |
---|
| 429 | break |
---|
| 430 | command_log = command_log + line |
---|
| 431 | file.close() |
---|
| 432 | os.remove('tmp.log') |
---|
| 433 | FinalCommand.SetLabel('%s' % command) |
---|
| 434 | CommandLog.WriteText('%s' % command_log) |
---|
| 435 | return self.next |
---|
| 436 | |
---|
| 437 | def GetPrev(self): |
---|
| 438 | self.fuse_next = 0 |
---|
| 439 | return self.prev |
---|
| 440 | |
---|