def __init__(self, helpfile): from mi.utils.miconfig import MiConfig CF = MiConfig.get_instance() uixml = parse('UIxml/mi_dialog.xml') textnodes = uixml.getElementsByTagName('text') for tn in textnodes: tn.setAttribute('filename', helpfile) magicpopup.__init__(self, self, uixml, _('Help'), magicpopup.MB_OK, 'helpdialog') self.topwin.set_size_request(CF.D.HELP_WIDTH, CF.D.HELP_HEIGHT) self.topwin.set_resizable(False)
def __init__(self, helpfile=None): from mi.utils.miconfig import MiConfig CF = MiConfig.get_instance() uixml = parse('UIxml/mi_dialog.xml') textnodes = uixml.getElementsByTagName('text') if helpfile: for tn in textnodes: tn.setAttribute('filename', helpfile) magicpopup.__init__(self, self, uixml, _('Help'), magicpopup.MB_OK, 'helpdialog') self.topwin.set_size_request(CF.D.HELP_WIDTH, CF.D.HELP_HEIGHT) self.topwin.set_resizable(False)
def get_devinfo(devfn, all_part_infor): if not devfn: return AttrDict() from mi.utils.miconfig import MiConfig CF = MiConfig.get_instance() for dev in all_part_infor: for tup in all_part_infor[dev]: if '%s%s' % (dev, tup[0]) == devfn: r = AttrDict() r['dev'] = devfn r['parted_fstype'] = tup[6] r['mountpoint'] = tup[7] r['not_touched'] = tup[8] try: r['fstype'] = CF.D.FSTYPE_MAP[tup[6]][0] r['flags'] = CF.D.FSTYPE_MAP[tup[6]][4] except KeyError: raise KeyError, 'Unregconized filesystem type %s.' % tup[6] return r raise KeyError, 'Device %s not exists in all_part_infor.' % devfn
from milogger import MiLogger #logger = MiLogger('mi') import logging, logging.config import os, sys CUR_DIR = os.path.dirname(__file__) logconf = os.path.join(CUR_DIR, 'logging.conf') print logconf logging.config.fileConfig(logconf) logger = logging.getLogger('mi') logger.i = logger.info logger.e = logger.error logger.w = logger.warn logger.d = logger.debug from mi.utils.miconfig import MiConfig CF = MiConfig.get_instance() from gettext import gettext as _
def test_getconf(): CF = MiConfig.get_instance() CONF.load_from_file('config.json') import pdb; pdb.set_trace() CONF.dump()
def test_getconf(): CF = MiConfig.get_instance() CONF.load_from_file('config.json') import pdb pdb.set_trace() CONF.dump()