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