Added numeric keyboard shortcuts for conversations screen

This commit is contained in:
Mark Qvist 2023-10-28 20:35:02 +02:00
parent 3cecf5e259
commit 3acf67fc39
1 changed files with 16 additions and 1 deletions

View File

@ -776,6 +776,12 @@ class SidebandApp(MDApp):
if text == "q" or text == "-": self.map_nav_zoom_out(modifier=nav_mod) if text == "q" or text == "-": self.map_nav_zoom_out(modifier=nav_mod)
if text == "e" or text == "+": self.map_nav_zoom_in(modifier=nav_mod) if text == "e" or text == "+": self.map_nav_zoom_in(modifier=nav_mod)
if self.root.ids.screen_manager.current == "conversations_screen":
if len(modifiers) > 0 and "ctrl" in modifiers:
if keycode < 40 and keycode > 29:
c_index = keycode-29
self.conversation_index_action(c_index)
if len(modifiers) > 0: if len(modifiers) > 0:
if modifiers[0] == "ctrl": if modifiers[0] == "ctrl":
if text == "q": if text == "q":
@ -936,9 +942,18 @@ class SidebandApp(MDApp):
self.open_conversation(context_dest) self.open_conversation(context_dest)
def conversation_index_action(self, index):
if self.conversations_view != None and self.conversations_view.list != None:
i = index-1
c = self.conversations_view.list.children
if len(c) > i:
item = c[(len(c)-1)-i]
self.conversation_action(item)
def conversation_action(self, sender): def conversation_action(self, sender):
context_dest = sender.sb_uid
def cb(dt): def cb(dt):
self.open_conversation(sender.sb_uid) self.open_conversation(context_dest)
def cbu(dt): def cbu(dt):
self.conversations_view.update() self.conversations_view.update()
Clock.schedule_once(cb, 0.15) Clock.schedule_once(cb, 0.15)