worked on implementing loader popup functionality on account switching

This commit is contained in:
navjot 2019-10-31 16:24:18 +05:30
parent 065dbef4db
commit d3cbe45608
No known key found for this signature in database
GPG Key ID: 9EE70AFD71357F1C
6 changed files with 75 additions and 39 deletions

View File

@ -14,6 +14,7 @@
#:import MDFloatingActionButton kivymd.button.MDFloatingActionButton #:import MDFloatingActionButton kivymd.button.MDFloatingActionButton
#:import Factory kivy.factory.Factory #:import Factory kivy.factory.Factory
#:import MDScrollViewRefreshLayout kivymd.refreshlayout.MDScrollViewRefreshLayout #:import MDScrollViewRefreshLayout kivymd.refreshlayout.MDScrollViewRefreshLayout
#:import MDSpinner kivymd.spinner.MDSpinner
#:set color_button (0.784, 0.443, 0.216, 1) # brown #:set color_button (0.784, 0.443, 0.216, 1) # brown
#:set color_button_pressed (0.659, 0.522, 0.431, 1) # darker brown #:set color_button_pressed (0.659, 0.522, 0.431, 1) # darker brown
@ -29,7 +30,7 @@
color: color_font color: color_font
<ContentNavigationDrawer@Navigatorss>: <ContentNavigationDrawer@Navigatorss>:
drawer_logo: app.address_identicon() drawer_logo: './images/drawer_logo1.png'
NavigationDrawerDivider: NavigationDrawerDivider:
NavigationDrawerSubheader: NavigationDrawerSubheader:
text: "Accounts" text: "Accounts"
@ -1204,3 +1205,17 @@ NavigationLayout:
id: search_field id: search_field
hint_text: 'Search' hint_text: 'Search'
on_text: app.searchQuery(self) on_text: app.searchQuery(self)
<LoadingPopup>:
separator_color: 1, 1, 1, 1
background: "White.png"
Button:
id: btn
disabled: True
background_disabled_normal: "White.png"
Image:
source: './images/loader.zip'
anim_delay: 0
#mipmap: True
size: root.size

View File

