3
3
# pylint: disable=broad-except
4
4
5
5
"""
6
- MailDetail screen for inbox, sent, draft, and trash.
6
+ MailDetail screen for inbox, sent, draft and trash.
7
7
"""
8
8
9
9
import os
27
27
from pybitmessage .bitmessagekivy .get_platform import platform
28
28
from pybitmessage .helper_sql import sqlQuery
29
29
30
+ # Define constants for magic numbers
31
+ ANDROID_WIDTH = 0.8
32
+ OTHER_WIDTH = 0.55
33
+ DIALOG_HEIGHT = 0.25
34
+ LONG_PRESS_DURATION = 1
35
+ DELETE_DELAY = 4
36
+
30
37
31
38
class OneLineListTitle (OneLineListItem ):
32
39
"""OneLineListTitle class for Kivy UI."""
33
40
__events__ = ('on_long_press' , )
34
- long_press_time = NumericProperty (1 )
41
+ long_press_time = NumericProperty (LONG_PRESS_DURATION )
35
42
36
43
def on_state (self , instance , value ):
37
44
"""Handle state change for long press."""
@@ -51,10 +58,10 @@ def on_long_press(self, *args):
51
58
def copy_message_title (self , title_text ):
52
59
"""Display dialog box with options to copy the message title."""
53
60
self .title_text = title_text
54
- width = 0.8 if platform == 'android' else 0.55
61
+ width = ANDROID_WIDTH if platform == 'android' else OTHER_WIDTH
55
62
self .dialog_box = MDDialog (
56
63
text = title_text ,
57
- size_hint = (width , 0.25 ),
64
+ size_hint = (width , DIALOG_HEIGHT ),
58
65
buttons = [
59
66
MDFlatButton (text = "Copy" , on_release = self .copy_title_callback ),
60
67
MDFlatButton (text = "Cancel" , on_release = self .copy_title_callback ),
@@ -89,7 +96,7 @@ class MailDetail(Screen): # pylint: disable=too-many-instance-attributes
89
96
90
97
def __init__ (self , * args , ** kwargs ):
91
98
"""Initialize MailDetail screen."""
92
- super ().__init__ (* args , ** kwargs )
99
+ super ().__init__ (* args , ** kwargs ) # pylint: disable=missing-super-argument
93
100
self .kivy_state = kivy_state_variables ()
94
101
Clock .schedule_once (self .init_ui , 0 )
95
102
@@ -150,7 +157,7 @@ def delete_mail(self):
150
157
if self .page_type != 'draft' :
151
158
self ._update_mail_counts (msg_count_objs )
152
159
153
- Clock .schedule_once (self .callback_for_delete , 4 )
160
+ Clock .schedule_once (self .callback_for_delete , DELETE_DELAY )
154
161
155
162
def _update_sent_mail (self , msg_count_objs ):
156
163
"""Update UI for sent mail."""
0 commit comments