mirror of
https://github.com/markqvist/Sideband.git
synced 2024-12-27 00:19:25 -05: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.clock import Clock
|
||||
|
||||
from kivymd.uix.button import MDFlatButton, MDRectangleFlatButton
|
||||
from kivymd.uix.button import MDRectangleFlatButton
|
||||
from kivymd.uix.dialog import MDDialog
|
||||
|
||||
if RNS.vendor.platformutils.get_platform() == "android":
|
||||
@ -84,9 +84,7 @@ class Announces():
|
||||
|
||||
def gen_info(ts, dest, name, dtype):
|
||||
def x(sender):
|
||||
yes_button = MDFlatButton(
|
||||
text="OK",
|
||||
)
|
||||
yes_button = MDRectangleFlatButton(text="OK",font_size=sp(18))
|
||||
|
||||
if dtype == "lxmf.delivery":
|
||||
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,
|
||||
elevation=1,
|
||||
radius=dp(3),
|
||||
opening_transition="linear",
|
||||
opening_time=0.0,
|
||||
)
|
||||
|
||||
def callback_factory(ref):
|
||||
|
@ -1,15 +1,16 @@
|
||||
import RNS
|
||||
import time
|
||||
|
||||
from kivy.metrics import dp
|
||||
from kivy.metrics import dp,sp
|
||||
from kivy.uix.boxlayout import BoxLayout
|
||||
from kivy.properties import StringProperty, BooleanProperty
|
||||
from kivymd.uix.list import MDList, IconLeftWidget, IconRightWidget, OneLineAvatarIconListItem
|
||||
from kivymd.uix.menu import MDDropdownMenu
|
||||
from kivy.uix.gridlayout import GridLayout
|
||||
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
|
||||
|
||||
|
||||
@ -23,6 +24,7 @@ class MsgSync(BoxLayout):
|
||||
|
||||
class ConvSettings(BoxLayout):
|
||||
disp_name = StringProperty()
|
||||
context_dest = StringProperty()
|
||||
trusted = BooleanProperty()
|
||||
|
||||
|
||||
@ -91,17 +93,12 @@ class Conversations():
|
||||
disp_name = self.app.sideband.raw_display_name(dest)
|
||||
is_trusted = self.app.sideband.is_trusted(dest)
|
||||
|
||||
yes_button = MDFlatButton(
|
||||
text="Save",
|
||||
font_size=dp(20),
|
||||
)
|
||||
no_button = MDFlatButton(
|
||||
text="Cancel",
|
||||
font_size=dp(20),
|
||||
)
|
||||
dialog_content = ConvSettings(disp_name=disp_name, trusted=is_trusted)
|
||||
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)
|
||||
no_button = MDRectangleFlatButton(text="Cancel",font_size=sp(18))
|
||||
dialog_content = ConvSettings(disp_name=disp_name, context_dest=RNS.hexrep(dest, delimit=False), trusted=is_trusted)
|
||||
dialog = MDDialog(
|
||||
title="Conversation with "+RNS.prettyhexrep(dest),
|
||||
title="Edit Conversation",
|
||||
text= "With "+RNS.prettyhexrep(dest),
|
||||
type="custom",
|
||||
content_cls=dialog_content,
|
||||
buttons=[ yes_button, no_button ],
|
||||
@ -126,7 +123,10 @@ class Conversations():
|
||||
RNS.log("Error while saving conversation settings: "+str(e), RNS.LOG_ERROR)
|
||||
|
||||
dialog.dismiss()
|
||||
self.reload()
|
||||
|
||||
def cb(dt):
|
||||
self.reload()
|
||||
Clock.schedule_once(cb, 0.2)
|
||||
|
||||
def dl_no(s):
|
||||
dialog.dismiss()
|
||||
@ -143,14 +143,11 @@ class Conversations():
|
||||
def gen_clear(dest, item):
|
||||
def x():
|
||||
dest = self.conversation_dropdown.context_dest
|
||||
yes_button = MDFlatButton(
|
||||
text="Yes",
|
||||
)
|
||||
no_button = MDFlatButton(
|
||||
text="No",
|
||||
)
|
||||
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)
|
||||
no_button = MDRectangleFlatButton(text="No",font_size=sp(18))
|
||||
|
||||
dialog = MDDialog(
|
||||
text="Clear all messages in conversation?",
|
||||
title="Clear all messages in conversation?",
|
||||
buttons=[ yes_button, no_button ],
|
||||
# elevation=0,
|
||||
)
|
||||
@ -168,21 +165,19 @@ class Conversations():
|
||||
|
||||
def gen_del(dest, item):
|
||||
def x():
|
||||
yes_button = MDFlatButton(
|
||||
text="Yes",
|
||||
)
|
||||
no_button = MDFlatButton(
|
||||
text="No",
|
||||
)
|
||||
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)
|
||||
no_button = MDRectangleFlatButton(text="No",font_size=sp(18))
|
||||
dialog = MDDialog(
|
||||
text="Delete conversation?",
|
||||
title="Delete conversation?",
|
||||
buttons=[ yes_button, no_button ],
|
||||
# elevation=0,
|
||||
)
|
||||
def dl_yes(s):
|
||||
dialog.dismiss()
|
||||
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):
|
||||
dialog.dismiss()
|
||||
|
||||
|
@ -1132,21 +1132,29 @@ MDNavigationLayout:
|
||||
|
||||
<ConvSettings>
|
||||
orientation: "vertical"
|
||||
spacing: "24dp"
|
||||
spacing: "16dp"
|
||||
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:
|
||||
id: name_field
|
||||
hint_text: "Name"
|
||||
text: root.disp_name
|
||||
font_size: dp(24)
|
||||
font_size: dp(18)
|
||||
|
||||
MDBoxLayout:
|
||||
orientation: "horizontal"
|
||||
# spacing: "24dp"
|
||||
size_hint_y: None
|
||||
padding: [0,0,dp(24),0]
|
||||
padding: [0,0,dp(8),0]
|
||||
height: dp(48)
|
||||
MDLabel:
|
||||
id: trusted_switch_label
|
||||
@ -1155,6 +1163,7 @@ MDNavigationLayout:
|
||||
|
||||
MDSwitch:
|
||||
id: trusted_switch
|
||||
pos_hint: {"center_y": 0.43}
|
||||
active: root.trusted
|
||||
|
||||
<NewConv>
|
||||
|
@ -2,7 +2,7 @@ import time
|
||||
import RNS
|
||||
import LXMF
|
||||
|
||||
from kivy.metrics import dp
|
||||
from kivy.metrics import dp,sp
|
||||
from kivy.core.clipboard import Clipboard
|
||||
from kivymd.uix.card import MDCard
|
||||
from kivymd.uix.menu import MDDropdownMenu
|
||||
@ -11,10 +11,12 @@ from kivymd.uix.behaviors import CommonElevationBehavior
|
||||
from kivy.properties import StringProperty, BooleanProperty
|
||||
from kivy.uix.gridlayout import GridLayout
|
||||
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
|
||||
|
||||
|
||||
if RNS.vendor.platformutils.get_platform() == "android":
|
||||
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
|
||||
@ -160,21 +162,21 @@ class Messages():
|
||||
|
||||
def gen_del(mhash, item):
|
||||
def x():
|
||||
yes_button = MDFlatButton(
|
||||
text="Yes",
|
||||
)
|
||||
no_button = MDFlatButton(
|
||||
text="No",
|
||||
)
|
||||
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)
|
||||
no_button = MDRectangleFlatButton(text="No",font_size=sp(18))
|
||||
dialog = MDDialog(
|
||||
text="Delete message?",
|
||||
title="Delete message?",
|
||||
buttons=[ yes_button, no_button ],
|
||||
# elevation=0,
|
||||
)
|
||||
def dl_yes(s):
|
||||
dialog.dismiss()
|
||||
self.app.sideband.delete_message(mhash)
|
||||
self.reload()
|
||||
|
||||
def cb(dt):
|
||||
self.reload()
|
||||
Clock.schedule_once(cb, 0.2)
|
||||
|
||||
def dl_no(s):
|
||||
dialog.dismiss()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user