diff options
Diffstat (limited to 'examples/twisted_serve_ssh.py')
-rw-r--r-- | examples/twisted_serve_ssh.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/examples/twisted_serve_ssh.py b/examples/twisted_serve_ssh.py index 9562bc6..36396dd 100644 --- a/examples/twisted_serve_ssh.py +++ b/examples/twisted_serve_ssh.py @@ -168,7 +168,7 @@ class TwistedScreen(urwid.BaseScreen): 1. Input 2. Output - Input is achieved in normal urwid by passing a lsit of available readable + Input is achieved in normal urwid by passing a list of available readable file descriptors to the event loop for polling/selecting etc. In the Twisted situation, this is not necessary because Twisted polls the input descriptors itself. Urwid allows this by being driven using the main loop @@ -221,14 +221,17 @@ class TwistedScreen(urwid.BaseScreen): self.terminal.cursorPosition(*cursor) # XXX from base screen - def set_mouse_tracking(self): + def set_mouse_tracking(self, enable=True): """ - Enable mouse tracking. + Enable (or disable) mouse tracking. After calling this function get_input will include mouse click events along with keystrokes. """ - self.write(urwid.escape.MOUSE_TRACKING_ON) + if enable: + self.write(urwid.escape.MOUSE_TRACKING_ON) + else: + self.write(urwid.escape.MOUSE_TRACKING_OFF) # twisted handles polling, so we don't need the loop to do it, we just # push what we get to the loop from dataReceived. @@ -262,7 +265,7 @@ class TwistedScreen(urwid.BaseScreen): # Private def _on_update_palette_entry(self, name, *attrspecs): - # copy the attribute to a dictionary containing the escape seqences + # copy the attribute to a dictionary containing the escape sequences self._pal_escape[name] = self._attrspec_to_escape( attrspecs[{16:0,1:1,88:2,256:3}[self.colors]]) |