66Kivy UI for inbox screen
77"""
88from kivy .clock import Clock
9- from kivy .properties import (
10- ListProperty ,
11- StringProperty
12- )
9+ from kivy .properties import ListProperty , StringProperty
1310from kivy .app import App
1411from kivy .uix .screenmanager import Screen
15-
1612from pybitmessage .bitmessagekivy .baseclass .common import kivy_state_variables , load_image_path
1713
1814
1915class Inbox (Screen ):
20- """Inbox Screen class for kivy Ui """
16+ """Inbox Screen class for Kivy UI """
2117
2218 queryreturn = ListProperty ()
2319 has_refreshed = True
@@ -26,33 +22,32 @@ class Inbox(Screen):
2622 label_str = "Yet no message for this account!"
2723
2824 def __init__ (self , * args , ** kwargs ):
29- """Initialize kivy variables"""
30- super (Inbox , self ).__init__ (* args , ** kwargs )
25+ """Initialize Kivy variables and set up the UI """
26+ super ().__init__ (* args , ** kwargs )
3127 self .kivy_running_app = App .get_running_app ()
3228 self .kivy_state = kivy_state_variables ()
3329 self .image_dir = load_image_path ()
3430 Clock .schedule_once (self .init_ui , 0 )
3531
36- def set_defaultAddress (self ):
37- """Set default address"""
38- if self .kivy_state .selected_address == "" :
39- if self .kivy_running_app .identity_list :
40- self .kivy_state .selected_address = self .kivy_running_app .identity_list [0 ]
32+ def set_default_address (self ):
33+ """Set the default address if none is selected"""
34+ if not self .kivy_state .selected_address and self .kivy_running_app .identity_list :
35+ self .kivy_state .selected_address = self .kivy_running_app .identity_list [0 ]
4136
4237 def init_ui (self , dt = 0 ):
43- """loadMessagelist() call at specific interval """
38+ """Initialize UI and load message list """
4439 self .loadMessagelist ()
4540
4641 def loadMessagelist (self , where = "" , what = "" ):
47- """Load inbox list for inbox messages"""
48- self .set_defaultAddress ()
42+ """Load inbox messages"""
43+ self .set_default_address ()
4944 self .account = self .kivy_state .selected_address
5045
5146 def refresh_callback (self , * args ):
52- """Load inbox messages while wating-loader spins & called in inbox.kv """
47+ """Refresh the inbox messages while showing a loading spinner """
5348
5449 def refresh_on_scroll_down (interval ):
55- """Reset fields and load data on scrolling upside down """
50+ """Reset search fields and reload data on scroll """
5651 self .kivy_state .searching_text = ""
5752 self .children [2 ].children [1 ].ids .search_field .text = ""
5853 self .ids .ml .clear_widgets ()
0 commit comments