def toggle_webview(m): global webview_shown if webview_shown: webview.hide() else: webview.show() webview_shown = not webview_shown
def refresh(self): webview.hide() if self.visible: webview.show()
webview.move(0, ui.main_screen().height) class History: def __init__(self): self.history = [] engine.register('post:phrase', self.on_phrase_post) def parse_phrase(self, phrase): return ' '.join(word.split('\\')[0] for word in phrase) def on_phrase_post(self, j): phrase = self.parse_phrase(j.get('phrase', [])) if phrase in ('history show', 'history hide'): return cmd = j['cmd'] if cmd == 'p.end' and phrase: self.history.append((phrase, '')) self.history = self.history[-hist_len:] webview.render(template, phrases=self.history) history = History() ctx = Context('phrase_history') ctx.keymap({ 'history show': lambda m: webview.show(), 'history hide': lambda m: webview.hide(), }) # webview.show()
def close_history(): webview.hide()
webview.move(0, ui.main_screen().height) class History: def __init__(self): self.history = [] engine.register("post:phrase", self.on_phrase_post) def parse_phrase(self, phrase): return " ".join(word.split("\\")[0] for word in phrase) def on_phrase_post(self, j): phrase = self.parse_phrase(j.get("phrase", [])) if phrase in ("history show", "history hide"): return cmd = j["cmd"] if cmd == "p.end" and phrase: self.history.append((phrase, "")) self.history = self.history[-hist_len:] webview.render(template, phrases=self.history) history = History() ctx = Context("phrase_history") ctx.keymap({ "history show": lambda m: webview.show(), "history hide": lambda m: webview.hide() }) # webview.show()
def auto_hide(self): self.auto_hidden = True # webview.set_element_attribute() webview.hide()