def on_select_item(self, index): if index == -1: return file_path = self.view.file_name() project_path = watch.get_observer_path(file_path) id = project.get_id(project_path) info = project.get_info(id) page_file = self.items[index][1] params = info['params'] url = self.get_url( info[self.prefix_key], page_file, params['page_path'] if page_file in params else None ) webbrowser.open_new_tab(url)
def watch_project(): watch.start(path, ProjectEventHandler(path)) sublime.set_timeout(set_status, 0) id = project.get_id(path) def after_fetch(res): if res['errno']: return data = res['data'] project.set_info(id, { 'online_prefix': SITE + data['onlineprefix'], 'mobile_prefix': 'bainuo://component?url=' + SITE + data['mobileprefix'], 'params': data['param'] }) project.fetch_info(id, after_fetch)
def watch_project(): watch.start(path, ProjectEventHandler(path)) sublime.set_timeout(set_status, 0) id = project.get_id(path) def after_fetch(res): if res['errno']: return data = res['data'] project.set_info( id, { 'online_prefix': SITE + data['onlineprefix'], 'mobile_prefix': 'bainuo://component?url=' + SITE + data['mobileprefix'], 'params': data['param'] }) project.fetch_info(id, after_fetch)
def after_create(): project.preview(project.get_id(path))
def __init__(self, path): FileSystemEventHandler.__init__(self) self.path = path self.id = project.get_id(path)
def run(self, dirs): project.preview(project.get_id(dirs[0]))