made message swipe delete faster

This commit is contained in:
navjot 2021-04-21 21:48:07 +05:30
parent 4f495961b0
commit 73f600c24c
No known key found for this signature in database
GPG Key ID: 9EE70AFD71357F1C
6 changed files with 30 additions and 16 deletions

View File

@ -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')

View File

@ -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"""

View File

@ -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())

View File

@ -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(

View File

@ -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')

View File

@ -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"""