Example #1
0
 def enter(self):
     logger.d('enter in magicstep substep %s' % self.substep)
     if hasattr(self, 'check_enter_%s' % self.substep):
         return eval('self.check_enter_%s()' % self.substep)
     # Always switch to substep_list.
     self.subswitch(self.substep_list[0])
     return 1
Example #2
0
            def next_post_script(tdata, data):
                logger.d('next_post_script %s %s' % (str(tdata), str(data)))
                # these post script return value is a tuple (ret, msg)
                # If ret is 0 the operation is right, otherwise the operation is wrong,
                # and msg is the error message
                if type(tdata) is str:
                    ret = -1
                    msg = tdata
                elif type(tdata) is int:
                    ret = tdata
                    msg = ''
                elif type(tdata) in (list, tuple) and len(tdata) == 2:
                    ret, msg = tdata
                else:
                    ret = -1
                    msg = 'Unknown error result %s' % tdata

                logger.d('next_post_script index %s func %s' %
                         (data, step_lst[data]))
                if ret != 0:
                    # dialog pop up to warning user and then run next step.
                    WarningDialog(self, msg, step_lst[data])
                    return
                else:
                    step_lst[data]()
Example #3
0
 def btnnext_clicked(self, widget, data):
     logger.d('btnnext_clicked in magicstep widget %s data %s substep %s' % (widget, data, self.substep))
     nextstep = ''
     if self.substep == self.substep_list[-1]:
         # if at end step, and click btnnext this stepgroup will leave, so check_leave_step-1 will be checked in stepgroup.leave method
         return 1
     if hasattr(self, 'check_leave_%s' % self.substep):
         if not eval('self.check_leave_%s()' % self.substep):
             return 0
     if hasattr(self, 'get_%s_next' % self.substep):
         nextstep = eval('self.get_%s_next()' % self.substep)
         if not nextstep:
             return 1 # Go to next toplevel-step.
     else:
         # Get next step. Notice nextstep variable is not a local var.
         curstep = ''
         for nextstep in self.substep_list:
             if curstep == self.substep:
                 break
             curstep = nextstep
     if hasattr(self, 'check_enter_%s' % nextstep):
         if not eval('self.check_enter_%s()' % nextstep):
             return 0
     self.subswitch(nextstep)
     return 0
Example #4
0
 def enter(self):
     logger.d('enter in magicstep substep %s' % self.substep)
     if hasattr(self, 'check_enter_%s' % self.substep):
         return eval('self.check_enter_%s()' % self.substep)
     # Always switch to substep_list.
     self.subswitch(self.substep_list[0])
     return 1
Example #5
0
 def btnnext_clicked(self, widget, data):
     logger.d('btnnext_clicked in magicstep widget %s data %s substep %s' %
              (widget, data, self.substep))
     nextstep = ''
     if self.substep == self.substep_list[-1]:
         # if at end step, and click btnnext this stepgroup will leave, so check_leave_step-1 will be checked in stepgroup.leave method
         return 1
     if hasattr(self, 'check_leave_%s' % self.substep):
         if not eval('self.check_leave_%s()' % self.substep):
             return 0
     if hasattr(self, 'get_%s_next' % self.substep):
         nextstep = eval('self.get_%s_next()' % self.substep)
         if not nextstep:
             return 1  # Go to next toplevel-step.
     else:
         # Get next step. Notice nextstep variable is not a local var.
         curstep = ''
         for nextstep in self.substep_list:
             if curstep == self.substep:
                 break
             curstep = nextstep
     if hasattr(self, 'check_enter_%s' % nextstep):
         if not eval('self.check_enter_%s()' % nextstep):
             return 0
     self.subswitch(nextstep)
     return 0
Example #6
0
 def init(self, step_id_list):
     for step in self.step_lst:
         self.sself.leftpanel.addstep(step.name)
     
     #### Init startup action
     for step in self.step_lst:
         if hasattr(step.obj, 'startup_action'):
             logger.d('init %s' % step.obj.startup_action)
             step.obj.startup_action()
Example #7
0
    def addstep(self, name):
        logger.d('addstep %s' % name)
        step = self.sself.steps.get_step_by_name(name)

        btn = StepButton('images/applet-blank.png', step.title)
        btn.connect('clicked', self.on_switch_to_page, name)

        self.btn_lst.append(btn)
        self.vbox.pack_start(btn, False, False)
