Implement qrcode display feature with Ui enhancement and message avtar display based on message

This commit is contained in:
surbhi 2019-06-28 20:24:47 +05:30
parent 4904f8d3ee
commit 2fc2101e80
No known key found for this signature in database
GPG Key ID: 88928762974D3618
29 changed files with 428 additions and 115 deletions

View File

@ -35,11 +35,18 @@
#:import MDFloatingActionButton kivymd.button.MDFloatingActionButton #:import MDFloatingActionButton kivymd.button.MDFloatingActionButton
#:import Factory kivy.factory.Factory #:import Factory kivy.factory.Factory
#:set color_button (0.784, 0.443, 0.216, 1) # brown
#:set color_button_pressed (0.659, 0.522, 0.431, 1) # darker brown
#:set color_font (0.957, 0.890, 0.843, 1) # off white
<MyNavigationDrawerIconButton@NavigationDrawerIconButton>: <MyNavigationDrawerIconButton@NavigationDrawerIconButton>:
icon: 'checkbox-blank-circle' icon: 'checkbox-blank-circle'
<MySpinnerOption@SpinnerOption>: <MySpinnerOption@SpinnerOption>:
font_size: '12.5sp' font_size: '12.5sp'
background_color: color_button if self.state == 'down' else color_button_pressed
background_down: 'atlas://data/images/defaulttheme/button'
color: color_font
<ContentNavigationDrawer@Navigatorss>: <ContentNavigationDrawer@Navigatorss>:
drawer_logo: './images/drawer_logo1.png' drawer_logo: './images/drawer_logo1.png'
@ -54,19 +61,24 @@
option_cls: Factory.get("MySpinnerOption") option_cls: Factory.get("MySpinnerOption")
font_size: '12.5sp' font_size: '12.5sp'
text: app.getDefaultAccData() text: app.getDefaultAccData()
background_color: color_button if self.state == 'normal' else color_button_pressed
background_down: 'atlas://data/images/defaulttheme/spinner'
color: color_font
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() on_press: app.limit_spinner()
NavigationDrawerIconButton: NavigationDrawerIconButton:
id: inbox_cnt
icon: 'email-open' icon: 'email-open'
text: "Inbox" text: "Inbox"
on_release: app.root.ids.scr_mngr.current = 'inbox' on_release: app.root.ids.scr_mngr.current = 'inbox'
badge_text: "99+" badge_text: app.mail_count(self.text)
NavigationDrawerIconButton: NavigationDrawerIconButton:
id: send_cnt
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: "0" badge_text: app.mail_count(self.text)
NavigationDrawerIconButton: NavigationDrawerIconButton:
icon: 'message-draw' icon: 'message-draw'
text: "Draft" text: "Draft"
@ -87,10 +99,11 @@
on_release: app.root.ids.scr_mngr.current = 'inbox' on_release: app.root.ids.scr_mngr.current = 'inbox'
badge_text: "8+" badge_text: "8+"
NavigationDrawerIconButton: NavigationDrawerIconButton:
id: trash_cnt
icon: 'delete' icon: 'delete'
text: "Trash" text: "Trash"
on_release: app.root.ids.scr_mngr.current = 'trash' on_release: app.root.ids.scr_mngr.current = 'trash'
badge_text: "9+" badge_text: app.mail_count(self.text)
NavigationDrawerIconButton: NavigationDrawerIconButton:
text: "All Mails" text: "All Mails"
icon:'contact-mail' icon:'contact-mail'
@ -182,6 +195,8 @@ NavigationLayout:
id:sc13 id:sc13
MailDetail: MailDetail:
id:sc14 id:sc14
ShowQRCode:
id:sc15
<Inbox>: <Inbox>:
name: 'inbox' name: 'inbox'
@ -233,7 +248,7 @@ NavigationLayout:
BoxLayout: BoxLayout:
orientation: 'vertical' orientation: 'vertical'
size_hint_y: None size_hint_y: None
height: dp(app.scr_size) height: dp(600)
padding: dp(32) padding: dp(32)
spacing: 15 spacing: 15
BoxLayout: BoxLayout:
@ -249,11 +264,10 @@ NavigationLayout:
BoxLayout: BoxLayout:
size_hint_y: None size_hint_y: None
height: 100 height: dp(40)
Spinner: Spinner:
background_color: app.theme_cls.primary_dark background_color: app.theme_cls.primary_dark
id: btn id: btn
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") option_cls: Factory.get("MySpinnerOption")
@ -289,17 +303,19 @@ NavigationLayout:
required: True required: True
helper_text_mode: "on_error" helper_text_mode: "on_error"
BoxLayout: BoxLayout:
spacing:50
AnchorLayout: AnchorLayout:
MDRaisedButton: MDRaisedButton:
size_hint: .8, .3 size_hint: 1, None
height: dp(40)
text: 'send' text: 'send'
on_press: root.send() on_press: root.send()
BoxLayout:
AnchorLayout: AnchorLayout:
MDRaisedButton: MDRaisedButton:
size_hint: .8, .3 size_hint: 1, None
height: dp(40)
text: 'reset' text: 'reset'
on_press: app.root.ids.scr_mngr.current = 'random' on_press: app.root.ids.scr_mngr.current = 'random'
<MyTextInput>: <MyTextInput>:
readonly: False readonly: False
@ -341,7 +357,7 @@ NavigationLayout:
BoxLayout: BoxLayout:
orientation: 'vertical' orientation: 'vertical'
size_hint_y: None size_hint_y: None
height: dp(800) height: dp(700)
BoxLayout: BoxLayout:
MDLabel: MDLabel:
font_style: 'Body1' font_style: 'Body1'
@ -483,7 +499,7 @@ NavigationLayout:
MDCheckbox: MDCheckbox:
id: chkbox id: chkbox
size_hint: None, None size_hint: None, None
size: dp(48), dp(48) size: dp(48), dp(64)
active: True active: True
MDLabel: MDLabel:
font_style: 'Body1' font_style: 'Body1'
@ -519,44 +535,62 @@ NavigationLayout:
id: popup id: popup
title: 'add contact\'s' title: 'add contact\'s'
background: './images/popup.jpeg' background: './images/popup.jpeg'
title_size: sp(30) title_size: sp(20)
title_color: 0.4, 0.3765, 0.3451, 1 title_color: 0.4, 0.3765, 0.3451, 1
size_hint: 1, 1 size_hint: 1, 1
auto_dismiss: False auto_dismiss: False
separator_color: 0.3529, 0.3922, 0.102, 0.7 separator_color: 0.3529, 0.3922, 0.102, 0.7
BoxLayout: BoxLayout:
size_hint_y: None size_hint_y: 0.5
orientation: 'vertical' orientation: 'vertical'
spacing:50 spacing:dp(20)
id: popup_box id: popup_box
orientation: 'vertical' BoxLayout:
MDTextField: orientation: 'vertical'
id: label MDTextField:
multiline: True id: label
hint_text: "Label" multiline: True
required: True hint_text: "Label"
helper_text_mode: "on_error" required: True
MDTextField: helper_text_mode: "on_error"
id: address MDTextField:
hint_text: "Address" id: address
required: True hint_text: "Address"
helper_text_mode: "on_error" required: True
MDRaisedButton: helper_text_mode: "on_error"
size_hint: 1, None BoxLayout:
height: dp(40) spacing:5
text: 'Save' orientation: 'horizontal'
on_release: MDRaisedButton:
root.savecontact() size_hint: 1.5, None
app.root.ids.scr_mngr.current = 'addressbook' height: dp(40)
MDRaisedButton: on_release:
size_hint: 1, None root.savecontact()
height: dp(40) MDLabel:
text: 'Cancel' font_style: 'Title'
on_press: root.dismiss() text: 'Save'
MDRaisedButton: font_size: '13sp'
size_hint: 1, None color: (1,1,1,1)
height: dp(40) halign: 'center'
text: 'Scan QR code' MDRaisedButton:
size_hint: 1.5, None
height: dp(40)
on_press: root.dismiss()
MDLabel:
font_style: 'Title'
text: 'Cancel'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
MDRaisedButton:
size_hint: 2, None
height: dp(40)
MDLabel:
font_style: 'Title'
text: 'Scan QR code'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
<NetworkStat>: <NetworkStat>:
name: 'networkstat' name: 'networkstat'
@ -659,7 +693,8 @@ NavigationLayout:
MDRaisedButton: MDRaisedButton:
size_hint: 1, None size_hint: 1, None
height: dp(40) height: dp(40)
text: 'Copy' text: 'Reply' if root.page_type == 'inbox' else 'Copy'
on_press: root.inbox_reply() if root.page_type == 'inbox' else root.copy_sent_mail()
MDRaisedButton: MDRaisedButton:
size_hint: 1, None size_hint: 1, None
height: dp(40) height: dp(40)
@ -680,6 +715,7 @@ NavigationLayout:
elevation_normal: 8 elevation_normal: 8
md_bg_color: [0.941, 0, 0,1] md_bg_color: [0.941, 0, 0,1]
on_press: app.root.ids.scr_mngr.current = 'create' on_press: app.root.ids.scr_mngr.current = 'create'
on_release: app.clear_composer()
<MyaddDetailPopup>: <MyaddDetailPopup>:
id: myadd_popup id: myadd_popup
@ -688,39 +724,151 @@ NavigationLayout:
auto_dismiss: False auto_dismiss: False
BoxLayout: BoxLayout:
size_hint_y: None size_hint_y: None
spacing:50 spacing:dp(70)
id: popup_box id: myadd_popup_box
orientation: 'vertical' orientation: 'vertical'
MDLabel: BoxLayout:
font_style: 'Title' size_hint_y: None
theme_text_color: 'Primary' orientation: 'vertical'
text: "Label" spacing:dp(25)
halign: 'left' MDLabel:
MDLabel: font_style: 'Title'
font_style: 'Subhead' theme_text_color: 'Primary'
theme_text_color: 'Primary' text: "Label"
text: root.address_label font_size: '17sp'
halign: 'left' halign: 'left'
MDLabel: MDLabel:
font_style: 'Title' font_style: 'Subhead'
theme_text_color: 'Primary' theme_text_color: 'Primary'
text: "Address" text: root.address_label
halign: 'left' font_size: '15sp'
MDLabel: halign: 'left'
font_style: 'Subhead' MDLabel:
theme_text_color: 'Primary' font_style: 'Title'
text: root.address theme_text_color: 'Primary'
halign: 'left' text: "Address"
MDRaisedButton: font_size: '17sp'
size_hint: 1, None halign: 'left'
height: dp(40) MDLabel:
text: 'Save' font_style: 'Subhead'
MDRaisedButton: theme_text_color: 'Primary'
size_hint: 1, None text: root.address
height: dp(40) font_size: '15sp'
text: 'Cancel' halign: 'left'
on_press: root.dismiss() BoxLayout:
MDRaisedButton: spacing:5
size_hint: 1, None orientation: 'horizontal'
height: dp(40) MDRaisedButton:
text: 'Scan QR code' size_hint: 2, None
height: dp(40)
on_press: root.send_message_from()
MDLabel:
font_style: 'Title'
text: 'Send message from'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
MDRaisedButton:
size_hint: 1.5, None
height: dp(40)
on_press: root.dismiss()
on_press: app.root.ids.scr_mngr.current = 'showqrcode'
on_press: app.root.ids.sc15.qrdisplay()
MDLabel:
font_style: 'Title'
text: 'Show QR code'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
MDRaisedButton:
size_hint: 1.5, None
height: dp(40)
on_press: root.dismiss()
MDLabel:
font_style: 'Title'
text: 'Cancel'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
<AddbookDetailPopup>:
id: addbook_popup
background: './images/popup.jpeg'
separator_height: 0
auto_dismiss: False
BoxLayout:
size_hint_y: None
spacing:dp(70)
id: addbook_popup_box
orientation: 'vertical'
BoxLayout:
size_hint_y: None
orientation: 'vertical'
spacing:dp(20)
MDLabel:
font_style: 'Title'
theme_text_color: 'Primary'
text: "Label"
font_size: '17sp'
halign: 'left'
MDTextField:
id: add_label
font_style: 'Subhead'
font_size: '15sp'
halign: 'left'
text: root.address_label
theme_text_color: 'Primary'
required: True
helper_text_mode: "on_error"
MDLabel:
font_style: 'Title'
theme_text_color: 'Primary'
text: "Address"
font_size: '17sp'
halign: 'left'
MDLabel:
font_style: 'Subhead'
theme_text_color: 'Primary'
text: root.address
font_size: '15sp'
halign: 'left'
BoxLayout:
spacing:5
orientation: 'horizontal'
MDRaisedButton:
size_hint: 2, None
height: dp(40)
on_press: root.send_message_to()
MDLabel:
font_style: 'Title'
text: 'Send message to'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
MDRaisedButton:
size_hint: 1.5, None
height: dp(40)
font_size: '10sp'
on_press: root.update_addbook_label(root.address)
MDLabel:
font_style: 'Title'
text: 'Save'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
MDRaisedButton:
size_hint: 1.5, None
height: dp(40)
on_press: root.dismiss()
MDLabel:
font_style: 'Title'
text: 'Cancel'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
<ShowQRCode>:
name: 'showqrcode'
BoxLayout:
orientation: 'vertical'
id: qr

