Example #1
0
    def check_leave_bootlist(self):
        self.fetch_values(self.rootobj.values)
        instpos = self.get_data(self.values, 'bootloader.instpos')
        win_device = self.get_data(self.values, 'bootloader.win_device')
        if win_device:
            for dev, os_type in CF.G.win_probe_result:
                if dev == win_device:
                    break
            else:
                magicpopup.magicmsgbox(
                    None,
                    _('%s is not a Windows partition.') % win_device,
                    magicpopup.magicmsgbox.MB_ERROR,
                    magicpopup.magicpopup.MB_OK)
                return 0
            if instpos == 'win' and os_type != 'winnt':
                magicpopup.magicmsgbox(
                    None,
                    _('Cannot install grldr: %s does not contain ntldr.') %
                    win_device, magicpopup.magicmsgbox.MB_ERROR,
                    magicpopup.magicpopup.MB_OK)
                return 0
        elif instpos == 'win':
            magicpopup.magicmsgbox(None, _('Windows partition is empty.'),
                                   magicpopup.magicmsgbox.MB_ERROR,
                                   magicpopup.magicpopup.MB_OK)
            return 0

        self.backup_entrylist()
        return 1
Example #2
0
 def remove_entry(self, widget, data):
     (model, iter) = self.name_map['bootlist_treeview'].get_selection().get_selected()
     if not iter:
         magicpopup.magicmsgbox(None,
                                _('Please choose an entry to remove.'),
                                magicpopup.magicmsgbox.MB_ERROR,
                                magicpopup.magicpopup.MB_OK)
         return
     device = model.get_value(iter, 2)
     if device == CF.G.root_device:
         magicpopup.magicmsgbox(None,
                                _('Please do not remove the entry to boot the installed system.'),
                                magicpopup.magicmsgbox.MB_ERROR,
                                magicpopup.magicpopup.MB_OK)
         return
     else:
         self.restore_dos = None
     default = model.get_value(iter, 3)
     self.list_remove('bootloader.entrylist', iter)
     iter = model.get_iter_first()
     while iter:
         device = model.get_value(iter, 2)
         if device == CF.G.root_device:
             model.set_value(iter, 0, self.get_pixbuf_map('images/yes.png'))
             model.set_value(iter, 3, 'true')
             break
         iter = model.iter_next(iter)
Example #3
0
 def enter(self):
     if CF.G.pkgarr_probe_status != STAT.OP_STATUS_DONE:
         magicpopup.magicmsgbox(None, _('Please wait a while for the search of package arrangement information.'),
                                magicpopup.magicmsgbox.MB_INFO,
                                magicpopup.magicpopup.MB_OK)
         return 0
     if len(CF.G.pkgarr_probe_result) == 0:
         magicpopup.magicmsgbox(None, _('Not any package arrangement information can be found!\nPlease return to the parted step to check your setup.'),
                                magicpopup.magicmsgbox.MB_ERROR,
                                magicpopup.magicpopup.MB_OK)
         return 0
     if len(CF.G.pkgarr_probe_result) > 1:
         dolog("CF.G.pkgarr_probe_result: %s" % CF.G.pkgarr_probe_result)
         popup = 'true'
         if self.pa_choose:
             for result in CF.G.pkgarr_probe_result:
                 if self.pa_choose == result[0]:
                     popup = None
                     break
         if popup:
             self.popup_srcpos_dialog()
     else:
         if not self.tryload_file(CF.G.pkgarr_probe_result[0]):
             magicpopup.magicmsgbox(None,
                                    _('Load the only package arrangement failed!\nPlease return to the parted step to check your step.'),
                                    magicpopup.magicmsgbox.MB_ERROR,
                                    magicpopup.magicpopup.MB_OK)
             return 0
     return 1
Example #4
0
 def act_instpkg_disc_start(self, tdata, disc_no):
     if tdata != 0:
         pass #### occur error, tdata is the error msg
     if self.discdlg_open_time > 0:
         # Do adjustment to omit the influence of replace disc.
         self.starttime = self.starttime + \
                          (time.time() - self.discdlg_open_time)
         self.discdlg_open_time = -1
     (pafile, dev, fstype, reldir, bootiso_relpath) =  CF.G.choosed_patuple
     while disc_no < len(CF.G.arrangement):
         if not self.install_allpkg and not self.disk_map.has_key(disc_no):
             # Skip the disc which is not needed.
             disc_no = disc_no + 1
             continue
         dolog("probe_all_disc_result: %s" % self.probe_all_disc_result)
         if disc_no >= len(self.probe_all_disc_result) \
                or not self.probe_all_disc_result[disc_no]:
             #### multi disc, whether it can get here???
             self.cur_disc_no = disc_no
             msgtxt = _("Can't find packages in disc %d.\nIf you are using CDROM to install system, it is the chance to eject the original disc and insert the %d disc.")
             msgtxt = msgtxt % (disc_no + 1, disc_no + 1)
             self.discdlg_open_time = time.time()
             DiscDialog(self, self.uixmldoc, msgtxt, 'disc.dialog')
             return
         bootiso_relpath = self.probe_all_disc_result[disc_no][0]
         self.add_action(None,
                         self.act_instpkg_pkg_start, (disc_no, 0),
                         'instpkg_disc_prep', dev, reldir, fstype, bootiso_relpath)
         return
     self.add_action(_('Last operations for package installation'),
                     self.nextop, None,
                     'instpkg_post', dev, reldir, fstype)
Example #5
0
    def __init__(self, sself, *args, **kw):
        gtk.HBox.__init__(self, *args, **kw)
        self.sself = sself
        
        self.logger = gtk.Button()
        self.logger.add(self.img_label_box('images/stock_help_24.png', _('Logger')))
        self.theme = gtk.Button()
        self.theme.add(self.img_label_box('images/gnome-ccthemes-24.png', _('Theme')))
        self.help = gtk.Button()
        self.help.add(self.img_label_box('images/stock_help_24.png', _('Help')))
        self.back = gtk.Button()
        self.back.add(self.img_label_box('images/stock_left_arrow_24.png', _('Back')))
        self.next = gtk.Button()
        self.next.add(self.img_label_box('images/stock_right_arrow_24.png', _('Next')))

        self.set_border_width(4)
        self.set_spacing(4)
        self.pack_start(self.logger, False, True)
        self.pack_start(self.theme, False, True)
        self.pack_start(self.help, False, True)
        
        self.pack_end(self.next, False, True)
        self.pack_end(self.back, False, True)
        
        self.logger.connect('clicked', self.on_logger_clicked, None)
        self.theme.connect('clicked', self.on_theme_clicked, None)
        self.help.connect('clicked', self.on_help_clicked, None)
        self.back.connect('clicked', self.on_back_clicked, None)
        self.next.connect('clicked', self.on_next_clicked, None)
