Added Enhancement for Sent Screen and also manage KivyMD with virtual env
This commit is contained in:
parent
9df2021c9f
commit
2c666dddc7
|
@ -51,6 +51,7 @@
|
||||||
text: app.getDefaultAccData()
|
text: app.getDefaultAccData()
|
||||||
values: app.variable_1
|
values: app.variable_1
|
||||||
on_text:app.getCurrentAccountData(self.text)
|
on_text:app.getCurrentAccountData(self.text)
|
||||||
|
on_press: app.limit_spinner()
|
||||||
NavigationDrawerIconButton:
|
NavigationDrawerIconButton:
|
||||||
icon: 'email-open'
|
icon: 'email-open'
|
||||||
text: "Inbox"
|
text: "Inbox"
|
||||||
|
@ -60,7 +61,7 @@
|
||||||
icon: 'send'
|
icon: 'send'
|
||||||
text: "Sent"
|
text: "Sent"
|
||||||
on_release: app.root.ids.scr_mngr.current = 'sent'
|
on_release: app.root.ids.scr_mngr.current = 'sent'
|
||||||
badge_text: "2"
|
badge_text: "0"
|
||||||
NavigationDrawerIconButton:
|
NavigationDrawerIconButton:
|
||||||
icon: 'message-draw'
|
icon: 'message-draw'
|
||||||
text: "Draft"
|
text: "Draft"
|
||||||
|
@ -127,7 +128,9 @@ NavigationLayout:
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
Toolbar:
|
Toolbar:
|
||||||
id: toolbar..
|
id: toolbar
|
||||||
|
opacity: 1 if app.addressexist() else 0
|
||||||
|
disabled: False if app.addressexist() else True
|
||||||
md_bg_color: app.theme_cls.primary_color
|
md_bg_color: app.theme_cls.primary_color
|
||||||
background_palette: 'Primary'
|
background_palette: 'Primary'
|
||||||
background_hue: '500'
|
background_hue: '500'
|
||||||
|
@ -172,6 +175,8 @@ NavigationLayout:
|
||||||
id:sc12
|
id:sc12
|
||||||
NetworkStat:
|
NetworkStat:
|
||||||
id:sc13
|
id:sc13
|
||||||
|
SentDetail:
|
||||||
|
id:sc14
|
||||||
|
|
||||||
<Inbox>:
|
<Inbox>:
|
||||||
name: 'inbox'
|
name: 'inbox'
|
||||||
|
@ -388,6 +393,7 @@ NavigationLayout:
|
||||||
id: grp_chkbox_1
|
id: grp_chkbox_1
|
||||||
group: 'test'
|
group: 'test'
|
||||||
active: True
|
active: True
|
||||||
|
allow_no_selection: False
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Caption'
|
font_style: 'Caption'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
|
@ -400,6 +406,7 @@ NavigationLayout:
|
||||||
MDCheckbox:
|
MDCheckbox:
|
||||||
id: grp_chkbox_1
|
id: grp_chkbox_1
|
||||||
group: 'test'
|
group: 'test'
|
||||||
|
allow_no_selection: False
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Caption'
|
font_style: 'Caption'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
|
@ -445,7 +452,6 @@ NavigationLayout:
|
||||||
id: label
|
id: label
|
||||||
multiline: True
|
multiline: True
|
||||||
hint_text: "Label"
|
hint_text: "Label"
|
||||||
helper_text: "Label (not shown to anyone except you)"
|
|
||||||
required: True
|
required: True
|
||||||
helper_text_mode: "on_error"
|
helper_text_mode: "on_error"
|
||||||
MDRaisedButton:
|
MDRaisedButton:
|
||||||
|
@ -640,4 +646,35 @@ NavigationLayout:
|
||||||
AnchorLayout:
|
AnchorLayout:
|
||||||
MDRaisedButton:
|
MDRaisedButton:
|
||||||
size_hint: .8, .6
|
size_hint: .8, .6
|
||||||
text: root.text_variable_5
|
text: root.text_variable_5
|
||||||
|
|
||||||
|
<SentDetail>:
|
||||||
|
name: 'sentdetail'
|
||||||
|
ScrollView:
|
||||||
|
do_scroll_x: False
|
||||||
|
BoxLayout:
|
||||||
|
orientation: 'vertical'
|
||||||
|
size_hint_y: None
|
||||||
|
height: dp(400)
|
||||||
|
padding: dp(32)
|
||||||
|
MDLabel:
|
||||||
|
font_style: 'Headline'
|
||||||
|
theme_text_color: 'Primary'
|
||||||
|
text: root.subject
|
||||||
|
halign: 'left'
|
||||||
|
MDLabel:
|
||||||
|
font_style: 'Subhead'
|
||||||
|
theme_text_color: 'Primary'
|
||||||
|
text: "To: " + root.to_addr
|
||||||
|
halign: 'left'
|
||||||
|
MDLabel:
|
||||||
|
font_style: 'Subhead'
|
||||||
|
theme_text_color: 'Primary'
|
||||||
|
text: "From: " + root.from_addr
|
||||||
|
halign: 'left'
|
||||||
|
MDLabel:
|
||||||
|
font_style: 'Subhead'
|
||||||
|
theme_text_color: 'Primary'
|
||||||
|
text: root.message
|
||||||
|
halign: 'left'
|
||||||
|
bold: True
|
|
@ -45,9 +45,7 @@ from semaphores import kivyuisignaler
|
||||||
from kivy.uix.button import Button
|
from kivy.uix.button import Button
|
||||||
import kivy_helper_search
|
import kivy_helper_search
|
||||||
from kivy.core.window import Window
|
from kivy.core.window import Window
|
||||||
|
from functools import partial
|
||||||
|
|
||||||
userAddress = ''
|
|
||||||
|
|
||||||
|
|
||||||
class Navigatorss(MDNavigationDrawer):
|
class Navigatorss(MDNavigationDrawer):
|
||||||
|
@ -108,9 +106,9 @@ class MyAddress(Screen):
|
||||||
|
|
||||||
def init_ui(self, dt=0):
|
def init_ui(self, dt=0):
|
||||||
"""Clock Schdule for method inbox accounts."""
|
"""Clock Schdule for method inbox accounts."""
|
||||||
if BMConfigParser().addresses():
|
if BMConfigParser().addresses() or state.kivyapp.variable_1:
|
||||||
data = []
|
data = []
|
||||||
for address in BMConfigParser().addresses():
|
for address in state.kivyapp.variable_1:
|
||||||
data.append({'text': BMConfigParser().get(address, 'label'), 'secondary_text': address})
|
data.append({'text': BMConfigParser().get(address, 'label'), 'secondary_text': address})
|
||||||
for item in data:
|
for item in data:
|
||||||
meny = TwoLineAvatarIconListItem(text=item['text'], secondary_text=item['secondary_text'], theme_text_color= 'Custom',text_color=NavigateApp().theme_cls.primary_color)
|
meny = TwoLineAvatarIconListItem(text=item['text'], secondary_text=item['secondary_text'], theme_text_color= 'Custom',text_color=NavigateApp().theme_cls.primary_color)
|
||||||
|
@ -125,6 +123,10 @@ class MyAddress(Screen):
|
||||||
size_hint_y=None,
|
size_hint_y=None,
|
||||||
valign='top')
|
valign='top')
|
||||||
self.ids.ml.add_widget(content)
|
self.ids.ml.add_widget(content)
|
||||||
|
try:
|
||||||
|
self.manager.current = 'login'
|
||||||
|
except Exception as e:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class AddressBook(Screen):
|
class AddressBook(Screen):
|
||||||
|
@ -259,10 +261,11 @@ class DropDownWidget(BoxLayout):
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
msg = 'Enter a valid recipients address'
|
msg = 'Enter a valid recipients address'
|
||||||
self.address_error_message(msg)
|
|
||||||
elif not toAddress:
|
elif not toAddress:
|
||||||
msg = 'Enter a recipients address'
|
msg = 'Please fill the form'
|
||||||
self.address_error_message(msg)
|
else:
|
||||||
|
msg = 'Please fill the form'
|
||||||
|
self.address_error_message(msg)
|
||||||
|
|
||||||
def address_error_message(self, msg):
|
def address_error_message(self, msg):
|
||||||
self.box = FloatLayout()
|
self.box = FloatLayout()
|
||||||
|
@ -369,6 +372,10 @@ class Random(Screen):
|
||||||
)
|
)
|
||||||
self.manager.current = 'add_sucess'
|
self.manager.current = 'add_sucess'
|
||||||
self.ids.label.text = ''
|
self.ids.label.text = ''
|
||||||
|
self.parent.parent.parent.parent.ids.toolbar.opacity = 1
|
||||||
|
self.parent.parent.parent.parent.ids.toolbar.disabled = False
|
||||||
|
self.parent.parent.parent.parent.ids.sc10.clear_widgets()
|
||||||
|
self.parent.parent.parent.parent.ids.sc10.add_widget(MyAddress())
|
||||||
|
|
||||||
|
|
||||||
class AddressSuccessful(Screen):
|
class AddressSuccessful(Screen):
|
||||||
|
@ -409,10 +416,11 @@ class Sent(Screen):
|
||||||
if queryreturn:
|
if queryreturn:
|
||||||
for mail in queryreturn:
|
for mail in queryreturn:
|
||||||
third_text = mail[3].replace('\n', ' ')
|
third_text = mail[3].replace('\n', ' ')
|
||||||
data.append({'text': mail[0].strip(), 'secondary_text': mail[2][:10] + '...........' if len(mail[2]) > 10 else mail[2] + '\n' + " " + (third_text[:25] + '...!') if len(third_text) > 25 else third_text })
|
data.append({'text': mail[0].strip(), 'secondary_text': mail[2][:10] + '...........' if len(mail[2]) > 10 else mail[2] + '\n' + " " + (third_text[:25] + '...!') if len(third_text) > 25 else third_text, 'lastactiontime': mail[6]})
|
||||||
for item in data:
|
for item in data:
|
||||||
meny = ThreeLineAvatarIconListItem(text=item['text'], secondary_text=item['secondary_text'], theme_text_color= 'Custom', text_color=NavigateApp().theme_cls.primary_color)
|
meny = ThreeLineAvatarIconListItem(text=item['text'], secondary_text=item['secondary_text'], theme_text_color= 'Custom', text_color=NavigateApp().theme_cls.primary_color)
|
||||||
meny.add_widget(AvatarSampleWidget(source='./images/avatar.png'))
|
meny.add_widget(AvatarSampleWidget(source='./images/avatar.png'))
|
||||||
|
meny.bind(on_press = partial(self.sent_detail, item['lastactiontime']))
|
||||||
self.ids.ml.add_widget(meny)
|
self.ids.ml.add_widget(meny)
|
||||||
else:
|
else:
|
||||||
content = MDLabel(font_style='Body1',
|
content = MDLabel(font_style='Body1',
|
||||||
|
@ -424,6 +432,16 @@ class Sent(Screen):
|
||||||
valign='top')
|
valign='top')
|
||||||
self.ids.ml.add_widget(content)
|
self.ids.ml.add_widget(content)
|
||||||
|
|
||||||
|
def sent_detail(self, lastsenttime, *args):
|
||||||
|
state.sentMailTime = lastsenttime
|
||||||
|
if self.manager:
|
||||||
|
src_mng_obj = self.manager
|
||||||
|
else:
|
||||||
|
src_mng_obj = self.parent.parent
|
||||||
|
src_mng_obj.screens[13].clear_widgets()
|
||||||
|
src_mng_obj.screens[13].add_widget(SentDetail())
|
||||||
|
src_mng_obj.current = 'sentdetail'
|
||||||
|
|
||||||
|
|
||||||
class Trash(Screen):
|
class Trash(Screen):
|
||||||
"""Trash Screen uses screen to show widgets of screens."""
|
"""Trash Screen uses screen to show widgets of screens."""
|
||||||
|
@ -475,9 +493,10 @@ class NavigateApp(App):
|
||||||
theme_cls = ThemeManager()
|
theme_cls = ThemeManager()
|
||||||
previous_date = ObjectProperty()
|
previous_date = ObjectProperty()
|
||||||
obj_1 = ObjectProperty()
|
obj_1 = ObjectProperty()
|
||||||
|
# obj_2 = ObjectProperty()
|
||||||
variable_1 = ListProperty(BMConfigParser().addresses())
|
variable_1 = ListProperty(BMConfigParser().addresses())
|
||||||
nav_drawer = ObjectProperty()
|
nav_drawer = ObjectProperty()
|
||||||
sentmail = NumericProperty(0)
|
total_sentmail = str(state.totalSentMail)
|
||||||
scr_size = Window.size[0]
|
scr_size = Window.size[0]
|
||||||
title = "PyBitmessage"
|
title = "PyBitmessage"
|
||||||
count = 0
|
count = 0
|
||||||
|
@ -504,6 +523,7 @@ class NavigateApp(App):
|
||||||
os.path.join(os.path.dirname(__file__), 'main.kv'))
|
os.path.join(os.path.dirname(__file__), 'main.kv'))
|
||||||
self.nav_drawer = Navigatorss()
|
self.nav_drawer = Navigatorss()
|
||||||
self.obj_1 = AddressBook()
|
self.obj_1 = AddressBook()
|
||||||
|
# self.obj_2 = MyAddress()
|
||||||
kivysignalthread = UIkivySignaler()
|
kivysignalthread = UIkivySignaler()
|
||||||
kivysignalthread.daemon = True
|
kivysignalthread.daemon = True
|
||||||
kivysignalthread.start()
|
kivysignalthread.start()
|
||||||
|
@ -535,7 +555,6 @@ class NavigateApp(App):
|
||||||
def showmeaddresses(name="text"):
|
def showmeaddresses(name="text"):
|
||||||
"""Show the addresses in spinner to make as dropdown."""
|
"""Show the addresses in spinner to make as dropdown."""
|
||||||
if name == "text":
|
if name == "text":
|
||||||
# return BMConfigParser().get(BMConfigParser().addresses()[0], 'label')[:12] + '..'
|
|
||||||
if bmconfigparserigParser().addresses():
|
if bmconfigparserigParser().addresses():
|
||||||
return BMConfigParser().addresses()[0][:16] + '..'
|
return BMConfigParser().addresses()[0][:16] + '..'
|
||||||
else:
|
else:
|
||||||
|
@ -581,6 +600,19 @@ class NavigateApp(App):
|
||||||
return BMConfigParser().addresses()[0]
|
return BMConfigParser().addresses()[0]
|
||||||
return 'Select Address'
|
return 'Select Address'
|
||||||
|
|
||||||
|
def addressexist(self):
|
||||||
|
if BMConfigParser().addresses():
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def prnttttttttttttt(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def limit_spinner(self):
|
||||||
|
max = 2.8
|
||||||
|
spinner_obj =ContentNavigationDrawer().ids.btn
|
||||||
|
spinner_obj.dropdown_cls.max_height = spinner_obj.height* max + max * 4
|
||||||
|
|
||||||
|
|
||||||
class GrashofPopup(Popup):
|
class GrashofPopup(Popup):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
|
@ -650,4 +682,25 @@ class NavigationDrawerTwoLineListItem(
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _set_active(self, active, list):
|
def _set_active(self, active, list):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class SentDetail(Screen):
|
||||||
|
"""SentDetail Screen uses to show the detail of mails."""
|
||||||
|
to_addr = StringProperty()
|
||||||
|
from_addr = StringProperty()
|
||||||
|
subject = StringProperty()
|
||||||
|
message = StringProperty()
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super(SentDetail, self).__init__(*args, **kwargs)
|
||||||
|
Clock.schedule_once(self.init_ui, 0)
|
||||||
|
|
||||||
|
def init_ui(self, dt=0):
|
||||||
|
"""Clock Schdule for method SentDetail mails."""
|
||||||
|
data = sqlQuery("select toaddress, fromaddress, subject, message from sent where lastactiontime = {};".format(state.sentMailTime))
|
||||||
|
if data:
|
||||||
|
self.to_addr = data[0][0]
|
||||||
|
self.from_addr = data[0][1]
|
||||||
|
self.subject = data[0][2].upper()
|
||||||
|
self.message = data[0][3]
|
BIN
src/images/avatar.png
Normal file
BIN
src/images/avatar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
BIN
src/images/drawer_logo1.png
Normal file
BIN
src/images/drawer_logo1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
10
src/state.py
10
src/state.py
|
@ -72,4 +72,12 @@ association = ''
|
||||||
|
|
||||||
kivyapp = None
|
kivyapp = None
|
||||||
|
|
||||||
navinstance = None
|
navinstance = None
|
||||||
|
|
||||||
|
totalSentMail = 0
|
||||||
|
|
||||||
|
sentMailTime = 0
|
||||||
|
|
||||||
|
dynamicAddressList = []
|
||||||
|
|
||||||
|
myAddressObj = None
|
Reference in New Issue
Block a user