added keyboard keys for laptops

This commit is contained in:
DYefremov
2018-11-05 11:09:15 +03:00
parent 4e34057d16
commit 5ee6615d6f
4 changed files with 10 additions and 5 deletions

View File

@@ -980,7 +980,6 @@ class MainAppWindow:
def on_tree_view_key_release(self, view, event):
""" Handling keystrokes on release """
key = KeyboardKey(event.hardware_keycode)
print(event.hardware_keycode)
if not key:
return
ctrl = event.state & Gdk.ModifierType.CONTROL_MASK

View File

@@ -67,7 +67,7 @@ def move_items(key, view: Gtk.TreeView):
parent_itr = model.iter_parent(model.get_iter(paths[0]))
parent_index = model.get_path(parent_itr)
children_num = model.iter_n_children(parent_itr)
if key in (KeyboardKey.PAGE_DOWN, KeyboardKey.END):
if key in (KeyboardKey.PAGE_DOWN, KeyboardKey.END, KeyboardKey.END_KP, KeyboardKey.PAGE_DOWN_KP):
children_num -= 1
min_path = Gtk.TreePath.new_from_string("{}:{}".format(parent_index, 0))
max_path = Gtk.TreePath.new_from_string("{}:{}".format(parent_index, children_num))
@@ -85,9 +85,9 @@ def move_items(key, view: Gtk.TreeView):
else:
max_path.prev()
move_down(max_path, model, paths)
elif key in (KeyboardKey.PAGE_UP, KeyboardKey.HOME):
elif key in (KeyboardKey.PAGE_UP, KeyboardKey.HOME, KeyboardKey.PAGE_UP_KP, KeyboardKey.HOME_KP):
move_up(min_path if is_tree_store else cursor_path, model, paths)
elif key in (KeyboardKey.PAGE_DOWN, KeyboardKey.END):
elif key in (KeyboardKey.PAGE_DOWN, KeyboardKey.END, KeyboardKey.END_KP, KeyboardKey.PAGE_DOWN_KP):
move_down(max_path if is_tree_store else cursor_path, model, paths)

View File

@@ -305,6 +305,7 @@ class SatellitesDialog:
satellite = Satellite(sat[0], sat[-2], sat[-1], transponders)
sats.append(satellite)
# ***************** Transponder dialog *******************#
class TransponderDialog:

View File

@@ -53,6 +53,11 @@ class KeyboardKey(Enum):
BACK_SPACE = 22
CTRL_L = 37
CTRL_R = 105
# Laptop codes
HOME_KP = 79
END_KP = 87
PAGE_UP_KP = 81
PAGE_DOWN_KP = 89
@classmethod
def _missing_(cls, value):
@@ -62,7 +67,7 @@ class KeyboardKey(Enum):
# Keys for move in lists. KEY_KP_(NAME) for laptop!!!
MOVE_KEYS = (KeyboardKey.UP, KeyboardKey.PAGE_UP, KeyboardKey.DOWN, KeyboardKey.PAGE_DOWN, KeyboardKey.HOME,
KeyboardKey.END)
KeyboardKey.END, KeyboardKey.HOME_KP, KeyboardKey.END_KP, KeyboardKey.PAGE_UP_KP, KeyboardKey.PAGE_DOWN_KP)
class ViewTarget(Enum):