View File

@ -47,6 +47,8 @@ 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 from kivy.uix.carousel import Carousel
from kivy.garden.qrcode import QRCodeWidget
from kivy.utils import platform
class Navigatorss(MDNavigationDrawer): class Navigatorss(MDNavigationDrawer):
@ -89,10 +91,11 @@ class Inbox(Screen):
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] }) 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/text_images/{}.png'.format(item['secondary_text'][0].upper())))
meny.bind(on_press = partial(self.inbox_detail, item['receivedTime'])) meny.bind(on_press = partial(self.inbox_detail, item['receivedTime']))
carousel = Carousel(direction='right') carousel = Carousel(direction='right')
carousel.height = 150 if platform == 'android':
carousel.height = 150
carousel.size_hint_y = None carousel.size_hint_y = None
carousel.ignore_perpendicular_swipes = True carousel.ignore_perpendicular_swipes = True
carousel.data_index = 0 carousel.data_index = 0
@ -132,6 +135,7 @@ class Inbox(Screen):
def delete(self, data_index, instance, *args): def delete(self, data_index, instance, *args):
"""Delete inbox mail from inbox listing""" """Delete inbox mail from inbox listing"""
state.navigation_drawer_obj = self.parent.parent.parent.parent.children[2].children[0].children[0].children[0].children
sqlExecute("UPDATE inbox SET folder = 'trash' WHERE received = {};".format(data_index)) sqlExecute("UPDATE inbox SET folder = 'trash' WHERE received = {};".format(data_index))
self.ids.ml.remove_widget(instance.parent.parent) self.ids.ml.remove_widget(instance.parent.parent)
self.update_trash() self.update_trash()
@ -161,14 +165,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 ContentNavigationDrawer().ids.btn.values: if BMConfigParser().addresses() or state.kivyapp.variable_1:
data = [] data = []
for address in ContentNavigationDrawer().ids.btn.values: 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)
meny.add_widget(AvatarSampleWidget(source='./images/avatar.png')) meny.add_widget(AvatarSampleWidget(source='./images/text_images/{}.png'.format(item['text'][0].upper())))
meny.bind(on_press = partial(self.myadd_detail, item['secondary_text'])) meny.bind(on_press=partial(self.myadd_detail, item['secondary_text'], item['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',
@ -184,10 +188,10 @@ class MyAddress(Screen):
except Exception as e: except Exception as e:
pass pass
def myadd_detail(self, fromaddress, *args): def myadd_detail(self, fromaddress, label, *args):
p = MyaddDetailPopup() p = MyaddDetailPopup()
p.open() p.open()
p.get_address(fromaddress) p.set_address(fromaddress, label)
class AddressBook(Screen): class AddressBook(Screen):
@ -202,7 +206,8 @@ class AddressBook(Screen):
if data: if data:
for item in data: for item in data:
meny = TwoLineAvatarIconListItem(text=item[0], secondary_text=item[1], theme_text_color='Custom',text_color=NavigateApp().theme_cls.primary_color) meny = TwoLineAvatarIconListItem(text=item[0], secondary_text=item[1], 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/text_images/{}.png'.format(item[0][0].upper())))
meny.bind(on_press = partial(self.addBook_detail, item[1], item[0]))
self.ids.ml.add_widget(meny) self.ids.ml.add_widget(meny)
else: else:
content = MDLabel(font_style='Body1', content = MDLabel(font_style='Body1',
@ -218,6 +223,10 @@ class AddressBook(Screen):
state.navinstance.ids.sc11.clear_widgets() state.navinstance.ids.sc11.clear_widgets()
state.navinstance.ids.sc11.add_widget(AddressBook()) state.navinstance.ids.sc11.add_widget(AddressBook())
def addBook_detail(self, address, label, *args):
p = AddbookDetailPopup()
p.open()
p.set_addbook_data(address, label)
class SelectableRecycleBoxLayout(FocusBehavior, LayoutSelectionBehavior, class SelectableRecycleBoxLayout(FocusBehavior, LayoutSelectionBehavior,
RecycleBoxLayout): RecycleBoxLayout):
@ -307,6 +316,10 @@ class DropDownWidget(BoxLayout):
'sent', 'sent',
encoding, encoding,
BMConfigParser().getint('bitmessagesettings', 'ttl')) BMConfigParser().getint('bitmessagesettings', 'ttl'))
state.check_sent_acc = fromAddress
state.msg_counter_objs = self.parent.parent.parent.parent.parent.parent.children[0].children[2].children[0].ids
# state.msg_counter_objs.send_cnt.badge_text = str(int(state.sent_count) + 1)
# state.sent_count = str(int(state.sent_count) + 1)
self.parent.parent.screens[3].clear_widgets() self.parent.parent.screens[3].clear_widgets()
self.parent.parent.screens[3].add_widget(Sent()) self.parent.parent.screens[3].add_widget(Sent())
toLabel = '' toLabel = ''
@ -319,6 +332,7 @@ class DropDownWidget(BoxLayout):
self.parent.parent.current = 'sent' self.parent.parent.current = 'sent'
self.ids.btn.text = 'select' self.ids.btn.text = 'select'
self.ids.ti.text = '' self.ids.ti.text = ''
return None return None
else: else:
msg = 'Enter a valid recipients address' msg = 'Enter a valid recipients address'
@ -438,10 +452,10 @@ class Random(Screen):
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
state.myAddressObj = self.parent.parent.parent.parent.ids.sc10 # 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.clear_widgets()
# self.parent.parent.parent.parent.ids.sc10.add_widget(MyAddress()) self.parent.parent.parent.parent.ids.sc10.add_widget(MyAddress())
class AddressSuccessful(Screen): class AddressSuccessful(Screen):
pass pass
@ -478,16 +492,22 @@ class Sent(Screen):
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) state.totalSentMail = len(queryreturn)
if state.msg_counter_objs and state.association == state.check_sent_acc:
state.msg_counter_objs.send_cnt.badge_text = str(len(queryreturn))
state.sent_count = str(int(state.sent_count) + 1)
state.check_sent_acc = None
if queryreturn: if queryreturn:
for mail in queryreturn: for mail in queryreturn:
third_text = mail[3].replace('\n', ' ') third_text = mail[3].replace('\n', ' ')
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]}) 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 self.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/text_images/{}.png'.format(item['secondary_text'][0].upper())))
meny.bind(on_press = partial(self.sent_detail, item['lastactiontime'])) meny.bind(on_press = partial(self.sent_detail, item['lastactiontime']))
carousel = Carousel(direction='right') carousel = Carousel(direction='right')
carousel.height = 150 if platform == 'android':
carousel.height = 150
carousel.size_hint_y = None carousel.size_hint_y = None
carousel.ignore_perpendicular_swipes = True carousel.ignore_perpendicular_swipes = True
carousel.data_index = 0 carousel.data_index = 0
@ -528,8 +548,19 @@ class Sent(Screen):
def delete(self, data_index, instance, *args): def delete(self, data_index, instance, *args):
"""delete sent mail from sent mail listing""" """delete sent mail from sent mail listing"""
try:
msg_count_objs = self.parent.parent.parent.parent.children[2].ids
except Exception as e:
msg_count_objs = self.parent.parent.parent.parent.parent.children[2].children[0].ids
if int(state.sent_count) > 0:
msg_count_objs.send_cnt.badge_text = str(int(state.sent_count) - 1)
msg_count_objs.trash_cnt.badge_text = str(int(state.trash_count) + 1)
state.sent_count = str(int(state.sent_count) - 1)
state.trash_count = str(int(state.trash_count) + 1)
sqlExecute("UPDATE sent SET folder = 'trash' WHERE lastactiontime = {};".format(data_index)) sqlExecute("UPDATE sent SET folder = 'trash' WHERE lastactiontime = {};".format(data_index))
self.ids.ml.remove_widget(instance.parent.parent) self.ids.ml.remove_widget(instance.parent.parent)
# self.update_mail_count()
self.update_trash() self.update_trash()
def archive(self, data_index, instance, *args): def archive(self, data_index, instance, *args):
@ -556,12 +587,17 @@ 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."""
inbox = sqlQuery("SELECT toaddress, fromaddress, subject, message from inbox WHERE folder = 'trash';") if state.association == '':
sent = sqlQuery("SELECT toaddress, fromaddress, subject, message from sent WHERE folder = 'trash';") if BMConfigParser().addresses():
state.association = BMConfigParser().addresses()[0]
inbox = sqlQuery("SELECT toaddress, fromaddress, subject, message from inbox WHERE folder = 'trash' and fromaddress = '{}';".format(state.association))
sent = sqlQuery("SELECT toaddress, fromaddress, subject, message from sent WHERE folder = 'trash' and fromaddress = '{}';".format(state.association))
trash_data = inbox + sent trash_data = inbox + sent
for item in trash_data: for item in trash_data:
meny = ThreeLineAvatarIconListItem(text=item[1], secondary_text=item[2], theme_text_color= 'Custom',text_color=NavigateApp().theme_cls.primary_color) meny = ThreeLineAvatarIconListItem(text=item[1], secondary_text=item[2], 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/text_images/{}.png'.format(item[2][0].upper())))
self.ids.ml.add_widget(meny) self.ids.ml.add_widget(meny)
class Page(Screen): class Page(Screen):
@ -590,11 +626,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()
total_sentmail = str(state.totalSentMail) total_sentmail = str(state.totalSentMail)
scr_size = Window.size[0] state.screen_density = Window.size
title = "PyBitmessage" title = "PyBitmessage"
count = 0 count = 0
menu_items = [ menu_items = [
@ -620,7 +655,6 @@ 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()
@ -631,13 +665,6 @@ class NavigateApp(App):
kivyuisignaler.release() kivyuisignaler.release()
super(NavigateApp, self).run() super(NavigateApp, self).run()
def say_exit(self):
"""Exit the application as uses shutdown PyBitmessage."""
print("**************************EXITING FROM APPLICATION*****************************")
App.get_running_app().stop()
import shutdown
shutdown.doCleanShutdown()
def show_address_success(self): def show_address_success(self):
content = MDLabel(font_style='Body1', content = MDLabel(font_style='Body1',
theme_text_color='Secondary', theme_text_color='Secondary',
@ -674,6 +701,17 @@ class NavigateApp(App):
self.root.ids.sc5.add_widget(Trash()) self.root.ids.sc5.add_widget(Trash())
self.root.ids.scr_mngr.current = 'inbox' self.root.ids.scr_mngr.current = 'inbox'
msg_counter_objs = self.root_window.children[1].children[2].children[0].ids
state.sent_count = str(sqlQuery("SELECT COUNT(*) FROM sent WHERE fromaddress = '{}' and folder = 'sent' ;".format(state.association))[0][0])
state.inbox_count = str(sqlQuery("SELECT COUNT(*) FROM inbox WHERE fromaddress = '{}' and folder = 'inbox' ;".format(state.association))[0][0])
state.trash_count = str(sqlQuery("SELECT (SELECT count(*) FROM sent where fromaddress = '{0}' and folder = 'trash' )+(SELECT count(*) FROM inbox where fromaddress = '{0}' and folder = 'trash') AS SumCount".format(state.association))[0][0])
if msg_counter_objs:
msg_counter_objs.send_cnt.badge_text = state.sent_count
msg_counter_objs.inbox_cnt.badge_text = state.inbox_count
msg_counter_objs.trash_cnt.badge_text = state.trash_count
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."""
try: try:
@ -727,12 +765,44 @@ class NavigateApp(App):
if state.ackdata == ackData: if state.ackdata == ackData:
state.status.status = message state.status.status = message
def clear_composer(self):
"""if slow down the nwe will make new composer edit screen"""
composer_obj = self.root.ids.sc3.children[0].ids
composer_obj.ti.text = ''
composer_obj.btn.text = ''
composer_obj.txt_input.text = ''
composer_obj.subject.text = ''
def on_stop(self):
"""On stop methos is used for stoping the runing script"""
print("**************************EXITING FROM APPLICATION*****************************")
import shutdown
shutdown.doCleanShutdown()
def mail_count(self, text):
if state.association == '':
if BMConfigParser().addresses():
state.association = BMConfigParser().addresses()[0]
if text == 'Sent':
state.sent_count = str(sqlQuery("SELECT COUNT(*) FROM {0} WHERE fromaddress = '{1}' and folder = '{0}' ;".format(text.lower(), state.association))[0][0])
return state.sent_count
elif text == 'Inbox':
state.inbox_count = str(sqlQuery("SELECT COUNT(*) FROM {0} WHERE fromaddress = '{1}' and folder = '{0}' ;".format(text.lower(), state.association))[0][0])
return state.inbox_count
elif text == 'Trash':
state.trash_count = str(sqlQuery("SELECT (SELECT count(*) FROM sent where fromaddress = '{0}' and folder = 'trash' )+(SELECT count(*) FROM inbox where fromaddress = '{0}' and folder = 'trash') AS SumCount".format(state.association))[0][0])
return state.trash_count
class GrashofPopup(Popup): class GrashofPopup(Popup):
def __init__(self, **kwargs): def __init__(self, **kwargs):
super(GrashofPopup, self).__init__(**kwargs) super(GrashofPopup, self).__init__(**kwargs)
self.size_hint_y = 0.7 if state.screen_density[0] <= 720:
self.size_hint_x = 0.9 self.size_hint_y = 0.4
self.size_hint_x = 0.9
else:
self.size_hint_y = 0.42
self.size_hint_x = 0.7
def savecontact(self): def savecontact(self):
label = self.ids.label.text label = self.ids.label.text
@ -742,6 +812,7 @@ class GrashofPopup(Popup):
queues.UISignalQueue.put(('rerenderAddressBook', '')) queues.UISignalQueue.put(('rerenderAddressBook', ''))
self.dismiss() self.dismiss()
sqlExecute("INSERT INTO addressbook VALUES(?,?)", label, address) sqlExecute("INSERT INTO addressbook VALUES(?,?)", label, address)
self.parent.children[1].ids.scr_mngr.current = 'addressbook'
def show_error_message(self): def show_error_message(self):
content = MDLabel(font_style='Body1', content = MDLabel(font_style='Body1',
@ -806,6 +877,7 @@ class MailDetail(Screen):
subject = StringProperty() subject = StringProperty()
message = StringProperty() message = StringProperty()
status = StringProperty() status = StringProperty()
page_type = StringProperty()
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(MailDetail, self).__init__(*args, **kwargs) super(MailDetail, self).__init__(*args, **kwargs)
@ -813,6 +885,7 @@ class MailDetail(Screen):
def init_ui(self, dt=0): def init_ui(self, dt=0):
"""Clock Schdule for method MailDetail mails.""" """Clock Schdule for method MailDetail mails."""
self.page_type = state.detailPageType if state.detailPageType else ''
if state.detailPageType == 'sent': if state.detailPageType == 'sent':
data = sqlQuery("select toaddress, fromaddress, subject, message , status, ackdata from sent where lastactiontime = {};".format(state.sentMailTime)) data = sqlQuery("select toaddress, fromaddress, subject, message , status, ackdata from sent where lastactiontime = {};".format(state.sentMailTime))
state.status = self state.status = self
@ -836,9 +909,28 @@ class MailDetail(Screen):
self.parent.parent.screens[3].clear_widgets() self.parent.parent.screens[3].clear_widgets()
self.parent.parent.screens[3].add_widget(Sent()) self.parent.parent.screens[3].add_widget(Sent())
self.parent.parent.current = 'sent' self.parent.parent.current = 'sent'
elif state.detailPageType == 'inbox':
sqlExecute("UPDATE inbox SET folder = 'trash' WHERE received = {};".format(state.sentMailTime))
self.parent.parent.screens[0].clear_widgets()
self.parent.parent.screens[0].add_widget(Inbox())
self.parent.parent.current = 'inbox'
self.parent.parent.screens[4].clear_widgets() self.parent.parent.screens[4].clear_widgets()
self.parent.parent.screens[4].add_widget(Trash()) self.parent.parent.screens[4].add_widget(Trash())
def inbox_reply(self):
"""This method is used for replying inbox messages"""
data = sqlQuery("select toaddress, fromaddress, subject, message from inbox where received = {};".format(state.sentMailTime))
composer_obj = self.parent.parent.screens[2].children[0].ids
composer_obj.ti.text = data[0][1]
composer_obj.btn.text = data[0][1]
composer_obj.txt_input.text = data[0][0]
composer_obj.subject.text = data[0][2]
self.parent.parent.current = 'create'
def copy_sent_mail(self):
"""This method is used for copying sent mail to the composer"""
pass
class MyaddDetailPopup(Popup): class MyaddDetailPopup(Popup):
"""MyaddDetailPopup pop is used for showing my address detail""" """MyaddDetailPopup pop is used for showing my address detail"""
@ -847,10 +939,71 @@ class MyaddDetailPopup(Popup):
def __init__(self, **kwargs): def __init__(self, **kwargs):
super(MyaddDetailPopup, self).__init__(**kwargs) super(MyaddDetailPopup, self).__init__(**kwargs)
self.size_hint_y = 0.4 if state.screen_density[0] <= 720:
self.size_hint_x = 0.9 self.size_hint_y = 0.32
self.size_hint_x = 0.9
else:
self.size_hint_y = 0.32
self.size_hint_x = 0.7
def get_address(self, address): def set_address(self, address, label):
"""Getting address for displaying details on popup""" """Getting address for displaying details on popup"""
self.address_label = BMConfigParser().get(address, 'label') if BMConfigParser().get(address, 'label') else '' self.address_label = label
self.address = address self.address = address
def send_message_from(self):
"""This method used to fill from address of composer autofield"""
window_obj = self.parent.children[1].ids
window_obj.sc3.children[0].ids.ti.text = self.address
window_obj.sc3.children[0].ids.btn.text = self.address
window_obj.sc3.children[0].ids.txt_input.text = ''
window_obj.sc3.children[0].ids.subject.text = ''
window_obj.sc3.children[0].ids.body.text = ''
window_obj.scr_mngr.current = 'create'
self.dismiss()
class AddbookDetailPopup(Popup):
"""AddbookDetailPopup pop is used for showing my address detail"""
address_label = StringProperty()
address = StringProperty()
def __init__(self, **kwargs):
super(AddbookDetailPopup, self).__init__(**kwargs)
if state.screen_density[0] <= 720:
self.size_hint_y = 0.35
self.size_hint_x = 0.95
else:
self.size_hint_y = 0.35
self.size_hint_x = 0.7
def set_addbook_data(self, address, label):
"""Getting address book data for detial dipaly"""
self.address_label = label
self.address = address
def update_addbook_label(self, address):
"""Updating the label of address book address"""
if str(self.ids.add_label.text):
sqlExecute("UPDATE addressbook SET label = '{}' WHERE address = '{}';".format(str(self.ids.add_label.text), address))
self.parent.children[1].ids.sc11.clear_widgets()
self.parent.children[1].ids.sc11.add_widget(AddressBook())
self.dismiss()
def send_message_to(self):
"""This method used to fill to_address of composer autofield"""
window_obj = self.parent.children[1].ids
window_obj.sc3.children[0].ids.txt_input.text = self.address
window_obj.sc3.children[0].ids.ti.text = ''
window_obj.sc3.children[0].ids.btn.text = ''
window_obj.sc3.children[0].ids.subject.text = ''
window_obj.sc3.children[0].ids.body.text = ''
window_obj.scr_mngr.current = 'create'
self.dismiss()
class ShowQRCode(Screen):
"""ShowQRCode Screen uses to show the detail of mails."""
def qrdisplay(self):
self.ids.qr.clear_widgets()
self.ids.qr.add_widget(QRCodeWidget(data=self.manager.get_parent_window().children[0].address))

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@ -84,4 +84,16 @@ detailPageType = None
ackdata = None ackdata = None
status = None status = None
screen_density = None
msg_counter_objs = None
check_sent_acc = None
sent_count = 0
inbox_count = 0
trash_count = 0