diff --git a/src/bitmessagekivy/baseclass/addressbook.py b/src/bitmessagekivy/baseclass/addressbook.py index 0eb08462..eea47860 100644 --- a/src/bitmessagekivy/baseclass/addressbook.py +++ b/src/bitmessagekivy/baseclass/addressbook.py @@ -1,4 +1,3 @@ -from turtle import pd from bitmessagekivy.get_platform import platform from bitmessagekivy import kivy_helper_search from helper_sql import sqlExecute @@ -22,7 +21,8 @@ from bitmessagekivy.baseclass.common import ( from bitmessagekivy.baseclass.popup import AddbookDetailPopup from bitmessagekivy.baseclass.addressbook_widgets import HelperAddressBook -class AddressBook(Screen): + +class AddressBook(Screen, HelperAddressBook): """AddressBook Screen class for kivy Ui""" queryreturn = ListProperty() @@ -58,6 +58,7 @@ class AddressBook(Screen): self.set_mdList(0, 20) self.ids.scroll_y.bind(scroll_y=self.check_scroll_y) else: + """This is still exprimental, may need to make changes somewhere""" # content = MDLabel( # font_style='Caption', # theme_text_color='Primary', @@ -66,18 +67,7 @@ class AddressBook(Screen): # halign='center', # size_hint_y=None, # valign='top') - self.ids.ml.add_widget(HelperAddressBook.default_label_while_empty()) - - # def show_default_content(self): - # content = MDLabel( - # font_style='Caption', - # theme_text_color='Primary', - # text="No contact found!" if state.searcing_text - # else "No contact found yet...... ", - # halign='center', - # size_hint_y=None, - # valign='top') - # return content + self.ids.ml.add_widget(self.default_label_when_empty()) def set_mdList(self, start_index, end_index): """Creating the mdList""" @@ -127,34 +117,34 @@ class AddressBook(Screen): if instance.state == 'closed': instance.ids.delete_msg.disabled = True if instance.open_progress == 0.0: - HelperAddressBook.address_detail_popup(self, address, label, instance) - # obj = AddbookDetailPopup() - # 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.set_normal_height() - # self.addbook_popup = HelperAddressBook.address_detail_popup(self) - # self.addbook_popup.auto_dismiss = False - # self.addbook_popup.open() + obj = AddbookDetailPopup() + 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.set_normal_height() + self.addbook_popup = HelperAddressBook.address_detail_popup(self) + self.addbook_popup.auto_dismiss = False + self.addbook_popup.open() + # HelperAddressBook.address_detail_popup(address, label, instance,) else: instance.ids.delete_msg.disabled = False @@ -190,7 +180,7 @@ class AddressBook(Screen): state.kivyapp.root.ids.sc11.loadAddresslist(None, 'All', '') self.addbook_popup.dismiss() toast('Saved') - + def send_message_to(self, instance): """Method used to fill to_address of composer autofield""" state.kivyapp.set_navbar_for_composer() @@ -202,3 +192,6 @@ class AddressBook(Screen): window_obj.sc3.children[1].ids.body.text = '' window_obj.scr_mngr.current = 'create' self.addbook_popup.dismiss() + + + diff --git a/src/bitmessagekivy/baseclass/addressbook_widgets.py b/src/bitmessagekivy/baseclass/addressbook_widgets.py index 0521a90a..ee6c22c5 100644 --- a/src/bitmessagekivy/baseclass/addressbook_widgets.py +++ b/src/bitmessagekivy/baseclass/addressbook_widgets.py @@ -7,9 +7,13 @@ 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: - def default_label_while_empty(): + """Widget used in Addressbook are here""" + + @staticmethod + def default_label_when_empty(): content = MDLabel( font_style='Caption', theme_text_color='Primary', @@ -20,29 +24,30 @@ class HelperAddressBook: valign='top') return content - def address_detail_popup(self, address, label, instance): - obj = AddbookDetailPopup() - 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.auto_dismiss = False - self.addbook_popup.open() + # @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() diff --git a/src/bitmessagekivy/kv/login.kv b/src/bitmessagekivy/kv/login.kv index ffa922e1..992938dc 100644 --- a/src/bitmessagekivy/kv/login.kv +++ b/src/bitmessagekivy/kv/login.kv @@ -80,7 +80,7 @@ icon: "chevron-double-right" text: app.tr._("Proceed Next") on_release: - app.root.set_screen('random') + app.set_screen('random') on_press: app.root.ids.sc7.reset_address_label()