~osomon/phatch/extract-all-metadata

« back to all changes in this revision

Viewing changes to phatch/core/config.py

  • Committer: spe.stani.be at gmail
  • Date: 2009-06-15 02:40:12 UTC
  • Revision ID: spe.stani.be@gmail.com-20090615024012-xekqmq40jlbt3m5y
change file structure

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
        PHATCH_FONTS_CACHE_PATH= config_paths['PHATCH_FONTS_CACHE_PATH']
62
62
        return config_paths
63
63
    SYSTEM_INSTALL      = True
64
 
    PHATCH_SHARE_PATH   = os.path.join(sys.prefix, "share")#also for win?
65
 
    PHATCH_FONTS_PATH   = os.path.join(PHATCH_SHARE_PATH,
66
 
                            "phatch","fonts")
 
64
    ROOT_SHARE_PATH     = os.path.join(sys.prefix, "share")#for win?
 
65
    PHATCH_SHARE_PATH   = os.path.join(ROOT_SHARE_PATH,"phatch")
 
66
    PHATCH_DATA_PATH    = os.path.join(PHATCH_SHARE_PATH,"data")
 
67
    PHATCH_FONTS_PATH   = os.path.join(PHATCH_DATA_PATH,"fonts")
67
68
    PHATCH_FONTS_CACHE_PATH   = os.path.join(PHATCH_SHARE_PATH,
68
 
                            "phatch","cache","fonts")
 
69
                            "cache","fonts")
69
70
 
70
71
    if sys.platform.startswith('win'):
71
72
        sys.stderr.write(
75
76
        sys.exit()
76
77
    else:
77
78
        return {
78
 
            "PHATCH_IMAGE_PATH" : os.path.join(PHATCH_SHARE_PATH,
79
 
                                    "phatch","images"),
80
 
            "PHATCH_LOCALE_PATH": os.path.join(PHATCH_SHARE_PATH,
81
 
                                    "locale"),
82
 
            "PHATCH_DOCS_PATH"  : os.path.join(PHATCH_SHARE_PATH,
83
 
                                    "phatch","docs"),
84
 
            "PHATCH_FONTS_PATH"       : PHATCH_FONTS_PATH,
85
 
            "PHATCH_FONTS_CACHE_PATH" : PHATCH_FONTS_CACHE_PATH,
86
 
            "PHATCH_ACTIONLISTS_PATH": os.path.join(PHATCH_SHARE_PATH,
87
 
                                    "phatch","actionlists"),
 
79
            'PHATCH_IMAGE_PATH' : os.path.join(PHATCH_SHARE_PATH,
 
80
                                    'images'),
 
81
            'PHATCH_LOCALE_PATH': os.path.join(PHATCH_SHARE_PATH,
 
82
                                    'locale'),
 
83
            'PHATCH_DOCS_PATH'  : os.path.join(PHATCH_SHARE_PATH,
 
84
                                    'phatch','docs'),
 
85
            #cache
 
86
            'PHATCH_FONTS_CACHE_PATH' : PHATCH_FONTS_CACHE_PATH,
 
87
            #data
 
88
            'PHATCH_ACTIONLISTS_PATH': os.path.join(PHATCH_DATA_PATH,
 
89
                                    'actionlists'),
 
90
            'PHATCH_FONTS_PATH'      : PHATCH_FONTS_PATH,
 
91
            'PHATCH_HIGHLIGHTS_PATH' : os.path.join(PHATCH_DATA_PATH,
 
92
                                    'highlights'),
 
93
            'PHATCH_MASKS_PATH' : os.path.join(PHATCH_DATA_PATH,
 
94
                                    'masks'),
88
95
        }
89
96
        
90
97
def add_user_paths(config_paths):
91
98
    config_paths.update({
92
 
        "USER_PATH"             : USER_PATH,
93
 
        "USER_ACTIONS_PATH"     : USER_ACTIONS_PATH,
94
 
        "USER_BIN_PATH"         : USER_BIN_PATH,
95
 
        "USER_FONTS_PATH"       : USER_FONTS_PATH,
96
 
        "USER_FONTS_CACHE_PATH" : USER_FONTS_CACHE_PATH,
97
 
        "USER_MASKS_PATH"       : USER_MASKS_PATH,
98
 
        "USER_HIGHLIGHTS_PATH"  : USER_HIGHLIGHTS_PATH,
99
 
        "USER_PREVIEW_PATH"     : USER_PREVIEW_PATH,
100
 
        "USER_SETTINGS_PATH"    : USER_SETTINGS_PATH,
101
 
        "USER_WATERMARKS_PATH"  : USER_WATERMARKS_PATH,
 
99
        'USER_PATH'             : USER_PATH,
 
100
        'USER_ACTIONS_PATH'     : USER_ACTIONS_PATH,
 
101
        'USER_BIN_PATH'         : USER_BIN_PATH,
 
102
        'USER_FONTS_PATH'       : USER_FONTS_PATH,
 
103
        'USER_FONTS_CACHE_PATH' : USER_FONTS_CACHE_PATH,
 
104
        'USER_MASKS_PATH'       : USER_MASKS_PATH,
 
105
        'USER_HIGHLIGHTS_PATH'  : USER_HIGHLIGHTS_PATH,
 
106
        'USER_PREVIEW_PATH'     : USER_PREVIEW_PATH,
 
107
        'USER_SETTINGS_PATH'    : USER_SETTINGS_PATH,
 
108
        'USER_WATERMARKS_PATH'  : USER_WATERMARKS_PATH,
102
109
    })
103
110
 
104
111
def fix_python_path(phatch_python_path=None):
136
143
    add_user_paths(config_paths)
137
144
    #configure sys.path
138
145
    phatch_path     = fix_python_path(
139
 
                        config_paths.get("PHATCH_PYTHON_PATH",None))
 
146
                        config_paths.get('PHATCH_PYTHON_PATH',None))
140
147
    fix_python_path(os.path.join(phatch_path,'core','lib'))
141
148
    #only when the gui is involved
142
149
    pyWxLib         = os.path.join(phatch_path,'pyWx','lib')
153
160
    #user actions
154
161
    fix_python_path(USER_ACTIONS_PATH)
155
162
    #load locale
156
 
    #load_locale('phatch',config_paths["PHATCH_LOCALE_PATH"])
 
163
    #load_locale('phatch',config_paths['PHATCH_LOCALE_PATH'])
157
164
    #set font cache
158
165
    from fonts import set_font_cache
159
166
    set_font_cache(USER_FONTS_PATH, PHATCH_FONTS_PATH,
168
175
    if config_paths is None:
169
176
        config_paths = {}
170
177
    config_paths    = check_config_paths(config_paths)
171
 
    load_locale('phatch',config_paths["PHATCH_LOCALE_PATH"])
 
178
    load_locale('phatch',config_paths['PHATCH_LOCALE_PATH'])
172
179