[kupfer] Add accelerator configuration for comma trick



commit 74ccd8f8f321708a99dea4e1147e071123a6c8dd
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Thu Apr 7 22:13:13 2005 +0200

    Add accelerator configuration for comma trick
    
    So that it can be used when single-keystroke accelerators (,) are
    disabled.

 data/defaults.cfg        |    1 +
 kupfer/ui/browser.py     |   14 ++++++++++----
 kupfer/ui/preferences.py |    1 +
 3 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/data/defaults.cfg b/data/defaults.cfg
index 158b469..5835f08 100644
--- a/data/defaults.cfg
+++ b/data/defaults.cfg
@@ -15,6 +15,7 @@ UseCommandKeys = True
 
 [Keybindings]
 activate = <Alt>a
+comma_trick =
 compose_action = <Control>Return
 reset_all = <Control>r
 select_quit = <Control>q
diff --git a/kupfer/ui/browser.py b/kupfer/ui/browser.py
index 0b93308..eb91a42 100644
--- a/kupfer/ui/browser.py
+++ b/kupfer/ui/browser.py
@@ -934,10 +934,7 @@ class Interface (gobject.GObject):
 			elif keyv == ord("/") and has_selection:
 				keyv = key_book["Right"]
 			elif keyv == ord(",") and has_selection:
-				cur = self.current.get_current()
-				curpane = self._pane_for_widget(self.current)
-				if self.data_controller.object_stack_push(curpane, cur):
-					self._relax_search_terms()
+				if self.comma_trick():
 					return True
 			elif keyv in init_text_keys:
 				if self.try_enable_text_mode():
@@ -1220,6 +1217,15 @@ class Interface (gobject.GObject):
 	def compose_action(self):
 		self.data_controller.compose_selection()
 
+	def comma_trick(self):
+		if self.current.get_match_state() != State.Match:
+			return False
+		cur = self.current.get_current()
+		curpane = self._pane_for_widget(self.current)
+		if self.data_controller.object_stack_push(curpane, cur):
+			self._relax_search_terms()
+			return True
+
 	def _pane_reset(self, controller, pane, item):
 		wid = self._widget_for_pane(pane)
 		if not item:
diff --git a/kupfer/ui/preferences.py b/kupfer/ui/preferences.py
index efcc5ba..6de7714 100644
--- a/kupfer/ui/preferences.py
+++ b/kupfer/ui/preferences.py
@@ -31,6 +31,7 @@ class PreferencesWindowController (pretty.OutputMixin):
 
 	ACCELERATOR_NAMES = {
 		'activate': _('Alternate Activate'),
+		'comma_trick': _('Comma Trick'),
 		'compose_action': _('Compose Command'),
 		'reset_all': _('Reset All'),
 		'select_quit': _('Select Quit'),



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]