Example #6
0
 def check_leave_others(self):
     self.fetch_values(self.rootobj.values)
     ulnode = self.srh_data_node(self.values, 'accounts.userlist')
     all_username = {}
     all_uid = {}
     for rownode in ulnode.getElementsByTagName('row'):
         username = rownode.getAttribute('c0')
         if all_username.has_key(username):
             # TO TRANSLATOR: Do not translate %FIRST.
             errtxt = _("Two user share the same username '%s'.")
             errtxt = errtxt % username
             magicpopup.magicmsgbox(None, errtxt,
                                    magicpopup.magicmsgbox.MB_ERROR,
                                    magicpopup.magicmsgbox.MB_OK)
             return 0
         all_username[username] = 'y'
         uid = rownode.getAttribute('c4')
         if uid == 'Auto':
             continue
         if all_uid.has_key(uid):
             errtxt = _("The custom uid is conflict between '%s' and '%s'.")
             errtxt = errtxt % (all_uid[uid], rownode.getAttribute('c0'))
             magicpopup.magicmsgbox(None, errtxt,
                                    magicpopup.magicmsgbox.MB_ERROR,
                                    magicpopup.magicmsgbox.MB_OK)
             return 0
         all_uid[uid] = rownode.getAttribute('c0')
     return 1
Example #7
0
 def check_leave_bootlist(self):
     self.fetch_values(self.rootobj.values)
     instpos = self.get_data(self.values, 'bootloader.instpos')
     win_device = self.get_data(self.values, 'bootloader.win_device')
     if win_device:
         for dev, os_type in CF.G.win_probe_result:
             if dev == win_device:
                 break
         else:
             magicpopup.magicmsgbox(None,
                                    _('%s is not a Windows partition.') % win_device,
                                    magicpopup.magicmsgbox.MB_ERROR,
                                    magicpopup.magicpopup.MB_OK)
             return 0
         if instpos == 'win' and os_type != 'winnt':
             magicpopup.magicmsgbox(None,
                                    _('Cannot install grldr: %s does not contain ntldr.') % win_device,
                                    magicpopup.magicmsgbox.MB_ERROR,
                                    magicpopup.magicpopup.MB_OK)
             return 0
     elif instpos == 'win':
         magicpopup.magicmsgbox(None,
                                _('Windows partition is empty.'), 
                                magicpopup.magicmsgbox.MB_ERROR,
                                magicpopup.magicpopup.MB_OK)
         return 0            
         
     self.backup_entrylist()
     return  1
Example #8
0
 def check_leave_others(self):
     self.fetch_values(self.rootobj.values)
     ulnode = self.srh_data_node(self.values, 'accounts.userlist')
     all_username = {}
     all_uid = {}
     for rownode in ulnode.getElementsByTagName('row'):
         username = rownode.getAttribute('c0')
         if all_username.has_key(username):
             # TO TRANSLATOR: Do not translate %FIRST.
             errtxt = _("Two user share the same username '%s'.")
             errtxt = errtxt % username
             magicpopup.magicmsgbox(None, errtxt,
                                    magicpopup.magicmsgbox.MB_ERROR,
                                    magicpopup.magicmsgbox.MB_OK)
             return 0
         all_username[username] = 'y'
         uid = rownode.getAttribute('c4')
         if uid == 'Auto':
             continue
         if all_uid.has_key(uid):
             errtxt = _("The custom uid is conflict between '%s' and '%s'.")
             errtxt = errtxt % (all_uid[uid], rownode.getAttribute('c0'))
             magicpopup.magicmsgbox(None, errtxt,
                                    magicpopup.magicmsgbox.MB_ERROR,
                                    magicpopup.magicmsgbox.MB_OK)
             return 0
         all_uid[uid] = rownode.getAttribute('c0')
     return 1
Example #9
0
def format_partition(mia, operid, devpath, part_start, fstype):
    logger.d('format_partition device: %s partition start: %s fstype: %s' % (devpath, part_start, fstype))
    mia.set_step(operid, 0, -1)
    if not CF.D.FSTYPE_MAP.has_key(fstype):
        errmsg = _('Unrecoginzed filesystem %s.')
        return errmsg % fstype
    if CF.D.FSTYPE_MAP[fstype][1] == '':
        errmsg = _('Format %s is not supported.')
        return errmsg % fstype
    if not CF.S.all_harddisks.has_key(devpath):
        return _('No such device: ') + devpath
    disk = CF.S.all_harddisks[devpath][1]
    if not disk:
        return _('Not any partition table found on: ') + devpath

    part = disk.getFirstPartition()
    while part:
        if part.geometry.start != part_start:
            part = part.nextPartition()
            continue
        if CF.D.FSTYPE_MAP[fstype][1] == 'internal':
            parted_fstype = parted.fileSystemType[revision_fstype(fstype)]
            try:
                part.getPedPartition().set_system(parted_fstype)
                logger.d('Create internal fstype %s on device %s partition start %s' % (fstype, devpath, part_start))
                part.fileSystem.create()
                disk.commit()
                logger.d('Create internal partition complete!')
            except NotImplementedError, errmsg:
                return  str(errmsg)
            except parted.DiskException as errmsg:
                return  str(errmsg)
            return  0
Example #10
0
 def remove_entry(self, widget, data):
     (model, iter
      ) = self.name_map['bootlist_treeview'].get_selection().get_selected()
     if not iter:
         magicpopup.magicmsgbox(None,
                                _('Please choose an entry to remove.'),
                                magicpopup.magicmsgbox.MB_ERROR,
                                magicpopup.magicpopup.MB_OK)
         return
     device = model.get_value(iter, 2)
     if device == CF.G.root_device:
         magicpopup.magicmsgbox(
             None,
             _('Please do not remove the entry to boot the installed system.'
               ), magicpopup.magicmsgbox.MB_ERROR,
             magicpopup.magicpopup.MB_OK)
         return
     else:
         self.restore_dos = None
     default = model.get_value(iter, 3)
     self.list_remove('bootloader.entrylist', iter)
     iter = model.get_iter_first()
     while iter:
         device = model.get_value(iter, 2)
         if device == CF.G.root_device:
             model.set_value(iter, 0, self.get_pixbuf_map('images/yes.png'))
             model.set_value(iter, 3, 'true')
             break
         iter = model.iter_next(iter)
Example #11
0
 def try_format(devn, id_):
     # Wait for device block appear.
     fblk = False
     time.sleep(1)
     # We attemp to detect device file whether exists
     for trycnt in range(10):
         # os.path.exists cannot detect file exists real time
         #if os.path.exists(devn):
         if os.system('ls %s' % devn) == 0:
             fblk = True
             break
         else:
             time.sleep(1)
             
     if not fblk:
         msg = _('Not exists device block on %s: \ntry time: %d\n') % (devpath, trycnt)
         logger.w(msg)
         return msg
     else:
         logger.d('try_format %s ls device %s time' % (id_, trycnt))
     # Run command to format partition
     cmd_format = CF.D.FSTYPE_MAP[fstype][1]
     cmd_f_list = cmd_format.split()
     cmd = cmd_f_list[0]
     argv = cmd_f_list[1:]
     argv.append(devn)
     cmdres = run_bash(cmd, argv)
     logger.d('%s %s' % (cmd, ' '.join(argv)))
     logger.d(' '.join(cmdres['out']))
     if cmdres['ret'] != 0:
         errmsg = _('Run "%s %s" failed: %s\ntry time: %d\n')
         return  errmsg % ( cmd, ' '.join(argv), str(cmdres['err']), trycnt )
     else:
         return  0
Example #12
0
    def enter(self):
        if CF.G.skipxsetting:
            if not self.gen_x_settings():
                magicpopup.magicmsgbox(None,
                                   _('Failed to collect the information about Xwindow configuration.'),
                                   magicpopup.magicmsgbox.MB_ERROR,
                                   magicpopup.magicpopup.MB_OK)
                # Continue anyway.
                #return 0
            self.rootobj.tm.add_action(_('Generate Xwindow configuration'),
                                     None, None, 'gen_x_config', self.x_settings)
            self.rootobj.tm.add_action(_('Backup Xwindow configuration files'),
                                     None, None, 'backup_xconfig', 0)

        self.rootobj.btnback_sensitive(False)
        self.rootobj.btnnext_sensitive(False)

        dolog('action_accounts\n')
        rootpasswd = self.get_data(self.values, 'accounts.root.password')
        acclist = []
        accnode = self.srh_data_node(self.values, 'accounts.userlist')
        for node in accnode.getElementsByTagName('row'):
            acclist.append((node.getAttribute('c0'), # Username.
                            node.getAttribute('c1'), # Password.
                            node.getAttribute('c2'), # Shell.
                            node.getAttribute('c3'), # Home directory.
                            node.getAttribute('c4'))) # Real UID or 'Auto'.
        dolog('%s\n' % 'setup_accounts') #str(('setup_accounts', rootpasswd, acclist)))

        self.rootobj.tm.add_action(_('Setup accounts'), self.doshort, None,
                                   'setup_accounts', rootpasswd, acclist)

        return  1
Example #13
0
 def enter(self):
     if CF.G.pkgarr_probe_status != STAT.OP_STATUS_DONE:
         magicpopup.magicmsgbox(
             None,
             _('Please wait a while for the search of package arrangement information.'
               ), magicpopup.magicmsgbox.MB_INFO,
             magicpopup.magicpopup.MB_OK)
         return 0
     if len(CF.G.pkgarr_probe_result) == 0:
         magicpopup.magicmsgbox(
             None,
             _('Not any package arrangement information can be found!\nPlease return to the parted step to check your setup.'
               ), magicpopup.magicmsgbox.MB_ERROR,
             magicpopup.magicpopup.MB_OK)
         return 0
     if len(CF.G.pkgarr_probe_result) > 1:
         popup = True
         if self.pa_choose:
             for result in CF.G.pkgarr_probe_result:
                 if self.pa_choose == result[0]:
                     popup = False
                     break
         if popup:
             self.popup_srcpos_dialog()
     else:
         if not self.tryload_file(CF.G.pkgarr_probe_result[0]):
             magicpopup.magicmsgbox(
                 None,
                 _('Load the only package arrangement failed!\nPlease return to the parted step to check your step.'
                   ), magicpopup.magicmsgbox.MB_ERROR,
                 magicpopup.magicpopup.MB_OK)
             return 0
     return 1
Example #14
0
 def startup_action(self):
     self.rootobj.tm.add_action(_('Probe Monitor'), self.probe_monitor_ok,
                                None, 'probe_monitor', 0)
     self.rootobj.tm.add_action(_('Probe VideoCard'),
                                self.probe_videocard_ok, None,
                                'probe_videocard', 0)
     self.rootobj.tm.add_action(_('Probe Mouse'), self.probe_mouse_ok, None,
                                'probe_mouse', 0)
Example #15
0
 def startup_action(self):
     self.rootobj.tm.add_action(_('Probe windows partition', None, None, 'pkgarr_probe', ''))
     
     CF.G.pkgarr_probe_status = STAT.OP_STATUS_DOING
     if not os.path.isdir(CF.G.path_allpa):
         os.makedirs(CF.G.path_allpa)
     self.rootobj.tm.add_action(_('Search package information'),
                                self.got_pkgarr_probe_result, None,
                                'pkgarr_probe', CF.G.all_orig_part)
Example #16
0
 def startup_action(self):
     self.rootobj.tm.add_action(_('Probe Monitor'),
                                self.probe_monitor_ok, None,
                                'probe_monitor', 0)
     self.rootobj.tm.add_action(_('Probe VideoCard'),
                                self.probe_videocard_ok, None,
                                'probe_videocard', 0)
     self.rootobj.tm.add_action(_('Probe Mouse'),
                                self.probe_mouse_ok, None,
                                'probe_mouse', 0)
Example #17
0
 def test_x_settings_result(self, tdata, data):
     result = tdata
     print 'test_x_settings:', result
     if result == 'SUCCESS':
         magicpopup.magicmsgbox(None, _('Success!'),
                                magicpopup.magicmsgbox.MB_INFO,
                                magicpopup.magicpopup.MB_OK)
     else:
         magicpopup.magicmsgbox(None, _(result),
                                magicpopup.magicmsgbox.MB_ERROR,
                                magicpopup.magicpopup.MB_OK)
Example #18
0
 def leave(self):
     if not magicstep.magicstepgroup.leave(self):  return 0
     if not self.gen_x_settings():
         magicpopup.magicmsgbox(None,
                                _('Failed to collect the information about Xwindow configuration.'),
                                magicpopup.magicmsgbox.MB_ERROR,
                                magicpopup.magicpopup.MB_OK)
         return  0
     self.rootobj.tm.add_action(_('Generate Xwindow configuration'),
                                  None, None, 'gen_x_config', self.x_settings)
     return  1
Example #19
0
 def test_x_settings_result(self, tdata, data):
     result = tdata
     print 'test_x_settings:', result
     if result == 'SUCCESS':
         magicpopup.magicmsgbox(None, _('Success!'),
                                magicpopup.magicmsgbox.MB_INFO,
                                magicpopup.magicpopup.MB_OK)
     else:
         magicpopup.magicmsgbox(None, _(result),
                                magicpopup.magicmsgbox.MB_ERROR,
                                magicpopup.magicpopup.MB_OK)
Example #20
0
 def leave(self):
     if not magicstep.magicstepgroup.leave(self): return 0
     if not self.gen_x_settings():
         magicpopup.magicmsgbox(
             None,
             _('Failed to collect the information about Xwindow configuration.'
               ), magicpopup.magicmsgbox.MB_ERROR,
             magicpopup.magicpopup.MB_OK)
         return 0
     self.rootobj.tm.add_action(_('Generate Xwindow configuration'), None,
                                None, 'gen_x_config', self.x_settings)
     return 1