Example #8
0
    def addstep(self, group, name):
        logger.d('addstep %s' % name)
        step = self.sself.steps.get_step_by_name(name)

        btn = StepButton('images/applet-blank.png', step.title)
        #btn.connect('clicked', self.on_switch_to_page, name)

        self.btn_lst.append([group, btn])

        self.xml_obj.id_map['step_box'].pack_start(btn, False, False)
Example #9
0
    def addstep(self, group, name):
        logger.d('addstep %s' % name)
        step = self.sself.steps.get_step_by_name(name)

        btn = StepButton('images/applet-blank.png', step.title)
        #btn.connect('clicked', self.on_switch_to_page, name)

        self.btn_lst.append([group, btn])

        self.xml_obj.id_map['step_box'].pack_start(btn, False, False)
Example #10
0
    def init(self):

        for step in self.step_lst:
            self.sself.leftpanel.addstep(self.get_step_group(step), step.name)

        #### Init startup action
        if not CF.D.DEBUG_GUI:
            for step in self.step_lst:
                if hasattr(step.obj, 'startup_action'):
                    logger.d('init %s' % step.obj.startup_action)
                    step.obj.startup_action()
Example #11
0
 def init(self):
     
     for step in self.step_lst:
         self.sself.leftpanel.addstep(self.get_step_group(step), step.name)
     
     #### Init startup action
     if not CF.D.DEBUG_GUI:
         for step in self.step_lst:
             if hasattr(step.obj, 'startup_action'):
                 logger.d('init %s' % step.obj.startup_action)
                 step.obj.startup_action()
Example #12
0
 def btnback_clicked(self, widget, data):
     logger.d('btnback_clicked in magicstep widget %s data %s substep %s' % (widget, data, self.substep))
     if self.substep == self.substep_list[0]:
         # if at first step, and click btnback this stepgroup will leave, so check_leave_step0 will be checked in stepgroup.leave method
         return 1
     if hasattr(self, 'check_leave_%s' % self.substep):
         if not eval('self.check_leave_%s()' % self.substep):
             return 0
     prevstep = ''
     for curstep in self.substep_list:
         if curstep == self.substep:
             break
         prevstep = curstep
     if hasattr(self, 'check_enter_%s' % prevstep):
         if not eval('self.check_enter_%s()' % prevstep):
             return 0
     self.subswitch(prevstep)
     return 0
Example #13
0
 def btnback_clicked(self, widget, data):
     logger.d('btnback_clicked in magicstep widget %s data %s substep %s' %
              (widget, data, self.substep))
     if self.substep == self.substep_list[0]:
         # if at first step, and click btnback this stepgroup will leave, so check_leave_step0 will be checked in stepgroup.leave method
         return 1
     if hasattr(self, 'check_leave_%s' % self.substep):
         if not eval('self.check_leave_%s()' % self.substep):
             return 0
     prevstep = ''
     for curstep in self.substep_list:
         if curstep == self.substep:
             break
         prevstep = curstep
     if hasattr(self, 'check_enter_%s' % prevstep):
         if not eval('self.check_enter_%s()' % prevstep):
             return 0
     self.subswitch(prevstep)
     return 0
Example #14
0
 def next_post_script(tdata, data):
     logger.d('next_post_script %s %s' % (str(tdata), str(data)))
     # these post script return value is a tuple (ret, msg)
     # If ret is 0 the operation is right, otherwise the operation is wrong, 
     # and msg is the error message
     if type(tdata) is str:
         ret = -1
         msg = tdata
     elif type(tdata) is int:
         ret = tdata
         msg = ''
     elif type(tdata) in (list, tuple) and len(tdata) == 2:
         ret, msg = tdata
     else:
         ret = -1
         msg = 'Unknown error result %s' % tdata
         
     logger.d('next_post_script index %s func %s' % (data, step_lst[data]))
     if ret != 0:
         # dialog pop up to warning user and then run next step.
         WarningDialog(self, msg, step_lst[data])
         return
     else:
         step_lst[data]()
Example #15
0
 def subswitch(self, substep):
     logger.d('subswitch substep: %s, self.substep: %s' % (substep, self.substep))
     if substep != self.substep:
         if not self.name_map.has_key(substep):
             logger.w("%s step is not in UIxml, please fill it yourself, and check it work" % substep)
             self.substep = substep
             return
         if self.name_map.has_key(self.substep):
             logger.d('hide %s' % self.substep)
             self.name_map[self.substep].hide()
         self.name_map[substep].show()
         logger.d('show %s' % substep)
         if hasattr(self, 'switch_%s_%s' % (self.substep, substep)):
             eval('self.switch_%s_%s()' % (self.substep, substep))
         self.substep = substep
