Merge pull request #76 from navjotcis/newwork

worked on resolving navigation issue or spinner UI designing issue
This commit is contained in:
navjotcis 2020-04-27 22:34:55 +05:30 committed by GitHub
commit 221be57afe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 9 deletions

View File

@ -39,7 +39,7 @@
NavigationDrawerIconButton: NavigationDrawerIconButton:
CustomSpinner: CustomSpinner:
id: btn id: btn
pos_hint:{"x":0,"y":.25} pos_hint:{"x":0,"y":.0}
option_cls: Factory.get("MySpinnerOption") option_cls: Factory.get("MySpinnerOption")
font_size: '11.9sp' font_size: '11.9sp'
text: app.getDefaultAccData() text: app.getDefaultAccData()

View File

@ -812,15 +812,23 @@ class Random(Screen):
self.manager.current = 'myaddress' self.manager.current = 'myaddress'
Clock.schedule_once(self.address_created_callback, 6) Clock.schedule_once(self.address_created_callback, 6)
@staticmethod def address_created_callback(self, dt=0):
def address_created_callback(dt=0):
"""New address created""" """New address created"""
state.kivyapp.root.ids.sc10.children[1].active = False state.kivyapp.root.ids.sc10.children[1].active = False
state.kivyapp.root.ids.sc10.ids.ml.clear_widgets() state.kivyapp.root.ids.sc10.ids.ml.clear_widgets()
state.kivyapp.root.ids.sc10.is_add_created = True state.kivyapp.root.ids.sc10.is_add_created = True
state.kivyapp.root.ids.sc10.init_ui() state.kivyapp.root.ids.sc10.init_ui()
self.reset_address_spinner()
toast('New address created') toast('New address created')
def reset_address_spinner(self):
"""reseting spinner address and UI"""
addresses = BMConfigParser().addresses()
self.manager.parent.parent.parent.parent.ids.nav_drawer.ids.btn.values = []
self.manager.parent.parent.parent.parent.ids.sc3.children[1].ids.btn.values = []
self.manager.parent.parent.parent.parent.ids.nav_drawer.ids.btn.values = addresses
self.manager.parent.parent.parent.parent.ids.sc3.children[1].ids.btn.values = addresses
def add_validation(self, instance): def add_validation(self, instance):
"""Checking validation at address creation time""" """Checking validation at address creation time"""
entered_label = str(instance.text.strip()) entered_label = str(instance.text.strip())
@ -1353,14 +1361,20 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods
def on_key(self, window, key, *args): def on_key(self, window, key, *args):
"""Method is used for going on previous screen""" """Method is used for going on previous screen"""
if key == 27: if key == 27:
if state.in_search_mode and self.root.ids.scr_mngr.current != ( if state.in_search_mode and self.root.ids.scr_mngr.current not in [
"mailDetail"): "mailDetail", "create"]:
self.closeSearchScreen() self.closeSearchScreen()
elif self.root.ids.scr_mngr.current == "mailDetail": elif self.root.ids.scr_mngr.current == "mailDetail":
self.root.ids.scr_mngr.current = 'sent'\ self.root.ids.scr_mngr.current = 'sent'\
if state.detailPageType == 'sent' else 'inbox' \ if state.detailPageType == 'sent' else 'inbox' \
if state.detailPageType == 'inbox' else 'draft' if state.detailPageType == 'inbox' else 'draft'
self.back_press() self.back_press()
if state.in_search_mode and state.searcing_text:
toolbar_obj = self.root.ids.toolbar
toolbar_obj.left_action_items = [
['arrow-left', lambda x: self.closeSearchScreen()]]
toolbar_obj.right_action_items = []
self.root.ids.toolbar.title = ''
elif self.root.ids.scr_mngr.current == "create": elif self.root.ids.scr_mngr.current == "create":
self.save_draft() self.save_draft()
self.set_common_header() self.set_common_header()
@ -1376,7 +1390,7 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods
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 state.searcing_text: elif key == 13 and state.searcing_text and not state.in_composer:
if state.search_screen == 'inbox': if state.search_screen == 'inbox':
self.root.ids.sc1.children[1].active = True self.root.ids.sc1.children[1].active = True
Clock.schedule_once(self.search_callback, 0.5) Clock.schedule_once(self.search_callback, 0.5)
@ -1619,6 +1633,11 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods
def set_mail_detail_header(self): def set_mail_detail_header(self):
"""Setting the details of the page""" """Setting the details of the page"""
if state.association and state.in_search_mode:
address_label = self.current_address_label(
BMConfigParser().get(
state.association, 'label'), state.association)
self.root.ids.toolbar.title = address_label
toolbar_obj = self.root.ids.toolbar toolbar_obj = self.root.ids.toolbar
toolbar_obj.left_action_items = [ toolbar_obj.left_action_items = [
['arrow-left', lambda x: self.back_press()]] ['arrow-left', lambda x: self.back_press()]]
@ -1924,6 +1943,7 @@ class MailDetail(Screen):
def inbox_reply(self): def inbox_reply(self):
"""Reply inbox messages""" """Reply inbox messages"""
state.in_composer = True
data = sqlQuery( data = sqlQuery(
"select toaddress, fromaddress, subject, message from inbox where" "select toaddress, fromaddress, subject, message from inbox where"
" msgid = ?;", str(state.mail_id)) " msgid = ?;", str(state.mail_id))
@ -2438,16 +2458,16 @@ class Allmails(Screen):
def avatarImageFirstLetter(letter_string): def avatarImageFirstLetter(letter_string):
"""This function is used to the first letter for the avatar image""" """This function is used to the first letter for the avatar image"""
if letter_string: try:
if letter_string[0].upper() >= 'A' and letter_string[0].upper() <= 'Z': if letter_string[0].upper() >= 'A' and letter_string[0].upper() <= 'Z':
img_latter = letter_string[0].upper() img_latter = letter_string[0].upper()
elif int(letter_string[0]) >= 0 and int(letter_string[0]) <= 9: elif int(letter_string[0]) >= 0 and int(letter_string[0]) <= 9:
img_latter = letter_string[0] img_latter = letter_string[0]
else: else:
img_latter = '!' img_latter = '!'
else: except ValueError as e:
img_latter = '!' img_latter = '!'
return img_latter return img_latter if img_latter else '!'
class Starred(Screen): class Starred(Screen):