Exemplo n.º 1
0
 def act_parted_format_start(self, pos):
     if pos < len(self.format_list):
         actinfor = 'Formating %s on %s%d.'
         actinfor = actinfor % (self.format_list[pos][2],
                                self.format_list[pos][0],
                                self.format_list[pos][3])
         logger.info('format_start: %s\n' % str(actinfor))
         self.add_action(actinfor, self.act_parted_format_result, pos,
                         'format_partition',
                         self.format_list[pos][0], # devpath.
                         self.format_list[pos][1], # part_start.
                         self.format_list[pos][2]) # fstype
     else:
         CONF.RUN.g_mount_all_list = []
         for devpath in CONF.RUN.g_all_part_infor.keys():
             for part_tuple in CONF.RUN.g_all_part_infor[devpath]:
                 if part_tuple[7] == '':  # mountpoint ### TODO
                     continue
                 mntpoint = part_tuple[7]
                 devfn = '%s%d' % (devpath, part_tuple[0])
                 fstype = part_tuple[6]
                 CONF.RUN.g_mount_all_list.append((mntpoint, devfn, fstype))
         CONF.RUN.g_mount_all_list.sort(self.malcmp)
         logger.info('CONF.RUN.g_mount_all_list: %s\n' % str(CONF.RUN.g_mount_all_list))
         #self.add_action(_('Mount all target partitions.'),
                         #self.nextop, None,
                         #'mount_all_tgtpart', CONF.RUN.g_mount_all_list, 'y')
         self.nextop(None, None)
Exemplo n.º 2
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
Exemplo n.º 3
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
Exemplo n.º 4
0
 def act_parted_format_result(self, tdata, data):
     result = tdata
     if result:
         # Error occurred. Stop it?
         # Yes, we should stop it, and we should stop at mount failed place too.
         logger.info('format_result ERROR: %s\n' % str(result))
         magicpopup.magicmsgbox(None, _('Format Partition Error: %s' % result),
                    magicpopup.magicmsgbox.MB_ERROR,
                    magicpopup.magicpopup.MB_OK)
         #self.rootobj.btnback_do()
     self.act_parted_format_start(data + 1)
Exemplo n.º 5
0
 def act_parted_get_dirty_result(self, tdata, data):
     self.dirty_disks = tdata
     self.format_list = []
     for devpath in CONF.RUN.g_all_part_infor.keys():
         for part_tuple in CONF.RUN.g_all_part_infor[devpath]:
             if part_tuple[5] == 'true':
                 self.format_list.append((devpath,
                                          part_tuple[3],
                                          part_tuple[6],
                                          part_tuple[0]))
     logger.info('self.dirty_disks: %s\n' % str(self.dirty_disks))
     logger.info('self.format_list: %s\n' % str(self.format_list))
     self.act_parted_commit_start(0)
Exemplo n.º 6
0
 def act_parted_format_start(self, pos):
     if pos < len(self.format_list):
         actinfor = 'Formating %s on %s%d.'
         actinfor = actinfor % (self.format_list[pos][2],
                                self.format_list[pos][0],
                                self.format_list[pos][3])
         logger.info('format_start: %s\n' % str(actinfor))
         self.add_action(actinfor, self.act_parted_format_result, pos,
                         'format_partition',
                         self.format_list[pos][0], # devpath.
                         self.format_list[pos][1], # part_start.
                         self.format_list[pos][2]) # fstype
     else:
         self.act_end_parted()
Exemplo n.º 7
0
 def act_parted_get_dirty_result(self, tdata, data):
     self.dirty_disks = tdata
     self.format_list = []
     for devpath in CF.G.all_part_infor.keys():
         for part_tuple in CF.G.all_part_infor[devpath]:
             if part_tuple[5] == 'true': # format_or_not
                 self.format_list.append((devpath,
                                          part_tuple[3], # start
                                          part_tuple[6], # ftype
                                          part_tuple[0])) # partnum
     self.fill_all_info()
     self.name_map['pfprog'].set_fraction(1)
     # We get all information, and commit dirty partition and format can be do.
     self.sself.btnnext_sensitive(True)
     logger.info('self.dirty_disks: %s\n' % str(self.dirty_disks))
     logger.info('self.format_list: %s\n' % str(self.format_list))
Exemplo n.º 8
0
 def act_parted_get_dirty_result(self, tdata, data):
     self.dirty_disks = tdata
     self.format_list = []
     for devpath in CF.G.all_part_infor.keys():
         for part_tuple in CF.G.all_part_infor[devpath]:
             if part_tuple[5] == 'true':  # format_or_not
                 self.format_list.append((
                     devpath,
                     part_tuple[3],  # start
                     part_tuple[6],  # ftype
                     part_tuple[0]))  # partnum
     self.fill_all_info()
     self.name_map['pfprog'].set_fraction(1)
     # We get all information, and commit dirty partition and format can be do.
     self.sself.btnnext_sensitive(True)
     logger.info('self.dirty_disks: %s\n' % str(self.dirty_disks))
     logger.info('self.format_list: %s\n' % str(self.format_list))
