def main(): widget_name = __file__ + str(os.stat(__file__).st_mtime) v = appex.get_widget_view() # Optimization: Don't create a new view if the widget already shows the launcher. if v is None or v.name != widget_name: from utils import py_utils from core.ui2.ui_widget import LauncherView # load global configs MAIN_CONFIG = py_utils.load_config() # getter index page buttons v = LauncherView(MAIN_CONFIG) v.name = widget_name appex.set_widget_view(v)
def __init__(self, cfg): super().__init__(cfg) self.cuda = True if torch.cuda.is_available() else False self.exp_cfg = load_config(self.cfg.exp_cfg)
# @File : ui_widget_setter.py # @Author : loli # @Date : 2018-03-15 # @Version : 1.0 # @Contact : https://t.me/weep_x # @tg group: https://t.me/pythonista3dalaoqun import common import os import shutil import ui import console from utils import py_utils,file_picker import css_color_selector,icon_selector config = py_utils.load_config(os.path.join(py_utils.load_base_dir(False),'config.json')) def color_callback(color): scrv['color'].text=color def icon_callback(icon): scrv['icon'].text=icon def selecter(sender): w,h = ui.get_screen_size() if w >490: w=324 h=260 else:
#!/usr/bin/python3 # -*- coding: UTF-8 -*- import common import ui, clipboard, console from utils import py_utils _icons = py_utils.load_config(file='config/icon.json') def create_swatch_image(icon, w=32): return ui.Image('iob:' + icon) class MyDataClass(object): # supplies our list with records that are formatted for # ui.ListDataSource. Because we create swatch images, this is a good # idea. All the swatchs' are created once and kept. def __init__(self, *args, **kwargs): self.data = self._my_data(_icons) def _my_data(self, lst): # ListDataSource format return [{ 'title': clr, 'image': create_swatch_image(clr, w=24), 'accessory_type': 'detail_button' } for i, clr in enumerate(sorted(lst))] def filter(self, filter=''): # return the data, if filter is not passed, all records returned
# @File : pystore.py # @Author : loli # @Date : 2018-03-15 # @Version : v0.1 bate(内部测试版) # @Contact : https://t.me/weep_x # @tg group: https://t.me/pythonista3dalaoqun import common import os import appex from utils import py_utils from objc_util import * _runas = 0 # load global configs MAIN_CONFIG = py_utils.load_config() # getter index page buttons SHORTCUTS = MAIN_CONFIG['ibtns'] MAIN_CONFIG = None def main(): if appex.is_running_extension(): from core.ui2 import ui_extension_menu ui_extension_menu.load() else: from core.ui2 import ui_sys_conf ui_sys_conf.load() if __name__ == '__main__': main()