Implement qrcode display feature with Ui enhancement and message avtar display based on message
|
@ -35,11 +35,18 @@
|
|||
#:import MDFloatingActionButton kivymd.button.MDFloatingActionButton
|
||||
#: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>:
|
||||
icon: 'checkbox-blank-circle'
|
||||
|
||||
<MySpinnerOption@SpinnerOption>:
|
||||
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>:
|
||||
drawer_logo: './images/drawer_logo1.png'
|
||||
|
@ -54,19 +61,24 @@
|
|||
option_cls: Factory.get("MySpinnerOption")
|
||||
font_size: '12.5sp'
|
||||
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
|
||||
on_text:app.getCurrentAccountData(self.text)
|
||||
on_press: app.limit_spinner()
|
||||
NavigationDrawerIconButton:
|
||||
id: inbox_cnt
|
||||
icon: 'email-open'
|
||||
text: "Inbox"
|
||||
on_release: app.root.ids.scr_mngr.current = 'inbox'
|
||||
badge_text: "99+"
|
||||
badge_text: app.mail_count(self.text)
|
||||
NavigationDrawerIconButton:
|
||||
id: send_cnt
|
||||
icon: 'send'
|
||||
text: "Sent"
|
||||
on_release: app.root.ids.scr_mngr.current = 'sent'
|
||||
badge_text: "0"
|
||||
badge_text: app.mail_count(self.text)
|
||||
NavigationDrawerIconButton:
|
||||
icon: 'message-draw'
|
||||
text: "Draft"
|
||||
|
@ -87,10 +99,11 @@
|
|||
on_release: app.root.ids.scr_mngr.current = 'inbox'
|
||||
badge_text: "8+"
|
||||
NavigationDrawerIconButton:
|
||||
id: trash_cnt
|
||||
icon: 'delete'
|
||||
text: "Trash"
|
||||
on_release: app.root.ids.scr_mngr.current = 'trash'
|
||||
badge_text: "9+"
|
||||
badge_text: app.mail_count(self.text)
|
||||
NavigationDrawerIconButton:
|
||||
text: "All Mails"
|
||||
icon:'contact-mail'
|
||||
|
@ -182,6 +195,8 @@ NavigationLayout:
|
|||
id:sc13
|
||||
MailDetail:
|
||||
id:sc14
|
||||
ShowQRCode:
|
||||
id:sc15
|
||||
|
||||
<Inbox>:
|
||||
name: 'inbox'
|
||||
|
@ -233,7 +248,7 @@ NavigationLayout:
|
|||
BoxLayout:
|
||||
orientation: 'vertical'
|
||||
size_hint_y: None
|
||||
height: dp(app.scr_size)
|
||||
height: dp(600)
|
||||
padding: dp(32)
|
||||
spacing: 15
|
||||
BoxLayout:
|
||||
|
@ -249,11 +264,10 @@ NavigationLayout:
|
|||
|
||||
BoxLayout:
|
||||
size_hint_y: None
|
||||
height: 100
|
||||
height: dp(40)
|
||||
Spinner:
|
||||
background_color: app.theme_cls.primary_dark
|
||||
id: btn
|
||||
text: 'select'
|
||||
values: app.variable_1
|
||||
on_text: ti.text = self.text
|
||||
option_cls: Factory.get("MySpinnerOption")
|
||||
|
@ -289,17 +303,19 @@ NavigationLayout:
|
|||
required: True
|
||||
helper_text_mode: "on_error"
|
||||
BoxLayout:
|
||||
spacing:50
|
||||
AnchorLayout:
|
||||
MDRaisedButton:
|
||||
size_hint: .8, .3
|
||||
size_hint: 1, None
|
||||
height: dp(40)
|
||||
text: 'send'
|
||||
on_press: root.send()
|
||||
BoxLayout:
|
||||
AnchorLayout:
|
||||
MDRaisedButton:
|
||||
size_hint: .8, .3
|
||||
size_hint: 1, None
|
||||
height: dp(40)
|
||||
text: 'reset'
|
||||
on_press: app.root.ids.scr_mngr.current = 'random'
|
||||
on_press: app.root.ids.scr_mngr.current = 'random'
|
||||
|
||||
<MyTextInput>:
|
||||
readonly: False
|
||||
|
@ -341,7 +357,7 @@ NavigationLayout:
|
|||
BoxLayout:
|
||||
orientation: 'vertical'
|
||||
size_hint_y: None
|
||||
height: dp(800)
|
||||
height: dp(700)
|
||||
BoxLayout:
|
||||
MDLabel:
|
||||
font_style: 'Body1'
|
||||
|
@ -483,7 +499,7 @@ NavigationLayout:
|
|||
MDCheckbox:
|
||||
id: chkbox
|
||||
size_hint: None, None
|
||||
size: dp(48), dp(48)
|
||||
size: dp(48), dp(64)
|
||||
active: True
|
||||
MDLabel:
|
||||
font_style: 'Body1'
|
||||
|
@ -519,44 +535,62 @@ NavigationLayout:
|
|||
id: popup
|
||||
title: 'add contact\'s'
|
||||
background: './images/popup.jpeg'
|
||||
title_size: sp(30)
|
||||
title_size: sp(20)
|
||||
title_color: 0.4, 0.3765, 0.3451, 1
|
||||
size_hint: 1, 1
|
||||
auto_dismiss: False
|
||||
separator_color: 0.3529, 0.3922, 0.102, 0.7
|
||||
BoxLayout:
|
||||
size_hint_y: None
|
||||
size_hint_y: 0.5
|
||||
orientation: 'vertical'
|
||||
spacing:50
|
||||
spacing:dp(20)
|
||||
id: popup_box
|
||||
orientation: 'vertical'
|
||||
MDTextField:
|
||||
id: label
|
||||
multiline: True
|
||||
hint_text: "Label"
|
||||
required: True
|
||||
helper_text_mode: "on_error"
|
||||
MDTextField:
|
||||
id: address
|
||||
hint_text: "Address"
|
||||
required: True
|
||||
helper_text_mode: "on_error"
|
||||
MDRaisedButton:
|
||||
size_hint: 1, None
|
||||
height: dp(40)
|
||||
text: 'Save'
|
||||
on_release:
|
||||
root.savecontact()
|
||||
app.root.ids.scr_mngr.current = 'addressbook'
|
||||
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'
|
||||
BoxLayout:
|
||||
orientation: 'vertical'
|
||||
MDTextField:
|
||||
id: label
|
||||
multiline: True
|
||||
hint_text: "Label"
|
||||
required: True
|
||||
helper_text_mode: "on_error"
|
||||
MDTextField:
|
||||
id: address
|
||||
hint_text: "Address"
|
||||
required: True
|
||||
helper_text_mode: "on_error"
|
||||
BoxLayout:
|
||||
spacing:5
|
||||
orientation: 'horizontal'
|
||||
MDRaisedButton:
|
||||
size_hint: 1.5, None
|
||||
height: dp(40)
|
||||
on_release:
|
||||
root.savecontact()
|
||||
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'
|
||||
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>:
|
||||
name: 'networkstat'
|
||||
|
@ -659,7 +693,8 @@ NavigationLayout:
|
|||
MDRaisedButton:
|
||||
size_hint: 1, None
|
||||
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:
|
||||
size_hint: 1, None
|
||||
height: dp(40)
|
||||
|
@ -680,6 +715,7 @@ NavigationLayout:
|
|||
elevation_normal: 8
|
||||
md_bg_color: [0.941, 0, 0,1]
|
||||
on_press: app.root.ids.scr_mngr.current = 'create'
|
||||
on_release: app.clear_composer()
|
||||
|
||||
<MyaddDetailPopup>:
|
||||
id: myadd_popup
|
||||
|
@ -688,39 +724,151 @@ NavigationLayout:
|
|||
auto_dismiss: False
|
||||
BoxLayout:
|
||||
size_hint_y: None
|
||||
spacing:50
|
||||
id: popup_box
|
||||
spacing:dp(70)
|
||||
id: myadd_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'
|
||||
BoxLayout:
|
||||
size_hint_y: None
|
||||
orientation: 'vertical'
|
||||
spacing:dp(25)
|
||||
MDLabel:
|
||||
font_style: 'Title'
|
||||
theme_text_color: 'Primary'
|
||||
text: "Label"
|
||||
font_size: '17sp'
|
||||
halign: 'left'
|
||||
MDLabel:
|
||||
font_style: 'Subhead'
|
||||
theme_text_color: 'Primary'
|
||||
text: root.address_label
|
||||
font_size: '15sp'
|
||||
halign: 'left'
|
||||
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_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
|
|
@ -47,6 +47,8 @@ import kivy_helper_search
|
|||
from kivy.core.window import Window
|
||||
from functools import partial
|
||||
from kivy.uix.carousel import Carousel
|
||||
from kivy.garden.qrcode import QRCodeWidget
|
||||
from kivy.utils import platform
|
||||
|
||||
|
||||
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] })
|
||||
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/text_images/{}.png'.format(item['secondary_text'][0].upper())))
|
||||
meny.bind(on_press = partial(self.inbox_detail, item['receivedTime']))
|
||||
carousel = Carousel(direction='right')
|
||||
carousel.height = 150
|
||||
if platform == 'android':
|
||||
carousel.height = 150
|
||||
carousel.size_hint_y = None
|
||||
carousel.ignore_perpendicular_swipes = True
|
||||
carousel.data_index = 0
|
||||
|
@ -132,6 +135,7 @@ class Inbox(Screen):
|
|||
|
||||
def delete(self, data_index, instance, *args):
|
||||
"""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))
|
||||
self.ids.ml.remove_widget(instance.parent.parent)
|
||||
self.update_trash()
|
||||
|
@ -161,14 +165,14 @@ class MyAddress(Screen):
|
|||
|
||||
def init_ui(self, dt=0):
|
||||
"""Clock Schdule for method inbox accounts."""
|
||||
if BMConfigParser().addresses() or ContentNavigationDrawer().ids.btn.values:
|
||||
if BMConfigParser().addresses() or state.kivyapp.variable_1:
|
||||
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})
|
||||
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.add_widget(AvatarSampleWidget(source='./images/avatar.png'))
|
||||
meny.bind(on_press = partial(self.myadd_detail, item['secondary_text']))
|
||||
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'], item['text']))
|
||||
self.ids.ml.add_widget(meny)
|
||||
else:
|
||||
content = MDLabel(font_style='Body1',
|
||||
|
@ -184,10 +188,10 @@ class MyAddress(Screen):
|
|||
except Exception as e:
|
||||
pass
|
||||
|
||||
def myadd_detail(self, fromaddress, *args):
|
||||
def myadd_detail(self, fromaddress, label, *args):
|
||||
p = MyaddDetailPopup()
|
||||
p.open()
|
||||
p.get_address(fromaddress)
|
||||
p.set_address(fromaddress, label)
|
||||
|
||||
|
||||
class AddressBook(Screen):
|
||||
|
@ -202,7 +206,8 @@ class AddressBook(Screen):
|
|||
if 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.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)
|
||||
else:
|
||||
content = MDLabel(font_style='Body1',
|
||||
|
@ -218,6 +223,10 @@ class AddressBook(Screen):
|
|||
state.navinstance.ids.sc11.clear_widgets()
|
||||
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,
|
||||
RecycleBoxLayout):
|
||||
|
@ -307,6 +316,10 @@ class DropDownWidget(BoxLayout):
|
|||
'sent',
|
||||
encoding,
|
||||
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].add_widget(Sent())
|
||||
toLabel = ''
|
||||
|
@ -319,6 +332,7 @@ class DropDownWidget(BoxLayout):
|
|||
self.parent.parent.current = 'sent'
|
||||
self.ids.btn.text = 'select'
|
||||
self.ids.ti.text = ''
|
||||
|
||||
return None
|
||||
else:
|
||||
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.disabled = False
|
||||
|
||||
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())
|
||||
|
||||
# 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):
|
||||
pass
|
||||
|
@ -478,16 +492,22 @@ class Sent(Screen):
|
|||
queryreturn = kivy_helper_search.search_sql(
|
||||
xAddress, account, "sent", where, what, False)
|
||||
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:
|
||||
for mail in queryreturn:
|
||||
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]})
|
||||
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.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']))
|
||||
carousel = Carousel(direction='right')
|
||||
carousel.height = 150
|
||||
if platform == 'android':
|
||||
carousel.height = 150
|
||||
carousel.size_hint_y = None
|
||||
carousel.ignore_perpendicular_swipes = True
|
||||
carousel.data_index = 0
|
||||
|
@ -528,8 +548,19 @@ class Sent(Screen):
|
|||
|
||||
def delete(self, data_index, instance, *args):
|
||||
"""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))
|
||||
self.ids.ml.remove_widget(instance.parent.parent)
|
||||
# self.update_mail_count()
|
||||
self.update_trash()
|
||||
|
||||
def archive(self, data_index, instance, *args):
|
||||
|
@ -556,12 +587,17 @@ class Trash(Screen):
|
|||
|
||||
def init_ui(self, dt=0):
|
||||
"""Clock Schdule for method inbox accounts."""
|
||||
inbox = sqlQuery("SELECT toaddress, fromaddress, subject, message from inbox WHERE folder = 'trash';")
|
||||
sent = sqlQuery("SELECT toaddress, fromaddress, subject, message from sent WHERE folder = 'trash';")
|
||||
if state.association == '':
|
||||
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
|
||||
|
||||
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.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)
|
||||
|
||||
class Page(Screen):
|
||||
|
@ -590,11 +626,10 @@ class NavigateApp(App):
|
|||
theme_cls = ThemeManager()
|
||||
previous_date = ObjectProperty()
|
||||
obj_1 = ObjectProperty()
|
||||
obj_2 = ObjectProperty()
|
||||
variable_1 = ListProperty(BMConfigParser().addresses())
|
||||
nav_drawer = ObjectProperty()
|
||||
total_sentmail = str(state.totalSentMail)
|
||||
scr_size = Window.size[0]
|
||||
state.screen_density = Window.size
|
||||
title = "PyBitmessage"
|
||||
count = 0
|
||||
menu_items = [
|
||||
|
@ -620,7 +655,6 @@ class NavigateApp(App):
|
|||
os.path.join(os.path.dirname(__file__), 'main.kv'))
|
||||
self.nav_drawer = Navigatorss()
|
||||
self.obj_1 = AddressBook()
|
||||
self.obj_2 = MyAddress()
|
||||
kivysignalthread = UIkivySignaler()
|
||||
kivysignalthread.daemon = True
|
||||
kivysignalthread.start()
|
||||
|
@ -631,13 +665,6 @@ class NavigateApp(App):
|
|||
kivyuisignaler.release()
|
||||
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):
|
||||
content = MDLabel(font_style='Body1',
|
||||
theme_text_color='Secondary',
|
||||
|
@ -674,6 +701,17 @@ class NavigateApp(App):
|
|||
self.root.ids.sc5.add_widget(Trash())
|
||||
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):
|
||||
"""It will get message detail after make selected message description."""
|
||||
try:
|
||||
|
@ -727,12 +765,44 @@ class NavigateApp(App):
|
|||
if state.ackdata == ackData:
|
||||
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):
|
||||
def __init__(self, **kwargs):
|
||||
super(GrashofPopup, self).__init__(**kwargs)
|
||||
self.size_hint_y = 0.7
|
||||
self.size_hint_x = 0.9
|
||||
if state.screen_density[0] <= 720:
|
||||
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):
|
||||
label = self.ids.label.text
|
||||
|
@ -742,6 +812,7 @@ class GrashofPopup(Popup):
|
|||
queues.UISignalQueue.put(('rerenderAddressBook', ''))
|
||||
self.dismiss()
|
||||
sqlExecute("INSERT INTO addressbook VALUES(?,?)", label, address)
|
||||
self.parent.children[1].ids.scr_mngr.current = 'addressbook'
|
||||
|
||||
def show_error_message(self):
|
||||
content = MDLabel(font_style='Body1',
|
||||
|
@ -806,6 +877,7 @@ class MailDetail(Screen):
|
|||
subject = StringProperty()
|
||||
message = StringProperty()
|
||||
status = StringProperty()
|
||||
page_type = StringProperty()
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(MailDetail, self).__init__(*args, **kwargs)
|
||||
|
@ -813,6 +885,7 @@ class MailDetail(Screen):
|
|||
|
||||
def init_ui(self, dt=0):
|
||||
"""Clock Schdule for method MailDetail mails."""
|
||||
self.page_type = state.detailPageType if state.detailPageType else ''
|
||||
if state.detailPageType == 'sent':
|
||||
data = sqlQuery("select toaddress, fromaddress, subject, message , status, ackdata from sent where lastactiontime = {};".format(state.sentMailTime))
|
||||
state.status = self
|
||||
|
@ -836,9 +909,28 @@ class MailDetail(Screen):
|
|||
self.parent.parent.screens[3].clear_widgets()
|
||||
self.parent.parent.screens[3].add_widget(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].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):
|
||||
"""MyaddDetailPopup pop is used for showing my address detail"""
|
||||
|
@ -847,10 +939,71 @@ class MyaddDetailPopup(Popup):
|
|||
|
||||
def __init__(self, **kwargs):
|
||||
super(MyaddDetailPopup, self).__init__(**kwargs)
|
||||
self.size_hint_y = 0.4
|
||||
self.size_hint_x = 0.9
|
||||
if state.screen_density[0] <= 720:
|
||||
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"""
|
||||
self.address_label = BMConfigParser().get(address, 'label') if BMConfigParser().get(address, 'label') else ''
|
||||
self.address = address
|
||||
self.address_label = label
|
||||
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))
|
BIN
src/images/text_images/A.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
src/images/text_images/B.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
src/images/text_images/C.png
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
src/images/text_images/D.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
BIN
src/images/text_images/E.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
src/images/text_images/F.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
src/images/text_images/G.png
Normal file
After Width: | Height: | Size: 7.4 KiB |
BIN
src/images/text_images/H.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
src/images/text_images/I.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
src/images/text_images/J.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
BIN
src/images/text_images/K.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
src/images/text_images/L.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
src/images/text_images/M.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
src/images/text_images/N.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
src/images/text_images/O.png
Normal file
After Width: | Height: | Size: 7.7 KiB |
BIN
src/images/text_images/P.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
src/images/text_images/Q.png
Normal file
After Width: | Height: | Size: 8.1 KiB |
BIN
src/images/text_images/R.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
src/images/text_images/S.png
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
src/images/text_images/T.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
src/images/text_images/U.png
Normal file
After Width: | Height: | Size: 6.0 KiB |
BIN
src/images/text_images/V.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
src/images/text_images/W.png
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
src/images/text_images/X.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
src/images/text_images/Y.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
src/images/text_images/Z.png
Normal file
After Width: | Height: | Size: 6.0 KiB |
14
src/state.py
|
@ -84,4 +84,16 @@ detailPageType = 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
|