Skip to content

Commit 41ce3ef

Browse files
author
surbhi
committed
code-quality: Update code quality kivy/baseclass/draft
1 parent db69b98 commit 41ce3ef

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

src/bitmessagekivy/baseclass/draft.py

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,50 @@
55
draft.py
66
==============
77
8-
Draft screen
9-
8+
Draft screen for managing draft messages in Kivy UI.
109
"""
1110
from kivy.clock import Clock
12-
from kivy.properties import (
13-
ListProperty,
14-
StringProperty
15-
)
11+
from kivy.properties import ListProperty, StringProperty
1612
from kivy.uix.screenmanager import Screen
1713
from kivy.app import App
1814
from pybitmessage.bitmessagekivy.baseclass.common import (
19-
show_limited_cnt, empty_screen_label,
20-
kivy_state_variables
15+
show_limited_cnt, empty_screen_label, kivy_state_variables
2116
)
2217
import logging
18+
2319
logger = logging.getLogger('default')
2420

2521

2622
class Draft(Screen):
27-
"""Draft screen class for kivy Ui"""
23+
"""Draft screen class for Kivy UI"""
2824

2925
data = ListProperty()
3026
account = StringProperty()
3127
queryreturn = ListProperty()
3228
has_refreshed = True
33-
label_str = "yet no message for this account!!!!!!!!!!!!!"
29+
label_str = "Yet no message for this account!"
3430

3531
def __init__(self, *args, **kwargs):
36-
"""Method used for storing draft messages"""
37-
super(Draft, self).__init__(*args, **kwargs)
32+
"""Initialize the Draft screen and set the default account"""
33+
super().__init__(*args, **kwargs)
3834
self.kivy_state = kivy_state_variables()
39-
if self.kivy_state.selected_address == '':
35+
if not self.kivy_state.selected_address:
4036
if App.get_running_app().identity_list:
4137
self.kivy_state.selected_address = App.get_running_app().identity_list[0]
4238
Clock.schedule_once(self.init_ui, 0)
4339

4440
def init_ui(self, dt=0):
45-
"""Clock Schedule for method draft accounts"""
41+
"""Initialize the UI and load draft messages"""
4642
self.load_draft()
47-
logger.debug(dt)
43+
logger.debug(f"UI initialized with dt: {dt}")
4844

4945
def load_draft(self, where="", what=""):
50-
"""Load draft list for Draft messages"""
46+
"""Load the list of draft messages"""
5147
self.set_draft_count('0')
5248
self.ids.ml.add_widget(empty_screen_label(self.label_str))
5349

5450
@staticmethod
55-
def set_draft_count(Count):
56-
"""Set the count of draft mails"""
57-
draftCnt_obj = App.get_running_app().root.ids.content_drawer.ids.draft_cnt
58-
draftCnt_obj.ids.badge_txt.text = show_limited_cnt(int(Count))
51+
def set_draft_count(count):
52+
"""Set the count of draft messages in the UI"""
53+
draft_count_obj = App.get_running_app().root.ids.content_drawer.ids.draft_cnt
54+
draft_count_obj.ids.badge_txt.text = show_limited_cnt(int(count))

0 commit comments

Comments
 (0)