mirror of
https://github.com/liberatedsystems/openCom-Companion.git
synced 2024-11-25 23:00:36 +01:00
Improved dropdown behaviour and widget allocation
This commit is contained in:
parent
bfd96a98ac
commit
c54422d771
@ -480,7 +480,6 @@ class SidebandApp(MDApp):
|
|||||||
self.root.ids.messages_scrollview.effect_cls = ScrollEffect
|
self.root.ids.messages_scrollview.effect_cls = ScrollEffect
|
||||||
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()
|
||||||
|
|
||||||
|
@ -201,6 +201,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):
|
||||||
|
@ -32,6 +32,7 @@ class Conversations():
|
|||||||
self.context_dests = []
|
self.context_dests = []
|
||||||
self.added_item_dests = []
|
self.added_item_dests = []
|
||||||
self.list = None
|
self.list = None
|
||||||
|
self.conversation_dropdown = None
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def reload(self):
|
def reload(self):
|
||||||
@ -85,6 +86,7 @@ class Conversations():
|
|||||||
|
|
||||||
def gen_edit(dest, item):
|
def gen_edit(dest, item):
|
||||||
def x():
|
def x():
|
||||||
|
dest = self.conversation_dropdown.context_dest
|
||||||
try:
|
try:
|
||||||
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)
|
||||||
@ -140,6 +142,7 @@ class Conversations():
|
|||||||
|
|
||||||
def gen_clear(dest, item):
|
def gen_clear(dest, item):
|
||||||
def x():
|
def x():
|
||||||
|
dest = self.conversation_dropdown.context_dest
|
||||||
yes_button = MDFlatButton(
|
yes_button = MDFlatButton(
|
||||||
text="Yes",
|
text="Yes",
|
||||||
)
|
)
|
||||||
@ -178,7 +181,7 @@ class Conversations():
|
|||||||
)
|
)
|
||||||
def dl_yes(s):
|
def dl_yes(s):
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
self.app.sideband.delete_conversation(dest)
|
self.app.sideband.delete_conversation(self.conversation_dropdown.context_dest)
|
||||||
self.reload()
|
self.reload()
|
||||||
def dl_no(s):
|
def dl_no(s):
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
@ -189,44 +192,51 @@ class Conversations():
|
|||||||
dialog.open()
|
dialog.open()
|
||||||
return x
|
return x
|
||||||
|
|
||||||
dm_items = [
|
if self.conversation_dropdown == None:
|
||||||
{
|
dmi_h = 40
|
||||||
"viewclass": "OneLineListItem",
|
dm_items = [
|
||||||
"text": "Edit",
|
{
|
||||||
"height": dp(40),
|
"viewclass": "OneLineListItem",
|
||||||
"on_release": gen_edit(context_dest, item)
|
"text": "Edit",
|
||||||
},
|
"height": dp(dmi_h),
|
||||||
{
|
"on_release": gen_edit(context_dest, item)
|
||||||
"text": "Clear Messages",
|
},
|
||||||
"viewclass": "OneLineListItem",
|
{
|
||||||
"height": dp(40),
|
"text": "Clear Messages",
|
||||||
"on_release": gen_clear(context_dest, item)
|
"viewclass": "OneLineListItem",
|
||||||
},
|
"height": dp(dmi_h),
|
||||||
{
|
"on_release": gen_clear(context_dest, item)
|
||||||
"text": "Delete Conversation",
|
},
|
||||||
"viewclass": "OneLineListItem",
|
{
|
||||||
"height": dp(40),
|
"text": "Delete Conversation",
|
||||||
"on_release": gen_del(context_dest, item)
|
"viewclass": "OneLineListItem",
|
||||||
}
|
"height": dp(dmi_h),
|
||||||
]
|
"on_release": gen_del(context_dest, item)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
self.conversation_dropdown = MDDropdownMenu(
|
||||||
|
caller=None,
|
||||||
|
items=dm_items,
|
||||||
|
position="auto",
|
||||||
|
width_mult=4,
|
||||||
|
elevation=1,
|
||||||
|
radius=dp(3),
|
||||||
|
opening_transition="linear",
|
||||||
|
opening_time=0.0,
|
||||||
|
)
|
||||||
|
|
||||||
item.iconr = IconRightWidget(icon="dots-vertical");
|
item.iconr = IconRightWidget(icon="dots-vertical");
|
||||||
|
item.dmenu = self.conversation_dropdown
|
||||||
item.dmenu = MDDropdownMenu(
|
|
||||||
caller=item.iconr,
|
|
||||||
items=dm_items,
|
|
||||||
position="auto",
|
|
||||||
width_mult=4,
|
|
||||||
elevation=1,
|
|
||||||
radius=dp(3),
|
|
||||||
)
|
|
||||||
|
|
||||||
def callback_factory(ref):
|
def callback_factory(ref, dest):
|
||||||
def x(sender):
|
def x(sender):
|
||||||
|
self.conversation_dropdown.context_dest = dest
|
||||||
|
ref.dmenu.caller = ref.iconr
|
||||||
ref.dmenu.open()
|
ref.dmenu.open()
|
||||||
return x
|
return x
|
||||||
|
|
||||||
item.iconr.bind(on_release=callback_factory(item))
|
item.iconr.bind(on_release=callback_factory(item, context_dest))
|
||||||
|
|
||||||
item.add_widget(item.iconr)
|
item.add_widget(item.iconr)
|
||||||
|
|
||||||
|
@ -925,6 +925,7 @@ MDNavigationLayout:
|
|||||||
|
|
||||||
ContentNavigationDrawer:
|
ContentNavigationDrawer:
|
||||||
ScrollView:
|
ScrollView:
|
||||||
|
id: nav_scrollview
|
||||||
DrawerList:
|
DrawerList:
|
||||||
id: md_list
|
id: md_list
|
||||||
|
|
||||||
|
@ -214,6 +214,8 @@ class Messages():
|
|||||||
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):
|
||||||
|
Loading…
Reference in New Issue
Block a user