Exemplo n.º 9
0
 def act_parted_format_start(self, pos):
     if pos < len(self.format_list):
         actinfor = 'Formating %s on %s%d.'
         actinfor = actinfor % (self.format_list[pos][2],
                                self.format_list[pos][0],
                                self.format_list[pos][3])
         logger.info('format_start: %s\n' % str(actinfor))
         self.add_action(
             actinfor,
             self.act_parted_format_result,
             pos,
             'format_partition',
             self.format_list[pos][0],  # devpath.
             self.format_list[pos][1],  # part_start.
             self.format_list[pos][2])  # fstype
     else:
         self.act_end_parted()
Exemplo n.º 10
0
 def act_parted_format_result(self, tdata, data):
     result = tdata
     class CallBack():
         def __init__(self, cb):
             self.cb = cb
         def ok_clicked(self, widget, data):
             self.cb()
             
     if result:
         # Error occurred. Stop it?
         # Yes, we should stop it, and we should stop at mount failed place too.
         # TOOD: we should give a stop option too.
         logger.info('format_result ERROR: %s\n' % str(result))
         call_back = CallBack(lambda : self.act_parted_format_start(data + 1))
         magicpopup.magicmsgbox(call_back, _('Format Partition Error: %s' % result),
                    magicpopup.magicmsgbox.MB_ERROR,
                    magicpopup.magicpopup.MB_OK)
         #self.rootobj.btnback_do()
     else:
         self.act_parted_format_start(data + 1)
Exemplo n.º 11
0
    def act_parted_format_result(self, tdata, data):
        result = tdata

        class CallBack():
            def __init__(self, cb):
                self.cb = cb

            def ok_clicked(self, widget, data):
                self.cb()

        if result:
            # Error occurred. Stop it?
            # Yes, we should stop it, and we should stop at mount failed place too.
            # TOOD: we should give a stop option too.
            logger.info('format_result ERROR: %s\n' % str(result))
            call_back = CallBack(
                lambda: self.act_parted_format_start(data + 1))
            magicpopup.magicmsgbox(call_back,
                                   _('Format Partition Error: %s' % result),
                                   magicpopup.magicmsgbox.MB_ERROR,
                                   magicpopup.magicpopup.MB_OK)
            #self.rootobj.btnback_do()
        else:
            self.act_parted_format_start(data + 1)
Exemplo n.º 12
0
#!/usr/bin/python
import os, gtk
import gettext
from mi.client.mainwin import MIMainWindow
from mi.client.utils import _, CF, logger
from mi.utils.common import treedir

USE_TEXTDOMAIN = True

## Setup constants and working directory.
logger.info('change current working directory to %s' %
            os.path.join(CF.D.DATADIR, 'mi'))
build_top = os.environ.get('MI_BUILD_TOP', None)
if build_top:
    os.chdir('%s/src/mi' % build_top)
else:
    os.chdir(os.path.join(CF.D.DATADIR, 'mi'))

if USE_TEXTDOMAIN:
    sys_locale = '/usr/share/locale'
    all_dirs, all_files = treedir(sys_locale, False)
    textdomain = CF.D.TEXTDOMAIN
    if textdomain + '.mo' in all_files:
        gettext.bindtextdomain(textdomain, sys_locale)
        gettext.textdomain(textdomain)
    else:
        logger.w('Can not bind textdomain %s' % textdomain)

## We can use some custom style here.
#settings = gtk.settings_get_default()
#settings.set_string_property('gtk-theme-name', 'Default', '')
Exemplo n.º 13
0
#!/usr/bin/python
import os, gtk
import gettext
from mi.client.mainwin import MIMainWindow
from mi.client.utils import _, CF, logger
from mi.utils.common import treedir

USE_TEXTDOMAIN = True

## Setup constants and working directory.
logger.info('change current working directory to %s' % os.path.join(CF.D.DATADIR, 'mi'))
build_top = os.environ.get('MI_BUILD_TOP', None)
if build_top:
    os.chdir('%s/src/mi' % build_top)
else:
    os.chdir(os.path.join(CF.D.DATADIR, 'mi'))

if USE_TEXTDOMAIN:
    sys_locale = '/usr/share/locale'
    all_dirs, all_files = treedir(sys_locale, False)
    textdomain = CF.D.TEXTDOMAIN
    if textdomain+'.mo' in all_files:
        gettext.bindtextdomain(textdomain, sys_locale)
        gettext.textdomain(textdomain)
    else:
        logger.w('Can not bind textdomain %s' % textdomain)

## We can use some custom style here.
#settings = gtk.settings_get_default()
#settings.set_string_property('gtk-theme-name', 'Default', '')
#gtk.rc_parse_string(open('style.rc', 'rt').read())