Enable mouse interaction, add a hint for selecting text.

Fixes #597
This commit is contained in:
Aldo Cortesi 2015-06-02 11:05:45 +12:00
parent 5e5e73001f
commit 62330e4b0f
2 changed files with 11 additions and 0 deletions

View File

@ -416,6 +416,7 @@ class ConsoleMaster(flow.FlowMaster):
def run(self): def run(self):
self.ui = urwid.raw_display.Screen() self.ui = urwid.raw_display.Screen()
self.ui.set_mouse_tracking()
self.ui.set_terminal_properties(256) self.ui.set_terminal_properties(256)
self.set_palette(self.palette) self.set_palette(self.palette)
self.loop = urwid.MainLoop( self.loop = urwid.MainLoop(

View File

@ -17,6 +17,16 @@ class Window(urwid.Frame):
def sig_focus(self, sender, section): def sig_focus(self, sender, section):
self.focus_position = section self.focus_position = section
def mouse_event(self, *args, **kwargs):
# args: (size, event, button, col, row)
k = super(self.__class__, self).mouse_event(*args, **kwargs)
if args[1] == "mouse drag":
signals.status_message.send(
message = "Hold down alt or ctrl to select text.",
expire = 1
)
return False
def keypress(self, size, k): def keypress(self, size, k):
k = super(self.__class__, self).keypress(size, k) k = super(self.__class__, self).keypress(size, k)
if k == "?": if k == "?":