Example #16
0
 def subswitch(self, substep):
     logger.d('subswitch substep: %s, self.substep: %s' %
              (substep, self.substep))
     if substep != self.substep:
         if not self.name_map.has_key(substep):
             logger.w(
                 "%s step is not in UIxml, please fill it yourself, and check it work"
                 % substep)
             self.substep = substep
             return
         if self.name_map.has_key(self.substep):
             logger.d('hide %s' % self.substep)
             self.name_map[self.substep].hide()
         self.name_map[substep].show()
         logger.d('show %s' % substep)
         if hasattr(self, 'switch_%s_%s' % (self.substep, substep)):
             eval('self.switch_%s_%s()' % (self.substep, substep))
         self.substep = substep
Example #17
0
 def leave(self):
     logger.d('leave in magicstep substep %s' % self.substep)
     if hasattr(self, 'check_leave_%s' % self.substep):
         return eval('self.check_leave_%s()' % self.substep)
     return 1
Example #18
0
 def cb_pop_leftpanel(self):
     logger.d('cb_pop_leftpanel')
     return self.leftpanel.pop()
Example #19
0
 def check_leave_doactions(self):
     logger.d('check_leave_doactions')
     self.rootobj.cb_pop_leftpanel()
     self.rootobj.cb_pop_rightpanel()
     return 1
Example #20
0
 def cb_push_rightpanel(self, widget):
     logger.d('cb_push_rightpanel rightpanel.stash_stack.len %s' %
              len(self.rightpanel.stash_stack))
     self.rightpanel.push(widget)
Example #21
0
 def cb_push_rightpanel(self, widget):
     logger.d('cb_push_rightpanel rightpanel.stash_stack.len %s' % len(self.rightpanel.stash_stack))
     self.rightpanel.push(widget)
Example #22
0
 def leave(self):
     logger.d('leave in magicstep substep %s' % self.substep)
     if hasattr(self, 'check_leave_%s' % self.substep):
         return eval('self.check_leave_%s()' % self.substep)
     return 1
Example #23
0
 def cb_pop_rightpanel(self):
     logger.d('cb_pop_rightpanel')
     return self.rightpanel.pop()
Example #24
0
 def cb_pop_leftpanel(self):
     logger.d('cb_pop_leftpanel')
     return self.leftpanel.pop()
Example #25
0
 def cb_push_leftpanel(self, widget):
     logger.d('cb_push_leftpanel')
     self.leftpanel.push(widget)
Example #26
0
 def cb_pop_rightpanel(self):
     logger.d('cb_pop_rightpanel')
     return self.rightpanel.pop()