Example #21
0
 def startup_action(self):
     # If we skip X Setting, we should auto detect the hardware, and copy
     # the generated Xorg.conf to target system.
     if 0:  #CF.G.skipxsetting:
         self.rootobj.tm.add_action(_('Probe Monitor'),
                                    self.probe_monitor_ok, None,
                                    'probe_monitor', 0)
         self.rootobj.tm.add_action(_('Probe VideoCard'),
                                    self.probe_videocard_ok, None,
                                    'probe_videocard', 0)
         self.rootobj.tm.add_action(_('Probe Mouse'), self.probe_mouse_ok,
                                    None, 'probe_mouse', 0)
Example #22
0
 def act_start_mkinitrd(self):
     self.tadlg.name_map['frame_other'].set_sensitive(True)
     self.rootobj.tm.push_progress(self.tadlg.name_map['otprog'],
                                   self.tadlg.name_map['otname'])
     scsi_module_list = self.get_data(self.values, 'scsi.modules')
     if scsi_module_list == None or scsi_module_list == '':
         dolog('No scsi driver has to be written into modprobe.conf.\n')
     else:
         dolog('scsi_modprobe_conf(%s)\n' % scsi_module_list)
         self.add_action(_("Generate modprobe.conf"), None, None,
                         'scsi_modprobe_conf', scsi_module_list)
     dolog('action_mkinitrd\n')
     self.add_action(_('Make initrd'), self.nextop, None, 'do_mkinitrd', 0)
Example #23
0
 def startup_action(self):
     # If we skip X Setting, we should auto detect the hardware, and copy
     # the generated Xorg.conf to target system.
     if 0:#CF.G.skipxsetting:
         self.rootobj.tm.add_action(_('Probe Monitor'),
                                self.probe_monitor_ok, None,
                                'probe_monitor', 0)
         self.rootobj.tm.add_action(_('Probe VideoCard'),
                                self.probe_videocard_ok, None,
                                'probe_videocard', 0)
         self.rootobj.tm.add_action(_('Probe Mouse'),
                                self.probe_mouse_ok, None,
                                'probe_mouse', 0)
Example #24
0
 def btntheme_clicked(self, widget, data):
     xml_data = '''
     <themedlg>
       <vbox>
         <label line_wrap="true" fill="true"
                text="((Click the button to choose the theme that you like.))"/>
         <hbox name="themes" expand="true" fill="true">
           <image file="images/gnome-ccthemes.png" fill="true"/>
         </hbox>
       </vbox>
     </themedlg>
     '''
     self.themedlg = magicpopup.magicpopup(self, xml_data,
                                           _('Theme Choice'),
                                           magicpopup.magicpopup.MB_OK,
                                           'themedlg', 'theme')
     themesdoc = parse('/etc/gtk-2.0/themes.xml')
     themelist = themesdoc.getElementsByTagName('theme')
     rows = 2
     thetable = gtk.Table(rows, (len(themelist) + rows - 1) / rows, True)
     thetable.set_col_spacings(4)
     thetable.set_row_spacings(4)
     left = 0
     top = 0
     for themenode in themelist:
         path = themenode.getAttribute('dir')
         pic = themenode.getAttribute('pic')
         if pic:
             thebutton = gtk.Button()
             theimage = gtk.Image()
             theimage.set_from_file('/etc/gtk-2.0/pics/' + pic)
             theimage.show()
             thebutton.add(theimage)
             thebutton.show()
         else:
             name = themenode.getAttribute('name')
             if not name:
                 if path:
                     name = path
                 else:
                     name = _('Default')
             thebutton = gtk.Button(name)
         thebutton.connect('clicked', self.theme_clicked, path)
         thetable.attach(thebutton, left, left + 1, top, top + 1, 0, 0, 0,
                         0)
         top = top + 1
         if top == rows:
             top = 0
             left = left + 1
     thetable.show()
     self.themedlg.name_map['themes'].pack_start(thetable, True, True)
Example #25
0
 def btntheme_clicked(self, widget, data):
     xml_data = '''
     <themedlg>
       <vbox>
         <label line_wrap="true" fill="true"
                text="((Click the button to choose the theme that you like.))"/>
         <hbox name="themes" expand="true" fill="true">
           <image file="images/gnome-ccthemes.png" fill="true"/>
         </hbox>
       </vbox>
     </themedlg>
     '''
     self.themedlg = magicpopup.magicpopup(self, xml_data,
                                           _('Theme Choice'),
                                           magicpopup.magicpopup.MB_OK,
                                           'themedlg', 'theme')
     themesdoc = parse('/etc/gtk-2.0/themes.xml')
     themelist = themesdoc.getElementsByTagName('theme')
     rows = 2
     thetable = gtk.Table(rows, (len(themelist) + rows - 1) / rows, True)
     thetable.set_col_spacings(4)
     thetable.set_row_spacings(4)
     left = 0
     top = 0
     for themenode in themelist:
         path = themenode.getAttribute('dir')
         pic = themenode.getAttribute('pic')
         if pic:
             thebutton = gtk.Button()
             theimage = gtk.Image()
             theimage.set_from_file('/etc/gtk-2.0/pics/' + pic)
             theimage.show()
             thebutton.add(theimage)
             thebutton.show()
         else:
             name = themenode.getAttribute('name')
             if not name:
                 if path:
                     name = path
                 else:
                     name = _('Default')
             thebutton = gtk.Button(name)
         thebutton.connect('clicked', self.theme_clicked, path)
         thetable.attach(thebutton, left, left + 1, top, top + 1, 0, 0, 0, 0)
         top = top + 1
         if top == rows:
             top = 0
             left = left + 1
     thetable.show()
     self.themedlg.name_map['themes'].pack_start(thetable, True, True)
Example #26
0
 def __init__(self, step_name_list, *args, **kw):
     gtk.Window.__init__(self, *args, **kw)
     self.set_name(self.__class__.__name__)
     self.top = MITop(self)
     self.leftpanel = MILeftPanel(self, _('Steps'))
     self.rightpanel = MIRightPanel(self, '')
     self.statusbar = MIStatusBar(self)
     self.buttonbar = MIButtonBar(self)
     self.set_title(_('Magic Installer'))
     self.set_border_width(4)
     self.connect('destroy', lambda x: gtk.main_quit())
     self.values = parse(search_file('magic.values.xml', [CF.D.HOTFIXDIR, '.']))
     self.tm = MiTaskman(1325, self.statusbar.get_progressbar(),
                       self.statusbar.get_progressbar())
     self.step_name_list = step_name_list
