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


Python ConfigParser.getint方法代码示例

本文整理汇总了Python中kivy.config.ConfigParser.getint方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigParser.getint方法的具体用法?Python ConfigParser.getint怎么用?Python ConfigParser.getint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kivy.config.ConfigParser的用法示例。


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

示例1: on_start

# 需要导入模块: from kivy.config import ConfigParser [as 别名]
# 或者: from kivy.config.ConfigParser import getint [as 别名]
 def on_start(self):
     """
         Método chamado para inicializar o menu inicial
     :return: nada
     """
     Window.size = (300, 100)
     config = ConfigParser()
     # Carrega últimas configurações utilizadas (ou padrões se arquivo não é encontrado)
     config.read('settings.ini')
     self.username = config.get('section0', 'key00')
     self.color = SettingsApp.get_color(config.get('section0', 'key01'))
     if config.get('section1', 'key10') == "Single":
         self.is_multiplayer = False
     else:
         self.is_multiplayer = True
     self.match = config.get('section1', 'key11')
     self.rows = config.getint('section2', 'key20')
     self.columns = config.getint('section2', 'key21')
     self.bombs = config.getint('section3', 'key30')
开发者ID:iksmada,项目名称:Minesweeper,代码行数:21,代码来源:settings.py

示例2: Program

# 需要导入模块: from kivy.config import ConfigParser [as 别名]
# 或者: from kivy.config.ConfigParser import getint [as 别名]