@ -1026,10 +1026,25 @@ class NavigateApp(App):
self.root_window.children[1].ids.toolbar.title = address_label self.root_window.children[1].ids.toolbar.title = address_label
state.association = text state.association = text
state.searcing_text = '' state.searcing_text = ''
LoadingPopup().open()
self.root.ids.sc1.ids.ml.clear_widgets() self.root.ids.sc1.ids.ml.clear_widgets()
self.root.ids.sc1.loadMessagelist(state.association) self.root.ids.sc1.loadMessagelist(state.association)
self.root.ids.sc4.ids.ml.clear_widgets()
self.root.ids.sc4.children[1].children[1].ids.search_field.text = ''
self.root.ids.sc4.loadSent(state.association)
self.root.ids.sc16.clear_widgets()
self.root.ids.sc16.add_widget(Draft())
self.root.ids.sc5.clear_widgets()
self.root.ids.sc5.add_widget(Trash())
self.root.ids.sc17.clear_widgets()
self.root.ids.sc17.add_widget(Allmails())
self.root.ids.scr_mngr.current = 'inbox' self.root.ids.scr_mngr.current = 'inbox'
msg_counter_objs = self.root_window.children[1].children[2].children[0].ids msg_counter_objs = self.root_window.children[2].children[2].children[0].ids
state.sent_count = str( state.sent_count = str(
sqlQuery( sqlQuery(
"SELECT COUNT(*) FROM sent WHERE fromaddress = '{}' and" "SELECT COUNT(*) FROM sent WHERE fromaddress = '{}' and"
@ -1224,37 +1239,37 @@ class NavigateApp(App):
def refreshScreen(self, instance): def refreshScreen(self, instance):
"""Method show search button only on inbox or sent screen.""" """Method show search button only on inbox or sent screen."""
state.searcing_text = '' state.searcing_text = ''
if instance.text == 'Sent': # if instance.text == 'Sent':
self.root.ids.sc4.ids.ml.clear_widgets() # self.root.ids.sc4.ids.ml.clear_widgets()
self.root.ids.sc4.children[1].children[1].ids.search_field.text = '' # self.root.ids.sc4.children[1].children[1].ids.search_field.text = ''
self.root.ids.sc4.loadSent(state.association) # self.root.ids.sc4.loadSent(state.association)
elif instance.text == 'Inbox': # elif instance.text == 'Inbox':
self.root.ids.sc1.ids.ml.clear_widgets() # self.root.ids.sc1.ids.ml.clear_widgets()
try: # try:
self.root.ids.sc1.children[2].children[1].ids.search_field.text = '' # self.root.ids.sc1.children[2].children[1].ids.search_field.text = ''
except Exception: # except Exception:
self.root.ids.sc1.children[1].children[1].ids.search_field.text = '' # self.root.ids.sc1.children[1].children[1].ids.search_field.text = ''
self.root.ids.sc1.loadMessagelist(state.association) # self.root.ids.sc1.loadMessagelist(state.association)
elif instance.text == 'Draft': # elif instance.text == 'Draft':
self.root.ids.sc16.clear_widgets() # self.root.ids.sc16.clear_widgets()
self.root.ids.sc16.add_widget(Draft()) # self.root.ids.sc16.add_widget(Draft())
elif instance.text == 'Trash': # elif instance.text == 'Trash':
self.root.ids.sc5.clear_widgets() # self.root.ids.sc5.clear_widgets()
self.root.ids.sc5.add_widget(Trash()) # self.root.ids.sc5.add_widget(Trash())
elif instance.text == 'All Mails': # elif instance.text == 'All Mails':
self.root.ids.sc17.clear_widgets() # self.root.ids.sc17.clear_widgets()
self.root.ids.sc17.add_widget(Allmails()) # self.root.ids.sc17.add_widget(Allmails())
elif instance.text == 'Address Book': # elif instance.text == 'Address Book':
self.root.ids.sc11.ids.ml.clear_widgets() # self.root.ids.sc11.ids.ml.clear_widgets()
self.root.ids.sc11.children[1].children[1].ids.search_field.text = '' # self.root.ids.sc11.children[1].children[1].ids.search_field.text = ''
self.root.ids.sc11.loadAddresslist(None, 'All', '') # self.root.ids.sc11.loadAddresslist(None, 'All', '')
elif instance.text == 'My Addresses': # elif instance.text == 'My Addresses':
self.root.ids.sc10.ids.ml.clear_widgets() # self.root.ids.sc10.ids.ml.clear_widgets()
try: # try:
self.root.ids.sc10.children[1].children[1].ids.search_field.text = '' # self.root.ids.sc10.children[1].children[1].ids.search_field.text = ''
except Exception: # except Exception:
self.root.ids.sc10.children[2].children[1].ids.search_field.text = '' # self.root.ids.sc10.children[2].children[1].ids.search_field.text = ''
self.root.ids.sc10.init_ui() # self.root.ids.sc10.init_ui()
return return
def set_identicon(self, text): def set_identicon(self, text):
@ -1262,11 +1277,6 @@ class NavigateApp(App):
img = identiconGeneration.generate(text) img = identiconGeneration.generate(text)
self.root.children[2].children[0].ids.btn.children[1].texture = img.texture self.root.children[2].children[0].ids.btn.children[1].texture = img.texture
@staticmethod
def address_identicon():
"""Address identicon"""
return './images/drawer_logo1.png'
def set_mail_detail_header(self): def set_mail_detail_header(self):
"""Method is used for setting the details of the page""" """Method is used for setting the details of the page"""
toolbar_obj = self.root.ids.toolbar toolbar_obj = self.root.ids.toolbar
@ -1966,3 +1976,14 @@ class Spam(Screen):
"""Spam Screen show widgets of page.""" """Spam Screen show widgets of page."""
pass pass
class LoadingPopup(Popup):
def __init__(self, **kwargs):
super(LoadingPopup, self).__init__(**kwargs)
# call dismiss_popup in 2 seconds
Clock.schedule_once(self.dismiss_popup, 0.5)
def dismiss_popup(self, dt):
self.dismiss()

View File

@ -13,7 +13,7 @@ package.domain = org.test
source.dir = . source.dir = .
# (list) Source files to include (let empty to include all the files) # (list) Source files to include (let empty to include all the files)
source.include_exts = py,png,jpg,kv,atlas source.include_exts = py,png,jpg,kv,atlas,gif,zip
# (list) List of inclusions using pattern matching # (list) List of inclusions using pattern matching
#source.include_patterns = assets/*,images/*.png #source.include_patterns = assets/*,images/*.png

BIN
src/images/3.zip Normal file

Binary file not shown.

BIN
src/images/loader.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
src/images/loader.zip Normal file

Binary file not shown.