From 41ce3ef1ba8b7c2a0a281c34f7b9ef604c7ecb31 Mon Sep 17 00:00:00 2001 From: surbhi Date: Mon, 9 Sep 2024 09:26:57 +0530 Subject: [PATCH] code-quality: Update code quality kivy/baseclass/draft --- src/bitmessagekivy/baseclass/draft.py | 36 ++++++++++++--------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/src/bitmessagekivy/baseclass/draft.py b/src/bitmessagekivy/baseclass/draft.py index 1b3ddf21..8fe7f2ce 100644 --- a/src/bitmessagekivy/baseclass/draft.py +++ b/src/bitmessagekivy/baseclass/draft.py @@ -5,54 +5,50 @@ draft.py ============== -Draft screen - +Draft screen for managing draft messages in Kivy UI. """ from kivy.clock import Clock -from kivy.properties import ( - ListProperty, - StringProperty -) +from kivy.properties import ListProperty, StringProperty from kivy.uix.screenmanager import Screen from kivy.app import App from pybitmessage.bitmessagekivy.baseclass.common import ( - show_limited_cnt, empty_screen_label, - kivy_state_variables + show_limited_cnt, empty_screen_label, kivy_state_variables ) import logging + logger = logging.getLogger('default') class Draft(Screen): - """Draft screen class for kivy Ui""" + """Draft screen class for Kivy UI""" data = ListProperty() account = StringProperty() queryreturn = ListProperty() has_refreshed = True - label_str = "yet no message for this account!!!!!!!!!!!!!" + label_str = "Yet no message for this account!" def __init__(self, *args, **kwargs): - """Method used for storing draft messages""" - super(Draft, self).__init__(*args, **kwargs) + """Initialize the Draft screen and set the default account""" + super().__init__(*args, **kwargs) self.kivy_state = kivy_state_variables() - if self.kivy_state.selected_address == '': + if not self.kivy_state.selected_address: if App.get_running_app().identity_list: self.kivy_state.selected_address = App.get_running_app().identity_list[0] Clock.schedule_once(self.init_ui, 0) def init_ui(self, dt=0): - """Clock Schedule for method draft accounts""" + """Initialize the UI and load draft messages""" self.load_draft() - logger.debug(dt) + logger.debug(f"UI initialized with dt: {dt}") def load_draft(self, where="", what=""): - """Load draft list for Draft messages""" + """Load the list of draft messages""" self.set_draft_count('0') self.ids.ml.add_widget(empty_screen_label(self.label_str)) @staticmethod - def set_draft_count(Count): - """Set the count of draft mails""" - draftCnt_obj = App.get_running_app().root.ids.content_drawer.ids.draft_cnt - draftCnt_obj.ids.badge_txt.text = show_limited_cnt(int(Count)) + def set_draft_count(count): + """Set the count of draft messages in the UI""" + draft_count_obj = App.get_running_app().root.ids.content_drawer.ids.draft_cnt + draft_count_obj.ids.badge_txt.text = show_limited_cnt(int(count))