Example #27
0
    def leave(self):
        logger.d('install_finished %s setup_finished %s entered %s' %
                 (self.install_finished, self.setup_finished, self.entered))
        if not self.install_finished:
            return 0
        elif not self.setup_finished:
            self.rootobj.btnnext_sensitive(False)
            self.name_map['frame_other'].set_sensitive(True)
            self.rootobj.tm.push_progress(self.name_map['otprog'],
                                          self.name_map['otname'])

            # set modprobe.conf
            scsi_module_list = self.get_data(self.values, 'scsi.modules')
            if scsi_module_list == None or scsi_module_list == '':
                logger.w(
                    'No scsi driver has to be written into modprobe.conf.\n')
            else:
                logger.i('scsi_modprobe_conf(%s)\n' % scsi_module_list)
                self.add_action(_("Generate modprobe.conf"), None, None,
                                'scsi_modprobe_conf', scsi_module_list)

            step_lst = []

            class WarningDialog(magicpopup.magicmsgbox):
                def __init__(self, sself, msg, next_func):
                    self.sself = sself
                    self.next_func = next_func
                    magicpopup.magicmsgbox.__init__(
                        self, self, msg, magicpopup.magicmsgbox.MB_WARNING,
                        magicpopup.magicpopup.MB_IGNORE
                        | magicpopup.magicmsgbox.MB_REBOOT, '')

                def reboot_clicked(self, widget, data):
                    self.sself.reboot_clicked(widget, data)
                    self.closedialog()

                def ignore_clicked(self, widget, data):
                    self.next_func()
                    self.closedialog()

            def next_post_script(tdata, data):
                logger.d('next_post_script %s %s' % (str(tdata), str(data)))
                # these post script return value is a tuple (ret, msg)
                # If ret is 0 the operation is right, otherwise the operation is wrong,
                # and msg is the error message
                if type(tdata) is str:
                    ret = -1
                    msg = tdata
                elif type(tdata) is int:
                    ret = tdata
                    msg = ''
                elif type(tdata) in (list, tuple) and len(tdata) == 2:
                    ret, msg = tdata
                else:
                    ret = -1
                    msg = 'Unknown error result %s' % tdata

                logger.d('next_post_script index %s func %s' %
                         (data, step_lst[data]))
                if ret != 0:
                    # dialog pop up to warning user and then run next step.
                    WarningDialog(self, msg, step_lst[data])
                    return
                else:
                    step_lst[data]()

            def step0_0():
                # mount target system
                self.add_action(
                    _('Mount Target System'),
                    next_post_script,
                    1,
                    'mount_tgtsys',
                    CF.G.
                    mount_all_list,  # partition list [(mntpoint, devfn, fstype), ...] , be filled at partition step.
                )

            step_lst.append(step0_0)

            def step0():
                # generate fstab
                logger.i('do_genfstab')
                self.add_action(_('Generate fstab'), next_post_script, 2,
                                'do_genfstab', 0)

            step_lst.append(step0)

            def step1():
                # make initrd
                logger.i('do_mkinitrd')
                self.add_action(_('Make initrd'), next_post_script, 3,
                                'do_mkinitrd', 0)

            step_lst.append(step1)

            def step2():
                # set bootloader
                logger.i('setup_' + CF.BOOTLDR.bltype)
                self.add_action(_('Setup bootloader'), next_post_script, 4,
                                'setup_' + CF.BOOTLDR.bltype,
                                CF.BOOTLDR.timeout, CF.BOOTLDR.usepassword,
                                CF.BOOTLDR.password, CF.BOOTLDR.lba,
                                CF.BOOTLDR.options, CF.BOOTLDR.entries,
                                CF.BOOTLDR.default, CF.BOOTLDR.instpos,
                                CF.BOOTLDR.bootdev, CF.BOOTLDR.mbr_device,
                                CF.BOOTLDR.win_device, CF.BOOTLDR.win_fs)

            step_lst.append(step2)

            def step3():
                # setup account
                logger.i('action_accounts')
                self.rootobj.tm.add_action(_('Setup accounts'),
                                           next_post_script, 5,
                                           'setup_accounts',
                                           CF.ACCOUNT.rootpasswd,
                                           CF.ACCOUNT.acclist)

            step_lst.append(step3)

            def step4():
                # run post install script
                self.tm.add_action(_('Run post install script'),
                                   next_post_script, 6, 'run_post_install', 0)

            step_lst.append(step4)

            def step4_0():
                # backup log files
                self.tm.add_action(_('Backup MI log files'), next_post_script,
                                   7, 'backup_mi_logfiles', 0)

            step_lst.append(step4_0)

            def step4_1():
                self.add_action(
                    _('Mount Target System'),
                    self.do_setup_finished,
                    None,
                    'umount_tgtsys',
                    CF.G.
                    mount_all_list,  # partition list [(mntpoint, devfn, fstype), ...] , be filled at partition step.
                )

            step_lst.append(step4_1)
            step_lst[0]()
            return 0
        if not self.entered:
            return 0
        return 1
Example #28
0
 def switch(self, from_id, to_id):
     logger.d('leftpanel.switch: %s, %s' % (from_id, to_id))
     if from_id >= 0:
         self.btn_lst[from_id][1].change_image('images/applet-okay.png')
     self.btn_lst[to_id][1].change_image('images/applet-busy.png')