Example #27
0
    def __init__(self, rootobj):
        self.rootobj = rootobj
        magicstep.magicstepgroup.__init__(self, rootobj, 'takeactions.xml',
                                          ['notes', 'ensure', 'doactions'], 'step')
        self.actlist = []
        
        if not CF.D.DEBUG:
            # skip format and mount partition
            self.actlist.append( (_('Partition/Format'), self.act_start_parted, self.act_end_parted) )

        self.actlist.append( (_('Install Package'), self.act_start_instpkg, self.act_end_instpkg) )
        if not CF.D.DEBUG:
            self.actlist.append( (_('Make initrd'), self.act_start_mkinitrd, None) )
            self.actlist.append( (_('Install Bootloader'), self.act_start_bootloader, None) )
        #(_('Setup Keyboard'), self.act_start_keyboard, None)]
        self.actpos = 0
        self.discdlg_open_time = -1
        self.installmode = 'rpminstallmode'   # Default
        self.minorarch_pkgs = []
        self.minorarch_later = False     # push back minor arch packages ### current close this feature.
        self.add_action = self.rootobj.tm.add_action
        
        self.tadlg = TaDialog(self, self.uixmldoc, 'actions.dialog')
        self.statusarr = []
        width = 3
        height = (len(self.actlist) + width - 1) / width
        table = self.tadlg.name_map['stepsshow']
        for i in range(len(self.actlist)):
            image = gtk.Image()
            image.set_from_file('images/applet-blank.png')
            image.show()
            self.statusarr.append(image)
            table.attach(image, 0, 1, i, i + 1, 0, 0, 0, 0)
            label = gtk.Label(_(self.actlist[i][0]))
            label.set_alignment(0.0, 0.5)
            label.show()
            table.attach(label, 1, 2, i, i + 1,
                         gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL,
                         0, 0)
                         
        self.left_panel = self.tadlg.name_map['leftpanel']
        # remove leftpanel from its parent
        parent = self.left_panel.parent
        parent.remove(self.left_panel)
        self.right_panel = self.tadlg.name_map['rightpanel']
        # remove leftpanel from its parent
        parent = self.right_panel.parent
        parent.remove(self.right_panel)
Example #28
0
 def reboot_0(self, tdata, data):
     self.rebootdlg = \
                    magicpopup.magicmsgbox(self,
                                           _('Click "OK" to reboot your system!\nEject the cdrom if you are installed from cdrom.'),
                                           magicpopup.magicmsgbox.MB_ERROR,
                                           magicpopup.magicpopup.MB_OK,
                                           'reboot_0_')
Example #29
0
    def cb0_insert_next_disc(self, cur_discno, cb_retry_clicked,
                             cb_abort_clicked):
        '''
            callback from install rpm action, wait user change disc and click "retry_clicked"
        '''
        msgtxt = _(
            "Can't find packages in disc %d.\nIf you are using CDROM to install system, it is the chance to eject the original disc and insert the %d disc."
        ) % (cur_discno, cur_discno + 1)
        self.discdlg_open_time = time.time()

        class CallBack():
            def __init__(self, sself, cb_retry_clicked, cb_abort_clicked):
                self.sself = sself
                self.cb_retry_clicked = cb_retry_clicked
                self.cb_abort_clicked = cb_abort_clicked

            def retry_clicked(self, widget, data):
                if self.sself.discdlg_open_time > 0:
                    # Do adjustment to omit the influence of replace disc.
                    self.sself.starttime = self.sself.starttime + \
                                     (time.time() - self.sself.discdlg_open_time)
                    self.sself.discdlg_open_time = -1
                self.cb_retry_clicked()

            def abort_clicked(self, widget, data):
                self.cb_abort_clicked()

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

        DiscDialog(CallBack(self, cb_retry_clicked, cb_abort_clicked),
                   self.uixmldoc, msgtxt, 'disc.dialog')
Example #30
0
 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)
Example #31
0
    def popup_monitor_dialog(self, widget, data):
        def xmlesc(s):
            s = string.replace(s, "&", "&amp;")
            s = string.replace(s, "<", "&lt;")
            s = string.replace(s, ">", "&gt;")
            return s

        (model,
         iter) = self.name_map['monitor_vender_list_treeview'].get_selection(
         ).get_selected()
        if not iter: return
        vender = model.get_value(iter, 0)
        if not self.mondb.has_key(vender): return
        xmlstr = ''
        for (m_name, dummy, m_vert, m_horiz) in self.mondb[vender]:
            xmlstr = xmlstr + '<row c0="%s" c1="%s" c2="%s"/>' % (
                xmlesc(m_name), xmlesc(m_horiz), xmlesc(m_vert))
        xmldoc = parseString('<?xml version="1.0"?><data><monlist>' + xmlstr +
                             '</monlist></data>')
        self.mondlg = magicpopup.magicpopup(
            self, self.uixmldoc, _("Please choose your monitor here."),
            magicpopup.magicpopup.MB_OK | magicpopup.magicpopup.MB_CANCEL,
            "monitor.dialog", "mondlg_")
        self.mondlg.topwin.set_size_request(600, 400)
        self.mondlg.fill_values(xmldoc.documentElement)
Example #32
0
 def cb0_insert_next_disc(self, cur_discno, cb_retry_clicked, cb_abort_clicked):
     '''
         callback from install rpm action, wait user change disc and click "retry_clicked"
     '''
     msgtxt = _("Can't find packages in disc %d.\nIf you are using CDROM to install system, it is the chance to eject the original disc and insert the %d disc.") % (cur_discno, cur_discno+1)
     self.discdlg_open_time = time.time()
     class CallBack():
         def __init__(self, sself, cb_retry_clicked, cb_abort_clicked):
             self.sself = sself
             self.cb_retry_clicked = cb_retry_clicked
             self.cb_abort_clicked = cb_abort_clicked
             
         def retry_clicked(self, widget, data):
             if self.sself.discdlg_open_time > 0:
                 # Do adjustment to omit the influence of replace disc.
                 self.sself.starttime = self.sself.starttime + \
                                  (time.time() - self.sself.discdlg_open_time)
                 self.sself.discdlg_open_time = -1
             self.cb_retry_clicked()
             
         def abort_clicked(self, widget, data):
             self.cb_abort_clicked()
         
         def reboot_clicked(self, widget, data):
             self.sself.reboot_clicked(widget, data)
             
     DiscDialog(CallBack(self, cb_retry_clicked, cb_abort_clicked), self.uixmldoc, msgtxt, 'disc.dialog')
Example #33
0
    def enter(self):
        self.sself.btnback_sensitive(False)
        self.sself.btnnext_sensitive(False)
        self.name_map['pfprog'].set_fraction(0)

        self.name_map['frame_parted'].set_sensitive(True)
        self.rootobj.tm.push_progress(self.name_map['pfprog'],
                                      self.name_map['pfname'])

        CF.G.mount_all_list = []
        for devpath in CF.G.all_part_infor.keys():
            for part_tuple in CF.G.all_part_infor[devpath]:
                if part_tuple[7] == '':
                    # :) This mountpoint is not the obsolete "mountpoint",
                    # which was used by mount every device, removed already, please view the source in magicinstaller1
                    # Note: this mountpoint is point by user at create partition step, / /usr /home and so on.
                    continue
                mntpoint = part_tuple[7]
                devfn = '%s%d' % (devpath, part_tuple[0])
                fstype = part_tuple[6]
                CF.G.mount_all_list.append((mntpoint, devfn, fstype))
        CF.G.mount_all_list.sort(self.malcmp)
        logger.info('CONF.RUN.g_mount_all_list: %s\n' %
                    str(CF.G.mount_all_list))

        self.add_action(_('Get all dirty disk'),
                        self.act_parted_get_dirty_result, None,
                        'get_all_dirty_disk', 0)
        return 1
