diff --git a/src/bitmessagekivy/baseclass/allmail.py b/src/bitmessagekivy/baseclass/allmail.py index 06bd9b94..1c9caa59 100644 --- a/src/bitmessagekivy/baseclass/allmail.py +++ b/src/bitmessagekivy/baseclass/allmail.py @@ -184,8 +184,8 @@ class Allmails(Screen): state.trash_count = str(int(state.trash_count) + 1) if int(state.all_count) <= 0: self.ids.tag_label.text = '' - nav_lay_obj.sc5.clear_widgets() - nav_lay_obj.sc5.add_widget(Trash()) + # nav_lay_obj.sc5.clear_widgets() + # nav_lay_obj.sc5.add_widget(Trash()) nav_lay_obj.sc17.remove_widget(instance.parent.parent) toast('Deleted') diff --git a/src/bitmessagekivy/baseclass/inbox.py b/src/bitmessagekivy/baseclass/inbox.py index 56c717f3..d13df949 100644 --- a/src/bitmessagekivy/baseclass/inbox.py +++ b/src/bitmessagekivy/baseclass/inbox.py @@ -217,7 +217,7 @@ class Inbox(Screen): self.ids.ml.remove_widget( instance.parent.parent) toast('Deleted') - self.update_trash() + # self.update_trash() def archive(self, data_index, instance, *args): """Archive inbox mail from inbox listing""" diff --git a/src/bitmessagekivy/baseclass/sent.py b/src/bitmessagekivy/baseclass/sent.py index 6454212f..2eb2ed05 100644 --- a/src/bitmessagekivy/baseclass/sent.py +++ b/src/bitmessagekivy/baseclass/sent.py @@ -217,7 +217,6 @@ class Sent(Screen): " WHERE ackdata = ?;", data_index) self.ids.ml.remove_widget(instance.parent.parent) toast('Deleted') - self.update_trash() def archive(self, data_index, instance, *args): """Archive sent mail from sent mail listing""" @@ -232,10 +231,10 @@ class Sent(Screen): try: self.parent.screens[3].clear_widgets() self.parent.screens[3].add_widget(Factory.Trash()) - self.parent.screens[14].clear_widgets() - self.parent.screens[14].add_widget(Factory.Allmails()) + # self.parent.screens[14].clear_widgets() + # self.parent.screens[14].add_widget(Factory.Allmails()) except Exception: self.parent.parent.screens[3].clear_widgets() self.parent.parent.screens[3].add_widget(Factory.Trash()) - self.parent.parent.screens[14].clear_widgets() - self.parent.parent.screens[14].add_widget(Factory.Allmails()) + # self.parent.parent.screens[14].clear_widgets() + # self.parent.parent.screens[14].add_widget(Factory.Allmails()) diff --git a/src/bitmessagekivy/baseclass/trash.py b/src/bitmessagekivy/baseclass/trash.py index 1982ef83..78293681 100644 --- a/src/bitmessagekivy/baseclass/trash.py +++ b/src/bitmessagekivy/baseclass/trash.py @@ -44,18 +44,23 @@ class Trash(Screen): def init_ui(self, dt=0): """Clock Schdule for method trash screen""" + print('clearing data....................................', len(self.ids.ml.children)) if state.association == '': if BMConfigParser().addresses(): state.association = BMConfigParser().addresses()[0] self.ids.tag_label.text = '' self.trashDataQuery(0, 20) - if self.trash_messages: + print('count messages.....................', len(self.trash_messages)) + if len(self.trash_messages) and len(self.trash_messages) != len(self.ids.ml.children): + self.ids.ml.clear_widgets() self.ids.tag_label.text = 'Trash' # src_mng_obj = state.kivyapp.root.children[2].children[0].ids # src_mng_obj.trash_cnt.badge_text = state.trash_count self.set_TrashCnt(state.trash_count) self.set_mdList() self.ids.scroll_y.bind(scroll_y=self.check_scroll_y) + elif len(self.trash_messages): + self.ids.tag_label.text = 'Trash' else: self.set_TrashCnt('0') content = MDLabel( diff --git a/src/bitmessagekivy/main.kv b/src/bitmessagekivy/main.kv index e7483fa6..c91292f5 100644 --- a/src/bitmessagekivy/main.kv +++ b/src/bitmessagekivy/main.kv @@ -160,7 +160,8 @@ icon: 'delete' divider: None on_release: app.root.ids.scr_mngr.current = 'trash' - on_release: root.parent.set_state() + on_press: root.parent.set_state() + on_press: app.load_screen(self) NavigationItem: id: allmail_cnt text: app.tr._('All Mails') diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 1232c4d8..d18af5fb 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -812,6 +812,12 @@ class NavigateApp(MDApp): self.root.ids.sc17.children[1].active = True except Exception: self.root.ids.sc17.children[0].children[1].active = True + elif instance.text == 'Trash': + self.root.ids.scr_mngr.current = 'trash' + try: + self.root.ids.sc5.children[1].active = True + except Exception as e: + self.root.ids.sc5.children[0].children[1].active = False Clock.schedule_once(partial(self.load_screen_callback, instance), 1) def load_screen_callback(self, instance, dt=0): @@ -821,18 +827,21 @@ class NavigateApp(MDApp): self.root.ids.sc1.loadMessagelist(state.association) self.root.ids.sc1.children[1].active = False elif instance.text == 'All Mails': - # if len(self.root.ids.sc17.ids.ml.children) <= 2: - # self.root.ids.sc17.clear_widgets() - # self.root.ids.sc17.add_widget(Allmails()) - # else: - # self.root.ids.sc17.ids.ml.clear_widgets() - # self.root.ids.sc17.loadMessagelist() self.root.ids.sc17.clear_widgets() self.root.ids.sc17.add_widget(Allmails()) try: self.root.ids.sc17.children[1].active = False except Exception: self.root.ids.sc17.children[0].children[1].active = False + elif instance.text == 'Trash': + # self.root.ids.sc5.ids.ml.clear_widgets() + self.root.ids.sc5.init_ui(0) + # self.root.ids.sc5.clear_widgets() + # self.root.ids.sc5.add_widget(Trash()) + try: + self.root.ids.sc5.children[1].active = False + except Exception as e: + self.root.ids.sc5.children[0].children[1].active = False def on_request_close(self, *args): # pylint: disable=no-self-use """This method is for app closing request"""