worked on new address creation time loader functionality

This commit is contained in:
navjot 2019-11-04 21:57:53 +05:30
parent 15795e75ce
commit fc347c3731
No known key found for this signature in database
GPG Key ID: 9EE70AFD71357F1C
2 changed files with 80 additions and 65 deletions

View File

@ -58,52 +58,44 @@
text: "Inbox" text: "Inbox"
on_release: app.root.ids.scr_mngr.current = 'inbox' on_release: app.root.ids.scr_mngr.current = 'inbox'
badge_text: "0" badge_text: "0"
on_press: app.refreshScreen(self)
NavigationDrawerIconButton: NavigationDrawerIconButton:
id: send_cnt id: send_cnt
icon: 'send' icon: 'send'
text: "Sent" text: "Sent"
on_release: app.root.ids.scr_mngr.current = 'sent' on_release: app.root.ids.scr_mngr.current = 'sent'
badge_text: "0" badge_text: "0"
on_press: app.refreshScreen(self)
NavigationDrawerIconButton: NavigationDrawerIconButton:
id: draft_cnt id: draft_cnt
icon: 'message-draw' icon: 'message-draw'
text: "Draft" text: "Draft"
on_release: app.root.ids.scr_mngr.current = 'draft' on_release: app.root.ids.scr_mngr.current = 'draft'
badge_text: "0" badge_text: "0"
on_press: app.refreshScreen(self)
NavigationDrawerIconButton: NavigationDrawerIconButton:
text: "Starred" text: "Starred"
icon:'star' icon:'star'
on_release: app.root.ids.scr_mngr.current = 'starred' on_release: app.root.ids.scr_mngr.current = 'starred'
on_press: app.refreshScreen(self)
NavigationDrawerIconButton: NavigationDrawerIconButton:
icon: 'archive' icon: 'archive'
text: "Archieve" text: "Archieve"
on_release: app.root.ids.scr_mngr.current = 'archieve' on_release: app.root.ids.scr_mngr.current = 'archieve'
badge_text: "0" badge_text: "0"
on_press: app.refreshScreen(self)
NavigationDrawerIconButton: NavigationDrawerIconButton:
icon: 'email-open-outline' icon: 'email-open-outline'
text: "Spam" text: "Spam"
on_release: app.root.ids.scr_mngr.current = 'spam' on_release: app.root.ids.scr_mngr.current = 'spam'
badge_text: "0" badge_text: "0"
on_press: app.refreshScreen(self)
NavigationDrawerIconButton: NavigationDrawerIconButton:
id: trash_cnt id: trash_cnt
icon: 'delete' icon: 'delete'
text: "Trash" text: "Trash"
on_release: app.root.ids.scr_mngr.current = 'trash' on_release: app.root.ids.scr_mngr.current = 'trash'
badge_text: "0" badge_text: "0"
on_press: app.refreshScreen(self)
NavigationDrawerIconButton: NavigationDrawerIconButton:
id: allmail_cnt id: allmail_cnt
text: "All Mails" text: "All Mails"
icon:'contact-mail' icon:'contact-mail'
on_release: app.root.ids.scr_mngr.current = 'allmails' on_release: app.root.ids.scr_mngr.current = 'allmails'
badge_text: "0" badge_text: "0"
on_press: app.refreshScreen(self)
NavigationDrawerDivider: NavigationDrawerDivider:
NavigationDrawerSubheader: NavigationDrawerSubheader:
text: "All labels" text: "All labels"
@ -111,37 +103,30 @@
text: "Address Book" text: "Address Book"
icon:'book-multiple' icon:'book-multiple'
on_release: app.root.ids.scr_mngr.current = 'addressbook' on_release: app.root.ids.scr_mngr.current = 'addressbook'
on_press: app.refreshScreen(self)
NavigationDrawerIconButton: NavigationDrawerIconButton:
text: "Settings" text: "Settings"
icon:'settings' icon:'settings'
on_release: app.root.ids.scr_mngr.current = 'set' on_release: app.root.ids.scr_mngr.current = 'set'
on_press: app.refreshScreen(self)
NavigationDrawerIconButton: NavigationDrawerIconButton:
text: "Subscriptions/Payment" text: "Subscriptions/Payment"
icon:'bell' icon:'bell'
on_release: app.root.ids.scr_mngr.current = 'payment' on_release: app.root.ids.scr_mngr.current = 'payment'
on_press: app.refreshScreen(self)
NavigationDrawerIconButton: NavigationDrawerIconButton:
text: "Credits" text: "Credits"
icon:'wallet' icon:'wallet'
on_release: app.root.ids.scr_mngr.current = 'credits' on_release: app.root.ids.scr_mngr.current = 'credits'
on_press: app.refreshScreen(self)
NavigationDrawerIconButton: NavigationDrawerIconButton:
text: "new address" text: "new address"
icon:'account-plus' icon:'account-plus'
on_release: app.root.ids.scr_mngr.current = 'login' on_release: app.root.ids.scr_mngr.current = 'login'
on_press: app.refreshScreen(self)
NavigationDrawerIconButton: NavigationDrawerIconButton:
text: "Network Status" text: "Network Status"
icon:'server-network' icon:'server-network'
on_release: app.root.ids.scr_mngr.current = 'networkstat' on_release: app.root.ids.scr_mngr.current = 'networkstat'
on_press: app.refreshScreen(self)
NavigationDrawerIconButton: NavigationDrawerIconButton:
text: "My Addresses" text: "My Addresses"
icon:'account-multiple' icon:'account-multiple'
on_release: app.root.ids.scr_mngr.current = 'myaddress' on_release: app.root.ids.scr_mngr.current = 'myaddress'
on_press: app.refreshScreen(self)
NavigationLayout: NavigationLayout:
id: nav_layout id: nav_layout
@ -179,7 +164,7 @@ NavigationLayout:
id:sc6 id:sc6
Random: Random:
id:sc7 id:sc7
AddressSuccessful: Spam:
id:sc8 id:sc8
Setting: Setting:
id:sc9 id:sc9
@ -205,8 +190,6 @@ NavigationLayout:
id:sc19 id:sc19
Archieve: Archieve:
id:sc20 id:sc20
Spam:
id:sc21
<Inbox>: <Inbox>:
name: 'inbox' name: 'inbox'
@ -221,6 +204,7 @@ NavigationLayout:
root_layout: root root_layout: root
MDList: MDList:
id: ml id: ml
Loader:
ComposerButton: ComposerButton:
<Sent>: <Sent>:
@ -626,6 +610,7 @@ NavigationLayout:
root_layout: root root_layout: root
MDList: MDList:
id: ml id: ml
Loader:
ComposerButton: ComposerButton:
<AddressBook>: <AddressBook>:
@ -1219,3 +1204,11 @@ NavigationLayout:
anim_delay: 0 anim_delay: 0
#mipmap: True #mipmap: True
size: root.size size: root.size
<Loader@MDSpinner>:
id: spinner
size_hint: None, None
size: dp(46), dp(46)
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
active: False

