当前位置: 首页>>代码示例>>Python>>正文


Python config.Config类代码示例

本文整理汇总了Python中deepin_utils.config.Config的典型用法代码示例。如果您正苦于以下问题:Python Config类的具体用法?Python Config怎么用?Python Config使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Config类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: is_mirror_disabled

def is_mirror_disabled():
    if os.path.exists(deepin_version_path):
        config = Config(deepin_version_path)
        config.load()
        return config.has_option("Custom", "Mirror") and config.get("Custom", "Mirror") == "False"
    else:
        return True # not deepin os, disable mirror change
开发者ID:martyr-deepin,项目名称:deepin-store,代码行数:7,代码来源:mirror_test.py

示例2: get_config_info_config

def get_config_info_config():
    config_info_config = Config(CONFIG_INFO_PATH)
    if os.path.exists(CONFIG_INFO_PATH):
        config_info_config.load()
    else:
        touch_file(CONFIG_INFO_PATH)
        config_info_config.load()
    return config_info_config
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:8,代码来源:settings.new.py

示例3: get_vpc_remind_config

def get_vpc_remind_config():
    CONFIG_INFO_PATH = os.path.expanduser("~/.config/deepin-system-settings/tray/config.ini")
    config_info_config = Config(CONFIG_INFO_PATH)
    if os.path.exists(CONFIG_INFO_PATH):
        config_info_config.load()
    else:
        touch_file(CONFIG_INFO_PATH)
        config_info_config.load()
    return config_info_config
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:9,代码来源:tray_shutdown_plugin.py

示例4: __init__

 def __init__(self):
     QObject.__init__(self)
     self.config_file = get_config_file("config.ini")
     
     if os.path.exists(self.config_file):
         self.config = Config(self.config_file, DEFAULT_CONFIG)
         self.config.load()
     else:
         self.config = Config(self.config_file, DEFAULT_CONFIG)
         self.config.write()
开发者ID:lihongwu,项目名称:deepin-translator,代码行数:10,代码来源:config.py

示例5: Mirror

class Mirror(object):
    def __init__(self, ini_file):
        self.config = Config(ini_file)
        self.config.load()
        deepin_url = self.get_repo_urls()[1]
        _url_parse = urlparse(deepin_url)
        self._hostname = _url_parse.scheme + "://" + _url_parse.netloc
        self._priority = int(self.config.get("mirror", "priority")) if self.config.has_option("mirror", "priority") else 100
    
    @property
    def hostname(self):
        return self._hostname

    @property
    def name(self):
        if self.config.has_option('mirror', 'name[%s]' % LANGUAGE):
            return self.config.get('mirror', 'name[%s]' % LANGUAGE)
        else:
            return self.config.get('mirror', 'name[%s]' % 'en_US')

    @property
    def priority(self):
        return self._priority

    def get_repo_urls(self):
        return (self.config.get('mirror', 'ubuntu_url'), self.config.get('mirror', 'deepin_url'))
开发者ID:PeterDaveHello,项目名称:deepin-software-center,代码行数:26,代码来源:mirror_test.py

示例6: __init__

    def __init__(self,
                 config_file,
                 default_config=None):
        '''
        Init config module.

        @param config_file: Config filepath.
        @param default_config: Default config value use when config file is empty.
        '''
        print "Please import deepin_utils.config instead dtk.ui.config, this module will remove in next version."
        DConfig.__init__(self, config_file, default_config)
开发者ID:chenzhiwei,项目名称:deepin-ui,代码行数:11,代码来源:config.py

示例7: get_last_update_time

def get_last_update_time():
    config = Config(SYS_CONFIG_INFO_PATH)

    if os.path.exists(SYS_CONFIG_INFO_PATH):
        config.load()
        if config.has_option("update", "last_update_time"):
            return config.get("update", "last_update_time")
        else:
            return ""
    else:
        return ""
开发者ID:martyr-deepin,项目名称:deepin-store,代码行数:11,代码来源:utils.py

示例8: is_fontend_running

 def is_fontend_running(self):
     if os.path.exists(DATA_CURRENT_ID_CONFIG_PATH):
         config = Config(DATA_CURRENT_ID_CONFIG_PATH)
         config.load()
         data_id = config.get('current', 'data_id')
         if data_id:
             return True
         else:
             return False
     else:
         False
开发者ID:iceleaf916,项目名称:software-update-manager,代码行数:11,代码来源:dsc-daemon.py

示例9: scan_plugin_info

 def scan_plugin_info(self):
     self.engine_list = []
     self.engine_dict = {}
     
     for plugin_name in os.listdir(self.plugin_dir):
         plugin_config_file = os.path.join(self.plugin_dir, plugin_name, self.plugin_config_name)
         plugin_config = Config(plugin_config_file)
         plugin_config.load()
         
         language = get_language()
         plugin_display_name = plugin_config.get("Plugin Info", "name[%s]" % language) or plugin_config.get("Plugin Info", "name[en]")
         
         need_network = is_true(plugin_config.get("Voice Info", "need_network"))
         support_all_language = is_true(plugin_config.get("Voice Info", "support_all_language"))
         support_languages_info = plugin_config.get("Voice Info", "support_languages")
         priority = plugin_config.get("Voice Info", "priority")
         if support_languages_info == None:
             support_languages = []
         else:
             support_languages = support_languages_info.split(",")
             
         if support_all_language:
             self.engine_list.append((plugin_name, plugin_display_name, priority, need_network))
         else:
             self.update_dict(self.engine_dict, support_languages, plugin_name, plugin_display_name, priority, need_network)
