[kupfer] browser: Make both / and = initiate text mode with passthrough
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] browser: Make both / and = initiate text mode with passthrough
- Date: Wed, 9 Sep 2009 19:17:10 +0000 (UTC)
commit 4d3eaf47c625f3467069515497b53656ca95ca6e
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Wed Sep 9 19:22:26 2009 +0200
browser: Make both / and = initiate text mode with passthrough
/ allows you to begin typing an absolute path, = allows to begin
typing an expression to calculate.
kupfer/browser.py | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/kupfer/browser.py b/kupfer/browser.py
index 81fc7fe..31581b0 100644
--- a/kupfer/browser.py
+++ b/kupfer/browser.py
@@ -814,6 +814,9 @@ class Interface (gobject.GObject):
"<Control>s" : "switch_to_source",
"<Control>r" : "reset_all",
}
+ direct_text_key = gtk.gdk.keyval_from_name("period")
+ init_text_keys = map(gtk.gdk.keyval_from_name, ("slash", "equal"))
+ init_text_keys.append(direct_text_key)
# test for alt modifier (MOD1_MASK is alt/option)
modifiers = gtk.accelerator_get_default_mod_mask()
mod1_mask = ((event.state & modifiers) == gtk.gdk.MOD1_MASK)
@@ -855,11 +858,10 @@ class Interface (gobject.GObject):
keyv = key_book["Down"]
elif keyv == ord("/") and (has_selection or not can_text_mode):
keyv = key_book["Right"]
- elif can_text_mode and (keyv == ord(".") or keyv == ord("/")):
- # toggle text mode with "." or "/"
+ elif can_text_mode and keyv in init_text_keys:
self.toggle_text_mode(True)
- # swallow if a period
- swallow = (keyv == ord("."))
+ # swallow if it is the direct key
+ swallow = (keyv == direct_text_key)
return swallow
# activate on repeated key
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]