From 328d5af3ecc8e405205ecebbc455b8520dc19f6c Mon Sep 17 00:00:00 2001 From: shekhar-cis Date: Mon, 11 Jul 2022 15:40:57 +0530 Subject: [PATCH] Separate common_detail_screen() to avoid the circular import --- src/bitmessagekivy/baseclass/common.py | 16 -------------- .../baseclass/common_mail_detail.py | 22 +++++++++++++++++++ 2 files changed, 22 insertions(+), 16 deletions(-) create mode 100644 src/bitmessagekivy/baseclass/common_mail_detail.py diff --git a/src/bitmessagekivy/baseclass/common.py b/src/bitmessagekivy/baseclass/common.py index bf204464..80dc1672 100644 --- a/src/bitmessagekivy/baseclass/common.py +++ b/src/bitmessagekivy/baseclass/common.py @@ -183,19 +183,3 @@ def mdlist_message_content(queryreturn, data): for mail in queryreturn: mdlist_data = set_mail_details(mail) data.append(mdlist_data) - - -def mail_detail_screen(screen_name, msg_id, instance, folder, *args): - """Common function for all screens to open Mail detail.""" - kivy_state = kivy_state_variables() - if instance.open_progress == 0.0: - kivy_state.detailPageType = folder - kivy_state.mail_id = msg_id - if screen_name.manager: - src_mng_obj = screen_name.manager - else: - src_mng_obj = screen_name.parent.parent - src_mng_obj.screens[11].clear_widgets() - from bitmessagekivy.baseclass.maildetail import MailDetail - src_mng_obj.screens[11].add_widget(MailDetail()) - src_mng_obj.current = "mailDetail" diff --git a/src/bitmessagekivy/baseclass/common_mail_detail.py b/src/bitmessagekivy/baseclass/common_mail_detail.py new file mode 100644 index 00000000..773d60ca --- /dev/null +++ b/src/bitmessagekivy/baseclass/common_mail_detail.py @@ -0,0 +1,22 @@ +# pylint: disable=no-name-in-module, attribute-defined-outside-init, import-error +""" + All Common widgets of kivy are managed here. +""" + +from bitmessagekivy.baseclass.maildetail import MailDetail +from bitmessagekivy.baseclass.common import kivy_state_variables + + +def mail_detail_screen(screen_name, msg_id, instance, folder, *args): # pylint: disable=unused-argument + """Common function for all screens to open Mail detail.""" + kivy_state = kivy_state_variables() + if instance.open_progress == 0.0: + kivy_state.detailPageType = folder + kivy_state.mail_id = msg_id + if screen_name.manager: + src_mng_obj = screen_name.manager + else: + src_mng_obj = screen_name.parent.parent + src_mng_obj.screens[11].clear_widgets() + src_mng_obj.screens[11].add_widget(MailDetail()) + src_mng_obj.current = "mailDetail"