kivy new updates

This commit is contained in:
surbhi 2019-06-06 19:18:20 +05:30
parent c9acd463d4
commit f64d68f7b0
No known key found for this signature in database
GPG Key ID: 88928762974D3618
6 changed files with 302 additions and 97 deletions

View File

@ -1,4 +1,3 @@
#:import Toolbar kivymd.toolbar.Toolbar #:import Toolbar kivymd.toolbar.Toolbar
#:import ThemeManager kivymd.theming.ThemeManager #:import ThemeManager kivymd.theming.ThemeManager
#:import MDNavigationDrawer kivymd.navigationdrawer.MDNavigationDrawer #:import MDNavigationDrawer kivymd.navigationdrawer.MDNavigationDrawer
@ -34,10 +33,14 @@
#:import MDBottomNavigation kivymd.tabs.MDBottomNavigation #:import MDBottomNavigation kivymd.tabs.MDBottomNavigation
#:import MDBottomNavigationItem kivymd.tabs.MDBottomNavigationItem #:import MDBottomNavigationItem kivymd.tabs.MDBottomNavigationItem
#:import MDFloatingActionButton kivymd.button.MDFloatingActionButton #:import MDFloatingActionButton kivymd.button.MDFloatingActionButton
#:import Factory kivy.factory.Factory
<MyNavigationDrawerIconButton@NavigationDrawerIconButton>: <MyNavigationDrawerIconButton@NavigationDrawerIconButton>:
icon: 'checkbox-blank-circle' icon: 'checkbox-blank-circle'
<MySpinnerOption@SpinnerOption>:
font_size: '12.5sp'
<ContentNavigationDrawer@Navigatorss>: <ContentNavigationDrawer@Navigatorss>:
drawer_logo: './images/drawer_logo1.png' drawer_logo: './images/drawer_logo1.png'
NavigationDrawerDivider: NavigationDrawerDivider:
@ -48,6 +51,8 @@
Spinner: Spinner:
pos_hint:{"x":0,"y":.25} pos_hint:{"x":0,"y":.25}
id: btn id: btn
option_cls: Factory.get("MySpinnerOption")
font_size: '12.5sp'
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)
@ -175,7 +180,7 @@ NavigationLayout:
id:sc12 id:sc12
NetworkStat: NetworkStat:
id:sc13 id:sc13
SentDetail: MailDetail:
id:sc14 id:sc14
<Inbox>: <Inbox>:
@ -184,20 +189,8 @@ NavigationLayout:
do_scroll_x: False do_scroll_x: False
MDList: MDList:
id: ml id: ml
BoxLayout:
size_hint_y: None
height: dp(56)
spacing: '10dp'
pos_hint: {'center_x':0.45, 'center_y': .1}
Widget: ComposerButton:
MDFloatingActionButton:
icon: 'plus'
opposite_colors: True
elevation_normal: 8
md_bg_color: [0.941, 0, 0,1]
on_press: app.root.ids.scr_mngr.current = 'create'
<Sent>: <Sent>:
name: 'sent' name: 'sent'
@ -205,20 +198,7 @@ NavigationLayout:
do_scroll_x: False do_scroll_x: False
MDList: MDList:
id: ml id: ml
BoxLayout: ComposerButton:
size_hint_y: None
height: dp(56)
spacing: '10dp'
pos_hint: {'center_x':0.45, 'center_y': .1}
Widget:
MDFloatingActionButton:
icon: 'plus'
opposite_colors: True
elevation_normal: 8
md_bg_color: [0.941, 0, 0,1]
on_press: app.root.ids.scr_mngr.current = 'create'
<Trash>: <Trash>:
name: 'trash' name: 'trash'
@ -226,20 +206,7 @@ NavigationLayout:
do_scroll_x: False do_scroll_x: False
MDList: MDList:
id: ml id: ml
BoxLayout: ComposerButton:
size_hint_y: None
height: dp(56)
spacing: '10dp'
pos_hint: {'center_x':0.45, 'center_y': .1}
Widget:
MDFloatingActionButton:
icon: 'plus'
opposite_colors: True
elevation_normal: 8
md_bg_color: [0.941, 0, 0,1]
on_press: app.root.ids.scr_mngr.current = 'create'
<Draft>: <Draft>:
name: 'draft' name: 'draft'
@ -289,6 +256,8 @@ NavigationLayout:
text: 'select' text: 'select'
values: app.variable_1 values: app.variable_1
on_text: ti.text = self.text on_text: ti.text = self.text
option_cls: Factory.get("MySpinnerOption")
font_size: '12.5sp'
BoxLayout: BoxLayout:
orientation: 'vertical' orientation: 'vertical'
@ -530,6 +499,7 @@ NavigationLayout:
do_scroll_x: False do_scroll_x: False
MDList: MDList:
id: ml id: ml
ComposerButton:
<AddressBook>: <AddressBook>:
name: 'addressbook' name: 'addressbook'
@ -539,6 +509,7 @@ NavigationLayout:
do_scroll_x: False do_scroll_x: False
MDList: MDList:
id: ml id: ml
ComposerButton:
<Payment>: <Payment>:
name: 'payment' name: 'payment'
@ -648,8 +619,8 @@ NavigationLayout:
size_hint: .8, .6 size_hint: .8, .6
text: root.text_variable_5 text: root.text_variable_5
<SentDetail>: <MailDetail>:
name: 'sentdetail' name: 'mailDetail'
ScrollView: ScrollView:
do_scroll_x: False do_scroll_x: False
BoxLayout: BoxLayout:
@ -662,6 +633,11 @@ NavigationLayout:
theme_text_color: 'Primary' theme_text_color: 'Primary'
text: root.subject text: root.subject
halign: 'left' halign: 'left'
MDLabel:
font_style: 'Subhead'
theme_text_color: 'Primary'
text: "From: " + root.from_addr
halign: 'left'
MDLabel: MDLabel:
font_style: 'Subhead' font_style: 'Subhead'
theme_text_color: 'Primary' theme_text_color: 'Primary'
@ -670,7 +646,7 @@ NavigationLayout:
MDLabel: MDLabel:
font_style: 'Subhead' font_style: 'Subhead'
theme_text_color: 'Primary' theme_text_color: 'Primary'
text: "From: " + root.from_addr text: root.status
halign: 'left' halign: 'left'
MDLabel: MDLabel:
font_style: 'Subhead' font_style: 'Subhead'
@ -678,3 +654,73 @@ NavigationLayout:
text: root.message text: root.message
halign: 'left' halign: 'left'
bold: True bold: True
BoxLayout:
spacing:50
MDRaisedButton:
size_hint: 1, None
height: dp(40)
text: 'Copy'
MDRaisedButton:
size_hint: 1, None
height: dp(40)
text: 'Delete'
on_press: root.delete_mail()
<ComposerButton@BoxLayout>:
size_hint_y: None
height: dp(56)
spacing: '10dp'
pos_hint: {'center_x':0.45, 'center_y': .1}
Widget:
MDFloatingActionButton:
icon: 'plus'
opposite_colors: True
elevation_normal: 8
md_bg_color: [0.941, 0, 0,1]
on_press: app.root.ids.scr_mngr.current = 'create'
<MyaddDetailPopup>:
id: myadd_popup
background: './images/popup.jpeg'
separator_height: 0
auto_dismiss: False
BoxLayout:
size_hint_y: None
spacing:50
id: popup_box
orientation: 'vertical'
MDLabel:
font_style: 'Title'
theme_text_color: 'Primary'
text: "Label"
halign: 'left'
MDLabel:
font_style: 'Subhead'
theme_text_color: 'Primary'
text: root.address_label
halign: 'left'
MDLabel:
font_style: 'Title'
theme_text_color: 'Primary'
text: "Address"
halign: 'left'
MDLabel:
font_style: 'Subhead'
theme_text_color: 'Primary'
text: root.address
halign: 'left'
MDRaisedButton:
size_hint: 1, None
height: dp(40)
text: 'Save'
MDRaisedButton:
size_hint: 1, None
height: dp(40)
text: 'Cancel'
on_press: root.dismiss()
MDRaisedButton:
size_hint: 1, None
height: dp(40)
text: 'Scan QR code'

