Tweaks to held-key activation
- From: David Schneider <dnschneid gmail com>
- To: Kupfer <kupfer-list gnome org>
- Subject: Tweaks to held-key activation
- Date: Fri, 8 Apr 2011 01:02:41 -0700
As mentioned in a completely unrelated bug report, the hold-key activation
of actions is sort of useless as is.
I've found that when using it, the end result is that you accidentally spew
whatever key you were holding into the launched app. Not helpful.
This patch changes it so that the action activates upon release (if you
held it long enough). For visual feedback, when you've held it long enough
the current matchview turns to the active color.
Maybe it's more useful now; but maybe not.
>From e07c9b7deff308c585759d019db98da3d599a714 Mon Sep 17 00:00:00 2001
From: David Schneider <dnschneid gmail com>
Date: Fri, 8 Apr 2011 00:49:11 -0700
Subject: [PATCH] Holding a key now activates the current action upon release.
When you've held it long enough, the match view color turns "active" to give
visual feedback.
---
kupfer/ui/browser.py | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/kupfer/ui/browser.py b/kupfer/ui/browser.py
index b7f324a..2ac4651 100644
--- a/kupfer/ui/browser.py
+++ b/kupfer/ui/browser.py
@@ -311,6 +311,13 @@ class MatchView (gtk.Bin):
selectedc = self.style.dark[gtk.STATE_SELECTED]
self.event_box.modify_bg(gtk.STATE_SELECTED, selectedc)
+ def _key_held_feedback(self, held):
+ if held:
+ selectedc = self.style.dark[gtk.STATE_ACTIVE]
+ self.event_box.modify_bg(gtk.STATE_SELECTED, selectedc)
+ else:
+ self._update_theme()
+
def build_widget(self):
"""
Core initalization method that builds the widget
@@ -973,6 +980,7 @@ class Interface (gobject.GObject):
self._key_press_interval = 0.8
self._key_press_repeat_threshold = 0.02
self._key_pressed = None
+ self._key_held = False
self._reset_to_toplevel = False
self._reset_when_back = False
self.entry.connect("realize", self._entry_realized)
@@ -1070,8 +1078,15 @@ class Interface (gobject.GObject):
def _entry_realized(self, widget):
self.update_text_mode()
+ def _key_held_feedback(self, held):
+ self.current.match_view._key_held_feedback(held)
+
def _entry_key_release(self, entry, event):
self._key_pressed = None
+ if self._key_held:
+ self._key_held = False
+ self._key_held_feedback(False)
+ self._activate(None, None)
def _entry_key_press(self, entry, event):
"""
@@ -1143,8 +1158,9 @@ class Interface (gobject.GObject):
keyv not in self.keys_sensible and
curtime - self._key_press_time > self._key_press_repeat_threshold):
if curtime - self._key_press_time > self._key_press_interval:
- self._activate(None, None)
- self._key_pressed = None
+ if not self._key_held:
+ self._key_held_feedback(True)
+ self._key_held = True
return True
else:
self._key_press_time = curtime
--
1.7.1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]