mirror of
https://github.com/markqvist/Sideband.git
synced 2024-10-01 03:15:37 -04:00
Improved conversations and messages dialog boxes
This commit is contained in:
parent
f3107f4414
commit
7503737a96
@ -10,7 +10,7 @@ from kivy.uix.gridlayout import GridLayout
|
|||||||
from kivy.uix.boxlayout import BoxLayout
|
from kivy.uix.boxlayout import BoxLayout
|
||||||
from kivy.clock import Clock
|
from kivy.clock import Clock
|
||||||
|
|
||||||
from kivymd.uix.button import MDFlatButton, MDRectangleFlatButton
|
from kivymd.uix.button import MDRectangleFlatButton
|
||||||
from kivymd.uix.dialog import MDDialog
|
from kivymd.uix.dialog import MDDialog
|
||||||
|
|
||||||
if RNS.vendor.platformutils.get_platform() == "android":
|
if RNS.vendor.platformutils.get_platform() == "android":
|
||||||
@ -84,9 +84,7 @@ class Announces():
|
|||||||
|
|
||||||
def gen_info(ts, dest, name, dtype):
|
def gen_info(ts, dest, name, dtype):
|
||||||
def x(sender):
|
def x(sender):
|
||||||
yes_button = MDFlatButton(
|
yes_button = MDRectangleFlatButton(text="OK",font_size=sp(18))
|
||||||
text="OK",
|
|
||||||
)
|
|
||||||
|
|
||||||
if dtype == "lxmf.delivery":
|
if dtype == "lxmf.delivery":
|
||||||
ad_text = "[size=22dp]LXMF Peer[/size]\n\nReceived: "+ts+"\nAnnounced Name: "+name+"\nAddress: "+RNS.prettyhexrep(dest)
|
ad_text = "[size=22dp]LXMF Peer[/size]\n\nReceived: "+ts+"\nAnnounced Name: "+name+"\nAddress: "+RNS.prettyhexrep(dest)
|
||||||
@ -209,6 +207,8 @@ class Announces():
|
|||||||
width_mult=4,
|
width_mult=4,
|
||||||
elevation=1,
|
elevation=1,
|
||||||
radius=dp(3),
|
radius=dp(3),
|
||||||
|
opening_transition="linear",
|
||||||
|
opening_time=0.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
def callback_factory(ref):
|
def callback_factory(ref):
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
import RNS
|
import RNS
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from kivy.metrics import dp
|
from kivy.metrics import dp,sp
|
||||||
from kivy.uix.boxlayout import BoxLayout
|
from kivy.uix.boxlayout import BoxLayout
|
||||||
from kivy.properties import StringProperty, BooleanProperty
|
from kivy.properties import StringProperty, BooleanProperty
|
||||||
from kivymd.uix.list import MDList, IconLeftWidget, IconRightWidget, OneLineAvatarIconListItem
|
from kivymd.uix.list import MDList, IconLeftWidget, IconRightWidget, OneLineAvatarIconListItem
|
||||||
from kivymd.uix.menu import MDDropdownMenu
|
from kivymd.uix.menu import MDDropdownMenu
|
||||||
from kivy.uix.gridlayout import GridLayout
|
from kivy.uix.gridlayout import GridLayout
|
||||||
from kivy.uix.boxlayout import BoxLayout
|
from kivy.uix.boxlayout import BoxLayout
|
||||||
|
from kivy.clock import Clock
|
||||||
|
|
||||||
from kivymd.uix.button import MDFlatButton
|
from kivymd.uix.button import MDRectangleFlatButton
|
||||||
from kivymd.uix.dialog import MDDialog
|
from kivymd.uix.dialog import MDDialog
|
||||||
|
|
||||||
|
|
||||||
@ -23,6 +24,7 @@ class MsgSync(BoxLayout):
|
|||||||
|
|
||||||
class ConvSettings(BoxLayout):
|
class ConvSettings(BoxLayout):
|
||||||
disp_name = StringProperty()
|
disp_name = StringProperty()
|
||||||
|
context_dest = StringProperty()
|
||||||
trusted = BooleanProperty()
|
trusted = BooleanProperty()
|
||||||
|
|
||||||
|
|
||||||
@ -91,17 +93,12 @@ class Conversations():
|
|||||||
disp_name = self.app.sideband.raw_display_name(dest)
|
disp_name = self.app.sideband.raw_display_name(dest)
|
||||||
is_trusted = self.app.sideband.is_trusted(dest)
|
is_trusted = self.app.sideband.is_trusted(dest)
|
||||||
|
|
||||||
yes_button = MDFlatButton(
|
yes_button = MDRectangleFlatButton(text="Save",font_size=sp(18), theme_text_color="Custom", line_color=self.app.color_accept, text_color=self.app.color_accept)
|
||||||
text="Save",
|
no_button = MDRectangleFlatButton(text="Cancel",font_size=sp(18))
|
||||||
font_size=dp(20),
|
dialog_content = ConvSettings(disp_name=disp_name, context_dest=RNS.hexrep(dest, delimit=False), trusted=is_trusted)
|
||||||
)
|
|
||||||
no_button = MDFlatButton(
|
|
||||||
text="Cancel",
|
|
||||||
font_size=dp(20),
|
|
||||||
)
|
|
||||||
dialog_content = ConvSettings(disp_name=disp_name, trusted=is_trusted)
|
|
||||||
dialog = MDDialog(
|
dialog = MDDialog(
|
||||||
title="Conversation with "+RNS.prettyhexrep(dest),
|
title="Edit Conversation",
|
||||||
|
text= "With "+RNS.prettyhexrep(dest),
|
||||||
type="custom",
|
type="custom",
|
||||||
content_cls=dialog_content,
|
content_cls=dialog_content,
|
||||||
buttons=[ yes_button, no_button ],
|
buttons=[ yes_button, no_button ],
|
||||||
@ -126,7 +123,10 @@ class Conversations():
|
|||||||
RNS.log("Error while saving conversation settings: "+str(e), RNS.LOG_ERROR)
|
RNS.log("Error while saving conversation settings: "+str(e), RNS.LOG_ERROR)
|
||||||
|
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
self.reload()
|
|
||||||
|
def cb(dt):
|
||||||
|
self.reload()
|
||||||
|
Clock.schedule_once(cb, 0.2)
|
||||||
|
|
||||||
def dl_no(s):
|
def dl_no(s):
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
@ -143,14 +143,11 @@ class Conversations():
|
|||||||
def gen_clear(dest, item):
|
def gen_clear(dest, item):
|
||||||
def x():
|
def x():
|
||||||
dest = self.conversation_dropdown.context_dest
|
dest = self.conversation_dropdown.context_dest
|
||||||
yes_button = MDFlatButton(
|
yes_button = MDRectangleFlatButton(text="Yes",font_size=sp(18), theme_text_color="Custom", line_color=self.app.color_reject, text_color=self.app.color_reject)
|
||||||
text="Yes",
|
no_button = MDRectangleFlatButton(text="No",font_size=sp(18))
|
||||||
)
|
|
||||||
no_button = MDFlatButton(
|
|
||||||
text="No",
|
|
||||||
)
|
|
||||||
dialog = MDDialog(
|
dialog = MDDialog(
|
||||||
text="Clear all messages in conversation?",
|
title="Clear all messages in conversation?",
|
||||||
buttons=[ yes_button, no_button ],
|
buttons=[ yes_button, no_button ],
|
||||||
# elevation=0,
|
# elevation=0,
|
||||||
)
|
)
|
||||||
@ -168,21 +165,19 @@ class Conversations():
|
|||||||
|
|
||||||
def gen_del(dest, item):
|
def gen_del(dest, item):
|
||||||
def x():
|
def x():
|
||||||
yes_button = MDFlatButton(
|
yes_button = MDRectangleFlatButton(text="Yes",font_size=sp(18), theme_text_color="Custom", line_color=self.app.color_reject, text_color=self.app.color_reject)
|
||||||
text="Yes",
|
no_button = MDRectangleFlatButton(text="No",font_size=sp(18))
|
||||||
)
|
|
||||||
no_button = MDFlatButton(
|
|
||||||
text="No",
|
|
||||||
)
|
|
||||||
dialog = MDDialog(
|
dialog = MDDialog(
|
||||||
text="Delete conversation?",
|
title="Delete conversation?",
|
||||||
buttons=[ yes_button, no_button ],
|
buttons=[ yes_button, no_button ],
|
||||||
# elevation=0,
|
# elevation=0,
|
||||||
)
|
)
|
||||||
def dl_yes(s):
|
def dl_yes(s):
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
self.app.sideband.delete_conversation(self.conversation_dropdown.context_dest)
|
self.app.sideband.delete_conversation(self.conversation_dropdown.context_dest)
|
||||||
self.reload()
|
def cb(dt):
|
||||||
|
self.reload()
|
||||||
|
Clock.schedule_once(cb, 0.2)
|
||||||
def dl_no(s):
|
def dl_no(s):
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
|
|
||||||
|
@ -1132,21 +1132,29 @@ MDNavigationLayout:
|
|||||||
|
|
||||||
<ConvSettings>
|
<ConvSettings>
|
||||||
orientation: "vertical"
|
orientation: "vertical"
|
||||||
spacing: "24dp"
|
spacing: "16dp"
|
||||||
size_hint_y: None
|
size_hint_y: None
|
||||||
height: dp(148)
|
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:
|
MDTextField:
|
||||||
id: name_field
|
id: name_field
|
||||||
hint_text: "Name"
|
hint_text: "Name"
|
||||||
text: root.disp_name
|
text: root.disp_name
|
||||||
font_size: dp(24)
|
font_size: dp(18)
|
||||||
|
|
||||||
MDBoxLayout:
|
MDBoxLayout:
|
||||||
orientation: "horizontal"
|
orientation: "horizontal"
|
||||||
# spacing: "24dp"
|
# spacing: "24dp"
|
||||||
size_hint_y: None
|
size_hint_y: None
|
||||||
padding: [0,0,dp(24),0]
|
padding: [0,0,dp(8),0]
|
||||||
height: dp(48)
|
height: dp(48)
|
||||||
MDLabel:
|
MDLabel:
|
||||||
id: trusted_switch_label
|
id: trusted_switch_label
|
||||||
@ -1155,6 +1163,7 @@ MDNavigationLayout:
|
|||||||
|
|
||||||
MDSwitch:
|
MDSwitch:
|
||||||
id: trusted_switch
|
id: trusted_switch
|
||||||
|
pos_hint: {"center_y": 0.43}
|
||||||
active: root.trusted
|
active: root.trusted
|
||||||
|
|
||||||
<NewConv>
|
<NewConv>
|
||||||
|
@ -2,7 +2,7 @@ import time
|
|||||||
import RNS
|
import RNS
|
||||||
import LXMF
|
import LXMF
|
||||||
|
|
||||||
from kivy.metrics import dp
|
from kivy.metrics import dp,sp
|
||||||
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
|
||||||
@ -11,10 +11,12 @@ 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
|
||||||
|
from kivy.clock import Clock
|
||||||
|
|
||||||
from kivymd.uix.button import MDFlatButton
|
from kivymd.uix.button import MDRectangleFlatButton
|
||||||
from kivymd.uix.dialog import MDDialog
|
from kivymd.uix.dialog import MDDialog
|
||||||
|
|
||||||
|
|
||||||
if RNS.vendor.platformutils.get_platform() == "android":
|
if RNS.vendor.platformutils.get_platform() == "android":
|
||||||
from ui.helpers import ts_format, mdc
|
from ui.helpers import ts_format, mdc
|
||||||
from ui.helpers import color_received, color_delivered, color_propagated, color_failed, color_unknown, intensity_msgs_dark, intensity_msgs_light
|
from ui.helpers import color_received, color_delivered, color_propagated, color_failed, color_unknown, intensity_msgs_dark, intensity_msgs_light
|
||||||
@ -160,21 +162,21 @@ class Messages():
|
|||||||
|
|
||||||
def gen_del(mhash, item):
|
def gen_del(mhash, item):
|
||||||
def x():
|
def x():
|
||||||
yes_button = MDFlatButton(
|
yes_button = MDRectangleFlatButton(text="Yes",font_size=sp(18), theme_text_color="Custom", line_color=self.app.color_reject, text_color=self.app.color_reject)
|
||||||
text="Yes",
|
no_button = MDRectangleFlatButton(text="No",font_size=sp(18))
|
||||||
)
|
|
||||||
no_button = MDFlatButton(
|
|
||||||
text="No",
|
|
||||||
)
|
|
||||||
dialog = MDDialog(
|
dialog = MDDialog(
|
||||||
text="Delete message?",
|
title="Delete message?",
|
||||||
buttons=[ yes_button, no_button ],
|
buttons=[ yes_button, no_button ],
|
||||||
# elevation=0,
|
# elevation=0,
|
||||||
)
|
)
|
||||||
def dl_yes(s):
|
def dl_yes(s):
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
self.app.sideband.delete_message(mhash)
|
self.app.sideband.delete_message(mhash)
|
||||||
self.reload()
|
|
||||||
|
def cb(dt):
|
||||||
|
self.reload()
|
||||||
|
Clock.schedule_once(cb, 0.2)
|
||||||
|
|
||||||
def dl_no(s):
|
def dl_no(s):
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user