Skip to content

Commit cc6a6f9

Browse files
global shortcuts and copying to clipboard
1 parent e36e6fd commit cc6a6f9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

main.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ def __init__(self, master, languages, configs):
2929
self._master.title("AI Enhanced Translator")
3030
self._master.geometry("800x600")
3131
self._UI_init()
32+
# bind global keys
33+
self._master.bind("<F1>", self.onCopyTranslation)
34+
self._master.bind("<F5>", self.onRefine)
35+
self._master.bind("<Control-Return>", self.onForceTranslate)
3236

3337
self._worker = CWorker(self)
3438
self._worker.start()
@@ -233,6 +237,12 @@ def onRefine(self, event=None):
233237
self._worker.refine(self._lastAIResult)
234238
self._refineBtn.config(state=tk.DISABLED)
235239
return 'break'
240+
241+
def onCopyTranslation(self, event=None):
242+
translation = self._fullOutputText.get("1.0", tk.END).strip()
243+
self._master.clipboard_clear()
244+
self._master.clipboard_append(translation)
245+
return 'break'
236246
# End of class
237247

238248
def main():

0 commit comments

Comments
 (0)