def verify_app_user_paths(): """Create user path structure if it does not exist yet. If there are new action lists in the phatch library, copy them to the user folder. """ # fixme: better use setting, path retrieval should be cleaned for path in [USER_DATA_PATH, USER_CONFIG_PATH, USER_CACHE_PATH, USER_ACTIONLISTS_PATH, USER_ACTIONS_PATH, USER_BIN_PATH, USER_BIN_PATH, USER_FONTS_PATH, USER_MASKS_PATH, USER_HIGHLIGHTS_PATH, USER_WATERMARKS_PATH]: if 0: # and path == USER_ACTIONLISTS_PATH: # DISABLED # copy action lists from the phatch root to user if os.path.exists(path): existing = os.listdir(path) for al in os.listdir(PHATCH_ACTIONLISTS_PATH): if not (al in existing): shutil.copyfile( os.path.join(PHATCH_ACTIONLISTS_PATH, al), os.path.join(path, al)) else: shutil.copytree(PHATCH_ACTIONLISTS_PATH, path) else: #create when they don't exist system.ensure_path(path) geek = 'geek.txt' if not os.path.isfile(USER_GEEK_PATH): shutil.copyfile(os.path.join(PHATCH_DATA_PATH, geek), USER_GEEK_PATH)
def verify_app_user_paths(): """Create user path structure if it does not exist yet. If there are new action lists in the phatch library, copy them to the user folder. """ # fixme: better use setting, path retrieval should be cleaned for path in [ USER_DATA_PATH, USER_CONFIG_PATH, USER_CACHE_PATH, USER_ACTIONLISTS_PATH, USER_ACTIONS_PATH, USER_BIN_PATH, USER_BIN_PATH, USER_FONTS_PATH, USER_MASKS_PATH, USER_HIGHLIGHTS_PATH, USER_WATERMARKS_PATH ]: if 0: # and path == USER_ACTIONLISTS_PATH: # DISABLED # copy action lists from the phatch root to user if os.path.exists(path): existing = os.listdir(path) for al in os.listdir(PHATCH_ACTIONLISTS_PATH): if not (al in existing): shutil.copyfile( os.path.join(PHATCH_ACTIONLISTS_PATH, al), os.path.join(path, al)) else: shutil.copytree(PHATCH_ACTIONLISTS_PATH, path) else: #create when they don't exist system.ensure_path(path) geek = 'geek.txt' if not os.path.isfile(USER_GEEK_PATH): shutil.copyfile(os.path.join(PHATCH_DATA_PATH, geek), USER_GEEK_PATH)
def generate(source, size=(48, 48), path=USER_PREVIEW_PATH, force=True): source_image = openImage.open(source) source_image.thumbnail((min(source_image.size[0], size[0] * 1), min(source_image.size[0], size[0] * 1)), Image.ANTIALIAS) ensure_path(path) for Action in api.ACTIONS.values(): action = Action() filename = os.path.join(path, action.label + '.png') if os.path.exists(filename) and not force: continue action.init() result = action.apply_pil(source_image.copy()) result.thumbnail(size, Image.ANTIALIAS) result.save(filename)
def generate(source, size=(48, 48), path=USER_PREVIEW_PATH, force=True): source_image = openImage.open(source) source_image.thumbnail( (min(source_image.size[0], size[0] * 1), min(source_image.size[0], size[0] * 1)), Image.ANTIALIAS) ensure_path(path) for Action in api.ACTIONS.values(): action = Action() filename = os.path.join(path, action.label + '.png') if os.path.exists(filename) and not force: continue action.init() result = action.apply_pil(source_image.copy()) result.thumbnail(size, Image.ANTIALIAS) result.save(filename)
import py2exe from lib import imtools, system, openImage system.set_bin_paths( [os.path.dirname(files[0]) for path, files in bin_files if files]) openImage.register() exe_dir = os.path.join('..', 'exe') inno_dir = os.path.join(exe_dir, 'innosetup') py2exe_dir = os.path.join(exe_dir, 'py2exe') # clean up previous build for d in (inno_dir, py2exe_dir): if os.path.exists(d): shutil.rmtree(d) system.ensure_path(exe_dir) # copy innosetup files phatch_iss = os.path.join(exe_dir, 'phatch.iss') shutil.copy2('setup\\windows\\phatch.iss', phatch_iss) shutil.copytree('setup\\windows\\innosetup', inno_dir) # copy dlls dll_path = '..\\dll' if os.path.exists(dll_path): shutil.copytree(dll_path, py2exe_dir) # py2exe options extra_options['options'] = { 'py2exe': { 'skip_archive':