worked on implelemting back screen functionality for composer and fixed issues

This commit is contained in:
Navjot 2019-08-21 13:37:47 +05:30
parent a3964aee5a
commit 54eefe757f
No known key found for this signature in database
GPG Key ID: 9EE70AFD71357F1C
2 changed files with 33 additions and 15 deletions

View File

@ -304,7 +304,7 @@ NavigationLayout:
BoxLayout: BoxLayout:
orientation: 'vertical' orientation: 'vertical'
size_hint_y: None size_hint_y: None
height: dp(600) height: dp(500)
padding: dp(32) padding: dp(32)
spacing: 15 spacing: 15
BoxLayout: BoxLayout:
@ -326,7 +326,7 @@ NavigationLayout:
background_color: app.theme_cls.primary_dark background_color: app.theme_cls.primary_dark
id: btn id: btn
values: app.variable_1 values: app.variable_1
on_text: ti.text = self.text if self.text != 'Select' else '' on_text: root.auto_fill_fromaddr() if self.text != 'Select' else ''
option_cls: Factory.get("MySpinnerOption") option_cls: Factory.get("MySpinnerOption")
background_color: color_button if self.state == 'normal' else color_button_pressed background_color: color_button if self.state == 'normal' else color_button_pressed
background_down: 'atlas://data/images/defaulttheme/spinner' background_down: 'atlas://data/images/defaulttheme/spinner'
@ -344,7 +344,7 @@ NavigationLayout:
id: txt_input id: txt_input
size_hint_y: None size_hint_y: None
font_size: '13sp' font_size: '13sp'
height: 100 height: 70
hint_text: 'type or search recipients address starting with BM-' hint_text: 'type or search recipients address starting with BM-'
RV: RV:
id: rv id: rv
@ -525,7 +525,7 @@ NavigationLayout:
MDRaisedButton: MDRaisedButton:
size_hint: .5, None size_hint: .5, None
height: dp(40) height: dp(40)
on_release: root.generateaddress() on_release: root.generateaddress(app)
opposite_colors: True opposite_colors: True
MDLabel: MDLabel:
font_style: 'Title' font_style: 'Title'

View File

