</style>

<h3 id="title">History</h3>
<table>
{% for phrase in phrases %}
<tr><td class="phrase">{{ phrase }}</td></tr>
{% endfor %}
<tr><td><i>{{ hypothesis }}</i></td></tr>
</ul>
"""

if WEBVIEW:
    webview = webview.Webview()
    webview.render(template, phrases=["command"])
    webview.show()
    webview.move(1, ui.main_screen().height)


class History:
    def __init__(self):
        self.visible = True
        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", []))
        cmd = j["cmd"]
        if cmd == "p.end" and phrase:
        webview_location = webview_locations[key]
        if (webview_location["x"] != new_location["x"]
                or webview_location["y"] != new_location["y"]):
            webview_locations[key] = new_location
            config.save_config_json("webview_locations.json",
                                    webview_locations)

    webview = webview.Webview()
    webview.render(template, phrases=["command"])
    webview.show()

    key = screen_key()
    if key not in webview_locations:
        webview_locations[key] = {"x": 1, "y": ui.main_screen().height}
    print("moving webview_locations", webview_locations[key])
    webview.move(webview_locations[key]["x"], webview_locations[key]["y"])

    webview.register("blur", webview_blur)


class History:
    def __init__(self):
        self.visible = True
        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", []))
Exemple #3
0
}
</style>

<table>
{% for phrase in phrases %}
<tr><td class="phrase">{{ phrase }}</td></tr>
{% endfor %}
<tr><td><i>{{ hypothesis }}</i></td></tr>
</ul>
'''

if SHOW:
    webview = webview.Webview()
    webview.render(template, phrases=['waiting...'])
    webview.show()
    webview.move(ui.main_screen().width - 100, 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', []))
            cmd = j['cmd']
            if cmd == 'p.end' and phrase:
                self.history.append(phrase)
                self.history = self.history[-hist_len:]