Exemple #1
0
 def dispatch(self, *args):
     no_err = True
     self.lock.acquire()
     task_info = self.task_info_map[self.cur_tmid]
     
     # optional record
     #self.task_grp_info[task_info['grp_name']]['last_result'] = args
     # handle with this task's result
     self.lock.release()
     if callable(task_info['task'].rcfunc):
         ret = task_info['task'].rcfunc(*args)
     else:
         ret = 'quit'
     if type(ret) is str:
         if ret == 'quit':
             # quit current task group, do next task group
             self.cur_grp_name = None
         else:
             raise Exception('Not Support', 'Unknow ret %s' % ret)
     elif len(ret) == 2:
         valid, task_or_msg = ret
         if valid or valid == 'continue':
             # add a task
             if isinstance(task_or_msg, MiTask):
                 self.add_task(task_info['grp_name'], task_or_msg, False)
             else:
                 # ??
                 pass
         else:
             # occur error show error message
             class BoxMsgHandler(object):
                 def __init__(self, sself):
                     self.sself = sself
                 def yes_clicked(self, widget, data):
                     # quit program
                     data.topwin.destroy()
                     gtk.main_quit()
                     
                 def ignore_clicked(self, widget, data):
                     # continue next task
                     data.topwin.destroy()
                     self.sself.lock.acquire()
                     self.sself._run_next_task()
                     self.sself.lock.release()
                     
             magicpopup.magicmsgbox(BoxMsgHandler(self), _("Occur error! Click Yes to quit installation!\nTask(%s) Group(%s)\nERROR:%s" % (self.task_info_map[self.cur_tmid]['task'].describe, self.cur_grp_name, task_or_msg)), 
                                    magicpopup.magicmsgbox.MB_ERROR, 
                                    magicpopup.magicpopup.MB_YES|magicpopup.magicpopup.MB_IGNORE)
             no_err = False
     else:
         raise Exception('Not Support', 'Unknow ret %s' % ret)
     
     self.lock.acquire()
     self.cur_tmid = None
     if no_err:
         self._run_next_task()
     self.lock.release()
Exemple #2
0
def mount_tgtsys(mia, operid, tgtsys_devinfo):
    dolog('mount_tgtsys %s' % repr(tgtsys_devinfo))
    global dev_tgt # the target system devices.
    logger.d('######### Mount target system (please check the umount point) #############')            
    dev_tgt = MiDevice_TgtSys(tgtsys_devinfo)
    if not dev_tgt.mount_tgt_device(): #### NOTE: carefully handle this device's mount.
        msg = _('Mount target system devices Failed, install operate can not continue!!!')
        logger.e(msg)
        dev_tgt = None
        return msg
    return 0