Cleanup
This commit is contained in:
parent
cb572dd4f0
commit
a0628b61c9
|
@ -15,6 +15,8 @@ from kivy.effects.scroll import ScrollEffect
|
||||||
from kivymd.uix.button import MDRectangleFlatButton
|
from kivymd.uix.button import MDRectangleFlatButton
|
||||||
from kivymd.uix.dialog import MDDialog
|
from kivymd.uix.dialog import MDDialog
|
||||||
|
|
||||||
|
from kivy.lang.builder import Builder
|
||||||
|
|
||||||
class NewConv(BoxLayout):
|
class NewConv(BoxLayout):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -33,7 +35,13 @@ class Conversations():
|
||||||
self.context_dests = []
|
self.context_dests = []
|
||||||
self.added_item_dests = []
|
self.added_item_dests = []
|
||||||
self.list = None
|
self.list = None
|
||||||
|
self.ids = None
|
||||||
|
|
||||||
|
if not self.app.root.ids.screen_manager.has_screen("conversations_screen"):
|
||||||
|
self.screen = Builder.load_string(conv_screen_kv)
|
||||||
|
self.ids = self.screen.ids
|
||||||
|
self.app.root.ids.screen_manager.add_widget(self.screen)
|
||||||
|
|
||||||
self.conversation_dropdown = None
|
self.conversation_dropdown = None
|
||||||
self.delete_dialog = None
|
self.delete_dialog = None
|
||||||
self.clear_dialog = None
|
self.clear_dialog = None
|
||||||
|
@ -334,4 +342,140 @@ class Conversations():
|
||||||
RNS.log("Updated conversation list widgets in "+RNS.prettytime(time.time()-us), RNS.LOG_DEBUG)
|
RNS.log("Updated conversation list widgets in "+RNS.prettytime(time.time()-us), RNS.LOG_DEBUG)
|
||||||
|
|
||||||
def get_widget(self):
|
def get_widget(self):
|
||||||
return self.list
|
return self.list
|
||||||
|
|
||||||
|
conv_screen_kv = """
|
||||||
|
MDScreen:
|
||||||
|
name: "conversations_screen"
|
||||||
|
|
||||||
|
BoxLayout:
|
||||||
|
orientation: "vertical"
|
||||||
|
|
||||||
|
MDTopAppBar:
|
||||||
|
title: "Conversations"
|
||||||
|
anchor_title: "left"
|
||||||
|
elevation: 0
|
||||||
|
left_action_items:
|
||||||
|
[
|
||||||
|
['menu', lambda x: nav_drawer.set_state("open")],
|
||||||
|
]
|
||||||
|
right_action_items:
|
||||||
|
[
|
||||||
|
['access-point', lambda x: root.ids.screen_manager.app.announce_now_action(self)],
|
||||||
|
['webhook', lambda x: root.ids.screen_manager.app.connectivity_status(self)],
|
||||||
|
['qrcode', lambda x: root.ids.screen_manager.app.ingest_lxm_action(self)],
|
||||||
|
['email-sync', lambda x: root.ids.screen_manager.app.lxmf_sync_action(self)],
|
||||||
|
['account-plus', lambda x: root.ids.screen_manager.app.new_conversation_action(self)],
|
||||||
|
]
|
||||||
|
|
||||||
|
ScrollView:
|
||||||
|
id: conversations_scrollview
|
||||||
|
"""
|
||||||
|
|
||||||
|
Builder.load_string("""
|
||||||
|
<NewConv>
|
||||||
|
orientation: "vertical"
|
||||||
|
spacing: "24dp"
|
||||||
|
size_hint_y: None
|
||||||
|
height: dp(250)
|
||||||
|
|
||||||
|
MDTextField:
|
||||||
|
id: n_address_field
|
||||||
|
max_text_length: 32
|
||||||
|
hint_text: "Address"
|
||||||
|
helper_text: "Error, check your input"
|
||||||
|
helper_text_mode: "on_error"
|
||||||
|
text: ""
|
||||||
|
font_size: dp(24)
|
||||||
|
|
||||||
|
MDTextField:
|
||||||
|
id: n_name_field
|
||||||
|
hint_text: "Name"
|
||||||
|
text: ""
|
||||||
|
font_size: dp(24)
|
||||||
|
|
||||||
|
MDBoxLayout:
|
||||||
|
orientation: "horizontal"
|
||||||
|
size_hint_y: None
|
||||||
|
padding: [0,0,dp(8),dp(24)]
|
||||||
|
height: dp(48)
|
||||||
|
MDLabel:
|
||||||
|
id: "trusted_switch_label"
|
||||||
|
text: "Trusted"
|
||||||
|
font_style: "H6"
|
||||||
|
|
||||||
|
MDSwitch:
|
||||||
|
id: n_trusted
|
||||||
|
pos_hint: {"center_y": 0.3}
|
||||||
|
active: False
|
||||||
|
|
||||||
|
<ConvSettings>
|
||||||
|
orientation: "vertical"
|
||||||
|
spacing: "16dp"
|
||||||
|
size_hint_y: None
|
||||||
|
padding: [0, 0, 0, dp(8)]
|
||||||
|
height: self.minimum_height
|
||||||
|
|
||||||
|
MDTextField:
|
||||||
|
id: dest_field
|
||||||
|
hint_text: "Address"
|
||||||
|
text: root.context_dest
|
||||||
|
# disabled: True
|
||||||
|
font_size: dp(18)
|
||||||
|
|
||||||
|
MDTextField:
|
||||||
|
id: name_field
|
||||||
|
hint_text: "Name"
|
||||||
|
text: root.disp_name
|
||||||
|
font_size: dp(18)
|
||||||
|
|
||||||
|
MDBoxLayout:
|
||||||
|
orientation: "horizontal"
|
||||||
|
# spacing: "24dp"
|
||||||
|
size_hint_y: None
|
||||||
|
padding: [0,0,dp(8),0]
|
||||||
|
height: dp(48)
|
||||||
|
MDLabel:
|
||||||
|
id: trusted_switch_label
|
||||||
|
text: "Trusted"
|
||||||
|
font_style: "H6"
|
||||||
|
|
||||||
|
MDSwitch:
|
||||||
|
id: trusted_switch
|
||||||
|
pos_hint: {"center_y": 0.43}
|
||||||
|
active: root.trusted
|
||||||
|
|
||||||
|
MDBoxLayout:
|
||||||
|
orientation: "horizontal"
|
||||||
|
# spacing: "24dp"
|
||||||
|
size_hint_y: None
|
||||||
|
padding: [0,0,dp(8),0]
|
||||||
|
height: dp(48)
|
||||||
|
MDLabel:
|
||||||
|
id: telemetry_switch_label
|
||||||
|
text: "Include Telemetry"
|
||||||
|
font_style: "H6"
|
||||||
|
|
||||||
|
MDSwitch:
|
||||||
|
id: telemetry_switch
|
||||||
|
pos_hint: {"center_y": 0.43}
|
||||||
|
active: root.telemetry
|
||||||
|
|
||||||
|
<MsgSync>
|
||||||
|
orientation: "vertical"
|
||||||
|
spacing: "24dp"
|
||||||
|
size_hint_y: None
|
||||||
|
padding: [0, 0, 0, dp(16)]
|
||||||
|
height: self.minimum_height+dp(24)
|
||||||
|
|
||||||
|
MDProgressBar:
|
||||||
|
id: sync_progress
|
||||||
|
value: 0
|
||||||
|
|
||||||
|
MDLabel:
|
||||||
|
id: sync_status
|
||||||
|
hint_text: "Name"
|
||||||
|
text: "Initiating sync..."
|
||||||
|
|
||||||
|
|
||||||
|
""")
|
|
@ -2315,33 +2315,6 @@ MDNavigationLayout:
|
||||||
text_size: self.width, None
|
text_size: self.width, None
|
||||||
height: self.texture_size[1]
|
height: self.texture_size[1]
|
||||||
|
|
||||||
# MDBoxLayout:
|
|
||||||
# orientation: "horizontal"
|
|
||||||
# spacing: "24dp"
|
|
||||||
# size_hint_y: None
|
|
||||||
# height: self.minimum_height
|
|
||||||
# padding: [dp(0), dp(0), dp(0), dp(35)]
|
|
||||||
|
|
||||||
# MDRectangleFlatIconButton:
|
|
||||||
# id: serial_mote_export
|
|
||||||
# icon: "upload"
|
|
||||||
# text: "Export"
|
|
||||||
# padding: [dp(0), dp(14), dp(0), dp(14)]
|
|
||||||
# icon_size: dp(24)
|
|
||||||
# font_size: dp(16)
|
|
||||||
# size_hint: [1.0, None]
|
|
||||||
# on_release: root.ids.screen_manager.app.hardware_serial_export(self)
|
|
||||||
|
|
||||||
# MDRectangleFlatIconButton:
|
|
||||||
# id: serial_mote_import
|
|
||||||
# icon: "download"
|
|
||||||
# text: "Import"
|
|
||||||
# padding: [dp(0), dp(14), dp(0), dp(14)]
|
|
||||||
# icon_size: dp(24)
|
|
||||||
# font_size: dp(16)
|
|
||||||
# size_hint: [1.0, None]
|
|
||||||
# on_release: root.ids.screen_manager.app.hardware_serial_import(self)
|
|
||||||
|
|
||||||
MDLabel:
|
MDLabel:
|
||||||
text: "Port Options"
|
text: "Port Options"
|
||||||
font_style: "H6"
|
font_style: "H6"
|
||||||
|
@ -2514,151 +2487,4 @@ MDNavigationLayout:
|
||||||
icon: "power"
|
icon: "power"
|
||||||
on_release: root.ids.screen_manager.app.quit_action(self)
|
on_release: root.ids.screen_manager.app.quit_action(self)
|
||||||
|
|
||||||
<ListLXMessageCard>:
|
|
||||||
style: "outlined"
|
|
||||||
elevation: 2
|
|
||||||
padding: dp(8)
|
|
||||||
radius: [dp(4), dp(4), dp(4), dp(4)]
|
|
||||||
size_hint: 1.0, None
|
|
||||||
height: content_text.height + heading_text.height + dp(32)
|
|
||||||
pos_hint: {"center_x": .5, "center_y": .5}
|
|
||||||
|
|
||||||
MDRelativeLayout:
|
|
||||||
size_hint: 1.0, None
|
|
||||||
theme_text_color: "ContrastParentBackground"
|
|
||||||
|
|
||||||
MDIconButton:
|
|
||||||
id: msg_submenu
|
|
||||||
icon: "dots-vertical"
|
|
||||||
# theme_text_color: 'Custom'
|
|
||||||
# text_color: rgba(255,255,255,216)
|
|
||||||
pos:
|
|
||||||
root.width - (self.width + root.padding[0] + dp(4)), root.height - (self.height + root.padding[0] + dp(4))
|
|
||||||
|
|
||||||
MDLabel:
|
|
||||||
id: heading_text
|
|
||||||
markup: True
|
|
||||||
text: root.heading
|
|
||||||
adaptive_size: True
|
|
||||||
# theme_text_color: 'Custom'
|
|
||||||
# text_color: rgba(255,255,255,100)
|
|
||||||
pos: 0, root.height - (self.height + root.padding[0] + dp(8))
|
|
||||||
|
|
||||||
MDLabel:
|
|
||||||
id: content_text
|
|
||||||
text: root.text
|
|
||||||
# adaptive_size: True
|
|
||||||
size_hint_y: None
|
|
||||||
text_size: self.width, None
|
|
||||||
# theme_text_color: 'Custom'
|
|
||||||
# text_color: rgba(255,255,255,216)
|
|
||||||
height: self.texture_size[1]
|
|
||||||
|
|
||||||
<MsgSync>
|
|
||||||
orientation: "vertical"
|
|
||||||
spacing: "24dp"
|
|
||||||
size_hint_y: None
|
|
||||||
padding: [0, 0, 0, dp(16)]
|
|
||||||
height: self.minimum_height+dp(24)
|
|
||||||
|
|
||||||
MDProgressBar:
|
|
||||||
id: sync_progress
|
|
||||||
value: 0
|
|
||||||
|
|
||||||
MDLabel:
|
|
||||||
id: sync_status
|
|
||||||
hint_text: "Name"
|
|
||||||
text: "Initiating sync..."
|
|
||||||
|
|
||||||
<ConvSettings>
|
|
||||||
orientation: "vertical"
|
|
||||||
spacing: "16dp"
|
|
||||||
size_hint_y: None
|
|
||||||
padding: [0, 0, 0, dp(8)]
|
|
||||||
height: self.minimum_height
|
|
||||||
|
|
||||||
MDTextField:
|
|
||||||
id: dest_field
|
|
||||||
hint_text: "Address"
|
|
||||||
text: root.context_dest
|
|
||||||
# disabled: True
|
|
||||||
font_size: dp(18)
|
|
||||||
|
|
||||||
MDTextField:
|
|
||||||
id: name_field
|
|
||||||
hint_text: "Name"
|
|
||||||
text: root.disp_name
|
|
||||||
font_size: dp(18)
|
|
||||||
|
|
||||||
MDBoxLayout:
|
|
||||||
orientation: "horizontal"
|
|
||||||
# spacing: "24dp"
|
|
||||||
size_hint_y: None
|
|
||||||
padding: [0,0,dp(8),0]
|
|
||||||
height: dp(48)
|
|
||||||
MDLabel:
|
|
||||||
id: trusted_switch_label
|
|
||||||
text: "Trusted"
|
|
||||||
font_style: "H6"
|
|
||||||
|
|
||||||
MDSwitch:
|
|
||||||
id: trusted_switch
|
|
||||||
pos_hint: {"center_y": 0.43}
|
|
||||||
active: root.trusted
|
|
||||||
|
|
||||||
MDBoxLayout:
|
|
||||||
orientation: "horizontal"
|
|
||||||
# spacing: "24dp"
|
|
||||||
size_hint_y: None
|
|
||||||
padding: [0,0,dp(8),0]
|
|
||||||
height: dp(48)
|
|
||||||
MDLabel:
|
|
||||||
id: telemetry_switch_label
|
|
||||||
text: "Include Telemetry"
|
|
||||||
font_style: "H6"
|
|
||||||
|
|
||||||
MDSwitch:
|
|
||||||
id: telemetry_switch
|
|
||||||
pos_hint: {"center_y": 0.43}
|
|
||||||
active: root.telemetry
|
|
||||||
|
|
||||||
<NewConv>
|
|
||||||
orientation: "vertical"
|
|
||||||
spacing: "24dp"
|
|
||||||
size_hint_y: None
|
|
||||||
height: dp(250)
|
|
||||||
|
|
||||||
MDTextField:
|
|
||||||
id: n_address_field
|
|
||||||
max_text_length: 32
|
|
||||||
hint_text: "Address"
|
|
||||||
helper_text: "Error, check your input"
|
|
||||||
helper_text_mode: "on_error"
|
|
||||||
text: ""
|
|
||||||
font_size: dp(24)
|
|
||||||
|
|
||||||
MDTextField:
|
|
||||||
id: n_name_field
|
|
||||||
hint_text: "Name"
|
|
||||||
text: ""
|
|
||||||
font_size: dp(24)
|
|
||||||
|
|
||||||
MDBoxLayout:
|
|
||||||
orientation: "horizontal"
|
|
||||||
size_hint_y: None
|
|
||||||
padding: [0,0,dp(8),dp(24)]
|
|
||||||
height: dp(48)
|
|
||||||
MDLabel:
|
|
||||||
id: "trusted_switch_label"
|
|
||||||
text: "Trusted"
|
|
||||||
font_style: "H6"
|
|
||||||
|
|
||||||
MDSwitch:
|
|
||||||
id: n_trusted
|
|
||||||
pos_hint: {"center_y": 0.3}
|
|
||||||
active: False
|
|
||||||
|
|
||||||
<CustomOneLineIconListItem>
|
|
||||||
IconLeftWidget:
|
|
||||||
icon: root.icon
|
|
||||||
"""
|
"""
|
|
@ -30,6 +30,8 @@ else:
|
||||||
from .helpers import ts_format, file_ts_format, mdc
|
from .helpers import ts_format, file_ts_format, mdc
|
||||||
from .helpers import color_received, color_delivered, color_propagated, color_paper, color_failed, color_unknown, intensity_msgs_dark, intensity_msgs_light
|
from .helpers import color_received, color_delivered, color_propagated, color_paper, color_failed, color_unknown, intensity_msgs_dark, intensity_msgs_light
|
||||||
|
|
||||||
|
from kivy.lang.builder import Builder
|
||||||
|
|
||||||
class ListLXMessageCard(MDCard):
|
class ListLXMessageCard(MDCard):
|
||||||
# class ListLXMessageCard(MDCard, FakeRectangularElevationBehavior):
|
# class ListLXMessageCard(MDCard, FakeRectangularElevationBehavior):
|
||||||
text = StringProperty()
|
text = StringProperty()
|
||||||
|
@ -574,4 +576,50 @@ class Messages():
|
||||||
|
|
||||||
def close_send_error_dialog(self, sender=None):
|
def close_send_error_dialog(self, sender=None):
|
||||||
if self.send_error_dialog:
|
if self.send_error_dialog:
|
||||||
self.send_error_dialog.dismiss()
|
self.send_error_dialog.dismiss()
|
||||||
|
|
||||||
|
Builder.load_string("""
|
||||||
|
<ListLXMessageCard>:
|
||||||
|
style: "outlined"
|
||||||
|
elevation: 2
|
||||||
|
padding: dp(8)
|
||||||
|
radius: [dp(4), dp(4), dp(4), dp(4)]
|
||||||
|
size_hint: 1.0, None
|
||||||
|
height: content_text.height + heading_text.height + dp(32)
|
||||||
|
pos_hint: {"center_x": .5, "center_y": .5}
|
||||||
|
|
||||||
|
MDRelativeLayout:
|
||||||
|
size_hint: 1.0, None
|
||||||
|
theme_text_color: "ContrastParentBackground"
|
||||||
|
|
||||||
|
MDIconButton:
|
||||||
|
id: msg_submenu
|
||||||
|
icon: "dots-vertical"
|
||||||
|
# theme_text_color: 'Custom'
|
||||||
|
# text_color: rgba(255,255,255,216)
|
||||||
|
pos:
|
||||||
|
root.width - (self.width + root.padding[0] + dp(4)), root.height - (self.height + root.padding[0] + dp(4))
|
||||||
|
|
||||||
|
MDLabel:
|
||||||
|
id: heading_text
|
||||||
|
markup: True
|
||||||
|
text: root.heading
|
||||||
|
adaptive_size: True
|
||||||
|
# theme_text_color: 'Custom'
|
||||||
|
# text_color: rgba(255,255,255,100)
|
||||||
|
pos: 0, root.height - (self.height + root.padding[0] + dp(8))
|
||||||
|
|
||||||
|
MDLabel:
|
||||||
|
id: content_text
|
||||||
|
text: root.text
|
||||||
|
# adaptive_size: True
|
||||||
|
size_hint_y: None
|
||||||
|
text_size: self.width, None
|
||||||
|
# theme_text_color: 'Custom'
|
||||||
|
# text_color: rgba(255,255,255,216)
|
||||||
|
height: self.texture_size[1]
|
||||||
|
|
||||||
|
<CustomOneLineIconListItem>
|
||||||
|
IconLeftWidget:
|
||||||
|
icon: root.icon
|
||||||
|
""")
|
Loading…
Reference in New Issue