diff --git a/src/beanify/gui/mainwindow.py b/src/beanify/gui/mainwindow.py index 008a164..f8681ff 100644 --- a/src/beanify/gui/mainwindow.py +++ b/src/beanify/gui/mainwindow.py @@ -114,7 +114,8 @@ class MainWindow(ThemedTk): self.bind_all( "", lambda event: self.editor.toggle_extended_matching() ) - self.bind_all("", lambda event: self.editor.do_save_txn()) + + # self.bind_all("", lambda event: self.editor.do_save_txn()) self.bind_all("", lambda event: self.editor.do_apply()) def setup_window(self): diff --git a/src/beanify/gui/roweditor.py b/src/beanify/gui/roweditor.py index 87a6c3a..5d8aa16 100644 --- a/src/beanify/gui/roweditor.py +++ b/src/beanify/gui/roweditor.py @@ -1,5 +1,6 @@ from tkinter import BooleanVar, StringVar, ttk from typing import Type +from functools import partial from ..base.converter import Converter @@ -122,14 +123,19 @@ class RowEditor(ttk.Frame): if to_select is not None: to_select.focus_set() - def focus_txn_frame(self): + def focus_txn_frame(self, name=None): if self.showing_txn: - to_select = self.last_txnfield - if to_select is None: - to_select = next( - (entry for _, _, entry in self.txn_rows.values() if entry) - ) + if name is None: + to_select = self.last_txnfield + if to_select is None: + to_select = next( + (entry for _, _, entry in self.txn_rows.values() if entry) + ) + else: + _, _, to_select = self.txn_rows[name] to_select.focus_set() + to_select.select_range(0, "end") + to_select.icursor("end") def toggle_matching(self): self.match_var.set(not self.match_var.get()) @@ -461,6 +467,12 @@ class RowEditor(ttk.Frame): # TODO!: If we have a list of accounts, we could use a ComboBox here instead? For autocompletion. # TODO!: Key shortcuts for prev/next record, and hints on the buttons # TODO!: Radio Buttons on the flag + # Pretty hacky accelerators + char = name[0].lower() + self.bind_all( + f"", + lambda event, fname=name: self.focus_txn_frame(fname), + ) txnrows[name] = (matchbox, keylabel, entrybox)