From 305d6605010e05e61f3392cd30348759331867b2 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sun, 7 Nov 2021 15:48:12 -0800 Subject: [PATCH] startup: open selected repository when "Enter" is pressed Teach the startup dialog to open the currently selected repository when the "Enter" key is pressed. Closes #1162 Reported-by: Ihor @kopach on github.com Signed-off-by: David Aguilar --- CHANGES.rst | 4 ++++ cola/widgets/startup.py | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 80495bbf..1b364ae6 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -9,6 +9,10 @@ Usability, bells and whistles and can be configured to display text, just icons, or text and icons. (`#1171 `_) +* The startup dialog will now open the selected repository when the "enter" + key is pressed. + (`#1162 `_) + Fixes ----- * The "Unstage" toolbar action was fixed. diff --git a/cola/widgets/startup.py b/cola/widgets/startup.py index 39032349..043d5dec 100644 --- a/cola/widgets/startup.py +++ b/cola/widgets/startup.py @@ -10,6 +10,7 @@ from ..i18n import N_ from .. import core from .. import display from .. import guicmds +from .. import hotkeys from .. import icons from .. import qtutils from .. import version @@ -138,6 +139,10 @@ class StartupDialog(standard.Dialog): qtutils.connect_button(self.clone_button, self.clone_repo) qtutils.connect_button(self.new_button, self.new_repo) qtutils.connect_button(self.close_button, self.reject) + # Open the selected repository when "enter" is pressed. + self.action_open_repo = qtutils.add_action( + self, N_('Open'), self.open_selected_bookmark, *hotkeys.ACCEPT + ) # pylint: disable=no-member self.tab_bar.currentChanged.connect(self.tab_changed) @@ -229,6 +234,11 @@ class StartupDialog(standard.Dialog): self.repodir = repodir self.accept() + def open_selected_bookmark(self): + selected = self.bookmarks.selectedIndexes() + if selected: + self.open_bookmark(selected[0]) + def open_bookmark(self, index): if index.row() == 0: self.open_repo() -- 2.11.4.GIT