#.........这里部分代码省略.........

        return True

    def build(self):
        self.title = core.string_lang_title[:-1]  # заголовок окна программы
        self.icon = "Data/Images/logo.png"  # иконка окна программы
        self.use_kivy_settings = False

        self.config = ConfigParser()
        self.config.read("{}/program.ini".format(core.prog_path))
        self.beep = SoundLoader.load("Data/mess_unread.wav")
        self.set_variable_from_settings()

        # Домашняя страница клиента.
        self.start_screen = \
            StartScreen(name_buttons_menu=core.name_buttons_menu,
                        buttons_menu=core.buttons_menu,
                        buttons_group=core.buttons_group,
                        previous="Data/Images/logo.png",
                        title_previous=core.string_lang_title[:-1],
                        title_image="Data/Images/DV.png",
                        overflow_image="Data/Images/overflow_image.png",
                        previous_image="Data/Images/previous_image.png",
                        events_callback=self.events_program)
        self.screen = self.start_screen

        Clock.schedule_once(self.read_license, 3)
        return self.start_screen

    def edit_pallete_theme(self):
        print("edit_pallete_theme")

    def set_variable_from_settings(self):
        self.messagesread = self.config.getint(
            "Mail", "messagesread")
        self.intervalscanmess = self.config.getint(
            "Mail", "intervalscanmess")

        self.loadscr = self.config.getint(
            "Network", "loadscr")
        self.checkattachtoforum = self.config.getint(
            "Network", "checkattachtoforum")
        self.authoupdate = self.config.getint(
            "Network", "authoupdate")
        self.authoconnect = self.config.getint(
            "Network", "authoconnect")

        self.downloadkey = self.config.getint(
            "General", "downloadkey")
        self.downloadfolder = eval(self.config.get(
            "General", "downloadfolder"))
        self.window_text_size = self.config.getint(
            "General", "progresstextsize")
        self.language = core.select_locale[self.config.get(
            "General", "language")]
        self.showonstartpage = self.config.get(
            "General", "showonstartpage")
        self.authorization = self.config.getint(
            "General", "authorization")
        self.resmessages = self.config.getint(
            "General", "resmessages")
        _user_reg = eval(self.config.get(
            "General", "user_reg"))

        try:
            self.user_reg = {"login": _user_reg["login"].decode("hex"),
开发者ID:HeaTTheatR,项目名称:HeaTDV4A,代码行数:70,代码来源:program.py

示例3: UserPrefs

# 需要导入模块: from kivy.config import ConfigParser [as 别名]
# 或者: from kivy.config.ConfigParser import getint [as 别名]

#.........这里部分代码省略.........
        except (NoOptionError, ValueError):
            return default

    def get_pref_float(self, section, option, default=None):
        '''
        Retrieve a preferences value as a float. 
        return default value if preference does not exist
        :param section the configuration section for the preference
        :type section string
        :param option the option for the section
        :type option string
        :param default
        :type default float
        :return float preference value
        '''
        try:
            return self.config.getfloat(section, option)
        except (NoOptionError, ValueError):
            return default

    def get_pref_int(self, section, option, default=None):
        '''
        Retrieve a preferences value as an int. 
        return default value if preference does not exist
        :param section the configuration section for the preference
        :type section string
        :param option the option for the section
        :type option string
        :param default
        :type default user specified
        :return int preference value
        '''
        try:
            return self.config.getint(section, option)
        except (NoOptionError, ValueError):
            return default

    def get_pref(self, section, option, default=None):
        '''
        Retrieve a preferences value as a string. 
        return default value if preference does not exist
        :param section the configuration section for the preference
        :type section string
        :param option the option for the section
        :type option string
        :param default
        :type default user specified
        :return string preference value
        '''
        try:
            return self.config.get(section, option)
        except (NoOptionError, ValueError):
            return default

    def get_pref_list(self, section, option, default=[]):
        """
        Retrieve a preferences value as a list. 
        return default value if preference does not exist
        :param section the configuration section for the preference
        :type section string
        :param option the option for the section
        :type option string
        :param default
        :type default user specified
        :return list of string values
        """
开发者ID:autosportlabs,项目名称:RaceCapture_App,代码行数:70,代码来源:prefs.py

示例4: UserPrefs

# 需要导入模块: from kivy.config import ConfigParser [as 别名]
# 或者: from kivy.config.ConfigParser import getint [as 别名]

#.........这里部分代码省略.........
                    for id, channel in content_dict["gauge_settings"].iteritems():
                        self._prefs_dict["gauge_settings"][id] = channel

        except Exception:
            pass

    def get_pref_bool(self, section, option, default=None):
        '''
        Retrieve a preferences value as a bool. 
        return default value if preference does not exist
        :param section the configuration section for the preference
        :type section string
        :param option the option for the section
        :type option string
        :param default
        :type default bool
        :return bool preference value
        '''
        try:
            return self.config.getboolean(section, option)
        except (NoOptionError, ValueError):
            return default

    def get_pref_float(self, section, option, default=None):
        '''
        Retrieve a preferences value as a float. 
        return default value if preference does not exist
        :param section the configuration section for the preference
        :type section string
        :param option the option for the section
        :type option string
        :param default
        :type default float
        :return float preference value
        '''
        try:
            return self.config.getfloat(section, option)
        except (NoOptionError, ValueError):
            return default

    def get_pref_int(self, section, option, default=None):
        '''
        Retrieve a preferences value as an int. 
        return default value if preference does not exist
        :param section the configuration section for the preference
        :type section string
        :param option the option for the section
        :type option string
        :param default
        :type default user specified
        :return int preference value
        '''
        try:
            return self.config.getint(section, option)
        except (NoOptionError, ValueError):
            return default

    def get_pref(self, section, option, default=None):
        '''
        Retrieve a preferences value as a string. 
        return default value if preference does not exist
        :param section the configuration section for the preference
        :type section string
        :param option the option for the section
        :type option string
        :param default
        :type default user specified
        :return string preference value
        '''
        try:
            return self.config.get(section, option)
        except (NoOptionError, ValueError):
            return default

    def set_pref(self, section, option, value):
        '''
        Set a preference value
        :param section the configuration section for the preference
        :type string
        :param option the option for the section
        :type string
        :param value the preference value to set
        :type value user specified
        '''
        self.config.set(section, option, value)
        self.config.write()

    def to_json(self):
        '''
        Serialize preferences to json
        '''
        data = {'range_alerts': {}, 'gauge_settings':{}}

        for name, range_alert in self._prefs_dict["range_alerts"].iteritems():
            data["range_alerts"][name] = range_alert.to_dict()

        for id, channel in self._prefs_dict["gauge_settings"].iteritems():
            data["gauge_settings"][id] = channel

        return json.dumps(data)
开发者ID:ddimensia,项目名称:RaceCapture_App,代码行数:104,代码来源:prefs.py


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