View File

@ -46,6 +46,7 @@ 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 from functools import partial
from kivy.uix.carousel import Carousel
class Navigatorss(MDNavigationDrawer): class Navigatorss(MDNavigationDrawer):
@ -56,6 +57,8 @@ class Navigatorss(MDNavigationDrawer):
class Inbox(Screen): class Inbox(Screen):
"""Inbox Screen uses screen to show widgets of screens.""" """Inbox Screen uses screen to show widgets of screens."""
data = ListProperty()
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(Inbox, self).__init__(*args, **kwargs) super(Inbox, self).__init__(*args, **kwargs)
if state.association == '': if state.association == '':
@ -64,7 +67,7 @@ class Inbox(Screen):
Clock.schedule_once(self.init_ui, 0) Clock.schedule_once(self.init_ui, 0)
def init_ui(self, dt=0): def init_ui(self, dt=0):
"""Clock Schdule for method sent accounts.""" """Clock Schdule for method inbox accounts."""
self.inboxaccounts() self.inboxaccounts()
print(dt) print(dt)
@ -74,7 +77,7 @@ class Inbox(Screen):
self.loadMessagelist(account, 'All', '') self.loadMessagelist(account, 'All', '')
def loadMessagelist(self, account, where="", what=""): def loadMessagelist(self, account, where="", what=""):
"""Load Sent list for Sent messages.""" """Load Inbox list for Inbox messages."""
xAddress = 'toaddress' xAddress = 'toaddress'
data = [] data = []
queryreturn = kivy_helper_search.search_sql( queryreturn = kivy_helper_search.search_sql(
@ -82,11 +85,29 @@ class Inbox(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[2].strip(), 'secondary_text': mail[5][:10] + '...........' if len(mail[2]) > 10 else mail[2] + '\n' + " " + (third_text[:25] + '...!') if len(third_text) > 25 else third_text }) # ('inbox', 'j\xe5(M\xcfPbe\rl\x0f\xa3\r\xef>\xf0\x0b&\t\'}"RYg\x03\x80\x14\x82\xeb&,', 'BM-2cXpNNd7dhTjsv7LHNfmphfUabZk958sA3', 'hello', 'BM-2cWyUfBdY2FbgyuCb7abFZ49JYxSzUhNFe', 'test from peter', '1559121770', 0)
data.append({'text': mail[4].strip(), 'secondary_text': mail[5][:10] + '...........' if len(mail[3]) > 10 else mail[3] + '\n' + " " + (third_text[:25] + '...!') if len(third_text) > 25 else third_text, 'receivedTime': 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'))
self.ids.ml.add_widget(meny) meny.bind(on_press = partial(self.inbox_detail, item['receivedTime']))
carousel = Carousel(direction='right')
carousel.height = 150
carousel.size_hint_y = None
carousel.ignore_perpendicular_swipes = True
carousel.data_index = 0
carousel.min_move = 0.2
del_btn = Button(text='Delete')
del_btn.background_color = (1, 0, 0, .5)
del_btn.bind(on_press=partial(self.delete, item['receivedTime']))
carousel.add_widget(del_btn)
carousel.add_widget(meny)
ach_btn = Button(text='Achieve')
ach_btn.background_color = (0,1,0,1)
ach_btn.bind(on_press=partial(self.archive, item['receivedTime']))
carousel.add_widget(ach_btn)
carousel.index=1
self.ids.ml.add_widget(carousel)
else: else:
content = MDLabel(font_style='Body1', content = MDLabel(font_style='Body1',
theme_text_color='Primary', theme_text_color='Primary',
@ -97,6 +118,40 @@ class Inbox(Screen):
valign='top') valign='top')
self.ids.ml.add_widget(content) self.ids.ml.add_widget(content)
def inbox_detail(self, receivedTime, *args):
"""Load inbox page details"""
state.detailPageType = 'inbox'
state.sentMailTime = receivedTime
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(MailDetail())
src_mng_obj.current = 'mailDetail'
def delete(self, data_index, instance, *args):
"""Delete inbox mail from inbox listing"""
sqlExecute("UPDATE inbox SET folder = 'trash' WHERE received = {};".format(data_index))
self.ids.ml.remove_widget(instance.parent.parent)
self.update_trash()
def archive(self, data_index, instance, *args):
"""Archive inbox mail from inbox listing"""
sqlExecute("UPDATE inbox SET folder = 'trash' WHERE received = {};".format(data_index))
self.ids.ml.remove_widget(instance.parent.parent)
self.update_trash()
def update_trash(self):
"""Update trash screen mails which is deleted from inbox"""
try:
self.parent.screens[4].clear_widgets()
self.parent.screens[4].add_widget(Trash())
except Exception as e:
self.parent.parent.screens[4].clear_widgets()
self.parent.parent.screens[4].add_widget(Trash())
class MyAddress(Screen): class MyAddress(Screen):
"""MyAddress Screen uses screen to show widgets of screens.""" """MyAddress Screen uses screen to show widgets of screens."""
@ -106,13 +161,14 @@ 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() or state.kivyapp.variable_1: if BMConfigParser().addresses() or ContentNavigationDrawer().ids.btn.values:
data = [] data = []
for address in state.kivyapp.variable_1: for address in ContentNavigationDrawer().ids.btn.values:
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)
meny.add_widget(AvatarSampleWidget(source='./images/avatar.png')) meny.add_widget(AvatarSampleWidget(source='./images/avatar.png'))
meny.bind(on_press = partial(self.myadd_detail, item['secondary_text']))
self.ids.ml.add_widget(meny) self.ids.ml.add_widget(meny)
else: else:
content = MDLabel(font_style='Body1', content = MDLabel(font_style='Body1',
@ -128,6 +184,11 @@ class MyAddress(Screen):
except Exception as e: except Exception as e:
pass pass
def myadd_detail(self, fromaddress, *args):
p = MyaddDetailPopup()
p.open()
p.get_address(fromaddress)
class AddressBook(Screen): class AddressBook(Screen):
"""AddressBook Screen uses screen to show widgets of screens.""" """AddressBook Screen uses screen to show widgets of screens."""
@ -278,6 +339,7 @@ class DropDownWidget(BoxLayout):
self.main_pop = Popup(title="Error", content=self.box, self.main_pop = Popup(title="Error", content=self.box,
size_hint=(None, None), size=(550, 400), auto_dismiss=False, title_size=30) size_hint=(None, None), size=(550, 400), auto_dismiss=False, title_size=30)
self.but.bind(on_press=self.main_pop.dismiss) self.but.bind(on_press=self.main_pop.dismiss)
# self.main_pop.background = './images/popup.jpeg'
self.main_pop.open() self.main_pop.open()
@ -370,12 +432,15 @@ class Random(Screen):
nonceTrialsPerByte, nonceTrialsPerByte,
payloadLengthExtraBytes) payloadLengthExtraBytes)
) )
self.manager.current = 'add_sucess' # self.manager.current = 'add_sucess'
self.manager.current = 'myaddress'
self.ids.label.text = '' self.ids.label.text = ''
self.parent.parent.parent.parent.ids.toolbar.opacity = 1 self.parent.parent.parent.parent.ids.toolbar.opacity = 1
self.parent.parent.parent.parent.ids.toolbar.disabled = False 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()) state.myAddressObj = self.parent.parent.parent.parent.ids.sc10
# 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):
@ -410,18 +475,35 @@ class Sent(Screen):
def loadSent(self, account, where="", what=""): def loadSent(self, account, where="", what=""):
"""Load Sent list for Sent messages.""" """Load Sent list for Sent messages."""
xAddress = 'fromaddress' xAddress = 'fromaddress'
data = []
queryreturn = kivy_helper_search.search_sql( queryreturn = kivy_helper_search.search_sql(
xAddress, account, "sent", where, what, False) xAddress, account, "sent", where, what, False)
state.totalSentMail = len(queryreturn)
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, 'lastactiontime': mail[6]}) self.data.append({'text': mail[1].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 self.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'])) meny.bind(on_press = partial(self.sent_detail, item['lastactiontime']))
self.ids.ml.add_widget(meny) carousel = Carousel(direction='right')
carousel.height = 150
carousel.size_hint_y = None
carousel.ignore_perpendicular_swipes = True
carousel.data_index = 0
carousel.min_move = 0.2
del_btn = Button(text='Delete')
del_btn.background_color = (1, 0, 0, .5)
del_btn.bind(on_press=partial(self.delete, item['lastactiontime']))
carousel.add_widget(del_btn)
carousel.add_widget(meny)
ach_btn = Button(text='Achieve')
ach_btn.background_color = (0,1,0,1)
ach_btn.bind(on_press=partial(self.archive, item['lastactiontime']))
carousel.add_widget(ach_btn)
carousel.index=1
self.ids.ml.add_widget(carousel)
# self.ids.ml.add_widget(meny)
else: else:
content = MDLabel(font_style='Body1', content = MDLabel(font_style='Body1',
theme_text_color='Primary', theme_text_color='Primary',
@ -433,14 +515,37 @@ class Sent(Screen):
self.ids.ml.add_widget(content) self.ids.ml.add_widget(content)
def sent_detail(self, lastsenttime, *args): def sent_detail(self, lastsenttime, *args):
"""Load sent mail details"""
state.detailPageType = 'sent'
state.sentMailTime = lastsenttime state.sentMailTime = lastsenttime
if self.manager: if self.manager:
src_mng_obj = self.manager src_mng_obj = self.manager
else: else:
src_mng_obj = self.parent.parent src_mng_obj = self.parent.parent
src_mng_obj.screens[13].clear_widgets() src_mng_obj.screens[13].clear_widgets()
src_mng_obj.screens[13].add_widget(SentDetail()) src_mng_obj.screens[13].add_widget(MailDetail())
src_mng_obj.current = 'sentdetail' src_mng_obj.current = 'mailDetail'
def delete(self, data_index, instance, *args):
"""delete sent mail from sent mail listing"""
sqlExecute("UPDATE sent SET folder = 'trash' WHERE lastactiontime = {};".format(data_index))
self.ids.ml.remove_widget(instance.parent.parent)
self.update_trash()
def archive(self, data_index, instance, *args):
"""archive sent mail from sent mail listing"""
sqlExecute("UPDATE sent SET folder = 'trash' WHERE lastactiontime = {};".format(data_index))
self.ids.ml.remove_widget(instance.parent.parent)
self.update_trash()
def update_trash(self):
"""Update trash screen mails which is deleted from inbox"""
try:
self.parent.screens[4].clear_widgets()
self.parent.screens[4].add_widget(Trash())
except Exception as e:
self.parent.parent.screens[4].clear_widgets()
self.parent.parent.screens[4].add_widget(Trash())
class Trash(Screen): class Trash(Screen):
@ -451,22 +556,14 @@ class Trash(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."""
data = [{'text': "neha cis", 'secondary_text': "party invitation..........." + '\n' + " " + "lets gather for party on 1st JANUARY...!"}, inbox = sqlQuery("SELECT toaddress, fromaddress, subject, message from inbox WHERE folder = 'trash';")
{'text': "onkar", 'secondary_text': "party invitation..........." + '\n' + " " + "lets gather for party on 1st JANUARY...!"}, sent = sqlQuery("SELECT toaddress, fromaddress, subject, message from sent WHERE folder = 'trash';")
{'text': "amazon", 'secondary_text': "party invitation..........." + '\n' + " " + "lets gather for party on 1st JANUARY...!"}, trash_data = inbox + sent
{'text': "paytm", 'secondary_text': "party invitation..........." + '\n' + " " + "lets gather for party on 1st JANUARY...!"}, for item in trash_data:
{'text': "pol", 'secondary_text': "party invitation..........." + '\n' + " " + "lets gather for party on 1st JANUARY...!"}, meny = ThreeLineAvatarIconListItem(text=item[1], secondary_text=item[2], theme_text_color= 'Custom',text_color=NavigateApp().theme_cls.primary_color)
{'text': "akshayaura", 'secondary_text': "party invitation..........." + '\n' + " " + "lets gather for party on 1st JANUARY...!"},
{'text': "codementor", 'secondary_text': "party invitation..........." + '\n' + " " + "lets gather for party on 1st JANUARY...!"},
{'text': "yatra", 'secondary_text': "party invitation..........." + '\n' + " " + "lets gather for party on 1st JANUARY...!"},
{'text': "mdtezm", 'secondary_text': "party invitation..........." + '\n' + " " + "lets gather for party on 1st JANUARY...!"},
{'text': "crewqt", 'secondary_text': "party invitation..........." + '\n' + " " + "lets gather for party on 1st JANUARY...!"}]
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.add_widget(AvatarSampleWidget(source='./images/avatar.png')) meny.add_widget(AvatarSampleWidget(source='./images/avatar.png'))
self.ids.ml.add_widget(meny) self.ids.ml.add_widget(meny)
class Page(Screen): class Page(Screen):
pass pass
@ -493,7 +590,7 @@ class NavigateApp(App):
theme_cls = ThemeManager() theme_cls = ThemeManager()
previous_date = ObjectProperty() previous_date = ObjectProperty()
obj_1 = ObjectProperty() obj_1 = ObjectProperty()
# obj_2 = ObjectProperty() obj_2 = ObjectProperty()
variable_1 = ListProperty(BMConfigParser().addresses()) variable_1 = ListProperty(BMConfigParser().addresses())
nav_drawer = ObjectProperty() nav_drawer = ObjectProperty()
total_sentmail = str(state.totalSentMail) total_sentmail = str(state.totalSentMail)
@ -523,10 +620,11 @@ 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() self.obj_2 = MyAddress()
kivysignalthread = UIkivySignaler() kivysignalthread = UIkivySignaler()
kivysignalthread.daemon = True kivysignalthread.daemon = True
kivysignalthread.start() kivysignalthread.start()
Window.bind(on_keyboard=self.on_key)
return main_widget return main_widget
def run(self): def run(self):
@ -541,7 +639,6 @@ class NavigateApp(App):
shutdown.doCleanShutdown() shutdown.doCleanShutdown()
def show_address_success(self): def show_address_success(self):
print("9062 I am pressed...............................................................")
content = MDLabel(font_style='Body1', content = MDLabel(font_style='Body1',
theme_text_color='Secondary', theme_text_color='Secondary',
text="Successfully Saved your contact address. " text="Successfully Saved your contact address. "
@ -555,6 +652,7 @@ 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:
@ -574,6 +672,7 @@ class NavigateApp(App):
self.root.ids.sc1.add_widget(Inbox()) self.root.ids.sc1.add_widget(Inbox())
self.root.ids.sc4.add_widget(Sent()) self.root.ids.sc4.add_widget(Sent())
self.root.ids.sc5.add_widget(Trash()) self.root.ids.sc5.add_widget(Trash())
self.root.ids.scr_mngr.current = 'inbox'
def getInboxMessageDetail(self, instance): def getInboxMessageDetail(self, instance):
"""It will get message detail after make selected message description.""" """It will get message detail after make selected message description."""
@ -605,14 +704,29 @@ class NavigateApp(App):
return True return True
return False return False
def prnttttttttttttt(self):
pass
def limit_spinner(self): def limit_spinner(self):
max = 2.8 max = 2.8
spinner_obj =ContentNavigationDrawer().ids.btn spinner_obj = ContentNavigationDrawer().ids.btn
spinner_obj.dropdown_cls.max_height = spinner_obj.height* max + max * 4 spinner_obj.dropdown_cls.max_height = spinner_obj.height* max + max * 4
def on_key(self, window, key, *args):
if key == 27: # the esc key
if self.root.ids.scr_mngr.current_screen.name == "mailDetail":
self.root.ids.scr_mngr.current = 'sent'
# this is for direction of the screen comesup
# self.root.ids.scr_mngr.transition.direction = 'right'
return True
elif self.root.ids.scr_mngr.current_screen.name == "create":
self.root.ids.scr_mngr.current = 'inbox'
return True
else:
return True
def status_dispatching(self, data):
ackData, message = data
if state.ackdata == ackData:
state.status.status = message
class GrashofPopup(Popup): class GrashofPopup(Popup):
def __init__(self, **kwargs): def __init__(self, **kwargs):
@ -685,22 +799,58 @@ class NavigationDrawerTwoLineListItem(
pass pass
class SentDetail(Screen): class MailDetail(Screen):
"""SentDetail Screen uses to show the detail of mails.""" """MailDetail Screen uses to show the detail of mails."""
to_addr = StringProperty() to_addr = StringProperty()
from_addr = StringProperty() from_addr = StringProperty()
subject = StringProperty() subject = StringProperty()
message = StringProperty() message = StringProperty()
status = StringProperty()
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(SentDetail, self).__init__(*args, **kwargs) super(MailDetail, self).__init__(*args, **kwargs)
Clock.schedule_once(self.init_ui, 0) Clock.schedule_once(self.init_ui, 0)
def init_ui(self, dt=0): def init_ui(self, dt=0):
"""Clock Schdule for method SentDetail mails.""" """Clock Schdule for method MailDetail mails."""
data = sqlQuery("select toaddress, fromaddress, subject, message from sent where lastactiontime = {};".format(state.sentMailTime)) if state.detailPageType == 'sent':
if data: data = sqlQuery("select toaddress, fromaddress, subject, message , status, ackdata from sent where lastactiontime = {};".format(state.sentMailTime))
self.to_addr = data[0][0] state.status = self
self.from_addr = data[0][1] state.ackdata = data[0][5]
self.subject = data[0][2].upper() self.assign_mail_details(data)
self.message = data[0][3] elif state.detailPageType == 'inbox':
data = sqlQuery("select toaddress, fromaddress, subject, message from inbox where received = {};".format(state.sentMailTime))
self.assign_mail_details(data)
def assign_mail_details(self, data):
self.to_addr = data[0][0]
self.from_addr = data[0][1]
self.subject = data[0][2].upper()
self.message = data[0][3]
if len(data[0]) == 6:
self.status = data[0][4]
def delete_mail(self):
if state.detailPageType == 'sent':
sqlExecute("UPDATE sent SET folder = 'trash' WHERE lastactiontime = {};".format(state.sentMailTime))
self.parent.parent.screens[3].clear_widgets()
self.parent.parent.screens[3].add_widget(Sent())
self.parent.parent.current = 'sent'
self.parent.parent.screens[4].clear_widgets()
self.parent.parent.screens[4].add_widget(Trash())
class MyaddDetailPopup(Popup):
"""MyaddDetailPopup pop is used for showing my address detail"""
address_label = StringProperty()
address = StringProperty()
def __init__(self, **kwargs):
super(MyaddDetailPopup, self).__init__(**kwargs)
self.size_hint_y = 0.4
self.size_hint_x = 0.9
def get_address(self, address):
"""Getting address for displaying details on popup"""
self.address_label = BMConfigParser().get(address, 'label') if BMConfigParser().get(address, 'label') else ''
self.address = address

View File

@ -18,6 +18,8 @@ class UIkivySignaler(Thread):
state.kivyapp.variable_1.append(address) state.kivyapp.variable_1.append(address)
elif command == 'rerenderAddressBook': elif command == 'rerenderAddressBook':
state.kivyapp.obj_1.refreshs() state.kivyapp.obj_1.refreshs()
elif command == 'updateSentItemStatusByAckdata':
state.kivyapp.status_dispatching(data)
except Exception as e: except Exception as e:
print(e) print(e)

View File

@ -78,6 +78,10 @@ totalSentMail = 0
sentMailTime = 0 sentMailTime = 0
dynamicAddressList = []
myAddressObj = None myAddressObj = None
detailPageType = None
ackdata = None
status = None

View File

@ -13,8 +13,11 @@ class translateClass:
else: else:
return self.text return self.text
# def _translate(context, text, disambiguation = None, encoding = None, n = None):
# return translateText(context, text, n)
def _translate(context, text, disambiguation = None, encoding = None, n = None): def _translate(context, text, disambiguation = None, encoding = None, n = None):
return translateText(context, text, n) return text
def translateText(context, text, n = None): def translateText(context, text, n = None):
try: try: