Exemplo n.º 1
0
    def check_config_dirs(self):

        if not fsutils.exists(self.app_config_dir):
            fsutils.makedirs(self.app_config_dir)

        self.app_config = os.path.join(self.app_config_dir, 'preferences.cfg')

        # Check color profiles directory
        self.app_color_profile_dir = os.path.join(self.app_config_dir,
                                                  'profiles')
        if not fsutils.exists(self.app_color_profile_dir):
            fsutils.makedirs(self.app_color_profile_dir)

        from uc2.cms import libcms

        for item in uc2const.COLORSPACES + [uc2const.COLOR_DISPLAY, ]:
            filename = 'built-in_%s.icm' % item
            path = os.path.join(self.app_color_profile_dir, filename)
            if not fsutils.exists(path):
                path = fsutils.get_sys_path(path)
                libcms.cms_save_default_profile(path, item)
Exemplo n.º 2
0
    def __init__(self, app, cfgdir='~'):
        # --- Init paths
        path = fsutils.expanduser(os.path.join(cfgdir, '.config', 'sk1-wx'))
        self.app_config_dir = path

        UCData.__init__(self, app, check=False)
        self.check_config_dirs()

        self.app_palette_dir = os.path.join(path, 'palettes')
        self.plugin_dir = os.path.join(path, 'sk1_custom_plugins')
        self.app_temp_dir = os.path.join(path, 'temp')

        # --- Check config directories
        paths = (self.app_palette_dir, self.plugin_dir, self.app_temp_dir)
        [fsutils.makedirs(item) for item in paths if not fsutils.exists(item)]

        plugin_dir_init = os.path.join(self.plugin_dir, '__init__.py')
        if not fsutils.exists(plugin_dir_init):
            fsutils.get_fileptr(plugin_dir_init, True).close()