Example #34
0
    def act_install_pkg_start(self, tdata, data):
        if tdata != 0:
            ### TODO install_disc_prep ERROR, because package source on disc and can not access, error should exit.
            pass
        
        (disc_no, pkg_no) = data
        while pkg_no < len(CF.G.arrangement[disc_no]):
            pkgtuple = CF.G.arrangement[disc_no][pkg_no]
            noscripts = pkgtuple[6]
            if self.install_allpkg or self.instpkg_map.has_key(pkgtuple[1]):
                archpkg = self.pkg2archpkg(pkgtuple[1])
                if not archpkg:
                    data = (disc_no, pkg_no, 0, False)
                    msg = _("Target System Arch %s is not Compatible with package arch %s" % (self.arch, pkgtuple[1]))
                    self.cb0_install_pkg_err(msg, self.rpmerr_retry_clicked, self.rpmerr_skip_clicked, data)
                    return
                (apkg, aarch, asize) = archpkg
                apkg = os.path.basename(apkg)
                # Debug
#                 self.add_action(apkg, self.act_install_pkg_end, (disc_no, pkg_no, asize, False),
#                                 'sleep', 0)
                self.add_action(apkg,
                                self.act_install_pkg_end, (disc_no, pkg_no, asize, False),
                                'rpm_install_pkg', apkg, self.probe_all_disc_result[disc_no][1], noscripts)
                return
            pkg_no = pkg_no + 1
        (pafile, dev, fstype, reldir, bootiso_relpath) = CF.G.choosed_patuple
        # Install current disc finished, add action to start next disc installation.
        self.add_action(None,
                        self.act_install_disc_start, disc_no + 1,
                        'install_disc_post', dev, fstype, self.probe_all_disc_result[disc_no][0], reldir)
Example #35
0
    def reboot_clicked(self, widget, data):
        (pafile, dev, fstype, reldir, bootiso_relpath) = CF.G.choosed_patuple
        msg = _('Umount the target filesystem(s).')
        self.add_action(msg, None, None,
                        'install_post', (dev, fstype, reldir, bootiso_relpath), CF.G.mount_all_list)

        self.reboot_0(None, None)
Example #36
0
    def act_install_disc_start(self, tdata, disc_no):
        '''
            mount each ISO, and install it.
            install_disc_prep(server) mount ISO.
        '''
        (pafile, dev, fstype, reldir, bootiso_relpath) =  CF.G.choosed_patuple
        while disc_no < len(CF.G.arrangement):
            logger.i("act_install_disc_start probe_all_disc_result: %s" % self.probe_all_disc_result)
            if not self.install_allpkg and not self.disc_map.has_key(disc_no):
                # Skip the disc which is not needed.
                disc_no = disc_no + 1
                continue

            if disc_no >= len(self.probe_all_disc_result) \
                   or not self.probe_all_disc_result[disc_no]: ## TODO multi disc will always have only one probe_all_disc_result. please fix it.
                # we known have next disc in pkgarr.py file (CF.G.arrangement is the variable in pkgarr.py)
                # but there can not find next disc with disc_no in probe_all_disc_result. so we think it should have a next disc, and ask user to insert it.
                self.cb0_insert_next_disc(disc_no + 1, self.retry_clicked, self.abort_clicked) ## This call back will active next install action.
                return
            self.cur_disc_no = disc_no
            bootiso_relpath = self.probe_all_disc_result[disc_no][0]
            self.add_action(None,
                            self.act_install_pkg_start, (disc_no, 0),
                            'install_disc_prep', dev, fstype, bootiso_relpath, reldir)
            # add install current disc action, return now, and wait next disc action after current disc install action finished.
            return
        
        ### Install all disc finished
        self.add_action(_('Last operations for package installation'),
                        self.nextop, None,
                        'rpm_post_install', None)
Example #37
0
    def enter(self):
        self.sself.btnback_sensitive(False)
        self.sself.btnnext_sensitive(False)
        self.name_map['pfprog'].set_fraction(0)

        self.name_map['frame_parted'].set_sensitive(True)
        self.rootobj.tm.push_progress(self.name_map['pfprog'],
                                      self.name_map['pfname'])
        
        CF.G.mount_all_list = []
        for devpath in CF.G.all_part_infor.keys():
            for part_tuple in CF.G.all_part_infor[devpath]:
                if part_tuple[7] == '':
                    # :) This mountpoint is not the obsolete "mountpoint", 
                    # which was used by mount every device, removed already, please view the source in magicinstaller1
                    # Note: this mountpoint is point by user at create partition step, / /usr /home and so on.
                    continue
                mntpoint = part_tuple[7]
                devfn = '%s%d' % (devpath, part_tuple[0])
                fstype = part_tuple[6]
                CF.G.mount_all_list.append((mntpoint, devfn, fstype))
        CF.G.mount_all_list.sort(self.malcmp)
        logger.info('CONF.RUN.g_mount_all_list: %s\n' % str(CF.G.mount_all_list))
            
        self.add_action(_('Get all dirty disk'),
                        self.act_parted_get_dirty_result, None,
                        'get_all_dirty_disk', 0)
        return 1
Example #38
0
    def act_install_disc_start(self, tdata, disc_no):
        '''
            mount each ISO, and install it.
            install_disc_prep(server) mount ISO.
        '''
        (pafile, dev, fstype, reldir, bootiso_relpath) = CF.G.choosed_patuple
        while disc_no < len(CF.G.arrangement):
            logger.i("act_install_disc_start probe_all_disc_result: %s" %
                     self.probe_all_disc_result)
            if not self.install_allpkg and not self.disc_map.has_key(disc_no):
                # Skip the disc which is not needed.
                disc_no = disc_no + 1
                continue

            if disc_no >= len(self.probe_all_disc_result) \
                   or not self.probe_all_disc_result[disc_no]: ## TODO multi disc will always have only one probe_all_disc_result. please fix it.
                # we known have next disc in pkgarr.py file (CF.G.arrangement is the variable in pkgarr.py)
                # but there can not find next disc with disc_no in probe_all_disc_result. so we think it should have a next disc, and ask user to insert it.
                self.cb0_insert_next_disc(
                    disc_no + 1, self.retry_clicked, self.abort_clicked
                )  ## This call back will active next install action.
                return
            self.cur_disc_no = disc_no
            bootiso_relpath = self.probe_all_disc_result[disc_no][0]
            self.add_action(None, self.act_install_pkg_start, (disc_no, 0),
                            'install_disc_prep', dev, fstype, bootiso_relpath,
                            reldir)
            # add install current disc action, return now, and wait next disc action after current disc install action finished.
            return

        ### Install all disc finished
        self.add_action(_('Last operations for package installation'),
                        self.nextop, None, 'rpm_post_install', None)
