Created a UI independent function

This commit is contained in:
shekhar-cis 2022-03-17 18:25:31 +05:30
parent b772b2ce9b
commit 0ec38b43f8
Signed by untrusted user: shekhar-cis
GPG Key ID: F4F00AB04E83F9A7
2 changed files with 15 additions and 7 deletions

View File

@ -162,11 +162,5 @@ class AddressBook(Screen, HelperAddressBook):
def send_message_to(self, instance): def send_message_to(self, instance):
"""Method used to fill to_address of composer autofield""" """Method used to fill to_address of composer autofield"""
state.kivyapp.set_navbar_for_composer() state.kivyapp.set_navbar_for_composer()
window_obj = state.kivyapp.root.ids self.compose_message(None, self.address)
window_obj.sc3.children[1].ids.txt_input.text = self.address
window_obj.sc3.children[1].ids.ti.text = ''
window_obj.sc3.children[1].ids.btn.text = 'Select'
window_obj.sc3.children[1].ids.subject.text = ''
window_obj.sc3.children[1].ids.body.text = ''
window_obj.scr_mngr.current = 'create'
self.addbook_popup.dismiss() self.addbook_popup.dismiss()

View File

@ -50,3 +50,17 @@ class HelperAddressBook(object):
], ],
) )
return show_dialogue return show_dialogue
@staticmethod
def compose_message(from_addr=None, to_addr=None):
"""This UI independent method for message sending to reciever"""
window_obj = state.kivyapp.root.ids
if to_addr:
window_obj.sc3.children[1].ids.txt_input.text = to_addr
if from_addr:
window_obj.sc3.children[1].ids.txt_input.text = from_addr
window_obj.sc3.children[1].ids.ti.text = ''
window_obj.sc3.children[1].ids.btn.text = 'Select'
window_obj.sc3.children[1].ids.subject.text = ''
window_obj.sc3.children[1].ids.body.text = ''
window_obj.scr_mngr.current = 'create'