Python kivy.config.Config 模块,set() 实例源码

我们从Python开源项目中,提取了以下15个代码示例,用于说明如何使用kivy.config.Config.set()

项目:mobileinsight-mobile    作者:mobile-insight    | 项目源码 | 文件源码
def build(self):
        # Force to initialize all configs in .mobileinsight.ini
        # This prevents missing config due to existence of older-version .mobileinsight.ini
        # Work-around: force on_config_change, which would update config.ini
        config = self.load_config()
        val = int(config.get('mi_general', 'bcheck_update'))
        config.set('mi_general', 'bcheck_update', int(not val))
        config.write()
        config.set('mi_general', 'bcheck_update', val)
        config.write()

        Window.borderless = False

        self.screens = {}
        self.available_screens = screens.__all__
        self.screen_names = self.available_screens
        for i in range(len(self.available_screens)):
            self.screens[i] = getattr(screens, self.available_screens[i])()
        self.home_screen = self.screens[0]
        COORDINATOR.setup_analyzers()
        COORDINATOR.send_control('START')
        self.root.ids.scr_mngr.switch_to(self.screens[0])
项目:mobileinsight-mobile    作者:mobile-insight    | 项目源码 | 文件源码
def on_start(self):
        # android.stop_service() # Kill zombine service from previous app instances

        Config.set('kivy', 'exit_on_escape', 0)

        if not main_utils.is_rooted():
            err_str = "MobileInsight requires root privilege. Please root your device for correct functioning."
            Logger.error(err_str)
            self.home_screen.log_error(err_str)
        elif not main_utils.check_diag_mode():
            err_str = "The diagnostic mode is disabled. Please check your phone settings."
            Logger.error(err_str)
            self.home_screen.log_error(err_str)
            # content = ConfirmPopup(text=err_str)
            # content.bind(on_answer=self.__popup_dismiss)
            # self.popup = Popup(title='Diagnostic mode is not available',
            #             content=content,
            #             size_hint=(None, None), 
            #             size=(1200, 400),
            #             auto_dismiss=False)
            # self.popup.open()
        else:
            self.privacy_check()
            self.check_update()
项目:RKSV    作者:ztp-at    | 项目源码 | 文件源码
def verifyDEP_main_Cb(self, result):
        if not self._verifying:
            return

        outUsedRecIds = list()
        for r in result:
            if r[0]:
                self._verifying = False
                self.verify_button.text = _('Verify')
                displayError(r[0])
                return
            outUsedRecIds.append(r[1])

        App.get_running_app().pool.apply_async(verifyDEP_finalize_Task,
                (outUsedRecIds, set()), callback =
                self.verifyDEP_finalize_Cb)
项目:RKSV    作者:ztp-at    | 项目源码 | 文件源码
def verifyDEP_main_Cb(self, result):
        if not self._verifying:
            return

        outUsedRecIds = list()
        for r in result:
            if r[0]:
                self._verifying = False
                self.verify_button.text = _('Verify')
                displayError(r[0])
                return
            outUsedRecIds.append(r[1])

        App.get_running_app().pool.apply_async(verifyDEP_finalize_Task,
                (outUsedRecIds, set()), callback =
                self.verifyDEP_finalize_Cb)
项目:garden.notification    作者:kivy-garden    | 项目源码 | 文件源码
def _hide_x11_window(self):
        try:
            # Ubuntu's Unity for some reason ignores this if there are
            # multiple windows stacked to a single icon on taskbar.
            # Unity probably calls the same thing to stack the running
            # programs to a single icon, which makes this command worthless.
            x11_command = [
                'xprop', '-name', '{}'.format(self.title), '-f',
                '_NET_WM_STATE', '32a', '-set', '_NET_WM_STATE',
                '_NET_WM_STATE_SKIP_TASKBAR'
            ]
            check_output(x11_command)
        except Exception as e:
            tb = traceback.format_exc()
            Logger.error(
                'Notification: An error occured in {}\n'
                '{}'.format(self.title, tb)
            )
项目:corgi    作者:el-ethan    | 项目源码 | 文件源码
def build(self):
        Config.set('graphics', 'width', '700')
        Config.set('graphics', 'height', '50')
        return CaptureBox()
项目:kivy_rpg    作者:spinningD20    | 项目源码 | 文件源码
def new_game(self, choice='clyde'):
        print('new game')
        # get numbers of last save files to find an appropriate save file id to provide copying
        # make this beast a lot shorter sometime soon.  Probably just iterate over files with choice in them, inc
        # all_tmx_files_to_db() # update seed file for any changes from tmx files before copying it to use
        save_number = 0
        for rootdir, dir, files in os.walk(SAVE_PATH):
            current_number = len(fnmatch.filter(files, choice + '*.save'))
            if current_number > save_number:
                save_number = current_number
        save_number += 1
        filename = choice + '-' + str(save_number)
        while os.path.isfile(SAVE_PATH + filename + '.save'):
            filename += '0'
        filename = SAVE_PATH + filename + '.save'
        # copy seed db file with name of filename to make a new save file
        copyfile(os.path.join(runpath, 'seed.db'), filename)
        engine = create_engine('sqlite:///' + filename)
        Session = sessionmaker(bind=engine)  # configure session object
        self.db = Session()
        # set player flags like main_character, player_party, etc
        player_character_flag = self.db.query(GameFlag).filter(GameFlag.name == 'player_character').first()
        if not player_character_flag:
            player_character_flag = GameFlag()
            player_character_flag.name = 'player_character'
        player_character_flag.value = choice
        # MAYBE TO-DO : find clyde map object and set its coords and map_id to values for clyde choice?
        # FOR NOW, commit changes
        self.db.add(player_character_flag)
        self.db.commit()
        print('save file created...loading', filename)
        self.load_game(filename)
项目:kivy_rpg    作者:spinningD20    | 项目源码 | 文件源码
def load_game(self, filename=os.path.join(runpath, 'seed.db')):
        print('hitting load game')
        # set the db here, get current map player object was last at, and load that map
        engine = create_engine('sqlite:///' + filename)
        Session = sessionmaker(bind=engine)  # configure session object
        self.db = Session()
        # until the other characters are in the db, trying to load a game with anyone but clyde will crash
        player_character_flag = self.db.query(GameFlag).filter(GameFlag.name == 'player_character').first()
        self.player_object = self.db.query(MapObject).filter(MapObject.name == player_character_flag.value).first()
        tilemap = self.db.query(TileMap).filter(TileMap.id == self.player_object.map_id).first()
        self.manager.current = 'Game'
        self.load_map(tilemap.file_name)
项目:kivy_samples    作者:AtsushiSakai    | 项目源码 | 文件源码
def build(self):
        height = 300
        Config.set('graphics', 'height', height)
        Config.set('graphics', 'width', height * 2)
        return GraphView()
项目:segreto-3    作者:anselm94    | 项目源码 | 文件源码
def build(self):
        self.icon = 'data/icon/segreto_icon.png' # Don't know why icon isn't set :(
        self.title = 'Segreto 3'
        self.init()
        return self.screenmanager
项目:Tic-Tac-Toe    作者:CSaratakij    | 项目源码 | 文件源码
def init_config(self):
        Config.set("graphics", "fullscreen", 0)
        Config.set("graphics", "resizable", 0)
        Config.set("graphics", "height", 600)
        Config.set("graphics", "width", 600)
        Config.set("kivy", "exit_on_escape", 0)
        Config.set("input", "mouse", "mouse,multitouch_on_demand")
        Config.write()
项目:VKBot    作者:Fogapod    | 项目源码 | 文件源码
def save_setting(key, value, section='General'):
    Config.read(SETTINGS_FILE)
    Config.set(section, key, value)
    Config.write()
项目:GAP    作者:Tileyon    | 项目源码 | 文件源码
def setscreen(self):
        if self.kivy:
            from kivy.config import Config
            Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
            from kivy.uix.floatlayout import FloatLayout
            from kivy.core.window import Window
            from kivy.utils import platform as core_platform
            self.root = FloatLayout()
            if (self.xratio == 0) or (self.yratio == 0):
                if core_platform == 'android':
                    self.screen_size = Window.size
                else:
                    self.screen_size = (800, 600)
                self.xratio = self.screen_size[0] / 800.0
                self.yratio = self.screen_size[1] / 600.0

            if core_platform == 'android':
                Window.softinput_mode = 'pan'
            else:
                Window.size = self.screen_size
        else:
            import ui
            if (self.xratio == 0) or (self.yratio == 0):
                ss1 = ui.get_screen_size()[0]
                ss3 = ui.get_screen_size()[1]
                notoptimal = True
                while notoptimal:
                    if ss1 % 8 == 0:
                        notoptimal = False
                    else:
                        ss1 -= 1
                ss1 = ss1 - 124
                ss2 = (ss1 / 4) * 3
                if ss2 > ss3:
                    ss2 = ss3 - ss2 - ((ss3 - ss2) % 3)
                    ss1 = (ss2 / 3) * 4
                self.screen_size = (ss1, ss2)
                self.xratio = self.screen_size[0] / 800
                self.yratio = self.screen_size[1] / 600

            self.root = ui.View(frame=(0,0,self.screen_size[0], \
                        self.screen_size[1]))
