~nhanb/mcross

ca08134381a8068fea24b17fccb1d5942cd36c1d — Bùi Thành Nhân 11 months ago f868a62
ctrl-l to jump to address bar
2 files changed, 8 insertions(+), 2 deletions(-)

M src/mcross/gui/view.py
M src/mcross/gui/widgets.py
M src/mcross/gui/view.py => src/mcross/gui/view.py +6 -0
@@ 113,6 113,12 @@ class View:
        address_bar.bind("<KP_Enter>", self._on_go)
        address_bar.focus_set()

        def on_ctrl_l(ev):
            address_bar.focus()
            address_bar.select_all()

        root.bind("<Control-l>", on_ctrl_l)

        # Go button
        go_btn = ttk.Button(row1, text="三三ᕕ( ᐛ )ᕗ", command=self._on_go, width=10)
        self.go_btn = go_btn

M src/mcross/gui/widgets.py => src/mcross/gui/widgets.py +2 -2
@@ 28,9 28,9 @@ class McEntry(ttk.Entry):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.bind("<Control-a>", self._on_ctrl_a)
        self.bind("<Control-a>", self.select_all)

    def _on_ctrl_a(self, ev):
    def select_all(self, ev=None):
        self.select_range(0, "end")
        self.icursor("end")
        return "break"