def run(awtk_root, is_excluded_file_handler = None): global DPI global AWTK_ROOT global TOOLS_ROOT global THEMES global APP_THEME global APP_ROOT global ASSETS_ROOT global OUTPUT_ROOT global IS_GENERATE_INC_RES global IS_GENERATE_INC_BITMAP AWTK_ROOT = awtk_root APP_ROOT = common.getcwd() action = common.get_action() if APP_ROOT.endswith('scripts'): APP_ROOT = os.path.dirname(APP_ROOT) os.chdir(APP_ROOT) DPI = 'x1' THEMES = [] APP_THEME = 'default' IS_GENERATE_INC_RES = True IS_GENERATE_INC_BITMAP = True TOOLS_ROOT = common.join_path(AWTK_ROOT, 'bin') AWTK_ROOT = common.join_path(APP_ROOT, AWTK_ROOT) ASSETS_ROOT = common.join_path(APP_ROOT, 'design') OUTPUT_ROOT = common.join_path(APP_ROOT, 'res/assets') use_default_theme_config() ASSET_C = common.join_path(OUTPUT_ROOT, '../assets.inc') if action == 'json': ASSET_C = common.join_path(APP_ROOT, 'assets_web.js') if not is_dependencies_ok(): print('For details, please read scripts/README.md.') elif len(THEMES) == 0: print('Not found theme.') print('For details, please read scripts/README.md.') else: common.init(AWTK_ROOT, ASSETS_ROOT, THEMES, ASSET_C, OUTPUT_ROOT) common.set_tools_dir(TOOLS_ROOT) common.set_dpi(DPI) common.set_app_theme(APP_THEME) common.set_enable_generate_inc_res(IS_GENERATE_INC_RES) common.set_enable_generate_inc_bitmap(IS_GENERATE_INC_BITMAP) common.set_is_excluded_file_handler(is_excluded_file_handler) on_generate_res_event() common.update_res() if isinstance(THEMES[0], dict): if action != 'clean' and action != 'web' and action != 'json' and action != 'pinyin': common.gen_res_c(False)
#!/usr/bin/python import os import sys # try add AWTK_ROOT/scripts to system environment AWTK_ROOT = '../awtk' if os.path.exists(AWTK_ROOT): sys.path.append(AWTK_ROOT + '/scripts') elif not os.path.isabs(AWTK_ROOT): AWTK_ROOT = '../' + AWTK_ROOT if os.path.exists(AWTK_ROOT): sys.path.append(AWTK_ROOT + '/scripts') # AWTK_ROOT/scripts/update_res_common.py import update_res_common as common APP_ROOT = common.getcwd() if APP_ROOT.endswith('scripts'): APP_ROOT = os.path.dirname(APP_ROOT) os.chdir(APP_ROOT) AWTK_ROOT = common.join_path(APP_ROOT, AWTK_ROOT) ASSETS_ROOT = common.join_path(APP_ROOT, 'assets') ASSET_C = common.join_path(APP_ROOT, 'demos/assets.c') THEMES = ['default'] common.init(AWTK_ROOT, ASSETS_ROOT, THEMES, ASSET_C) common.update_res()
def run(): common.init(AWTK_ROOT, ASSETS_ROOT, THEMES, ASSET_C) common.set_is_excluded_file_handler(is_excluded_file) common.update_res()