Example #39
0
 def leave(self):
     if self.doing:
         magicpopup.magicmsgbox(
             None, _('We are doing setup, do not leave please.'),
             magicpopup.magicmsgbox.MB_ERROR, magicpopup.magicmsgbox.MB_OK)
         return 0
     return 1
Example #40
0
 def btncancel_clicked(self, widget, data):
     self.msgbox = magicpopup.magicmsgbox(
         self, _('Do you realy want to cancel the installation?'),
         magicpopup.magicmsgbox.MB_QUESTION,
         magicpopup.magicmsgbox.MB_YES | magicpopup.magicmsgbox.MB_NO)
     self.cancel_widget = widget
     self.cancel_data = data
Example #41
0
class MIStep_finish(magicstep.magicstep):
    NAME = 'finish'
    LABEL = _("Finish")

    def __init__(self, rootobj):
        magicstep.magicstep.__init__(self, rootobj, 'finish.xml', 'finish')
        self.rootobj = rootobj

    def enter(self):
        self.rootobj.btnnext_sensitive(False)
        self.rootobj.btnback_sensitive(False)
        return 1

    def get_label(self):
        return self.LABEL

    def btnfinish_clicked(self, widget, data):
        self.default_btnfinish_clicked(widget, data)

    def leave(self):
        magicpopup.magicmsgbox(
            None,
            _('You can not go back because the installation has finished.'),
            magicpopup.magicmsgbox.MB_ERROR, magicpopup.magicpopup.MB_OK)
        return 0
Example #42
0
    def startup_action(self):
        self.startup_flag = True

        def check_data(tdata):
            if not tdata:
                return False
            if type(tdata) not in (list, tuple):
                return False
            for d in tdata:
                if (type(d) not in (list, tuple)):
                    return False
            return True

        def resp_pkgarr_probe(tdata, data):
            logger.i('resp_pkgarr_probe result %s' % tdata)
            if not check_data(tdata):
                msg = _('Can not get packages info (pkgarr_probe)'
                        ) + '''RESULT TYPE %s VALUE: %s''' % (type(tdata),
                                                              tdata)
                logger.e(msg)
                self.sself.warn_dialog(msg)
            CF.G.pkgarr_probe_result = tdata
            CF.G.pkgarr_probe_status = STAT.OP_STATUS_DONE

        CF.G.pkgarr_probe_status = STAT.OP_STATUS_DOING
        self.rootobj.tm.add_action(_('Search package information'),
                                   resp_pkgarr_probe, None, 'pkgarr_probe')
Example #43
0
 def edit_user(self, widget, data):
     self.tmpdoc = self.origdoc.cloneNode(8)
     self.tmpvalues = self.tmpdoc.documentElement
     (model, self.iter) = self.name_map['userlist_treeview'].get_selection().get_selected()
     if self.iter:
         username = model.get_value(self.iter, 0)
         self.set_data(self.tmpdoc, 'username', username)
         value = model.get_value(self.iter, 1)
         self.set_data(self.tmpdoc, 'password', value)
         self.set_data(self.tmpdoc, 'confirm_password', value)
         self.set_data(self.tmpdoc, 'shell', model.get_value(self.iter, 2))
         homedir = model.get_value(self.iter, 3)
         if homedir == '/home/' + username:
             self.set_data(self.tmpdoc, 'homedir', 'false')
             self.set_data(self.tmpdoc, 'customhomedir', '')
         else:
             self.set_data(self.tmpdoc, 'homedir', 'true')
             self.set_data(self.tmpdoc, 'customhomedir', homedir)
         uid = model.get_value(self.iter, 4)
         if uid == _('Auto'):
             self.set_data(self.tmpdoc, 'uid', 'false')
             self.set_data(self.tmpdoc, 'customuid', '500')
         else:
             self.set_data(self.tmpdoc, 'uid', 'true')
             self.set_data(self.tmpdoc, 'customuid', str(uid))
     self.accdlg = self.account_dialog(self.uixmldoc, self)
Example #44
0
 def reboot_0(self, tdata, data):
     self.rebootdlg = \
                    magicpopup.magicmsgbox(self,
                                           _('Click "OK" to reboot your system!\nEject the cdrom if you are installed from cdrom.'),
                                           magicpopup.magicmsgbox.MB_ERROR,
                                           magicpopup.magicpopup.MB_OK,
                                           'reboot_0_')
Example #45
0
 def popup_srcpos_dialog(self):
     valdoc = Document()
     self.srcpos_value_doc = valdoc
     topele = valdoc.createElement('data')
     valdoc.appendChild(topele)
     valtopele = valdoc.createElement('srcposlist')
     topele.appendChild(valtopele)
     try:
         for (pafile, dev, fstype, reldir,
              isofn) in CF.G.pkgarr_probe_result:
             rowele = valdoc.createElement('row')
             rowele.setAttribute('c0', pafile)
             rowele.setAttribute('c1', dev)
             rowele.setAttribute('c2', fstype)
             rowele.setAttribute('c3', '/' + reldir)
             rowele.setAttribute('c4', isofn)
             valtopele.appendChild(rowele)
     except:
         raise MiNotSatisfied(
             '''Can not get information from CF.G.pkgarr_probe_result 
              TYPE %s VALUE: %s''' %
             (type(CF.G.pkgarr_probe_result), CF.G.pkgarr_probe_result))
     self.srcpos_dialog = magicpopup.magicpopup( \
         self, self.uixmldoc, _('You want fetch packages from...'),
         magicpopup.magicpopup.MB_OK, 'srcpos.dialog', 'srcpos_')
     self.srcpos_dialog.topwin.set_size_request(480, 320)
     self.srcpos_dialog.fill_values(topele)
Example #46
0
 def reprobe_all_disc_1(self, tdata, data):
     (errmsg, self.probe_all_disc_result) = tdata
     dolog('probe_all_disc_result: %s\n' % str(self.probe_all_disc_result))
     (pafile, dev, fstype, reldir, bootiso_relpath) = CF.G.choosed_patuple
     self.add_action(_('Researching packages...'),
                     self.act_instpkg_disc_start, self.cur_disc_no,
                     'instpkg_prep', dev, reldir, fstype, self.installmode)
Example #47
0
 def bl_umount(self, tdata, data):
     res = tdata
     if type(res) == int:
         self.add_action(None, self.nextop, None, 'sleep', 0)
         return
     self.add_action(_('Umount all target partitions before bootloader setup.'),
                     self.bl_setup, (data, res),
                     'umount_all_tgtpart', CF.G.mount_all_list, 0)
Example #48
0
    def get_modprobe_result(self, tdata, data):
        CF.G.reprobe_all_disks_required
        success = tdata
        self.waitdlg.topwin.destroy()
        if not success:
            magicpopup.magicmsgbox(None, _('Load module failed.'),
                                   magicpopup.magicmsgbox.MB_ERROR,
                                   magicpopup.magicpopup.MB_OK)
        else:
            CF.G.reprobe_all_disks_required = 1
            stepobj = self.rootobj.stepobj_list[self.rootobj.curstep + 1] # reprobe disk
            stepobj.reprobe_all()

            magicpopup.magicmsgbox(None, _('Load module success.'),
                                   magicpopup.magicmsgbox.MB_INFO,
                                   magicpopup.magicpopup.MB_OK)
            self.do_refresh_fill()
