Beispiel #1
0
    def __init__(self, init=True):
        # Read the config files
        self.__user_config = Utility.load_json(Utility.CONFIG_FILE_PATH)
        self.__system_config = Utility.load_json(
            Utility.SYSTEM_CONFIG_FILE_PATH)
        self.__force_upgrade = ['long_breaks', 'short_breaks']

        if init:
            if self.__user_config is None:
                Utility.initialize_safeeyes()
                self.__user_config = self.__system_config
                self.save()
            else:
                system_config_version = self.__system_config['meta'][
                    'config_version']
                meta_obj = self.__user_config.get('meta', None)
                if meta_obj is None:
                    # Corrupted user config
                    self.__user_config = self.__system_config
                else:
                    user_config_version = str(
                        meta_obj.get('config_version', '0.0.0'))
                    if LooseVersion(user_config_version) != LooseVersion(
                            system_config_version):
                        # Update the user config
                        self.__merge_dictionary(self.__user_config,
                                                self.__system_config)
                        self.__user_config = self.__system_config
                        # Update the style sheet
                        Utility.replace_style_sheet()

            Utility.merge_plugins(self.__user_config)
            self.save()
Beispiel #2
0
    def __init__(self):
        # Read the config files
        self.__user_config = Utility.load_json(Utility.CONFIG_FILE_PATH)
        self.__system_config = Utility.load_json(
            Utility.SYSTEM_CONFIG_FILE_PATH)

        if self.__user_config is None:
            Utility.initialize_safeeyes()
            self.__user_config = self.__system_config
            self.save()
        else:
            system_config_version = self.__system_config['meta'][
                'config_version']
            meta_obj = self.__user_config.get('meta', None)
            if meta_obj is None:
                # Corrupted user config
                self.__user_config = self.__system_config
            else:
                user_config_version = str(
                    meta_obj.get('config_version', '0.0.0'))
                if LooseVersion(user_config_version) != LooseVersion(
                        system_config_version):
                    # Update the user config
                    self.__merge_dictionary(self.__user_config,
                                            self.__system_config)
                    self.__user_config = self.__system_config

        Utility.merge_plugins(self.__user_config)
        self.save()