项目:GAP    作者:Tileyon    | 项目源码 | 文件源码
def setscreen(self):
        if self.kivy:
            from kivy.config import Config
            Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
            from kivy.uix.floatlayout import FloatLayout
            from kivy.core.window import Window
            from kivy.utils import platform as core_platform
            self.root = FloatLayout()
            if (self.xratio == 0) or (self.yratio == 0):
                if core_platform == 'android':
                    self.screen_size = Window.size
                    if self.screen_size[0] < self.screen_size[1]:
                        x = self.screen_size[0]
                        y = self.screen_size[0] / 4 * 3
                        self.screen_size = (x, y)
                else:
                    self.screen_size = (800, 600)
                self.xratio = self.screen_size[0] / 800.0
                self.yratio = self.screen_size[1] / 600.0

            if core_platform == 'android':
                Window.softinput_mode = 'pan'
            else:
                Window.size = self.screen_size
        else:
            import ui
            if (self.xratio == 0) or (self.yratio == 0):
                ss1 = ui.get_screen_size()[0]
                ss3 = ui.get_screen_size()[1]
                notoptimal = True
                while notoptimal:
                    if ss1 % 8 == 0:
                        notoptimal = False
                    else:
                        ss1 -= 1
                ss2 = (ss1 / 4) * 3
                title_bar_height = int(ss3 / 600 * 50)
                if ss2 > ss3 - title_bar_height:
                    ss2 = ss3 - title_bar_height
                    notoptimal = True
                    while notoptimal:
                        if ss2 % 6 == 0:
                            notoptimal = False
                        else:
                            ss2 -= 1
                    ss1 = (ss2 / 3) * 4
                self.screen_size = (ss1, ss2)
                self.xratio = ss1 / 800
                self.yratio = ss2 / 600

            self.root = ui.View(frame=(0,0,self.screen_size[0], \
                        self.screen_size[1]))
项目:GAP    作者:Tileyon    | 项目源码 | 文件源码
def setscreen(self):
        if self.kivy:
            from kivy.config import Config
            Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
            from kivy.uix.floatlayout import FloatLayout
            from kivy.core.window import Window
            from kivy.utils import platform as core_platform
            self.root = FloatLayout()
            if (self.xratio == 0) or (self.yratio == 0):
                if core_platform == 'android':
                    self.screen_size = Window.size
                    if self.screen_size[0] < self.screen_size[1]:
                        x = self.screen_size[0]
                        y = self.screen_size[0] / 4 * 3
                        self.screen_size = (x, y)
                else:
                    self.screen_size = (800, 600)
                self.xratio = self.screen_size[0] / 800.0
                self.yratio = self.screen_size[1] / 600.0

            if core_platform == 'android':
                Window.softinput_mode = 'pan'
            else:
                Window.size = self.screen_size
        else:
            import ui
            if (self.xratio == 0) or (self.yratio == 0):
                ss1 = ui.get_screen_size()[0]
                ss3 = ui.get_screen_size()[1]
                notoptimal = True
                while notoptimal:
                    if ss1 % 8 == 0:
                        notoptimal = False
                    else:
                        ss1 -= 1
                ss2 = (ss1 / 4) * 3
                title_bar_height = int(ss3 / 600 * 90)
                if ss2 > ss3 - title_bar_height:
                    ss2 = ss3 - title_bar_height
                    notoptimal = True
                    while notoptimal:
                        if ss2 % 6 == 0:
                            notoptimal = False
                        else:
                            ss2 -= 1
                    ss1 = (ss2 / 3) * 4
                self.screen_size = (ss1, ss2)
                self.xratio = ss1 / 800
                self.yratio = ss2 / 600

            self.root = ui.View(frame=(0,0,self.screen_size[0], \
                        self.screen_size[1]))