mirror of
https://github.com/liberatedsystems/openCom-Companion.git
synced 2024-11-22 05:20:36 +01:00
Added e-ink display mode
This commit is contained in:
parent
a4ecfb12b9
commit
5e8ed17bb3
@ -90,6 +90,9 @@ class SidebandApp(MDApp):
|
||||
|
||||
SERVICE_TIMEOUT = 30
|
||||
|
||||
EINK_BG_STR = "1,0,0,1"
|
||||
EINK_BG_ARR = [1,0,0,1]
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.title = "Sideband"
|
||||
@ -247,17 +250,26 @@ class SidebandApp(MDApp):
|
||||
else:
|
||||
self.color_reject = colors["DeepOrange"]["800"]
|
||||
self.color_accept = colors["LightGreen"]["700"]
|
||||
|
||||
self.apply_eink_mods()
|
||||
|
||||
def update_ui_theme(self):
|
||||
if self.sideband.config["dark_ui"]:
|
||||
self.theme_cls.theme_style = "Dark"
|
||||
else:
|
||||
self.theme_cls.theme_style = "Light"
|
||||
self.apply_eink_mods()
|
||||
|
||||
self.update_ui_colors()
|
||||
|
||||
# for wid in self.root.ids:
|
||||
# RNS.log("Found: "+str(wid)+str(self.root.ids[wid]))
|
||||
def apply_eink_mods(self):
|
||||
if self.sideband.config["eink_mode"]:
|
||||
if self.root != None:
|
||||
self.root.md_bg_color = self.theme_cls.bg_light
|
||||
|
||||
else:
|
||||
if self.root != None:
|
||||
self.root.md_bg_color = self.theme_cls.bg_darkest
|
||||
|
||||
def set_bars_colors(self):
|
||||
if RNS.vendor.platformutils.get_platform() == "android":
|
||||
@ -522,7 +534,10 @@ class SidebandApp(MDApp):
|
||||
from android import activity as a_activity
|
||||
a_activity.bind(on_new_intent=self.on_new_intent)
|
||||
|
||||
screen = Builder.load_string(root_layout)
|
||||
if self.sideband.config["eink_mode"] == True:
|
||||
screen = Builder.load_string(root_layout.replace("app.theme_cls.bg_darkest", "app.theme_cls.bg_light"))
|
||||
else:
|
||||
screen = Builder.load_string(root_layout)
|
||||
|
||||
return screen
|
||||
|
||||
@ -541,14 +556,14 @@ class SidebandApp(MDApp):
|
||||
)
|
||||
def dl_ok(s):
|
||||
dialog.dismiss()
|
||||
self.quit_action()
|
||||
self.quit_action(s)
|
||||
|
||||
ok_button.bind(on_release=dl_ok)
|
||||
self.final_load_completed = False
|
||||
dialog.open()
|
||||
|
||||
else:
|
||||
self.quit_action()
|
||||
self.quit_action(s)
|
||||
|
||||
else:
|
||||
self.service_last_available = time.time()
|
||||
@ -1246,6 +1261,11 @@ class SidebandApp(MDApp):
|
||||
self.sideband.save_configuration()
|
||||
self.update_ui_theme()
|
||||
|
||||
def save_eink_mode(sender=None, event=None):
|
||||
self.sideband.config["eink_mode"] = self.root.ids.settings_eink_mode.active
|
||||
self.sideband.save_configuration()
|
||||
self.update_ui_theme()
|
||||
|
||||
def save_notifications_on(sender=None, event=None):
|
||||
self.sideband.config["notifications_on"] = self.root.ids.settings_notifications_on.active
|
||||
self.sideband.save_configuration()
|
||||
@ -1331,6 +1351,9 @@ class SidebandApp(MDApp):
|
||||
self.root.ids.settings_dark_ui.active = self.sideband.config["dark_ui"]
|
||||
self.root.ids.settings_dark_ui.bind(active=save_dark_ui)
|
||||
|
||||
self.root.ids.settings_eink_mode.active = self.sideband.config["eink_mode"]
|
||||
self.root.ids.settings_eink_mode.bind(active=save_eink_mode)
|
||||
|
||||
self.root.ids.settings_start_announce.active = self.sideband.config["start_announce"]
|
||||
self.root.ids.settings_start_announce.bind(active=save_start_announce)
|
||||
|
||||
|
@ -234,6 +234,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
|
||||
|
||||
# Connectivity
|
||||
self.config["connect_transport"] = False
|
||||
@ -330,6 +331,8 @@ class SidebandCore():
|
||||
self.config["notifications_on"] = True
|
||||
if not "print_command" in self.config:
|
||||
self.config["print_command"] = "lp"
|
||||
if not "eink_mode" in self.config:
|
||||
self.config["eink_mode"] = False
|
||||
|
||||
if not "connect_transport" in self.config:
|
||||
self.config["connect_transport"] = False
|
||||
|
@ -1100,7 +1100,7 @@ MDNavigationLayout:
|
||||
height: dp(48)
|
||||
|
||||
MDLabel:
|
||||
text: "Dark Mode UI"
|
||||
text: "Dark Mode"
|
||||
font_style: "H6"
|
||||
|
||||
MDSwitch:
|
||||
@ -1108,6 +1108,21 @@ MDNavigationLayout:
|
||||
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: "E-Ink Mode"
|
||||
font_style: "H6"
|
||||
|
||||
MDSwitch:
|
||||
id: settings_eink_mode
|
||||
pos_hint: {"center_y": 0.3}
|
||||
active: False
|
||||
|
||||
MDBoxLayout:
|
||||
orientation: "horizontal"
|
||||
size_hint_y: None
|
||||
|
Loading…
Reference in New Issue
Block a user