Example #29
0
 def leave(self):
     logger.d('install_finished %s setup_finished %s entered %s' % (self.install_finished, self.setup_finished, self.entered))
     if not self.install_finished:
         return 0
     elif not self.setup_finished:
         self.rootobj.btnnext_sensitive(False)
         self.name_map['frame_other'].set_sensitive(True)
         self.rootobj.tm.push_progress(self.name_map['otprog'],
                                       self.name_map['otname'])
         
         # set modprobe.conf
         scsi_module_list = self.get_data(self.values, 'scsi.modules')
         if scsi_module_list == None or scsi_module_list == '':
             logger.w('No scsi driver has to be written into modprobe.conf.\n')
         else:
             logger.i('scsi_modprobe_conf(%s)\n' % scsi_module_list)
             self.add_action(_("Generate modprobe.conf"), None, None,
                             'scsi_modprobe_conf', scsi_module_list)
         
         step_lst = []
             
         class WarningDialog(magicpopup.magicmsgbox):
             def __init__(self, sself, msg, next_func):
                 self.sself = sself
                 self.next_func = next_func
                 magicpopup.magicmsgbox.__init__(self, self,
                       msg,
                       magicpopup.magicmsgbox.MB_WARNING,
                       magicpopup.magicpopup.MB_IGNORE|magicpopup.magicmsgbox.MB_REBOOT,
                       '')
             def reboot_clicked(self, widget, data):
                 self.sself.reboot_clicked(widget, data)
                 self.closedialog()
                 
             def ignore_clicked(self, widget, data):
                 self.next_func()
                 self.closedialog()
                 
         def next_post_script(tdata, data):
             logger.d('next_post_script %s %s' % (str(tdata), str(data)))
             # these post script return value is a tuple (ret, msg)
             # If ret is 0 the operation is right, otherwise the operation is wrong, 
             # and msg is the error message
             if type(tdata) is str:
                 ret = -1
                 msg = tdata
             elif type(tdata) is int:
                 ret = tdata
                 msg = ''
             elif type(tdata) in (list, tuple) and len(tdata) == 2:
                 ret, msg = tdata
             else:
                 ret = -1
                 msg = 'Unknown error result %s' % tdata
                 
             logger.d('next_post_script index %s func %s' % (data, step_lst[data]))
             if ret != 0:
                 # dialog pop up to warning user and then run next step.
                 WarningDialog(self, msg, step_lst[data])
                 return
             else:
                 step_lst[data]()
                 
         def step0_0():
             # mount target system
             self.add_action(_('Mount Target System'),
                     next_post_script, 1,
                     'mount_tgtsys', CF.G.mount_all_list,    # partition list [(mntpoint, devfn, fstype), ...] , be filled at partition step.
                         )
         step_lst.append(step0_0)
         
         def step0():
             # generate fstab
             logger.i('do_genfstab')
             self.add_action(_('Generate fstab'), next_post_script, 2, 'do_genfstab', 0)
         step_lst.append(step0)
         
         def step1():
             # make initrd
             logger.i('do_mkinitrd')
             self.add_action(_('Make initrd'), next_post_script, 3, 'do_mkinitrd', 0)
         step_lst.append(step1)    
         
         def step2():
             # set bootloader
             logger.i('setup_' + CF.BOOTLDR.bltype)
             self.add_action(_('Setup bootloader'), next_post_script, 4,
                             'setup_' + CF.BOOTLDR.bltype, CF.BOOTLDR.timeout, CF.BOOTLDR.usepassword, CF.BOOTLDR.password,
                             CF.BOOTLDR.lba, CF.BOOTLDR.options, CF.BOOTLDR.entries, CF.BOOTLDR.default, CF.BOOTLDR.instpos, 
                             CF.BOOTLDR.bootdev, CF.BOOTLDR.mbr_device, CF.BOOTLDR.win_device, CF.BOOTLDR.win_fs)
         step_lst.append(step2)
         
         def step3():
             # setup account
             logger.i('action_accounts')
             self.rootobj.tm.add_action(_('Setup accounts'), next_post_script, 5,
                                        'setup_accounts', CF.ACCOUNT.rootpasswd, CF.ACCOUNT.acclist)
         step_lst.append(step3)
         
         def step4():
             # run post install script
             self.tm.add_action(_('Run post install script'), next_post_script, 6,
                                    'run_post_install', 0)    
         step_lst.append(step4)
         def step4_0():
             # backup log files
             self.tm.add_action(_('Backup MI log files'), next_post_script, 7,
                                    'backup_mi_logfiles', 0)
         step_lst.append(step4_0)
         def step4_1():
             self.add_action(_('Mount Target System'),
                     self.do_setup_finished, None,
                     'umount_tgtsys', CF.G.mount_all_list,    # partition list [(mntpoint, devfn, fstype), ...] , be filled at partition step.
                         )
         step_lst.append(step4_1)
         step_lst[0]()
         return 0
     if not self.entered:
         return 0
     return 1
Example #30
0
 def switch(self, from_id, to_id):
     logger.d('leftpanel.switch: %s, %s' % (from_id, to_id))
     if from_id >= 0: self.btn_lst[from_id][1].change_image('images/applet-okay.png')
     self.btn_lst[to_id][1].change_image('images/applet-busy.png')
Example #31
0
 def cb_push_leftpanel(self, widget):
     logger.d('cb_push_leftpanel')
     self.leftpanel.push(widget)