@ -577,6 +577,10 @@ class DropDownWidget(BoxLayout):
self.ids.subject.text = '' self.ids.subject.text = ''
self.ids.body.text = '' self.ids.body.text = ''
def auto_fill_fromaddr(self):
self.ids.ti.text = self.ids.btn.text
self.ids.ti.focus = True
class MyTextInput(TextInput): class MyTextInput(TextInput):
"""Takes the text input in the field.""" """Takes the text input in the field."""
@ -674,7 +678,7 @@ class Random(Screen):
is_active = BooleanProperty(False) is_active = BooleanProperty(False)
checked = StringProperty("") checked = StringProperty("")
def generateaddress(self): def generateaddress(self, navApp):
"""Method for Address Generator.""" """Method for Address Generator."""
streamNumberForAddress = 1 streamNumberForAddress = 1
label = self.ids.label.text label = self.ids.label.text
@ -694,6 +698,7 @@ class Random(Screen):
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.clear_widgets() self.parent.parent.parent.parent.ids.sc10.clear_widgets()
self.parent.parent.parent.parent.ids.sc10.add_widget(MyAddress()) self.parent.parent.parent.parent.ids.sc10.add_widget(MyAddress())
navApp.add_search_bar()
toast('New address created') toast('New address created')
@ -1067,14 +1072,13 @@ class NavigateApp(App):
self.add_search_bar() self.add_search_bar()
elif self.root.ids.scr_mngr.current == "create": elif self.root.ids.scr_mngr.current == "create":
composer_objs = self.root composer_objs = self.root
from_addr = str(self.root.children[1].children[0].children[ from_addr = str(self.root.ids.sc3.children[0].ids.ti.text)
0].children[0].children[0].ids.ti.text) to_addr = str(self.root.ids.sc3.children[0].ids.txt_input.text)
to_addr = str(self.root.children[1].children[0].children[
0].children[0].children[0].ids.txt_input.text)
if from_addr and to_addr and state.detailPageType != 'draft': if from_addr and to_addr and state.detailPageType != 'draft':
Draft().draft_msg(composer_objs) Draft().draft_msg(composer_objs)
self.root.ids.scr_mngr.current = 'inbox' self.root.ids.scr_mngr.current = 'inbox'
self.add_search_bar() self.add_search_bar()
self.back_press()
elif self.root.ids.scr_mngr.current == "showqrcode": elif self.root.ids.scr_mngr.current == "showqrcode":
self.root.ids.scr_mngr.current = 'myaddress' self.root.ids.scr_mngr.current = 'myaddress'
elif self.root.ids.scr_mngr.current == "random": elif self.root.ids.scr_mngr.current == "random":
@ -1083,13 +1087,13 @@ class NavigateApp(App):
self.root.ids.scr_mngr.current = 'inbox' self.root.ids.scr_mngr.current = 'inbox'
self.add_search_bar() self.add_search_bar()
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.restart) self.root.ids.scr_mngr.transition.bind(on_complete=self.reset)
return True return True
def restart(self, *args): def reset(self, *args):
"""Method used to set transition direction.""" """Method used to set transition direction."""
self.root.ids.scr_mngr.transition.direction = 'left' self.root.ids.scr_mngr.transition.direction = 'left'
self.root.ids.scr_mngr.transition.unbind(on_complete=self.restart) self.root.ids.scr_mngr.transition.unbind(on_complete=self.reset)
@staticmethod @staticmethod
def status_dispatching(data): def status_dispatching(data):
@ -1100,6 +1104,9 @@ class NavigateApp(App):
def clear_composer(self): def clear_composer(self):
"""If slow down the nwe will make new composer edit screen.""" """If slow down the nwe will make new composer edit screen."""
self.root.ids.toolbar.left_action_items = [['arrow-left', lambda x: self.back_press()]]
self.root.ids.myButton.opacity = 0
self.root.ids.myButton.disabled = True
self.root.ids.search_bar.clear_widgets() self.root.ids.search_bar.clear_widgets()
composer_obj = self.root.ids.sc3.children[0].ids composer_obj = self.root.ids.sc3.children[0].ids
composer_obj.ti.text = '' composer_obj.ti.text = ''
@ -1107,6 +1114,16 @@ class NavigateApp(App):
composer_obj.txt_input.text = '' composer_obj.txt_input.text = ''
composer_obj.subject.text = '' composer_obj.subject.text = ''
def back_press(self):
"""This method is used for going back from composer to previous page"""
self.root.ids.myButton.opacity = 1
self.root.ids.myButton.disabled = False
self.root.ids.toolbar.left_action_items = [['menu', lambda x: self.root.toggle_nav_drawer()]]
self.root.ids.scr_mngr.current = 'inbox'
self.root.ids.scr_mngr.transition.direction = 'right'
self.root.ids.scr_mngr.transition.bind(on_complete=self.reset)
self.add_search_bar()
@staticmethod @staticmethod
def on_stop(): def on_stop():
"""On stop methos is used for stoping the runing script.""" """On stop methos is used for stoping the runing script."""
@ -1227,12 +1244,13 @@ class GrashofPopup(Popup):
"""Method is used for Saving Contacts.""" """Method is used for Saving Contacts."""
my_addresses = \ my_addresses = \
self.parent.children[1].children[2].children[0].ids.btn.values self.parent.children[1].children[2].children[0].ids.btn.values
entered_text = str(self.ids.label.text) entered_text = str(self.ids.address.text)
if entered_text in my_addresses: if entered_text in my_addresses:
self.ids.label.focus = True self.ids.address.focus = False
self.ids.label.helper_text = 'Please Enter corrent address' self.ids.address.helper_text = 'Please Enter corrent address'
elif entered_text == '': elif entered_text == '':
self.ids.label.focus = True self.ids.label.focus = True
# self.ids.address.focus = True
self.ids.label.helper_text = 'This field is required' self.ids.label.helper_text = 'This field is required'
label = self.ids.label.text label = self.ids.label.text