mirror of
https://github.com/liberatedsystems/openCom-Companion.git
synced 2024-12-27 04:28:39 +01:00
Added message color style toggle option
This commit is contained in:
parent
79ba89373a
commit
1989330d21
@ -3033,6 +3033,11 @@ class SidebandApp(MDApp):
|
||||
self.sideband.save_configuration()
|
||||
self.update_ui_theme()
|
||||
|
||||
def save_classic_message_colors(sender=None, event=None):
|
||||
self.sideband.config["classic_message_colors"] = self.settings_screen.ids.settings_classic_message_colors.active
|
||||
self.sideband.save_configuration()
|
||||
self.update_ui_theme()
|
||||
|
||||
def save_display_style_in_contact_list(sender=None, event=None):
|
||||
self.sideband.config["display_style_in_contact_list"] = self.settings_screen.ids.display_style_in_contact_list.active
|
||||
self.sideband.save_configuration()
|
||||
@ -3198,6 +3203,9 @@ class SidebandApp(MDApp):
|
||||
self.settings_screen.ids.settings_eink_mode.active = self.sideband.config["eink_mode"]
|
||||
self.settings_screen.ids.settings_eink_mode.bind(active=save_eink_mode)
|
||||
|
||||
self.settings_screen.ids.settings_classic_message_colors.active = self.sideband.config["classic_message_colors"]
|
||||
self.settings_screen.ids.settings_classic_message_colors.bind(active=save_classic_message_colors)
|
||||
|
||||
self.settings_screen.ids.display_style_in_contact_list.active = self.sideband.config["display_style_in_contact_list"]
|
||||
self.settings_screen.ids.display_style_in_contact_list.bind(active=save_display_style_in_contact_list)
|
||||
|
||||
|
@ -392,7 +392,7 @@ class SidebandCore():
|
||||
self.config["debug"] = False
|
||||
self.config["display_name"] = "Anonymous Peer"
|
||||
self.config["notifications_on"] = True
|
||||
self.config["dark_ui"] = False
|
||||
self.config["dark_ui"] = True
|
||||
self.config["start_announce"] = True
|
||||
self.config["propagation_by_default"] = False
|
||||
self.config["home_node_as_broadcast_repeater"] = False
|
||||
@ -408,7 +408,7 @@ class SidebandCore():
|
||||
self.config["last_lxmf_propagation_node"] = None
|
||||
self.config["nn_home_node"] = None
|
||||
self.config["print_command"] = "lp"
|
||||
self.config["eink_mode"] = False
|
||||
self.config["eink_mode"] = True
|
||||
self.config["lxm_limit_1mb"] = True
|
||||
self.config["trusted_markup_only"] = False
|
||||
|
||||
@ -524,7 +524,7 @@ class SidebandCore():
|
||||
if not "dark_ui" in self.config:
|
||||
self.config["dark_ui"] = True
|
||||
if not "advanced_stats" in self.config:
|
||||
self.config["advanced_stats"] = False
|
||||
self.config["advanced_stats"] = True
|
||||
if not "lxmf_periodic_sync" in self.config:
|
||||
self.config["lxmf_periodic_sync"] = False
|
||||
if not "lxmf_ignore_unknown" in self.config:
|
||||
@ -544,7 +544,9 @@ class SidebandCore():
|
||||
if not "print_command" in self.config:
|
||||
self.config["print_command"] = "lp"
|
||||
if not "eink_mode" in self.config:
|
||||
self.config["eink_mode"] = False
|
||||
self.config["eink_mode"] = True
|
||||
if not "classic_message_colors" in self.config:
|
||||
self.config["classic_message_colors"] = False
|
||||
if not "display_style_in_contact_list" in self.config:
|
||||
self.config["display_style_in_contact_list"] = True
|
||||
if not "lxm_limit_1mb" in self.config:
|
||||
|
@ -26,6 +26,19 @@ intensity_msgs_light = "500"
|
||||
intensity_play_dark = "600"
|
||||
intensity_play_light = "300"
|
||||
|
||||
|
||||
intensity_msgs_dark_alt = "800"
|
||||
intensity_msgs_light_alt = "400"
|
||||
color_received_alt = "BlueGray"
|
||||
color_received_alt_light = "BlueGray"
|
||||
color_delivered_alt = "LightBlue"
|
||||
color_delivered_alt = "Blue"
|
||||
color_propagated_alt = "Indigo"
|
||||
color_paper_alt = "Indigo"
|
||||
color_playing_alt = "Amber"
|
||||
color_failed_alt = "Red"
|
||||
color_unknown_alt = "Gray"
|
||||
|
||||
class ContentNavigationDrawer(Screen):
|
||||
pass
|
||||
|
||||
|
@ -1494,6 +1494,21 @@ MDScreen:
|
||||
pos_hint: {"center_y": 0.3}
|
||||
active: False
|
||||
|
||||
MDBoxLayout:
|
||||
orientation: "horizontal"
|
||||
size_hint_y: None
|
||||
padding: [0,0,dp(24),dp(0)]
|
||||
height: dp(48)
|
||||
|
||||
MDLabel:
|
||||
text: "Classic message colors"
|
||||
font_style: "H6"
|
||||
|
||||
MDSwitch:
|
||||
id: settings_classic_message_colors
|
||||
pos_hint: {"center_y": 0.3}
|
||||
active: False
|
||||
|
||||
MDBoxLayout:
|
||||
orientation: "horizontal"
|
||||
size_hint_y: None
|
||||
|
@ -35,11 +35,13 @@ if RNS.vendor.platformutils.get_platform() == "android":
|
||||
from sideband.sense import Telemeter, Commands
|
||||
from ui.helpers import ts_format, file_ts_format, mdc
|
||||
from ui.helpers import color_playing, color_received, color_delivered, color_propagated, color_paper, color_failed, color_unknown, intensity_msgs_dark, intensity_msgs_light, intensity_play_dark, intensity_play_light
|
||||
from ui.helpers import color_received_alt, color_received_alt_light, color_delivered_alt, color_propagated_alt, color_paper_alt, color_failed_alt, color_unknown_alt, color_playing_alt, intensity_msgs_dark_alt, intensity_msgs_light_alt
|
||||
else:
|
||||
import sbapp.plyer as plyer
|
||||
from sbapp.sideband.sense import Telemeter, Commands
|
||||
from .helpers import ts_format, file_ts_format, mdc
|
||||
from .helpers import color_playing, color_received, color_delivered, color_propagated, color_paper, color_failed, color_unknown, intensity_msgs_dark, intensity_msgs_light, intensity_play_dark, intensity_play_light
|
||||
from .helpers import color_received_alt, color_received_alt_light, color_delivered_alt, color_propagated_alt, color_paper_alt, color_failed_alt, color_unknown_alt, color_playing_alt, intensity_msgs_dark_alt, intensity_msgs_light_alt
|
||||
|
||||
if RNS.vendor.platformutils.is_darwin():
|
||||
from PIL import Image as PilImage
|
||||
@ -203,6 +205,23 @@ class Messages():
|
||||
self.ids.message_text.input_type = "text"
|
||||
self.ids.message_text.keyboard_suggestions = True
|
||||
|
||||
if not self.app.sideband.config["classic_message_colors"]:
|
||||
c_delivered = color_delivered_alt
|
||||
c_received = color_received_alt
|
||||
c_propagated = color_propagated_alt
|
||||
c_playing = color_playing_alt
|
||||
c_paper = color_paper_alt
|
||||
c_unknown = color_unknown_alt
|
||||
c_failed = color_failed_alt
|
||||
else:
|
||||
c_delivered = color_delivered
|
||||
c_received = color_received
|
||||
c_propagated = color_propagated
|
||||
c_playing = color_playing
|
||||
c_paper = color_paper
|
||||
c_unknown = color_unknown
|
||||
c_failed = color_failed
|
||||
|
||||
for new_message in self.app.sideband.list_messages(self.context_dest, after=self.latest_message_timestamp,limit=limit):
|
||||
self.new_messages.append(new_message)
|
||||
|
||||
@ -241,12 +260,20 @@ class Messages():
|
||||
if (len(self.added_item_hashes) < self.db_message_count) and not self.load_more_button in self.list.children:
|
||||
self.list.add_widget(self.load_more_button, len(self.list.children))
|
||||
|
||||
if self.app.sideband.config["dark_ui"]:
|
||||
intensity_msgs = intensity_msgs_dark
|
||||
intensity_play = intensity_play_dark
|
||||
if self.app.sideband.config["classic_message_colors"]:
|
||||
if self.app.sideband.config["dark_ui"]:
|
||||
intensity_msgs = intensity_msgs_dark
|
||||
intensity_play = intensity_play_dark
|
||||
else:
|
||||
intensity_msgs = intensity_msgs_light
|
||||
intensity_play = intensity_play_light
|
||||
else:
|
||||
intensity_msgs = intensity_msgs_light
|
||||
intensity_play = intensity_play_light
|
||||
if self.app.sideband.config["dark_ui"]:
|
||||
intensity_msgs = intensity_msgs_dark_alt
|
||||
intensity_play = intensity_play_dark
|
||||
else:
|
||||
intensity_msgs = intensity_msgs_light_alt
|
||||
intensity_play = intensity_play_light
|
||||
|
||||
for w in self.widgets:
|
||||
m = w.m
|
||||
@ -271,7 +298,7 @@ class Messages():
|
||||
delivery_syms = multilingual_markup(delivery_syms.encode("utf-8")).decode("utf-8")
|
||||
|
||||
if msg["state"] == LXMF.LXMessage.OUTBOUND or msg["state"] == LXMF.LXMessage.SENDING or msg["state"] == LXMF.LXMessage.SENT:
|
||||
w.md_bg_color = msg_color = mdc(color_unknown, intensity_msgs)
|
||||
w.md_bg_color = msg_color = mdc(c_unknown, intensity_msgs)
|
||||
txstr = time.strftime(ts_format, time.localtime(msg["sent"]))
|
||||
titlestr = ""
|
||||
prgstr = ""
|
||||
@ -305,7 +332,7 @@ class Messages():
|
||||
|
||||
|
||||
if msg["state"] == LXMF.LXMessage.DELIVERED:
|
||||
w.md_bg_color = msg_color = mdc(color_delivered, intensity_msgs)
|
||||
w.md_bg_color = msg_color = mdc(c_delivered, intensity_msgs)
|
||||
txstr = time.strftime(ts_format, time.localtime(msg["sent"]))
|
||||
titlestr = ""
|
||||
if msg["title"]:
|
||||
@ -317,7 +344,7 @@ class Messages():
|
||||
m["state"] = msg["state"]
|
||||
|
||||
if msg["method"] == LXMF.LXMessage.PAPER:
|
||||
w.md_bg_color = msg_color = mdc(color_paper, intensity_msgs)
|
||||
w.md_bg_color = msg_color = mdc(c_paper, intensity_msgs)
|
||||
txstr = time.strftime(ts_format, time.localtime(msg["sent"]))
|
||||
titlestr = ""
|
||||
if msg["title"]:
|
||||
@ -326,7 +353,7 @@ class Messages():
|
||||
m["state"] = msg["state"]
|
||||
|
||||
if msg["method"] == LXMF.LXMessage.PROPAGATED and msg["state"] == LXMF.LXMessage.SENT:
|
||||
w.md_bg_color = msg_color = mdc(color_propagated, intensity_msgs)
|
||||
w.md_bg_color = msg_color = mdc(c_propagated, intensity_msgs)
|
||||
txstr = time.strftime(ts_format, time.localtime(msg["sent"]))
|
||||
titlestr = ""
|
||||
if msg["title"]:
|
||||
@ -338,7 +365,7 @@ class Messages():
|
||||
m["state"] = msg["state"]
|
||||
|
||||
if msg["state"] == LXMF.LXMessage.FAILED:
|
||||
w.md_bg_color = msg_color = mdc(color_failed, intensity_msgs)
|
||||
w.md_bg_color = msg_color = mdc(c_failed, intensity_msgs)
|
||||
txstr = time.strftime(ts_format, time.localtime(msg["sent"]))
|
||||
titlestr = ""
|
||||
if msg["title"]:
|
||||
@ -361,14 +388,45 @@ class Messages():
|
||||
wid.height, wid.size_hint_y, wid.opacity, wid.disabled = 0, None, 0, True
|
||||
|
||||
def update_widget(self):
|
||||
if self.app.sideband.config["dark_ui"]:
|
||||
intensity_msgs = intensity_msgs_dark
|
||||
intensity_play = intensity_play_dark
|
||||
mt_color = [1.0, 1.0, 1.0, 0.8]
|
||||
|
||||
if self.app.sideband.config["classic_message_colors"]:
|
||||
if self.app.sideband.config["dark_ui"]:
|
||||
intensity_msgs = intensity_msgs_dark
|
||||
intensity_play = intensity_play_dark
|
||||
mt_color = [1.0, 1.0, 1.0, 0.8]
|
||||
else:
|
||||
intensity_msgs = intensity_msgs_light
|
||||
intensity_play = intensity_play_light
|
||||
mt_color = [1.0, 1.0, 1.0, 0.95]
|
||||
else:
|
||||
intensity_msgs = intensity_msgs_light
|
||||
intensity_play = intensity_play_light
|
||||
mt_color = [1.0, 1.0, 1.0, 0.95]
|
||||
if self.app.sideband.config["dark_ui"]:
|
||||
intensity_msgs = intensity_msgs_dark_alt
|
||||
intensity_play = intensity_play_dark
|
||||
mt_color = [1.0, 1.0, 1.0, 0.8]
|
||||
else:
|
||||
intensity_msgs = intensity_msgs_light_alt
|
||||
intensity_play = intensity_play_light
|
||||
mt_color = [1.0, 1.0, 1.0, 0.95]
|
||||
|
||||
if not self.app.sideband.config["classic_message_colors"]:
|
||||
if self.app.sideband.config["dark_ui"]:
|
||||
c_received = color_received_alt
|
||||
else:
|
||||
c_received = color_received_alt_light
|
||||
c_delivered = color_delivered_alt
|
||||
c_propagated = color_propagated_alt
|
||||
c_playing = color_playing_alt
|
||||
c_paper = color_paper_alt
|
||||
c_unknown = color_unknown_alt
|
||||
c_failed = color_failed_alt
|
||||
else:
|
||||
c_delivered = color_delivered
|
||||
c_received = color_received
|
||||
c_propagated = color_propagated
|
||||
c_playing = color_playing
|
||||
c_paper = color_paper
|
||||
c_unknown = color_unknown
|
||||
c_failed = color_failed
|
||||
|
||||
self.ids.message_text.font_name = self.app.input_font
|
||||
|
||||
@ -524,31 +582,31 @@ class Messages():
|
||||
|
||||
if m["source"] == self.app.sideband.lxmf_destination.hash:
|
||||
if m["state"] == LXMF.LXMessage.DELIVERED:
|
||||
msg_color = mdc(color_delivered, intensity_msgs)
|
||||
msg_color = mdc(c_delivered, intensity_msgs)
|
||||
heading_str = titlestr+"[b]Sent[/b] "+txstr+delivery_syms+"\n[b]State[/b] Delivered"
|
||||
|
||||
elif m["method"] == LXMF.LXMessage.PROPAGATED and m["state"] == LXMF.LXMessage.SENT:
|
||||
msg_color = mdc(color_propagated, intensity_msgs)
|
||||
msg_color = mdc(c_propagated, intensity_msgs)
|
||||
heading_str = titlestr+"[b]Sent[/b] "+txstr+delivery_syms+"\n[b]State[/b] On Propagation Net"
|
||||
|
||||
elif m["method"] == LXMF.LXMessage.PAPER:
|
||||
msg_color = mdc(color_paper, intensity_msgs)
|
||||
msg_color = mdc(c_paper, intensity_msgs)
|
||||
heading_str = titlestr+"[b]Created[/b] "+txstr+"\n[b]State[/b] Paper Message"
|
||||
|
||||
elif m["state"] == LXMF.LXMessage.FAILED:
|
||||
msg_color = mdc(color_failed, intensity_msgs)
|
||||
msg_color = mdc(c_failed, intensity_msgs)
|
||||
heading_str = titlestr+"[b]Sent[/b] "+txstr+"\n[b]State[/b] Failed"
|
||||
|
||||
elif m["state"] == LXMF.LXMessage.OUTBOUND or m["state"] == LXMF.LXMessage.SENDING:
|
||||
msg_color = mdc(color_unknown, intensity_msgs)
|
||||
msg_color = mdc(c_unknown, intensity_msgs)
|
||||
heading_str = titlestr+"[b]Sent[/b] "+txstr+"\n[b]State[/b] Sending "
|
||||
|
||||
else:
|
||||
msg_color = mdc(color_unknown, intensity_msgs)
|
||||
msg_color = mdc(c_unknown, intensity_msgs)
|
||||
heading_str = titlestr+"[b]Sent[/b] "+txstr+"\n[b]State[/b] Unknown"
|
||||
|
||||
else:
|
||||
msg_color = mdc(color_received, intensity_msgs)
|
||||
msg_color = mdc(c_received, intensity_msgs)
|
||||
heading_str = titlestr
|
||||
if phy_stats_str != "" and self.app.sideband.config["advanced_stats"]:
|
||||
heading_str += phy_stats_str+"\n"
|
||||
@ -598,9 +656,9 @@ class Messages():
|
||||
self.app.play_audio_field(sender.audio_field)
|
||||
stored_color = sender.md_bg_color
|
||||
if sender.lsource == self.app.sideband.lxmf_destination.hash:
|
||||
sender.md_bg_color = mdc(color_delivered, intensity_play)
|
||||
sender.md_bg_color = mdc(c_delivered, intensity_play)
|
||||
else:
|
||||
sender.md_bg_color = mdc(color_received, intensity_play)
|
||||
sender.md_bg_color = mdc(c_received, intensity_play)
|
||||
|
||||
def cb(dt):
|
||||
sender.md_bg_color = stored_color
|
||||
|
Loading…
Reference in New Issue
Block a user