Fixed widget calling by depen-injection
This commit is contained in:
parent
8a49e1ab6b
commit
d783465a3f
|
@ -67,7 +67,7 @@ class AddressBook(Screen, HelperAddressBook):
|
|||
# halign='center',
|
||||
# size_hint_y=None,
|
||||
# valign='top')
|
||||
self.ids.ml.add_widget(self.default_label_when_empty())
|
||||
self.ids.ml.add_widget(self.default_label_when_empty())
|
||||
|
||||
def set_mdList(self, start_index, end_index):
|
||||
"""Creating the mdList"""
|
||||
|
@ -121,30 +121,31 @@ class AddressBook(Screen, HelperAddressBook):
|
|||
self.address_label = obj.address_label = label
|
||||
self.address = obj.address = address
|
||||
width = .9 if platform == 'android' else .8
|
||||
self.addbook_popup = MDDialog(
|
||||
type="custom",
|
||||
size_hint=(width, .25),
|
||||
content_cls=obj,
|
||||
buttons=[
|
||||
MDRaisedButton(
|
||||
text="Send message to",
|
||||
on_release=self.send_message_to,
|
||||
),
|
||||
MDRaisedButton(
|
||||
text="Save",
|
||||
on_release=self.update_addbook_label,
|
||||
),
|
||||
MDRaisedButton(
|
||||
text="Cancel",
|
||||
on_release=self.close_pop,
|
||||
),
|
||||
],
|
||||
)
|
||||
# self.addbook_popup = MDDialog(
|
||||
# type="custom",
|
||||
# size_hint=(width, .25),
|
||||
# content_cls=obj,
|
||||
# buttons=[
|
||||
# MDRaisedButton(
|
||||
# text="Send message to",
|
||||
# on_release=self.send_message_to,
|
||||
# ),
|
||||
# MDRaisedButton(
|
||||
# text="Save",
|
||||
# on_release=self.update_addbook_label,
|
||||
# ),
|
||||
# MDRaisedButton(
|
||||
# text="Cancel",
|
||||
# on_release=self.close_pop,
|
||||
# ),
|
||||
# ],
|
||||
# )
|
||||
# self.addbook_popup.set_normal_height()
|
||||
self.addbook_popup = HelperAddressBook.address_detail_popup(self)
|
||||
self.addbook_popup = self.address_detail_popup(
|
||||
self.send_message_to, self.update_addbook_label,
|
||||
self.close_pop, width=width, obj=obj)
|
||||
self.addbook_popup.auto_dismiss = False
|
||||
self.addbook_popup.open()
|
||||
# HelperAddressBook.address_detail_popup(address, label, instance,)
|
||||
else:
|
||||
instance.ids.delete_msg.disabled = False
|
||||
|
||||
|
@ -192,6 +193,3 @@ class AddressBook(Screen, HelperAddressBook):
|
|||
window_obj.sc3.children[1].ids.body.text = ''
|
||||
window_obj.scr_mngr.current = 'create'
|
||||
self.addbook_popup.dismiss()
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ from kivymd.uix.dialog import MDDialog
|
|||
from kivymd.uix.label import MDLabel
|
||||
|
||||
from bitmessagekivy.baseclass.popup import AddbookDetailPopup
|
||||
# from bitmessagekivy.baseclass.addressbook import AddressBook
|
||||
|
||||
|
||||
class HelperAddressBook:
|
||||
"""Widget used in Addressbook are here"""
|
||||
|
@ -17,6 +17,7 @@ class HelperAddressBook:
|
|||
content = MDLabel(
|
||||
font_style='Caption',
|
||||
theme_text_color='Primary',
|
||||
# TODO: searcing_text(typo), need to create a kivy_state.py and add kivy related variables
|
||||
text="No contact found!" if state.searcing_text
|
||||
else "No contact found yet...... ",
|
||||
halign='center',
|
||||
|
@ -24,30 +25,24 @@ class HelperAddressBook:
|
|||
valign='top')
|
||||
return content
|
||||
|
||||
# @staticmethod
|
||||
# def address_detail_popup(address, label, instance, **args):
|
||||
# obj = AddbookDetailPopup()
|
||||
# address_label = obj.address_label = label
|
||||
# address = obj.address = address
|
||||
# width = .9 if platform == 'android' else .8
|
||||
# addbook_popup = MDDialog(
|
||||
# type="custom",
|
||||
# size_hint=(width, .25),
|
||||
# content_cls=obj,
|
||||
# buttons=[
|
||||
# MDRaisedButton(
|
||||
# text="Send message to",
|
||||
# on_release=AddressBook.send_message_to,
|
||||
# ),
|
||||
# MDRaisedButton(
|
||||
# text="Save",
|
||||
# on_release=AddressBook.update_addbook_label,
|
||||
# ),
|
||||
# MDRaisedButton(
|
||||
# text="Cancel",
|
||||
# on_release=AddressBook.close_pop,
|
||||
# ),
|
||||
# ],
|
||||
# )
|
||||
# addbook_popup.auto_dismiss = False
|
||||
# addbook_popup.open()
|
||||
def address_detail_popup(self, send_message, update_address, close_popup, width, obj):
|
||||
retval = MDDialog(
|
||||
type="custom",
|
||||
size_hint=(width, .25),
|
||||
content_cls=obj,
|
||||
buttons=[
|
||||
MDRaisedButton(
|
||||
text="Send message to",
|
||||
on_release=send_message,
|
||||
),
|
||||
MDRaisedButton(
|
||||
text="Save",
|
||||
on_release=update_address,
|
||||
),
|
||||
MDRaisedButton(
|
||||
text="Cancel",
|
||||
on_release=close_popup,
|
||||
),
|
||||
],
|
||||
)
|
||||
return retval
|
Reference in New Issue
Block a user