View File

@ -228,7 +228,7 @@ class Inbox(Screen):
def refresh_callback(interval): def refresh_callback(interval):
"""Method used for loading the inbox screen data.""" """Method used for loading the inbox screen data."""
state.searcing_text = '' state.searcing_text = ''
self.children[2].children[1].ids.search_field.text = '' self.children[3].children[1].ids.search_field.text = ''
self.ids.ml.clear_widgets() self.ids.ml.clear_widgets()
self.loadMessagelist(state.association) self.loadMessagelist(state.association)
self.ids.refresh_layout.refresh_done() self.ids.refresh_layout.refresh_done()
@ -301,7 +301,8 @@ class MyAddress(Screen):
def refresh_callback(interval): def refresh_callback(interval):
"""Method used for loading the myaddress screen data.""" """Method used for loading the myaddress screen data."""
state.searcing_text = '' state.searcing_text = ''
self.children[2].children[1].ids.search_field.text = '' state.kivyapp.root.ids.sc10.children[2].active = False
self.children[3].children[1].ids.search_field.text = ''
self.ids.ml.clear_widgets() self.ids.ml.clear_widgets()
self.init_ui() self.init_ui()
self.ids.refresh_layout.refresh_done() self.ids.refresh_layout.refresh_done()
@ -462,6 +463,7 @@ class DropDownWidget(BoxLayout):
sendMessageToPeople = True sendMessageToPeople = True
if sendMessageToPeople: if sendMessageToPeople:
if toAddress != '' and subject and message: if toAddress != '' and subject and message:
# navApp.root.ids.sc1.children[1].active = True
from addresses import decodeAddress from addresses import decodeAddress
status, addressVersionNumber, streamNumber, ripe = decodeAddress(toAddress) status, addressVersionNumber, streamNumber, ripe = decodeAddress(toAddress)
if status == 'success': if status == 'success':
@ -527,6 +529,7 @@ class DropDownWidget(BoxLayout):
queues.workerQueue.put(('sendmessage', toAddress)) queues.workerQueue.put(('sendmessage', toAddress))
print "sqlExecute successfully #######################" print "sqlExecute successfully #######################"
self.parent.parent.current = 'inbox' self.parent.parent.current = 'inbox'
# navApp.root.ids.sc1.children[1].active = False
state.in_composer = True state.in_composer = True
navApp.back_press() navApp.back_press()
toast('send') toast('send')
@ -689,6 +692,7 @@ class Random(Screen):
nonceTrialsPerByte = 1000 nonceTrialsPerByte = 1000
payloadLengthExtraBytes = 1000 payloadLengthExtraBytes = 1000
if str(self.ids.label.text).strip(): if str(self.ids.label.text).strip():
toast('Address Creating...')
queues.addressGeneratorQueue.put(( queues.addressGeneratorQueue.put((
'createRandomAddress', 'createRandomAddress',
4, streamNumberForAddress, 4, streamNumberForAddress,
@ -699,18 +703,17 @@ class Random(Screen):
self.parent.parent.parent.parent.ids.toolbar.opacity = 1 self.parent.parent.parent.parent.ids.toolbar.opacity = 1
self.parent.parent.parent.parent.ids.toolbar.disabled = False self.parent.parent.parent.parent.ids.toolbar.disabled = False
self.parent.parent.parent.parent.ids.sc10.ids.ml.clear_widgets() self.parent.parent.parent.parent.ids.sc10.ids.ml.clear_widgets()
self.parent.parent.parent.parent.ids.sc10.children[1].active = True
self.manager.current = 'myaddress' self.manager.current = 'myaddress'
self.parent.parent.parent.parent.ids.sc10.init_ui() Clock.schedule_once(self.address_created_callback, 10)
def address_created_callback(self, dt=0):
state.kivyapp.root.ids.sc10.children[1].active = False
state.kivyapp.root.ids.sc10.init_ui()
self.manager.current = 'myaddress' self.manager.current = 'myaddress'
toast('New address created') toast('New address created')
class AddressSuccessful(Screen):
"""Getting Address Detail."""
pass
class Sent(Screen): class Sent(Screen):
"""Sent Screen uses screen to show widgets of screens.""" """Sent Screen uses screen to show widgets of screens."""
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -1147,6 +1150,20 @@ class NavigateApp(App):
self.root.ids.scr_mngr.transition.direction = 'right' self.root.ids.scr_mngr.transition.direction = 'right'
self.root.ids.scr_mngr.transition.bind(on_complete=self.reset) self.root.ids.scr_mngr.transition.bind(on_complete=self.reset)
return True return True
elif key == 13 and platform == 'android':
if state.search_screen == 'inbox':
self.root.ids.sc1.ids.ml.clear_widgets()
self.root.ids.sc1.loadMessagelist(state.association)
elif state.search_screen == 'addressbook':
self.root.ids.sc11.ids.ml.clear_widgets()
self.root.ids.sc11.loadAddresslist(None, 'All', '')
elif state.search_screen == 'myaddress':
self.root.ids.sc10.ids.ml.clear_widgets()
self.root.ids.sc10.init_ui()
else:
self.root.ids.sc4.ids.ml.clear_widgets()
self.root.ids.sc4.loadSent(state.association)
self.root.ids.scr_mngr.current = state.search_screen
def reset(self, *args): def reset(self, *args):
"""Method used to set transition direction.""" """Method used to set transition direction."""
@ -1222,6 +1239,12 @@ class NavigateApp(App):
"""Method used for showing searched mails.""" """Method used for showing searched mails."""
state.search_screen = self.root.ids.scr_mngr.current state.search_screen = self.root.ids.scr_mngr.current
state.searcing_text = str(instance.text).strip() state.searcing_text = str(instance.text).strip()
if instance.focus and state.searcing_text:
toolbar_obj = self.root.ids.toolbar
toolbar_obj.left_action_items = [['close', lambda x: self.closeSearchScreen()]]
toolbar_obj.right_action_items = []
self.root.ids.toolbar.title = ''
if platform == 'linux':
if state.search_screen == 'inbox': if state.search_screen == 'inbox':
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)
@ -1236,40 +1259,39 @@ class NavigateApp(App):
self.root.ids.sc4.loadSent(state.association) self.root.ids.sc4.loadSent(state.association)
self.root.ids.scr_mngr.current = state.search_screen self.root.ids.scr_mngr.current = state.search_screen
def refreshScreen(self, instance): def closeSearchScreen(self):
self.root.ids.toolbar.right_action_items = [['account-plus', lambda x: self.addingtoaddressbook()]]
self.root.ids.toolbar.left_action_items = [['menu', lambda x: self.root.toggle_nav_drawer()]]
address_label = self.current_address_label(
BMConfigParser().get(state.association, 'label'), state.association)
self.root.ids.toolbar.title = address_label
self.refreshScreen()
def refreshScreen(self):
"""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 state.search_screen == 'inbox':
# self.root.ids.sc4.ids.ml.clear_widgets() try:
# self.root.ids.sc4.children[1].children[1].ids.search_field.text = '' self.root.ids.sc1.children[3].children[1].ids.search_field.text = ''
# self.root.ids.sc4.loadSent(state.association) except Exception:
# elif instance.text == 'Inbox': self.root.ids.sc1.children[2].children[1].ids.search_field.text = ''
# self.root.ids.sc1.ids.ml.clear_widgets() self.root.ids.sc1.ids.ml.clear_widgets()
# try: self.root.ids.sc1.loadMessagelist(state.association)
# self.root.ids.sc1.children[2].children[1].ids.search_field.text = '' elif state.search_screen == 'addressbook':
# except Exception: self.root.ids.sc11.children[1].children[1].ids.search_field.text = ''
# self.root.ids.sc1.children[1].children[1].ids.search_field.text = '' self.root.ids.sc11.ids.ml.clear_widgets()
# self.root.ids.sc1.loadMessagelist(state.association) self.root.ids.sc11.loadAddresslist(None, 'All', '')
# elif instance.text == 'Draft': elif state.search_screen == 'myaddress':
# self.root.ids.sc16.clear_widgets() try:
# self.root.ids.sc16.add_widget(Draft()) self.root.ids.sc10.children[3].children[1].ids.search_field.text = ''
# elif instance.text == 'Trash': except Exception:
# self.root.ids.sc5.clear_widgets() self.root.ids.sc10.children[2].children[1].ids.search_field.text = ''
# self.root.ids.sc5.add_widget(Trash()) self.root.ids.sc10.ids.ml.clear_widgets()
# elif instance.text == 'All Mails': self.root.ids.sc10.init_ui()
# self.root.ids.sc17.clear_widgets() else:
# self.root.ids.sc17.add_widget(Allmails()) self.root.ids.sc4.children[1].children[1].ids.search_field.text = ''
# elif instance.text == 'Address Book': self.root.ids.sc4.ids.ml.clear_widgets()
# self.root.ids.sc11.ids.ml.clear_widgets() self.root.ids.sc4.loadSent(state.association)
# self.root.ids.sc11.children[1].children[1].ids.search_field.text = ''
# self.root.ids.sc11.loadAddresslist(None, 'All', '')
# elif instance.text == 'My Addresses':
# self.root.ids.sc10.ids.ml.clear_widgets()
# try:
# self.root.ids.sc10.children[1].children[1].ids.search_field.text = ''
# except Exception:
# self.root.ids.sc10.children[2].children[1].ids.search_field.text = ''
# self.root.ids.sc10.init_ui()
return return
def set_identicon(self, text): def set_identicon(self, text):