mirror of
https://github.com/markqvist/Sideband.git
synced 2024-12-27 16:39:32 -05:00
Various UI enhancements
This commit is contained in:
parent
e72d0f892b
commit
62ac1ecd3b
@ -10,7 +10,7 @@ source.exclude_patterns = app_storage/*,venv/*,Makefile,./Makefil*,requirements,
|
|||||||
|
|
||||||
version.regex = __version__ = ['"](.*)['"]
|
version.regex = __version__ = ['"](.*)['"]
|
||||||
version.filename = %(source.dir)s/main.py
|
version.filename = %(source.dir)s/main.py
|
||||||
android.numeric_version = 20221008
|
android.numeric_version = 20221009
|
||||||
|
|
||||||
requirements = python3==3.9.5,hostpython3==3.9.5,cryptography,cffi,pycparser,kivy==2.1.0,pygments,sdl2,sdl2_ttf==2.0.15,pillow,lxmf==0.1.9,netifaces,libbz2,pydenticon
|
requirements = python3==3.9.5,hostpython3==3.9.5,cryptography,cffi,pycparser,kivy==2.1.0,pygments,sdl2,sdl2_ttf==2.0.15,pillow,lxmf==0.1.9,netifaces,libbz2,pydenticon
|
||||||
p4a.local_recipes = ../Others/python-for-android/pythonforandroid/recipes
|
p4a.local_recipes = ../Others/python-for-android/pythonforandroid/recipes
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
__debug_build__ = False
|
__debug_build__ = True
|
||||||
__version__ = "0.2.1"
|
__disable_shaders__ = True
|
||||||
|
__version__ = "0.2.2"
|
||||||
__variant__ = "beta"
|
__variant__ = "beta"
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
@ -88,13 +89,14 @@ class SidebandApp(MDApp):
|
|||||||
self.app_state = SidebandApp.STARTING
|
self.app_state = SidebandApp.STARTING
|
||||||
self.android_service = None
|
self.android_service = None
|
||||||
self.app_dir = plyer.storagepath.get_application_dir()
|
self.app_dir = plyer.storagepath.get_application_dir()
|
||||||
|
self.shaders_disabled = __disable_shaders__
|
||||||
|
|
||||||
if RNS.vendor.platformutils.get_platform() == "android":
|
if RNS.vendor.platformutils.get_platform() == "android":
|
||||||
self.sideband = SidebandCore(self, is_client=True, android_app_dir=self.app_dir, verbose=__debug_build__)
|
self.sideband = SidebandCore(self, is_client=True, android_app_dir=self.app_dir, verbose=__debug_build__)
|
||||||
else:
|
else:
|
||||||
self.sideband = SidebandCore(self, is_client=False, verbose=(args.verbose or __debug_build__))
|
self.sideband = SidebandCore(self, is_client=False, verbose=(args.verbose or __debug_build__))
|
||||||
|
|
||||||
self.update_ui_theme()
|
self.set_ui_theme()
|
||||||
|
|
||||||
self.conversations_view = None
|
self.conversations_view = None
|
||||||
self.sync_dialog = None
|
self.sync_dialog = None
|
||||||
@ -165,16 +167,28 @@ class SidebandApp(MDApp):
|
|||||||
# General helpers #
|
# General helpers #
|
||||||
#################################################
|
#################################################
|
||||||
|
|
||||||
def update_ui_theme(self):
|
def set_ui_theme(self):
|
||||||
self.theme_cls.material_style = "M3"
|
self.theme_cls.material_style = "M3"
|
||||||
self.theme_cls.widget_style = "android"
|
self.theme_cls.widget_style = "android"
|
||||||
self.theme_cls.primary_palette = "BlueGray"
|
self.theme_cls.primary_palette = "BlueGray"
|
||||||
self.theme_cls.accent_palette = "Orange"
|
self.theme_cls.accent_palette = "Orange"
|
||||||
|
|
||||||
if self.sideband.config["dark_ui"]:
|
if self.sideband.config["dark_ui"]:
|
||||||
self.theme_cls.theme_style = "Dark"
|
self.theme_cls.theme_style = "Dark"
|
||||||
else:
|
else:
|
||||||
self.theme_cls.theme_style = "Light"
|
self.theme_cls.theme_style = "Light"
|
||||||
|
|
||||||
|
def update_ui_theme(self):
|
||||||
|
if self.sideband.config["dark_ui"]:
|
||||||
|
self.theme_cls.theme_style = "Dark"
|
||||||
|
else:
|
||||||
|
self.theme_cls.theme_style = "Light"
|
||||||
|
|
||||||
|
st = time.time()
|
||||||
|
RNS.log("Recursing widgets...")
|
||||||
|
for wid in self.root.ids:
|
||||||
|
RNS.log("Found: "+str(wid)+str(self.root.ids[wid]))
|
||||||
|
|
||||||
def set_bars_colors(self):
|
def set_bars_colors(self):
|
||||||
if RNS.vendor.platformutils.get_platform() == "android":
|
if RNS.vendor.platformutils.get_platform() == "android":
|
||||||
set_bars_colors(
|
set_bars_colors(
|
||||||
@ -463,14 +477,18 @@ class SidebandApp(MDApp):
|
|||||||
self.messages_view = Messages(self, context_dest)
|
self.messages_view = Messages(self, context_dest)
|
||||||
|
|
||||||
self.root.ids.messages_scrollview.effect_cls = ScrollEffect
|
self.root.ids.messages_scrollview.effect_cls = ScrollEffect
|
||||||
self.root.ids.messages_scrollview.scroll_y = 1
|
|
||||||
for child in self.root.ids.messages_scrollview.children:
|
for child in self.root.ids.messages_scrollview.children:
|
||||||
self.root.ids.messages_scrollview.remove_widget(child)
|
self.root.ids.messages_scrollview.remove_widget(child)
|
||||||
|
RNS.log("Removed "+str(child))
|
||||||
|
|
||||||
list_widget = self.messages_view.get_widget()
|
list_widget = self.messages_view.get_widget()
|
||||||
|
|
||||||
|
# RNS.log(str(list_widget.children))
|
||||||
|
# RNS.log(str(list_widget.children[-1]))
|
||||||
|
|
||||||
self.root.ids.messages_scrollview.add_widget(list_widget)
|
self.root.ids.messages_scrollview.add_widget(list_widget)
|
||||||
self.root.ids.messages_scrollview.scroll_y = 0
|
self.root.ids.messages_scrollview.scroll_y = 0.001
|
||||||
|
|
||||||
self.root.ids.messages_toolbar.title = self.sideband.peer_display_name(context_dest)
|
self.root.ids.messages_toolbar.title = self.sideband.peer_display_name(context_dest)
|
||||||
self.root.ids.messages_scrollview.active_conversation = context_dest
|
self.root.ids.messages_scrollview.active_conversation = context_dest
|
||||||
self.sideband.setstate("app.active_conversation", context_dest)
|
self.sideband.setstate("app.active_conversation", context_dest)
|
||||||
@ -510,6 +528,8 @@ class SidebandApp(MDApp):
|
|||||||
context_dest = self.root.ids.messages_scrollview.active_conversation
|
context_dest = self.root.ids.messages_scrollview.active_conversation
|
||||||
if self.sideband.send_message(msg_content, context_dest, self.outbound_mode_propagation):
|
if self.sideband.send_message(msg_content, context_dest, self.outbound_mode_propagation):
|
||||||
self.root.ids.message_text.text = ""
|
self.root.ids.message_text.text = ""
|
||||||
|
|
||||||
|
self.root.ids.messages_scrollview.scroll_y = 0
|
||||||
self.jobs(0)
|
self.jobs(0)
|
||||||
else:
|
else:
|
||||||
self.messages_view.send_error_dialog = MDDialog(
|
self.messages_view.send_error_dialog = MDDialog(
|
||||||
|
@ -1025,7 +1025,7 @@ MDNavigationLayout:
|
|||||||
on_release: root.ids.screen_manager.app.quit_action(self)
|
on_release: root.ids.screen_manager.app.quit_action(self)
|
||||||
|
|
||||||
<ListLXMessageCard>:
|
<ListLXMessageCard>:
|
||||||
style: "filled"
|
style: "outlined"
|
||||||
elevation: 2
|
elevation: 2
|
||||||
padding: dp(8)
|
padding: dp(8)
|
||||||
radius: [dp(4), dp(4), dp(4), dp(4)]
|
radius: [dp(4), dp(4), dp(4), dp(4)]
|
||||||
|
@ -6,8 +6,8 @@ from kivy.metrics import dp
|
|||||||
from kivy.core.clipboard import Clipboard
|
from kivy.core.clipboard import Clipboard
|
||||||
from kivymd.uix.card import MDCard
|
from kivymd.uix.card import MDCard
|
||||||
from kivymd.uix.menu import MDDropdownMenu
|
from kivymd.uix.menu import MDDropdownMenu
|
||||||
from kivymd.uix.behaviors import RoundedRectangularElevationBehavior, FakeRectangularElevationBehavior
|
# from kivymd.uix.behaviors import RoundedRectangularElevationBehavior, FakeRectangularElevationBehavior
|
||||||
# from kivymd.uix.behaviors import CommonElevationBehavior
|
from kivymd.uix.behaviors import CommonElevationBehavior
|
||||||
from kivy.properties import StringProperty, BooleanProperty
|
from kivy.properties import StringProperty, BooleanProperty
|
||||||
from kivy.uix.gridlayout import GridLayout
|
from kivy.uix.gridlayout import GridLayout
|
||||||
from kivy.uix.boxlayout import BoxLayout
|
from kivy.uix.boxlayout import BoxLayout
|
||||||
@ -22,8 +22,8 @@ else:
|
|||||||
from .helpers import ts_format, mdc
|
from .helpers import ts_format, mdc
|
||||||
from .helpers import color_received, color_delivered, color_propagated, color_failed, color_unknown, intensity_msgs_dark, intensity_msgs_light
|
from .helpers import color_received, color_delivered, color_propagated, color_failed, color_unknown, intensity_msgs_dark, intensity_msgs_light
|
||||||
|
|
||||||
# class ListLXMessageCard(MDCard, CommonElevationBehavior):
|
class ListLXMessageCard(MDCard):
|
||||||
class ListLXMessageCard(MDCard, FakeRectangularElevationBehavior):
|
# class ListLXMessageCard(MDCard, FakeRectangularElevationBehavior):
|
||||||
text = StringProperty()
|
text = StringProperty()
|
||||||
heading = StringProperty()
|
heading = StringProperty()
|
||||||
|
|
||||||
@ -67,6 +67,11 @@ class Messages():
|
|||||||
|
|
||||||
for w in self.widgets:
|
for w in self.widgets:
|
||||||
m = w.m
|
m = w.m
|
||||||
|
if self.app.sideband.config["dark_ui"]:
|
||||||
|
w.line_color = (1.0, 1.0, 1.0, 0.25)
|
||||||
|
else:
|
||||||
|
w.line_color = (1.0, 1.0, 1.0, 0.5)
|
||||||
|
|
||||||
if m["state"] == LXMF.LXMessage.SENDING or m["state"] == LXMF.LXMessage.OUTBOUND:
|
if m["state"] == LXMF.LXMessage.SENDING or m["state"] == LXMF.LXMessage.OUTBOUND:
|
||||||
msg = self.app.sideband.message(m["hash"])
|
msg = self.app.sideband.message(m["hash"])
|
||||||
if msg["state"] == LXMF.LXMessage.DELIVERED:
|
if msg["state"] == LXMF.LXMessage.DELIVERED:
|
||||||
|
Loading…
Reference in New Issue
Block a user