Merge lp:~blackdaemon/enso/quasimodekey-doubletap-cmd into lp:~communityenso/enso/community-enso

Proposed by blackdaemon
Status: Needs review
Proposed branch: lp:~blackdaemon/enso/quasimodekey-doubletap-cmd
Merge into: lp:~communityenso/enso/community-enso
Diff against target: 69 lines (+24/-4)
2 files modified
enso/config.py (+5/-0)
enso/quasimode/__init__.py (+19/-4)
To merge this branch: bzr merge lp:~blackdaemon/enso/quasimodekey-doubletap-cmd
Reviewer Review Type Date Requested Status
Drarok Approve
Review via email: mp+28502@code.launchpad.net

Description of the change

New feature that allows to have specific Enso command pre-inserted when double-tapping the quasimode-key.

To post a comment you must log in.
Revision history for this message
Drarok (webmaster-drarok) wrote :

I've merged this into my local copy and tried it out, works great for the 'open' command, good idea! :)

review: Approve
144. By blackdaemon

Fixes full redraw of suggestions list after pre-typing the command.

145. By blackdaemon

Fixed the config value comment.
Set reasonable default to "open" command.

Unmerged revisions

145. By blackdaemon

Fixed the config value comment.
Set reasonable default to "open" command.

144. By blackdaemon

Fixes full redraw of suggestions list after pre-typing the command.

143. By blackdaemon

Added quasimode-key double-tap command

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'enso/config.py' (properties changed: -x to +x)
2--- enso/config.py 2008-04-27 11:12:38 +0000
3+++ enso/config.py 2010-06-25 17:41:34 +0000
4@@ -26,6 +26,11 @@
5 # auto-completion mechanism engages.
6 QUASIMODE_MIN_AUTOCOMPLETE_CHARS = 2
7
8+# Quasimode-key double-tap delay (seconds)
9+QUASIMODE_DOUBLETAP_DELAY = 0.5
10+# Command to pre-type on quasimode-key double-tap
11+QUASIMODE_DOUBLETAP_COMMAND = "open"
12+
13 # The message displayed when the user types some text that is not a command.
14 BAD_COMMAND_MSG = "<p><command>%s</command> is not a command.</p>"\
15 "%s"
16
17=== modified file 'enso/quasimode/__init__.py'
18--- enso/quasimode/__init__.py 2008-04-27 11:12:38 +0000
19+++ enso/quasimode/__init__.py 2010-06-25 17:41:34 +0000
20@@ -48,6 +48,7 @@
21 # Imports
22 # ----------------------------------------------------------------------------
23
24+import time
25 import weakref
26 import logging
27 import traceback
28@@ -155,6 +156,8 @@
29
30 self.__eventMgr.setModality( self.__isModal )
31
32+ self.__lastQuasimodeStarted = None
33+
34
35 def setQuasimodeKeyByName( self, function_name, key_name ):
36 # Sets the quasimode to use the given key (key_name must be a
37@@ -271,17 +274,29 @@
38
39 assert self._inQuasimode == False
40
41- if self.__quasimodeWindow == None:
42- logging.info( "Created a new quasimode window!" )
43+ if (config.QUASIMODE_DOUBLETAP_DELAY > 0
44+ and config.QUASIMODE_DOUBLETAP_COMMAND is not None):
45+ if self.__lastQuasimodeStarted is not None:
46+ elapsed = time.time() - self.__lastQuasimodeStarted
47+ if elapsed < config.QUASIMODE_DOUBLETAP_DELAY:
48+ self.__suggestionList.setUserText(
49+ "%s " % config.QUASIMODE_DOUBLETAP_COMMAND)
50+ self.__nextRedrawIsFull = True
51+
52+ self.__lastQuasimodeStarted = time.time()
53+
54+ if self.__quasimodeWindow is None:
55+ logging.debug( "Created a new quasimode window!" )
56 self.__quasimodeWindow = TheQuasimodeWindow()
57
58 self.__eventMgr.triggerEvent( "startQuasimode" )
59-
60- self.__eventMgr.registerResponder( self.__onTick, "timer" )
61+
62
63 self._inQuasimode = True
64 self.__needsRedraw = True
65
66+ self.__eventMgr.registerResponder( self.__onTick, "timer" )
67+
68 # Postcondition
69 assert self._inQuasimode == True
70

Subscribers

People subscribed via source and target branches

to status/vote changes: