Coding style.
- Rename mouse actions.
This commit is contained in:
parent
abc5b15d90
commit
7ce8c0b9dc
2 changed files with 18 additions and 18 deletions
|
|
@ -615,10 +615,10 @@ class Help:
|
||||||
|
|
||||||
def on_mouse_input(self, term_code):
|
def on_mouse_input(self, term_code):
|
||||||
event = terminal.decode_mouse_input(term_code)
|
event = terminal.decode_mouse_input(term_code)
|
||||||
if event[1] == terminal.WHEEL_UP_MOUSE:
|
if event[1] == terminal.MOUSE_WHEEL_UP:
|
||||||
self.view.portal.scroll_up()
|
self.view.portal.scroll_up()
|
||||||
fiil3.APPEARANCE_CHANGED_EVENT.set()
|
fiil3.APPEARANCE_CHANGED_EVENT.set()
|
||||||
elif event[1] == terminal.WHEEL_DOWN_MOUSE:
|
elif event[1] == terminal.MOUSE_WHEEL_DOWN:
|
||||||
self.view.portal.scroll_down()
|
self.view.portal.scroll_down()
|
||||||
fill3.APPEARANCE_CHANGED_EVENT.set()
|
fill3.APPEARANCE_CHANGED_EVENT.set()
|
||||||
|
|
||||||
|
|
@ -866,10 +866,10 @@ class Screen:
|
||||||
self._help_widget.on_mouse_input(term_code)
|
self._help_widget.on_mouse_input(term_code)
|
||||||
return
|
return
|
||||||
event = terminal.decode_mouse_input(term_code)
|
event = terminal.decode_mouse_input(term_code)
|
||||||
if event[0] not in [terminal.PRESS_MOUSE, terminal.DRAG_MOUSE]:
|
if event[0] not in [terminal.MOUSE_PRESS, terminal.MOUSE_DRAG]:
|
||||||
return
|
return
|
||||||
x, y = event[2:4]
|
x, y = event[2:4]
|
||||||
if event[0] == terminal.DRAG_MOUSE:
|
if event[0] == terminal.MOUSE_DRAG:
|
||||||
last_x, last_y = self._last_mouse_position
|
last_x, last_y = self._last_mouse_position
|
||||||
dx, dy = x - last_x, y - last_y
|
dx, dy = x - last_x, y - last_y
|
||||||
if self._is_summary_focused:
|
if self._is_summary_focused:
|
||||||
|
|
@ -877,9 +877,9 @@ class Screen:
|
||||||
else:
|
else:
|
||||||
self._move_listing((-dx, -dy))
|
self._move_listing((-dx, -dy))
|
||||||
else: # Mouse press
|
else: # Mouse press
|
||||||
if event[1] == terminal.WHEEL_UP_MOUSE:
|
if event[1] == terminal.MOUSE_WHEEL_UP:
|
||||||
self.listing_page_up()
|
self.listing_page_up()
|
||||||
elif event[1] == terminal.WHEEL_DOWN_MOUSE:
|
elif event[1] == terminal.MOUSE_WHEEL_DOWN:
|
||||||
self.listing_page_down()
|
self.listing_page_down()
|
||||||
else:
|
else:
|
||||||
view_width, view_height = self._summary._view_widget.portal.last_dimensions
|
view_width, view_height = self._summary._view_widget.portal.last_dimensions
|
||||||
|
|
|
||||||
|
|
@ -81,12 +81,12 @@ def interactive():
|
||||||
|
|
||||||
|
|
||||||
MOUSE = ESC + "[M"
|
MOUSE = ESC + "[M"
|
||||||
RELEASE_MOUSE = 0
|
MOUSE_RELEASE = 0
|
||||||
DRAG_MOUSE = 1
|
MOUSE_DRAG = 1
|
||||||
CLICK_MOUSE = 2
|
MOUSE_CLICK = 2
|
||||||
PRESS_MOUSE = 3
|
MOUSE_PRESS = 3
|
||||||
WHEEL_UP_MOUSE = 4
|
MOUSE_WHEEL_UP = 4
|
||||||
WHEEL_DOWN_MOUSE = 5
|
MOUSE_WHEEL_DOWN = 5
|
||||||
|
|
||||||
|
|
||||||
def decode_mouse_input(term_code):
|
def decode_mouse_input(term_code):
|
||||||
|
|
@ -95,14 +95,14 @@ def decode_mouse_input(term_code):
|
||||||
x, y = (keys[1] - 33) % 256, (keys[2] - 33) % 256
|
x, y = (keys[1] - 33) % 256, (keys[2] - 33) % 256
|
||||||
button = ((b & 64) / 64 * 3) + (b & 3) + 1
|
button = ((b & 64) / 64 * 3) + (b & 3) + 1
|
||||||
if b & 3 == 3:
|
if b & 3 == 3:
|
||||||
action = RELEASE_MOUSE
|
action = MOUSE_RELEASE
|
||||||
button = 0
|
button = 0
|
||||||
elif b & 2048:
|
elif b & 2048:
|
||||||
action = RELEASE_MOUSE
|
action = MOUSE_RELEASE
|
||||||
elif b & 32:
|
elif b & 32:
|
||||||
action = DRAG_MOUSE
|
action = MOUSE_DRAG
|
||||||
elif b & 1536:
|
elif b & 1536:
|
||||||
action = CLICK_MOUSE
|
action = MOUSE_CLICK
|
||||||
else:
|
else:
|
||||||
action = PRESS_MOUSE
|
action = MOUSE_PRESS
|
||||||
return (action, button, x, y)
|
return action, button, x, y
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue