Added option to disable propagation on direct delivery failure. Updated keyboard shortcuts.

This commit is contained in:
Mark Qvist 2023-10-26 13:43:28 +02:00
parent d87a58a51b
commit 4a1a5a7038
3 changed files with 48 additions and 4 deletions

View File

@ -750,6 +750,7 @@ class SidebandApp(MDApp):
def keydown_event(self, instance, keyboard, keycode, text, modifiers): def keydown_event(self, instance, keyboard, keycode, text, modifiers):
if len(modifiers) > 0 and modifiers[0] == 'ctrl' and (text == "q"): if len(modifiers) > 0 and modifiers[0] == 'ctrl' and (text == "q"):
self.quit_action(self) self.quit_action(self)
if len(modifiers) > 0 and modifiers[0] == 'ctrl' and (text == "w"): if len(modifiers) > 0 and modifiers[0] == 'ctrl' and (text == "w"):
if self.root.ids.screen_manager.current == "conversations_screen": if self.root.ids.screen_manager.current == "conversations_screen":
self.quit_action(self) self.quit_action(self)
@ -757,19 +758,36 @@ class SidebandApp(MDApp):
self.object_details_screen.close_action() self.object_details_screen.close_action()
else: else:
self.open_conversations(direction="right") self.open_conversations(direction="right")
if len(modifiers) > 0 and modifiers[0] == 'ctrl' and (text == "s" or text == "d"): if len(modifiers) > 0 and modifiers[0] == 'ctrl' and (text == "s" or text == "d"):
if self.root.ids.screen_manager.current == "messages_screen": if self.root.ids.screen_manager.current == "messages_screen":
self.message_send_action() self.message_send_action()
if len(modifiers) > 0 and modifiers[0] == 'ctrl' and (text == "l"): if len(modifiers) > 0 and modifiers[0] == 'ctrl' and (text == "l"):
self.announces_action(self) self.announces_action(self)
if len(modifiers) > 0 and modifiers[0] == 'ctrl' and (text == "m"): if len(modifiers) > 0 and modifiers[0] == 'ctrl' and (text == "m"):
self.map_action(self) if self.root.ids.screen_manager.current == "messages_screen":
context_dest = self.messages_view.ids.messages_scrollview.active_conversation
self.map_show_peer_location(context_dest)
else:
self.map_action(self)
if len(modifiers) > 0 and modifiers[0] == 'ctrl' and (text == "p"):
self.settings_action(self)
if len(modifiers) > 0 and modifiers[0] == 'ctrl' and (text == "t"): if len(modifiers) > 0 and modifiers[0] == 'ctrl' and (text == "t"):
self.telemetry_action(self) if self.root.ids.screen_manager.current == "messages_screen":
self.object_details_action(self.messages_view, from_conv=True)
else:
self.telemetry_action(self)
if len(modifiers) > 0 and modifiers[0] == 'ctrl' and (text == "r"): if len(modifiers) > 0 and modifiers[0] == 'ctrl' and (text == "r"):
self.conversations_action(self) self.conversations_action(self)
if len(modifiers) > 0 and modifiers[0] == 'ctrl' and (text == "g"): if len(modifiers) > 0 and modifiers[0] == 'ctrl' and (text == "g"):
self.guide_action(self) self.guide_action(self)
if len(modifiers) > 0 and modifiers[0] == 'ctrl' and (text == "n"): if len(modifiers) > 0 and modifiers[0] == 'ctrl' and (text == "n"):
if self.root.ids.screen_manager.current == "conversations_screen": if self.root.ids.screen_manager.current == "conversations_screen":
if not hasattr(self, "dialog_open") or not self.dialog_open: if not hasattr(self, "dialog_open") or not self.dialog_open:
@ -1386,6 +1404,10 @@ class SidebandApp(MDApp):
self.sideband.config["propagation_by_default"] = self.settings_screen.ids.settings_lxmf_delivery_by_default.active self.sideband.config["propagation_by_default"] = self.settings_screen.ids.settings_lxmf_delivery_by_default.active
self.sideband.save_configuration() self.sideband.save_configuration()
def save_lxmf_try_propagation_on_fail(sender=None, event=None):
self.sideband.config["lxmf_try_propagation_on_fail"] = self.settings_screen.ids.settings_lxmf_try_propagation_on_fail.active
self.sideband.save_configuration()
def save_lxmf_ignore_unknown(sender=None, event=None): def save_lxmf_ignore_unknown(sender=None, event=None):
self.sideband.config["lxmf_ignore_unknown"] = self.settings_screen.ids.settings_lxmf_ignore_unknown.active self.sideband.config["lxmf_ignore_unknown"] = self.settings_screen.ids.settings_lxmf_ignore_unknown.active
self.sideband.save_configuration() self.sideband.save_configuration()
@ -1473,6 +1495,9 @@ class SidebandApp(MDApp):
self.settings_screen.ids.settings_lxmf_delivery_by_default.active = self.sideband.config["propagation_by_default"] self.settings_screen.ids.settings_lxmf_delivery_by_default.active = self.sideband.config["propagation_by_default"]
self.settings_screen.ids.settings_lxmf_delivery_by_default.bind(active=save_lxmf_delivery_by_default) self.settings_screen.ids.settings_lxmf_delivery_by_default.bind(active=save_lxmf_delivery_by_default)
self.settings_screen.ids.settings_lxmf_try_propagation_on_fail.active = self.sideband.config["lxmf_try_propagation_on_fail"]
self.settings_screen.ids.settings_lxmf_try_propagation_on_fail.bind(active=save_lxmf_try_propagation_on_fail)
self.settings_screen.ids.settings_lxmf_ignore_unknown.active = self.sideband.config["lxmf_ignore_unknown"] self.settings_screen.ids.settings_lxmf_ignore_unknown.active = self.sideband.config["lxmf_ignore_unknown"]
self.settings_screen.ids.settings_lxmf_ignore_unknown.bind(active=save_lxmf_ignore_unknown) self.settings_screen.ids.settings_lxmf_ignore_unknown.bind(active=save_lxmf_ignore_unknown)

View File

@ -368,6 +368,8 @@ class SidebandCore():
self.config["lxmf_ignore_unknown"] = False self.config["lxmf_ignore_unknown"] = False
if not "lxmf_sync_interval" in self.config: if not "lxmf_sync_interval" in self.config:
self.config["lxmf_sync_interval"] = 43200 self.config["lxmf_sync_interval"] = 43200
if not "lxmf_try_propagation_on_fail" in self.config:
self.config["lxmf_try_propagation_on_fail"] = True
if not "notifications_on" in self.config: if not "notifications_on" in self.config:
self.config["notifications_on"] = True self.config["notifications_on"] = True
if not "print_command" in self.config: if not "print_command" in self.config:
@ -902,7 +904,7 @@ class SidebandCore():
if debug: if debug:
RNS.loglevel = 7 RNS.loglevel = 7
else: else:
RNS.loglevel = 2 RNS.loglevel = 2
return True return True
else: else:
try: try:
@ -2681,7 +2683,8 @@ class SidebandCore():
lxm.register_failed_callback(self.message_notification) lxm.register_failed_callback(self.message_notification)
if self.message_router.get_outbound_propagation_node() != None: if self.message_router.get_outbound_propagation_node() != None:
lxm.try_propagation_on_fail = True if self.config["lxmf_try_propagation_on_fail"]:
lxm.try_propagation_on_fail = True
self.message_router.handle_outbound(lxm) self.message_router.handle_outbound(lxm)
self.lxm_ingest(lxm, originator=True) self.lxm_ingest(lxm, originator=True)

View File

@ -1726,6 +1726,22 @@ MDScreen:
pos_hint: {"center_y": 0.3} pos_hint: {"center_y": 0.3}
active: False active: False
MDBoxLayout:
orientation: "horizontal"
size_hint_y: None
padding: [0,0,dp(24),dp(0)]
height: dp(48)
MDLabel:
text: "Try Propagation Node on direct delivery failure"
font_style: "H6"
MDSwitch:
id: settings_lxmf_try_propagation_on_fail
pos_hint: {"center_y": 0.3}
disabled: False
active: False
MDBoxLayout: MDBoxLayout:
orientation: "horizontal" orientation: "horizontal"
size_hint_y: None size_hint_y: None