开发者ID:PeterDaveHello,项目名称:deepin-translator,代码行数:25,代码来源:tts_plugin.py

示例10: __init__

 def __init__(self, ini_file):
     self.config = Config(ini_file)
     self.config.load()
     deepin_url = self.get_repo_urls()[1]
     _url_parse = urlparse(deepin_url)
     self._hostname = _url_parse.scheme + "://" + _url_parse.netloc
     self._priority = int(self.config.get("mirror", "priority")) if self.config.has_option("mirror", "priority") else 100
开发者ID:PeterDaveHello,项目名称:deepin-software-center,代码行数:7,代码来源:mirror_test.py

示例11: __init__

    def __init__(self, module_config_path, argv=""):
        '''
        init docs
        '''
        # Init.
        gtk.Plug.__init__(self, 0)
        self.module_config_path = module_config_path
        self.module_config = Config(self.module_config_path)
        self.module_config.load()
        self.module_id = self.module_config.get("main", "id")
        self.argv = argv
        
        # WARING: only use once in one process
        DBusGMainLoop(set_as_default=True) 
        
        # Init threads.
        if self.module_id != "bluetooth": # Added by hualet, wonder why? go ask him :)
            gtk.gdk.threads_init()

        # Init dbus.
        self.bus = dbus.SessionBus()
        self.module_dbus_name = "com.deepin.%s_settings" % (self.module_id)
        self.module_object_name = "/com/deepin/%s_settings" % (self.module_id)
        self.module_bus_name = dbus.service.BusName(self.module_dbus_name, bus=self.bus)
        
        # Handle signals.
        self.connect("realize", self.module_frame_realize)
        self.connect("destroy", self.module_frame_exit)

        glib.timeout_add(1000, self.is_exist)
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:30,代码来源:module_frame.py

示例12: Mirror

class Mirror(object):
    def __init__(self, ini_file):
        self.ini_file = ini_file
        self.config = Config(ini_file)
        self.config.load()
        deepin_url = self.get_repo_urls()[1]
        self._url_parse = urlparse(deepin_url)
        self._hostname = self._url_parse.scheme + "://" + self._url_parse.netloc
    
    @property
    def host(self):
        return self._url_parse.netloc

    @property
    def hostname(self):
        return self._hostname
开发者ID:electricface,项目名称:deepin-software-center,代码行数:16,代码来源:mirrors.py

示例13: __init__

 def __init__(self, ini_file):
     self.ini_file = ini_file
     self.config = Config(ini_file)
     self.config.load()
     deepin_url = self.get_repo_urls()[1]
     self._url_parse = urlparse(deepin_url)
     self._hostname = self._url_parse.scheme + "://" + self._url_parse.netloc
开发者ID:electricface,项目名称:deepin-software-center,代码行数:7,代码来源:mirrors.py

示例14: __init__

    def __init__(self, module_path):
        '''
        init docs
        '''
        self.path = module_path
        self.config = Config(os.path.join(self.path, "config.ini"))
        self.config.load()
        self.id = self.config.get("main", "id")
        # TODO: lihongwu req to support i18n
        self.name = MODULES_NAME_FOR_L18N.get(self.id, "")
        self.default_name = self.config.get("name", "default")

        """
        self.name = self.default_name
        if MAIN_LANG != "en_US":
            self.name = self.config.get("name", MAIN_LANG)
        """

        icon_infos = [self.get_system_icon_info(self.id, 48), 
                      self.get_system_icon_info(self.id, 16),
                     ]
        
        self.icon_pixbuf = None
        self.menu_icon_pixbuf = None
        try:
            self.icon_pixbuf = gtk.gdk.pixbuf_new_from_file(icon_infos[0])
            self.menu_icon_pixbuf = gtk.gdk.pixbuf_new_from_file(icon_infos[1])
        except:
            self.icon_pixbuf = app_theme.get_pixbuf("navigate/none-big.png").get_pixbuf()
            self.menu_icon_pixbuf = app_theme.get_pixbuf("navigate/none-small.png").get_pixbuf()
            
        self.search_keyword = self.config.get("main", "search_keyword")
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:32,代码来源:module_info.py

示例15: save_skin_name

 def save_skin_name(self):
     '''
     Internal function to save skin name.
     '''
     skin_config = Config(self.skin_config_file)
     skin_config.load()
     if skin_config.get("skin", "skin_name") != self.skin_name:
         skin_config.set("skin", "skin_name", self.skin_name)
         skin_config.write(self.skin_config_file)
开发者ID:chenzhiwei,项目名称:deepin-ui,代码行数:9,代码来源:skin_config.py


注:本文中的deepin_utils.config.Config类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。