Example #49
0
    def reboot_clicked(self, widget, data):
        (pafile, dev, fstype, reldir, bootiso_relpath) = CF.G.choosed_patuple
        msg = _('Umount the target filesystem(s).')
        self.add_action(msg, None, None, 'install_post',
                        (dev, fstype, reldir, bootiso_relpath),
                        CF.G.mount_all_list)

        self.reboot_0(None, None)
Example #50
0
 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)
Example #51
0
 def check_leave_root(self):
     self.fetch_values(self.rootobj.values)
     rootpwd = self.get_data(self.values, 'accounts.root.password')
     rootpwdconfirm = self.get_data(self.values, 'accounts.root.passwordconfirm')
     if rootpwd != rootpwdconfirm:
         magicpopup.magicmsgbox(None,
                                _('Your root password is different with your root password confirmation!'),
                                magicpopup.magicmsgbox.MB_ERROR,
                                magicpopup.magicmsgbox.MB_OK)
         return 0
     if len(rootpwd) < 3:
         magicpopup.magicmsgbox(None,
                                _('Please do not use the password which shorter than 3 characters.'),
                                magicpopup.magicmsgbox.MB_ERROR,
                                magicpopup.magicmsgbox.MB_OK)
         return 0
     return 1
Example #52
0
 def popup_xglines(self, widget, data):
     framexml = parseString(
         '<?xml version="1.0"?><frame type="in"><frame name="slot" type="out"/></frame>'
     )
     self.gamebox = magicpopup.magicpopup(None, framexml, _('XGlines'), 0)
     self.gameobj = xglines('games', self.help_gamebox, self.close_gamebox)
     self.gameobj.widget.show()
     self.gamebox.name_map['slot'].add(self.gameobj.widget)
Example #53
0
 def act_parted_commit_start(self, pos):
     if pos < len(self.dirty_disks):
         actinfor = _('Write the partition table of %s.')
         actinfor = actinfor % self.dirty_disks[pos]
         self.add_action(actinfor, self.act_parted_commit_result, pos,
                         'commit_devpath', self.dirty_disks[pos])
     else:
         self.act_parted_format_start(0)
Example #54
0
 def __init__(self, sself):
     self.sself = sself
     self.header0 = MIHeader(sself)
     self.leftpanel = MILeftPanel(sself, _('Steps'))
     self.rightpanel = MIRightPanel(sself, '')
     self.statusbar = MIStatusBar(sself)
     self.buttonbar = MIButtonBar(sself)
     xmlgtk.xmlgtk.__init__(self, XML_DATA)
Example #55
0
 def remove_user(self, widget, data):
     iter = self.name_map['userlist_treeview'].get_selection().get_selected(
     )
     if iter[1]:
         self.list_remove('accounts.userlist', iter[1])
     else:
         magicpopup.magicmsgbox(None, _('Please choose a user to remove.'),
                                magicpopup.magicmsgbox.MB_ERROR,
                                magicpopup.magicmsgbox.MB_OK)
Example #56
0
 def retry_clicked(self):
     '''
         This is the DiscDialog retry button click callback.
         DiscDialog alert indicate that package installation pause, we should active it by reprobe disc.(If user has changed it)
     '''
     (pafile, dev, fstype, reldir, bootiso_relpath) = CF.G.choosed_patuple
     self.add_action(_('Researching packages...'), self.retry_install, None,
                     'probe_all_disc', dev, fstype, bootiso_relpath, reldir,
                     self.disc_first_pkgs)
Example #57
0
    def start(self):
        for disc_no in range(len(CF.G.arrangement)):
            self.disc_first_pkgs.append(CF.G.arrangement[disc_no][0][1])

        (pafile, dev, fstype, reldir, bootiso_relpath) = CF.G.choosed_patuple
        logger.i('disc_first_pkgs: %s\n' % str(self.disc_first_pkgs))
        self.add_action(_('Search packages'), self.act_install_prepare, None,
                        'probe_all_disc', dev, fstype, bootiso_relpath, reldir,
                        self.disc_first_pkgs)
Example #58
0
    def get_modprobe_result(self, tdata, data):
        CF.G.reprobe_all_disks_required
        success = tdata
        self.waitdlg.topwin.destroy()
        if not success:
            magicpopup.magicmsgbox(None, _('Load module failed.'),
                                   magicpopup.magicmsgbox.MB_ERROR,
                                   magicpopup.magicpopup.MB_OK)
        else:
            CF.G.reprobe_all_disks_required = 1
            stepobj = self.rootobj.stepobj_list[self.rootobj.curstep +
                                                1]  # reprobe disk
            stepobj.reprobe_all()

            magicpopup.magicmsgbox(None, _('Load module success.'),
                                   magicpopup.magicmsgbox.MB_INFO,
                                   magicpopup.magicpopup.MB_OK)
            self.do_refresh_fill()
Example #59
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.
     )
Example #60
0
 def ok_clicked(self, widget, data):
     self.accdlg.fetch_values(self.tmpdoc)
     username = self.get_data(self.tmpvalues, 'username')
     if username == '':
         magicpopup.magicmsgbox(None, _('Username is not specified.'),
                                magicpopup.magicmsgbox.MB_ERROR,
                                magicpopup.magicmsgbox.MB_OK)
         return
     password = self.get_data(self.tmpvalues, 'password')
     confirmpassword = self.get_data(self.tmpvalues, 'confirm_password')
     if password != confirmpassword:
         magicpopup.magicmsgbox(
             None,
             _('Your password is different with your confirm password.'),
             magicpopup.magicmsgbox.MB_ERROR, magicpopup.magicmsgbox.MB_OK)
         return
     if password == '':
         magicpopup.magicmsgbox(
             None,
             _('You can not login in this user directly because you leave the password to blank'
               ), magicpopup.magicmsgbox.MB_WARNING,
             magicpopup.magicmsgbox.MB_OK)
     self.accdlg.topwin.destroy()
     shell = self.get_data(self.tmpvalues, 'shell')
     homedir = self.get_data(self.tmpvalues, 'homedir')
     if homedir == 'true':
         homedir = self.get_data(self.tmpvalues, 'customhomedir')
     else:
         homedir = '/home/' + username
     uid = self.get_data(self.tmpvalues, 'uid')
     if uid == 'true':
         uid = str(int(float(self.get_data(self.tmpvalues, 'customuid'))))
     else:
         uid = 'Auto'
     newrow = self.rootobj.values.createElement('row')
     newrow.setAttribute('c0', username)
     newrow.setAttribute('c1', password)
     newrow.setAttribute('c2', shell)
     newrow.setAttribute('c3', homedir)
     newrow.setAttribute('c4', uid)
     if self.iter:
         self.list_replace('accounts.userlist', self.iter, newrow)
     else:
         self.list_append('accounts.userlist', newrow)