Merge pull request #20 from navjotcis/UiChanges
implement new features for kivy and optimization
This commit is contained in:
commit
9d9e0807d3
|
@ -1,16 +1,15 @@
|
||||||
"""
|
"""
|
||||||
src/identiconGeneration.py
|
Core classes for loading images and converting them to a Texture.
|
||||||
=================================
|
The raw image data can be keep in memory for further access
|
||||||
"""
|
"""
|
||||||
# pylint: disable=import-error
|
|
||||||
import hashlib
|
import hashlib
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from kivy.core.image import Image as CoreImage
|
from kivy.core.image import Image as CoreImage
|
||||||
from kivy.uix.image import Image as kiImage
|
from kivy.uix.image import Image as kiImage
|
||||||
""" Core classes for loading images and converting them to a Texture.
|
# pylint: disable=import-error
|
||||||
The raw image data can be keep in memory for further access """
|
|
||||||
|
|
||||||
|
|
||||||
# constants
|
# constants
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
"""
|
"""
|
||||||
src/bitmessagekivy/kivy_helper_search.py
|
Sql queries for bitmessagekivy
|
||||||
=================================
|
|
||||||
"""
|
"""
|
||||||
from helper_sql import sqlQuery
|
from helper_sql import sqlQuery
|
||||||
|
|
||||||
|
|
||||||
def search_sql(xAddress="toaddress", account=None, folder="inbox", where=None, what=None, unreadOnly=False):
|
def search_sql(
|
||||||
|
xAddress="toaddress", account=None, folder="inbox", where=None,
|
||||||
|
what=None, unreadOnly=False, start_indx=0, end_indx=20):
|
||||||
"""Method helping for searching mails"""
|
"""Method helping for searching mails"""
|
||||||
# pylint: disable=too-many-arguments, too-many-branches
|
# pylint: disable=too-many-arguments, too-many-branches
|
||||||
if what is not None and what != "":
|
if what is not None and what != "":
|
||||||
|
@ -14,14 +15,15 @@ def search_sql(xAddress="toaddress", account=None, folder="inbox", where=None, w
|
||||||
what = None
|
what = None
|
||||||
|
|
||||||
if folder == "sent" or folder == "draft":
|
if folder == "sent" or folder == "draft":
|
||||||
sqlStatementBase = '''
|
sqlStatementBase = (
|
||||||
SELECT toaddress, fromaddress, subject, message, status, ackdata, lastactiontime
|
'''SELECT toaddress, fromaddress, subject, message, status,'''
|
||||||
FROM sent '''
|
''' ackdata, lastactiontime FROM sent ''')
|
||||||
elif folder == "addressbook":
|
elif folder == "addressbook":
|
||||||
sqlStatementBase = '''SELECT label, address From addressbook '''
|
sqlStatementBase = '''SELECT label, address From addressbook '''
|
||||||
else:
|
else:
|
||||||
sqlStatementBase = '''SELECT folder, msgid, toaddress, message, fromaddress, subject, received, read
|
sqlStatementBase = (
|
||||||
FROM inbox '''
|
'''SELECT folder, msgid, toaddress, message, fromaddress,'''
|
||||||
|
''' subject, received, read FROM inbox ''')
|
||||||
|
|
||||||
sqlStatementParts = []
|
sqlStatementParts = []
|
||||||
sqlArguments = []
|
sqlArguments = []
|
||||||
|
@ -58,8 +60,14 @@ def search_sql(xAddress="toaddress", account=None, folder="inbox", where=None, w
|
||||||
sqlStatementParts.append("read = 0")
|
sqlStatementParts.append("read = 0")
|
||||||
if sqlStatementParts:
|
if sqlStatementParts:
|
||||||
sqlStatementBase += "WHERE " + " AND ".join(sqlStatementParts)
|
sqlStatementBase += "WHERE " + " AND ".join(sqlStatementParts)
|
||||||
if folder == "sent":
|
if folder == "sent" or folder == "draft":
|
||||||
sqlStatementBase += " ORDER BY lastactiontime DESC"
|
sqlStatementBase += \
|
||||||
|
" ORDER BY lastactiontime DESC limit {0}, {1}".format(
|
||||||
|
start_indx, end_indx)
|
||||||
elif folder == "inbox":
|
elif folder == "inbox":
|
||||||
sqlStatementBase += " ORDER BY received DESC"
|
sqlStatementBase += \
|
||||||
|
" ORDER BY received DESC limit {0}, {1}".format(
|
||||||
|
start_indx, end_indx)
|
||||||
|
# elif folder == "addressbook":
|
||||||
|
# sqlStatementBase += " limit {0}, {1}".format(start_indx, end_indx)
|
||||||
return sqlQuery(sqlStatementBase, sqlArguments)
|
return sqlQuery(sqlStatementBase, sqlArguments)
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#:import MDFloatingActionButton kivymd.button.MDFloatingActionButton
|
#:import MDFloatingActionButton kivymd.button.MDFloatingActionButton
|
||||||
#:import Factory kivy.factory.Factory
|
#:import Factory kivy.factory.Factory
|
||||||
#:import MDScrollViewRefreshLayout kivymd.refreshlayout.MDScrollViewRefreshLayout
|
#:import MDScrollViewRefreshLayout kivymd.refreshlayout.MDScrollViewRefreshLayout
|
||||||
|
#:import MDSpinner kivymd.spinner.MDSpinner
|
||||||
|
#:import NoTransition kivy.uix.screenmanager.NoTransition
|
||||||
|
|
||||||
#:set color_button (0.784, 0.443, 0.216, 1) # brown
|
#: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_button_pressed (0.659, 0.522, 0.431, 1) # darker brown
|
||||||
|
@ -29,7 +31,7 @@
|
||||||
color: color_font
|
color: color_font
|
||||||
|
|
||||||
<ContentNavigationDrawer@Navigatorss>:
|
<ContentNavigationDrawer@Navigatorss>:
|
||||||
drawer_logo: app.address_identicon()
|
drawer_logo: './images/drawer_logo1.png'
|
||||||
NavigationDrawerDivider:
|
NavigationDrawerDivider:
|
||||||
NavigationDrawerSubheader:
|
NavigationDrawerSubheader:
|
||||||
text: "Accounts"
|
text: "Accounts"
|
||||||
|
@ -57,52 +59,47 @@
|
||||||
text: "Inbox"
|
text: "Inbox"
|
||||||
on_release: app.root.ids.scr_mngr.current = 'inbox'
|
on_release: app.root.ids.scr_mngr.current = 'inbox'
|
||||||
badge_text: "0"
|
badge_text: "0"
|
||||||
on_press: app.refreshScreen(self)
|
on_press: app.load_screen(self)
|
||||||
NavigationDrawerIconButton:
|
NavigationDrawerIconButton:
|
||||||
id: send_cnt
|
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: "0"
|
||||||
on_press: app.refreshScreen(self)
|
|
||||||
NavigationDrawerIconButton:
|
NavigationDrawerIconButton:
|
||||||
id: draft_cnt
|
id: draft_cnt
|
||||||
icon: 'message-draw'
|
icon: 'message-draw'
|
||||||
text: "Draft"
|
text: "Draft"
|
||||||
on_release: app.root.ids.scr_mngr.current = 'draft'
|
on_release: app.root.ids.scr_mngr.current = 'draft'
|
||||||
badge_text: "0"
|
badge_text: "0"
|
||||||
on_press: app.refreshScreen(self)
|
#NavigationDrawerIconButton:
|
||||||
NavigationDrawerIconButton:
|
#text: "Starred"
|
||||||
text: "Starred"
|
#icon:'star'
|
||||||
icon:'star'
|
#on_release: app.root.ids.scr_mngr.current = 'starred'
|
||||||
on_release: app.root.ids.scr_mngr.current = 'starred'
|
#badge_text: "0"
|
||||||
on_press: app.refreshScreen(self)
|
#NavigationDrawerIconButton:
|
||||||
NavigationDrawerIconButton:
|
#icon: 'archive'
|
||||||
icon: 'archive'
|
#text: "Archieve"
|
||||||
text: "Archieve"
|
#on_release: app.root.ids.scr_mngr.current = 'archieve'
|
||||||
on_release: app.root.ids.scr_mngr.current = 'archieve'
|
#badge_text: "0"
|
||||||
badge_text: "0"
|
#NavigationDrawerIconButton:
|
||||||
on_press: app.refreshScreen(self)
|
#icon: 'email-open-outline'
|
||||||
NavigationDrawerIconButton:
|
#text: "Spam"
|
||||||
icon: 'email-open-outline'
|
#on_release: app.root.ids.scr_mngr.current = 'spam'
|
||||||
text: "Spam"
|
#badge_text: "0"
|
||||||
on_release: app.root.ids.scr_mngr.current = 'spam'
|
|
||||||
badge_text: "0"
|
|
||||||
on_press: app.refreshScreen(self)
|
|
||||||
NavigationDrawerIconButton:
|
NavigationDrawerIconButton:
|
||||||
id: trash_cnt
|
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: "0"
|
badge_text: "0"
|
||||||
on_press: app.refreshScreen(self)
|
|
||||||
NavigationDrawerIconButton:
|
NavigationDrawerIconButton:
|
||||||
id: allmail_cnt
|
id: allmail_cnt
|
||||||
text: "All Mails"
|
text: "All Mails"
|
||||||
icon:'contact-mail'
|
icon:'contact-mail'
|
||||||
on_release: app.root.ids.scr_mngr.current = 'allmails'
|
on_release: app.root.ids.scr_mngr.current = 'allmails'
|
||||||
badge_text: "0"
|
badge_text: "0"
|
||||||
on_press: app.refreshScreen(self)
|
on_press: app.load_screen(self)
|
||||||
NavigationDrawerDivider:
|
NavigationDrawerDivider:
|
||||||
NavigationDrawerSubheader:
|
NavigationDrawerSubheader:
|
||||||
text: "All labels"
|
text: "All labels"
|
||||||
|
@ -110,37 +107,30 @@
|
||||||
text: "Address Book"
|
text: "Address Book"
|
||||||
icon:'book-multiple'
|
icon:'book-multiple'
|
||||||
on_release: app.root.ids.scr_mngr.current = 'addressbook'
|
on_release: app.root.ids.scr_mngr.current = 'addressbook'
|
||||||
on_press: app.refreshScreen(self)
|
|
||||||
NavigationDrawerIconButton:
|
NavigationDrawerIconButton:
|
||||||
text: "Settings"
|
text: "Settings"
|
||||||
icon:'settings'
|
icon:'settings'
|
||||||
on_release: app.root.ids.scr_mngr.current = 'set'
|
on_release: app.root.ids.scr_mngr.current = 'set'
|
||||||
on_press: app.refreshScreen(self)
|
|
||||||
NavigationDrawerIconButton:
|
NavigationDrawerIconButton:
|
||||||
text: "Subscriptions/Payment"
|
text: "Subscriptions/Payment"
|
||||||
icon:'bell'
|
icon:'bell'
|
||||||
on_release: app.root.ids.scr_mngr.current = 'payment'
|
on_release: app.root.ids.scr_mngr.current = 'payment'
|
||||||
on_press: app.refreshScreen(self)
|
|
||||||
NavigationDrawerIconButton:
|
NavigationDrawerIconButton:
|
||||||
text: "Credits"
|
text: "Credits"
|
||||||
icon:'wallet'
|
icon:'wallet'
|
||||||
on_release: app.root.ids.scr_mngr.current = 'credits'
|
on_release: app.root.ids.scr_mngr.current = 'credits'
|
||||||
on_press: app.refreshScreen(self)
|
|
||||||
NavigationDrawerIconButton:
|
NavigationDrawerIconButton:
|
||||||
text: "new address"
|
text: "new address"
|
||||||
icon:'account-plus'
|
icon:'account-plus'
|
||||||
on_release: app.root.ids.scr_mngr.current = 'login'
|
on_release: app.root.ids.scr_mngr.current = 'login'
|
||||||
on_press: app.refreshScreen(self)
|
|
||||||
NavigationDrawerIconButton:
|
NavigationDrawerIconButton:
|
||||||
text: "Network Status"
|
text: "Network Status"
|
||||||
icon:'server-network'
|
icon:'server-network'
|
||||||
on_release: app.root.ids.scr_mngr.current = 'networkstat'
|
on_release: app.root.ids.scr_mngr.current = 'networkstat'
|
||||||
on_press: app.refreshScreen(self)
|
|
||||||
NavigationDrawerIconButton:
|
NavigationDrawerIconButton:
|
||||||
text: "My Addresses"
|
text: "My Addresses"
|
||||||
icon:'account-multiple'
|
icon:'account-multiple'
|
||||||
on_release: app.root.ids.scr_mngr.current = 'myaddress'
|
on_release: app.root.ids.scr_mngr.current = 'myaddress'
|
||||||
on_press: app.refreshScreen(self)
|
|
||||||
|
|
||||||
NavigationLayout:
|
NavigationLayout:
|
||||||
id: nav_layout
|
id: nav_layout
|
||||||
|
@ -148,6 +138,8 @@ NavigationLayout:
|
||||||
ContentNavigationDrawer:
|
ContentNavigationDrawer:
|
||||||
id: nav_drawer
|
id: nav_drawer
|
||||||
|
|
||||||
|
FloatLayout:
|
||||||
|
id: float_box
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
id: box_layout
|
id: box_layout
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
|
@ -178,7 +170,7 @@ NavigationLayout:
|
||||||
id:sc6
|
id:sc6
|
||||||
Random:
|
Random:
|
||||||
id:sc7
|
id:sc7
|
||||||
AddressSuccessful:
|
Spam:
|
||||||
id:sc8
|
id:sc8
|
||||||
Setting:
|
Setting:
|
||||||
id:sc9
|
id:sc9
|
||||||
|
@ -204,22 +196,29 @@ NavigationLayout:
|
||||||
id:sc19
|
id:sc19
|
||||||
Archieve:
|
Archieve:
|
||||||
id:sc20
|
id:sc20
|
||||||
Spam:
|
|
||||||
id:sc21
|
|
||||||
|
|
||||||
<Inbox>:
|
<Inbox>:
|
||||||
name: 'inbox'
|
name: 'inbox'
|
||||||
|
transition: NoTransition()
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
spacing: dp(10)
|
spacing: dp(10)
|
||||||
SearchBar:
|
SearchBar:
|
||||||
FloatLayout:
|
#FloatLayout:
|
||||||
MDScrollViewRefreshLayout:
|
# MDScrollViewRefreshLayout:
|
||||||
id: refresh_layout
|
# id: refresh_layout
|
||||||
refresh_callback: root.refresh_callback
|
# refresh_callback: root.refresh_callback
|
||||||
root_layout: root
|
# root_layout: root.set_root_layout()
|
||||||
|
# MDList:
|
||||||
|
# id: ml
|
||||||
|
BoxLayout:
|
||||||
|
orientation:'vertical'
|
||||||
|
ScrollView:
|
||||||
|
id: scroll_y
|
||||||
|
do_scroll_x: False
|
||||||
MDList:
|
MDList:
|
||||||
id: ml
|
id: ml
|
||||||
|
Loader:
|
||||||
ComposerButton:
|
ComposerButton:
|
||||||
|
|
||||||
<Sent>:
|
<Sent>:
|
||||||
|
@ -230,22 +229,27 @@ NavigationLayout:
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
orientation:'vertical'
|
orientation:'vertical'
|
||||||
ScrollView:
|
ScrollView:
|
||||||
|
id: scroll_y
|
||||||
do_scroll_x: False
|
do_scroll_x: False
|
||||||
MDList:
|
MDList:
|
||||||
id: ml
|
id: ml
|
||||||
|
Loader:
|
||||||
ComposerButton:
|
ComposerButton:
|
||||||
|
|
||||||
<Trash>:
|
<Trash>:
|
||||||
name: 'trash'
|
name: 'trash'
|
||||||
ScrollView:
|
ScrollView:
|
||||||
|
id: scroll_y
|
||||||
do_scroll_x: False
|
do_scroll_x: False
|
||||||
MDList:
|
MDList:
|
||||||
id: ml
|
id: ml
|
||||||
|
Loader:
|
||||||
ComposerButton:
|
ComposerButton:
|
||||||
|
|
||||||
<Draft>:
|
<Draft>:
|
||||||
name: 'draft'
|
name: 'draft'
|
||||||
ScrollView:
|
ScrollView:
|
||||||
|
id: scroll_y
|
||||||
do_scroll_x: False
|
do_scroll_x: False
|
||||||
MDList:
|
MDList:
|
||||||
id: ml
|
id: ml
|
||||||
|
@ -277,13 +281,21 @@ NavigationLayout:
|
||||||
|
|
||||||
<Allmails>:
|
<Allmails>:
|
||||||
name: 'allmails'
|
name: 'allmails'
|
||||||
FloatLayout:
|
#FloatLayout:
|
||||||
MDScrollViewRefreshLayout:
|
# MDScrollViewRefreshLayout:
|
||||||
id: refresh_layout
|
# id: refresh_layout
|
||||||
refresh_callback: root.refresh_callback
|
# refresh_callback: root.refresh_callback
|
||||||
root_layout: root
|
# root_layout: root.set_root_layout()
|
||||||
|
# MDList:
|
||||||
|
# id: ml
|
||||||
|
BoxLayout:
|
||||||
|
orientation:'vertical'
|
||||||
|
ScrollView:
|
||||||
|
id: scroll_y
|
||||||
|
do_scroll_x: False
|
||||||
MDList:
|
MDList:
|
||||||
id: ml
|
id: ml
|
||||||
|
Loader:
|
||||||
ComposerButton:
|
ComposerButton:
|
||||||
|
|
||||||
<Test>:
|
<Test>:
|
||||||
|
@ -300,6 +312,7 @@ NavigationLayout:
|
||||||
|
|
||||||
<Create>:
|
<Create>:
|
||||||
name: 'create'
|
name: 'create'
|
||||||
|
Loader:
|
||||||
|
|
||||||
<Credits>:
|
<Credits>:
|
||||||
name: 'credits'
|
name: 'credits'
|
||||||
|
@ -369,7 +382,8 @@ NavigationLayout:
|
||||||
size_hint_y: None
|
size_hint_y: None
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
height: self.parent.height/2
|
height: self.parent.height/2
|
||||||
hint_text: 'type or search recipients address starting with BM-'
|
#hint_text: 'type or search recipients address starting with BM-'
|
||||||
|
hint_text: 'type, select or scan QR code for recipients address'
|
||||||
RV:
|
RV:
|
||||||
id: rv
|
id: rv
|
||||||
MDTextField:
|
MDTextField:
|
||||||
|
@ -484,6 +498,7 @@ NavigationLayout:
|
||||||
size_hint: .5, .35
|
size_hint: .5, .35
|
||||||
height: dp(40)
|
height: dp(40)
|
||||||
on_press: app.root.ids.scr_mngr.current = 'random'
|
on_press: app.root.ids.scr_mngr.current = 'random'
|
||||||
|
on_press: app.root.ids.sc7.reset_address_label()
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'Title'
|
||||||
text: 'proceed'
|
text: 'proceed'
|
||||||
|
@ -522,6 +537,7 @@ NavigationLayout:
|
||||||
hint_text: "Label"
|
hint_text: "Label"
|
||||||
required: True
|
required: True
|
||||||
helper_text_mode: "on_error"
|
helper_text_mode: "on_error"
|
||||||
|
on_text: root.add_validation(self)
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
AnchorLayout:
|
AnchorLayout:
|
||||||
MDRaisedButton:
|
MDRaisedButton:
|
||||||
|
@ -536,12 +552,6 @@ NavigationLayout:
|
||||||
color: (1,1,1,1)
|
color: (1,1,1,1)
|
||||||
halign: 'center'
|
halign: 'center'
|
||||||
|
|
||||||
<AddressSuccessful>:
|
|
||||||
name: 'add_sucess'
|
|
||||||
Label:
|
|
||||||
text: 'Successfully created a new bit address'
|
|
||||||
color: 0,0,0,1
|
|
||||||
|
|
||||||
<Setting>:
|
<Setting>:
|
||||||
name: 'set'
|
name: 'set'
|
||||||
ScrollView:
|
ScrollView:
|
||||||
|
@ -622,9 +632,10 @@ NavigationLayout:
|
||||||
MDScrollViewRefreshLayout:
|
MDScrollViewRefreshLayout:
|
||||||
id: refresh_layout
|
id: refresh_layout
|
||||||
refresh_callback: root.refresh_callback
|
refresh_callback: root.refresh_callback
|
||||||
root_layout: root
|
root_layout: root.set_root_layout()
|
||||||
MDList:
|
MDList:
|
||||||
id: ml
|
id: ml
|
||||||
|
Loader:
|
||||||
ComposerButton:
|
ComposerButton:
|
||||||
|
|
||||||
<AddressBook>:
|
<AddressBook>:
|
||||||
|
@ -635,9 +646,11 @@ NavigationLayout:
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
orientation:'vertical'
|
orientation:'vertical'
|
||||||
ScrollView:
|
ScrollView:
|
||||||
|
id: scroll_y
|
||||||
do_scroll_x: False
|
do_scroll_x: False
|
||||||
MDList:
|
MDList:
|
||||||
id: ml
|
id: ml
|
||||||
|
Loader:
|
||||||
ComposerButton:
|
ComposerButton:
|
||||||
|
|
||||||
<Payment>:
|
<Payment>:
|
||||||
|
@ -646,7 +659,7 @@ NavigationLayout:
|
||||||
do_scroll_x: False
|
do_scroll_x: False
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
padding: [dp(app.window_size[0]/16 if app.window_size[0] <= 720 else app.window_size[0]/4*1.1), dp(10)]
|
padding: [dp(app.window_size[0]/16 if app.window_size[0] <= 720 else app.window_size[0]/6 if app.window_size[0] <= 800 else app.window_size[0]/18), dp(10)]
|
||||||
spacing: 12
|
spacing: 12
|
||||||
size_hint_y: None
|
size_hint_y: None
|
||||||
height: self.minimum_height + dp(app.window_size[1]) if app.window_size[1] > app.window_size[0] else dp(app.window_size[0])
|
height: self.minimum_height + dp(app.window_size[1]) if app.window_size[1] > app.window_size[0] else dp(app.window_size[0])
|
||||||
|
@ -810,6 +823,7 @@ NavigationLayout:
|
||||||
hint_text: "Label"
|
hint_text: "Label"
|
||||||
required: True
|
required: True
|
||||||
helper_text_mode: "on_error"
|
helper_text_mode: "on_error"
|
||||||
|
on_text: root.checkLabel_valid(self)
|
||||||
MDTextField:
|
MDTextField:
|
||||||
id: address
|
id: address
|
||||||
hint_text: "Address"
|
hint_text: "Address"
|
||||||
|
@ -987,6 +1001,7 @@ NavigationLayout:
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
size_hint_y: None
|
size_hint_y: None
|
||||||
height: dp(100) + self.minimum_height
|
height: dp(100) + self.minimum_height
|
||||||
|
Loader:
|
||||||
|
|
||||||
<CopyTextBtn@Button>:
|
<CopyTextBtn@Button>:
|
||||||
id: cpyButton
|
id: cpyButton
|
||||||
|
@ -1129,6 +1144,7 @@ NavigationLayout:
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
required: True
|
required: True
|
||||||
helper_text_mode: "on_error"
|
helper_text_mode: "on_error"
|
||||||
|
on_text: root.checkLabel_valid(self)
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'Title'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
|
@ -1136,6 +1152,7 @@ NavigationLayout:
|
||||||
font_size: '17sp'
|
font_size: '17sp'
|
||||||
halign: 'left'
|
halign: 'left'
|
||||||
MDLabel:
|
MDLabel:
|
||||||
|
id: address
|
||||||
font_style: 'Subhead'
|
font_style: 'Subhead'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: root.address
|
text: root.address
|
||||||
|
@ -1204,3 +1221,25 @@ NavigationLayout:
|
||||||
id: search_field
|
id: search_field
|
||||||
hint_text: 'Search'
|
hint_text: 'Search'
|
||||||
on_text: app.searchQuery(self)
|
on_text: app.searchQuery(self)
|
||||||
|
|
||||||
|
|
||||||
|
<LoadingPopup>:
|
||||||
|
separator_color: 1, 1, 1, 1
|
||||||
|
background: "White.png"
|
||||||
|
Button:
|
||||||
|
id: btn
|
||||||
|
disabled: True
|
||||||
|
background_disabled_normal: "White.png"
|
||||||
|
Image:
|
||||||
|
source: './images/loader.zip'
|
||||||
|
anim_delay: 0
|
||||||
|
#mipmap: True
|
||||||
|
size: root.size
|
||||||
|
|
||||||
|
|
||||||
|
<Loader@MDSpinner>:
|
||||||
|
id: spinner
|
||||||
|
size_hint: None, None
|
||||||
|
size: dp(46), dp(46)
|
||||||
|
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
|
||||||
|
active: False
|
|
@ -1,12 +1,12 @@
|
||||||
"""
|
"""
|
||||||
src/bitmessagekivy/mpybit.py
|
Bitmessage android(mobile) interface
|
||||||
=================================
|
|
||||||
"""
|
"""
|
||||||
# pylint: disable=relative-import, unused-variable, import-error, no-name-in-module, too-many-lines
|
# pylint: disable=relative-import, import-error, no-name-in-module
|
||||||
|
# pylint: disable=too-few-public-methods, too-many-lines, unused-argument
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from functools import partial
|
|
||||||
from bmconfigparser import BMConfigParser
|
from bmconfigparser import BMConfigParser
|
||||||
|
from functools import partial
|
||||||
from helper_sql import sqlExecute, sqlQuery
|
from helper_sql import sqlExecute, sqlQuery
|
||||||
from kivy.app import App
|
from kivy.app import App
|
||||||
from kivy.clock import Clock
|
from kivy.clock import Clock
|
||||||
|
@ -36,6 +36,7 @@ from kivy.uix.screenmanager import Screen
|
||||||
from kivy.uix.spinner import Spinner
|
from kivy.uix.spinner import Spinner
|
||||||
from kivy.uix.textinput import TextInput
|
from kivy.uix.textinput import TextInput
|
||||||
from kivy.utils import platform
|
from kivy.utils import platform
|
||||||
|
|
||||||
import kivy_helper_search
|
import kivy_helper_search
|
||||||
from kivymd.button import MDIconButton
|
from kivymd.button import MDIconButton
|
||||||
from kivymd.dialog import MDDialog
|
from kivymd.dialog import MDDialog
|
||||||
|
@ -53,17 +54,19 @@ from kivymd.navigationdrawer import (
|
||||||
)
|
)
|
||||||
from kivymd.selectioncontrols import MDCheckbox
|
from kivymd.selectioncontrols import MDCheckbox
|
||||||
from kivymd.theming import ThemeManager
|
from kivymd.theming import ThemeManager
|
||||||
|
|
||||||
import queues
|
import queues
|
||||||
from semaphores import kivyuisignaler
|
from semaphores import kivyuisignaler
|
||||||
|
|
||||||
import state
|
import state
|
||||||
from uikivysignaler import UIkivySignaler
|
from uikivysignaler import UIkivySignaler
|
||||||
|
|
||||||
import identiconGeneration
|
import identiconGeneration
|
||||||
# pylint: disable=unused-argument, too-few-public-methods
|
from addresses import addBMIfNotPresent, decodeAddress
|
||||||
|
|
||||||
|
|
||||||
def toast(text):
|
def toast(text):
|
||||||
"""Method will display the toast message."""
|
"""Function displays toast message"""
|
||||||
# pylint: disable=redefined-outer-name
|
# pylint: disable=redefined-outer-name
|
||||||
from kivymd.toast.kivytoast import toast
|
from kivymd.toast.kivytoast import toast
|
||||||
toast(text)
|
toast(text)
|
||||||
|
@ -71,8 +74,7 @@ def toast(text):
|
||||||
|
|
||||||
|
|
||||||
class Navigatorss(MDNavigationDrawer):
|
class Navigatorss(MDNavigationDrawer):
|
||||||
"""Navigators class contains image, title and logo."""
|
"""Navigator class (image, title and logo)"""
|
||||||
|
|
||||||
image_source = StringProperty('images/qidenticon_two.png')
|
image_source = StringProperty('images/qidenticon_two.png')
|
||||||
title = StringProperty('Navigation')
|
title = StringProperty('Navigation')
|
||||||
drawer_logo = StringProperty()
|
drawer_logo = StringProperty()
|
||||||
|
@ -80,80 +82,54 @@ 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."""
|
||||||
|
queryreturn = ListProperty()
|
||||||
|
has_refreshed = True
|
||||||
|
account = StringProperty()
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""Method Parsing the address."""
|
"""Method Parsing the address."""
|
||||||
super(Inbox, self).__init__(*args, **kwargs)
|
super(Inbox, self).__init__(*args, **kwargs)
|
||||||
|
Clock.schedule_once(self.init_ui, 0)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def set_defaultAddress():
|
||||||
|
"""This method set default address"""
|
||||||
if state.association == '':
|
if state.association == '':
|
||||||
if BMConfigParser().addresses():
|
if BMConfigParser().addresses():
|
||||||
state.association = BMConfigParser().addresses()[0]
|
state.association = BMConfigParser().addresses()[0]
|
||||||
Clock.schedule_once(self.init_ui, 0)
|
|
||||||
|
|
||||||
def init_ui(self, dt=0):
|
def init_ui(self, dt=0):
|
||||||
"""Clock Schdule for method inbox accounts."""
|
"""Clock schdule for method inbox accounts."""
|
||||||
self.inboxaccounts()
|
self.loadMessagelist()
|
||||||
print dt
|
|
||||||
|
|
||||||
def inboxaccounts(self):
|
def loadMessagelist(self, where="", what=""):
|
||||||
"""Load inbox accounts."""
|
|
||||||
account = state.association
|
|
||||||
self.loadMessagelist(account, 'All', '')
|
|
||||||
|
|
||||||
def loadMessagelist(self, account, where="", what=""):
|
|
||||||
"""Load Inbox list for Inbox messages."""
|
"""Load Inbox list for Inbox messages."""
|
||||||
# pylint: disable=too-many-locals
|
# pylint: disable=too-many-locals
|
||||||
|
self.set_defaultAddress()
|
||||||
|
self.account = state.association
|
||||||
if state.searcing_text:
|
if state.searcing_text:
|
||||||
|
self.children[2].children[0].children[0].scroll_y = 1.0
|
||||||
where = ['subject', 'message']
|
where = ['subject', 'message']
|
||||||
what = state.searcing_text
|
what = state.searcing_text
|
||||||
xAddress = 'toaddress'
|
xAddress = 'toaddress'
|
||||||
data = []
|
data = []
|
||||||
queryreturn = kivy_helper_search.search_sql(
|
self.inboxDataQuery(xAddress, where, what)
|
||||||
xAddress, account, "inbox", where, what, False)
|
if self.queryreturn:
|
||||||
if queryreturn:
|
state.kivyapp.get_inbox_count()
|
||||||
src_mng_obj = state.kivyapp.root.children[2].children[0].ids
|
src_mng_obj = state.kivyapp.root.children[2].children[0].ids
|
||||||
src_mng_obj.inbox_cnt.badge_text = str(len(queryreturn))
|
src_mng_obj.inbox_cnt.badge_text = state.inbox_count
|
||||||
state.inbox_count = str(len(queryreturn))
|
for mail in self.queryreturn:
|
||||||
state.kivyapp.root.ids.sc17.clear_widgets()
|
# third_text = mail[3].replace('\n', ' ')
|
||||||
state.kivyapp.root.ids.sc17.add_widget(Allmails())
|
|
||||||
for mail in queryreturn:
|
|
||||||
third_text = mail[3].replace('\n', ' ')
|
|
||||||
data.append({
|
data.append({
|
||||||
'text': mail[4].strip(),
|
'text': mail[4].strip(),
|
||||||
'secondary_text': mail[5][:50] + '........' if len(
|
'secondary_text': mail[5][:50] + '........' if len(
|
||||||
mail[5]) >= 50 else (
|
mail[5]) >= 50 else (mail[5] + ',' + mail[3].replace(
|
||||||
mail[5] + ',' + mail[3].replace('\n', ''))[0:50] + '........',
|
'\n', ''))[0:50] + '........',
|
||||||
'msgid': mail[1]})
|
'msgid': mail[1]})
|
||||||
for item in data:
|
self.has_refreshed = True
|
||||||
meny = TwoLineAvatarIconListItem(
|
self.set_mdList(data)
|
||||||
text=item['text'],
|
self.children[2].children[0].children[0].bind(
|
||||||
secondary_text=item['secondary_text'],
|
scroll_y=self.check_scroll_y)
|
||||||
theme_text_color='Custom',
|
|
||||||
text_color=NavigateApp().theme_cls.primary_color)
|
|
||||||
meny.add_widget(AvatarSampleWidget(
|
|
||||||
source='./images/text_images/{}.png'.format(
|
|
||||||
avatarImageFirstLetter(item['secondary_text'].strip()))))
|
|
||||||
meny.bind(on_press=partial(
|
|
||||||
self.inbox_detail, item['msgid']))
|
|
||||||
carousel = Carousel(direction='right')
|
|
||||||
carousel.height = meny.height
|
|
||||||
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_normal = ''
|
|
||||||
del_btn.background_color = (1, 0, 0, 1)
|
|
||||||
del_btn.bind(on_press=partial(
|
|
||||||
self.delete, item['msgid']))
|
|
||||||
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['msgid']))
|
|
||||||
carousel.add_widget(ach_btn)
|
|
||||||
carousel.index = 1
|
|
||||||
self.ids.ml.add_widget(carousel)
|
|
||||||
else:
|
else:
|
||||||
content = MDLabel(
|
content = MDLabel(
|
||||||
font_style='Body1',
|
font_style='Body1',
|
||||||
|
@ -166,8 +142,90 @@ class Inbox(Screen):
|
||||||
valign='top')
|
valign='top')
|
||||||
self.ids.ml.add_widget(content)
|
self.ids.ml.add_widget(content)
|
||||||
|
|
||||||
|
# pylint: disable=too-many-arguments
|
||||||
|
def inboxDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
||||||
|
"""This method used for retrieving inbox data"""
|
||||||
|
self.queryreturn = kivy_helper_search.search_sql(
|
||||||
|
xAddress,
|
||||||
|
self.account,
|
||||||
|
"inbox",
|
||||||
|
where,
|
||||||
|
what,
|
||||||
|
False,
|
||||||
|
start_indx,
|
||||||
|
end_indx)
|
||||||
|
|
||||||
|
def set_mdList(self, data):
|
||||||
|
"""This method is used to create the mdList"""
|
||||||
|
total_message = len(self.ids.ml.children)
|
||||||
|
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/text_images/{}.png'.format(
|
||||||
|
avatarImageFirstLetter(
|
||||||
|
item['secondary_text'].strip()))))
|
||||||
|
meny.bind(
|
||||||
|
on_press=partial(
|
||||||
|
self.inbox_detail, item['msgid']))
|
||||||
|
carousel = Carousel(direction='right')
|
||||||
|
carousel.height = meny.height
|
||||||
|
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_normal = ''
|
||||||
|
del_btn.background_color = (1, 0, 0, 1)
|
||||||
|
del_btn.bind(
|
||||||
|
on_press=partial(
|
||||||
|
self.delete, item['msgid']))
|
||||||
|
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['msgid']))
|
||||||
|
carousel.add_widget(ach_btn)
|
||||||
|
carousel.index = 1
|
||||||
|
self.ids.ml.add_widget(carousel)
|
||||||
|
update_message = len(self.ids.ml.children)
|
||||||
|
self.has_refreshed = True if total_message != update_message else False
|
||||||
|
|
||||||
|
def check_scroll_y(self, instance, somethingelse):
|
||||||
|
"""This method is used to load data on scroll"""
|
||||||
|
if self.children[2].children[0].children[
|
||||||
|
0].scroll_y <= -0.0 and self.has_refreshed:
|
||||||
|
self.children[2].children[0].children[0].scroll_y = 0.06
|
||||||
|
total_message = len(self.ids.ml.children)
|
||||||
|
self.update_inbox_screen_on_scroll(total_message)
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def update_inbox_screen_on_scroll(self, total_message, where="", what=""):
|
||||||
|
"""This method is used to load more data on scroll down"""
|
||||||
|
data = []
|
||||||
|
if state.searcing_text:
|
||||||
|
where = ['subject', 'message']
|
||||||
|
what = state.searcing_text
|
||||||
|
self.inboxDataQuery('toaddress', where, what, total_message, 5)
|
||||||
|
for mail in self.queryreturn:
|
||||||
|
# third_text = mail[3].replace('\n', ' ')
|
||||||
|
data.append({
|
||||||
|
'text': mail[4].strip(),
|
||||||
|
'secondary_text': mail[5][:50] + '........' if len(
|
||||||
|
mail[5]) >= 50 else (mail[5] + ',' + mail[3].replace(
|
||||||
|
'\n', ''))[0:50] + '........',
|
||||||
|
'msgid': mail[1]})
|
||||||
|
self.set_mdList(data)
|
||||||
|
|
||||||
def inbox_detail(self, msg_id, *args):
|
def inbox_detail(self, msg_id, *args):
|
||||||
"""Load inbox page details."""
|
"""Load inbox page details"""
|
||||||
state.detailPageType = 'inbox'
|
state.detailPageType = 'inbox'
|
||||||
state.mail_id = msg_id
|
state.mail_id = msg_id
|
||||||
if self.manager:
|
if self.manager:
|
||||||
|
@ -179,14 +237,17 @@ class Inbox(Screen):
|
||||||
src_mng_obj.current = 'mailDetail'
|
src_mng_obj.current = 'mailDetail'
|
||||||
|
|
||||||
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"""
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
"UPDATE inbox SET folder = 'trash' WHERE msgid = ?;", str(
|
"UPDATE inbox SET folder = 'trash' WHERE msgid = ?;", str(
|
||||||
data_index))
|
data_index))
|
||||||
try:
|
try:
|
||||||
msg_count_objs = self.parent.parent.parent.parent.children[2].children[0].ids
|
msg_count_objs = (
|
||||||
|
self.parent.parent.parent.parent.children[2].children[0].ids)
|
||||||
except Exception:
|
except Exception:
|
||||||
msg_count_objs = self.parent.parent.parent.parent.parent.children[2].children[0].ids
|
msg_count_objs = (
|
||||||
|
self.parent.parent.parent.parent.parent.children[
|
||||||
|
2].children[0].ids)
|
||||||
if int(state.inbox_count) > 0:
|
if int(state.inbox_count) > 0:
|
||||||
msg_count_objs.inbox_cnt.badge_text = str(
|
msg_count_objs.inbox_cnt.badge_text = str(
|
||||||
int(state.inbox_count) - 1)
|
int(state.inbox_count) - 1)
|
||||||
|
@ -206,7 +267,7 @@ class Inbox(Screen):
|
||||||
self.update_trash()
|
self.update_trash()
|
||||||
|
|
||||||
def archive(self, data_index, instance, *args):
|
def archive(self, data_index, instance, *args):
|
||||||
"""Archive inbox mail from inbox listing."""
|
"""Archive inbox mail from inbox listing"""
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
"UPDATE inbox SET folder = 'trash' WHERE msgid = ?;", str(
|
"UPDATE inbox SET folder = 'trash' WHERE msgid = ?;", str(
|
||||||
data_index))
|
data_index))
|
||||||
|
@ -214,7 +275,7 @@ class Inbox(Screen):
|
||||||
self.update_trash()
|
self.update_trash()
|
||||||
|
|
||||||
def update_trash(self):
|
def update_trash(self):
|
||||||
"""Update trash screen mails which is deleted from inbox."""
|
"""Update trash screen mails which is deleted from inbox"""
|
||||||
try:
|
try:
|
||||||
self.parent.screens[4].clear_widgets()
|
self.parent.screens[4].clear_widgets()
|
||||||
self.parent.screens[4].add_widget(Trash())
|
self.parent.screens[4].add_widget(Trash())
|
||||||
|
@ -224,53 +285,51 @@ class Inbox(Screen):
|
||||||
|
|
||||||
# pylint: disable=attribute-defined-outside-init
|
# pylint: disable=attribute-defined-outside-init
|
||||||
def refresh_callback(self, *args):
|
def refresh_callback(self, *args):
|
||||||
"""Method updates the state of application, While the spinner remains on the screen."""
|
"""Method updates the state of application,
|
||||||
|
While the spinner remains on the screen"""
|
||||||
def refresh_callback(interval):
|
def refresh_callback(interval):
|
||||||
"""Method used for loading the inbox screen data."""
|
"""Method used for loading the inbox screen data"""
|
||||||
state.searcing_text = ''
|
state.searcing_text = ''
|
||||||
self.children[2].children[1].ids.search_field.text = ''
|
self.children[2].children[1].ids.search_field.text = ''
|
||||||
self.ids.ml.clear_widgets()
|
self.ids.ml.clear_widgets()
|
||||||
self.loadMessagelist(state.association)
|
self.loadMessagelist(state.association)
|
||||||
|
self.has_refreshed = True
|
||||||
self.ids.refresh_layout.refresh_done()
|
self.ids.refresh_layout.refresh_done()
|
||||||
self.tick = 0
|
self.tick = 0
|
||||||
|
|
||||||
Clock.schedule_once(refresh_callback, 1)
|
Clock.schedule_once(refresh_callback, 1)
|
||||||
|
|
||||||
|
# def set_root_layout(self):
|
||||||
|
# """Setting root layout"""
|
||||||
|
# return self.parent.parent.parent
|
||||||
|
|
||||||
|
|
||||||
class MyAddress(Screen):
|
class MyAddress(Screen):
|
||||||
"""MyAddress Screen uses screen to show widgets of screens."""
|
"""MyAddress screen uses screen to show widgets of screens."""
|
||||||
|
addresses_list = ListProperty()
|
||||||
|
has_refreshed = True
|
||||||
|
is_add_created = False
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""Clock Schdule for method inbox accounts."""
|
"""Clock schdule for method Myaddress accounts."""
|
||||||
super(MyAddress, self).__init__(*args, **kwargs)
|
super(MyAddress, 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 inbox accounts."""
|
"""Clock schdule for method Myaddress accounts"""
|
||||||
# pylint: disable=unnecessary-lambda, deprecated-lambda
|
# pylint: disable=unnecessary-lambda, deprecated-lambda
|
||||||
addresses_list = state.kivyapp.variable_1
|
self.addresses_list = state.kivyapp.variable_1
|
||||||
if state.searcing_text:
|
if state.searcing_text:
|
||||||
|
self.ids.refresh_layout.scroll_y = 1.0
|
||||||
filtered_list = filter(
|
filtered_list = filter(
|
||||||
lambda addr: self.filter_address(
|
lambda addr: self.filter_address(
|
||||||
addr), BMConfigParser().addresses())
|
addr), BMConfigParser().addresses())
|
||||||
addresses_list = filtered_list
|
self.addresses_list = filtered_list
|
||||||
if addresses_list:
|
self.addresses_list = [obj for obj in reversed(self.addresses_list)]
|
||||||
data = []
|
if self.addresses_list:
|
||||||
for address in addresses_list:
|
self.has_refreshed = True
|
||||||
data.append({
|
self.set_mdList(0, 15)
|
||||||
'text': BMConfigParser().get(address, 'label'),
|
self.ids.refresh_layout.bind(scroll_y=self.check_scroll_y)
|
||||||
'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/text_images/{}.png'.format(avatarImageFirstLetter(item['text'].strip()))))
|
|
||||||
meny.bind(on_press=partial(
|
|
||||||
self.myadd_detail, item['secondary_text'], item['text']))
|
|
||||||
self.ids.ml.add_widget(meny)
|
|
||||||
else:
|
else:
|
||||||
content = MDLabel(
|
content = MDLabel(
|
||||||
font_style='Body1',
|
font_style='Body1',
|
||||||
|
@ -282,26 +341,65 @@ class MyAddress(Screen):
|
||||||
size_hint_y=None,
|
size_hint_y=None,
|
||||||
valign='top')
|
valign='top')
|
||||||
self.ids.ml.add_widget(content)
|
self.ids.ml.add_widget(content)
|
||||||
if not state.searcing_text:
|
if not state.searcing_text and not self.is_add_created:
|
||||||
try:
|
try:
|
||||||
self.manager.current = 'login'
|
self.manager.current = 'login'
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def set_mdList(self, first_index, last_index):
|
||||||
|
"""Creating the mdlist"""
|
||||||
|
data = []
|
||||||
|
for address in self.addresses_list[first_index:last_index]:
|
||||||
|
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/text_images/{}.png'.format(
|
||||||
|
avatarImageFirstLetter(item['text'].strip()))))
|
||||||
|
meny.bind(on_press=partial(
|
||||||
|
self.myadd_detail, item['secondary_text'], item['text']))
|
||||||
|
self.ids.ml.add_widget(meny)
|
||||||
|
|
||||||
|
def check_scroll_y(self, instance, somethingelse):
|
||||||
|
"""Load data on scroll down"""
|
||||||
|
if self.ids.refresh_layout.scroll_y <= -0.0 and self.has_refreshed:
|
||||||
|
self.ids.refresh_layout.scroll_y = 0.06
|
||||||
|
my_addresses = len(self.ids.ml.children)
|
||||||
|
if my_addresses != len(self.addresses_list):
|
||||||
|
self.update_addressBook_on_scroll(my_addresses)
|
||||||
|
self.has_refreshed = True if my_addresses != len(
|
||||||
|
self.addresses_list) else False
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def update_addressBook_on_scroll(self, my_addresses):
|
||||||
|
"""Loads more data on scroll down"""
|
||||||
|
self.set_mdList(my_addresses, my_addresses + 20)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def myadd_detail(fromaddress, label, *args):
|
def myadd_detail(fromaddress, label, *args):
|
||||||
"""Myaddress Details."""
|
"""Load myaddresses details"""
|
||||||
p = MyaddDetailPopup()
|
p = MyaddDetailPopup()
|
||||||
p.open()
|
p.open()
|
||||||
p.set_address(fromaddress, label)
|
p.set_address(fromaddress, label)
|
||||||
|
|
||||||
# pylint: disable=attribute-defined-outside-init
|
# pylint: disable=attribute-defined-outside-init
|
||||||
def refresh_callback(self, *args):
|
def refresh_callback(self, *args):
|
||||||
"""Method updates the state of application, While the spinner remains on the screen."""
|
"""Method updates the state of application,
|
||||||
|
While the spinner remains on the screen"""
|
||||||
def refresh_callback(interval):
|
def refresh_callback(interval):
|
||||||
"""Method used for loading the myaddress screen data."""
|
"""Method used for loading the myaddress screen data"""
|
||||||
state.searcing_text = ''
|
state.searcing_text = ''
|
||||||
|
state.kivyapp.root.ids.sc10.children[2].active = False
|
||||||
self.children[2].children[1].ids.search_field.text = ''
|
self.children[2].children[1].ids.search_field.text = ''
|
||||||
|
self.has_refreshed = True
|
||||||
self.ids.ml.clear_widgets()
|
self.ids.ml.clear_widgets()
|
||||||
self.init_ui()
|
self.init_ui()
|
||||||
self.ids.refresh_layout.refresh_done()
|
self.ids.refresh_layout.refresh_done()
|
||||||
|
@ -310,7 +408,7 @@ class MyAddress(Screen):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def filter_address(address):
|
def filter_address(address):
|
||||||
"""Method will filter the my address list data."""
|
"""Method will filter the my address list data"""
|
||||||
# pylint: disable=deprecated-lambda
|
# pylint: disable=deprecated-lambda
|
||||||
if filter(lambda x: (state.searcing_text).lower() in x, [
|
if filter(lambda x: (state.searcing_text).lower() in x, [
|
||||||
BMConfigParser().get(
|
BMConfigParser().get(
|
||||||
|
@ -318,37 +416,63 @@ class MyAddress(Screen):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def set_root_layout(self):
|
||||||
|
"""Setting root layout"""
|
||||||
|
return self.manager.parent.parent
|
||||||
|
|
||||||
|
|
||||||
class AddressBook(Screen):
|
class AddressBook(Screen):
|
||||||
"""AddressBook Screen uses screen to show widgets of screens."""
|
"""AddressBook Screen uses screen to show widgets of screens"""
|
||||||
|
queryreturn = ListProperty()
|
||||||
|
has_refreshed = True
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""Getting AddressBook Details."""
|
"""Getting AddressBook Details"""
|
||||||
super(AddressBook, self).__init__(*args, **kwargs)
|
super(AddressBook, 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 AddressBook."""
|
"""Clock Schdule for method AddressBook"""
|
||||||
self.loadAddresslist(None, 'All', '')
|
self.loadAddresslist(None, 'All', '')
|
||||||
print dt
|
print dt
|
||||||
|
|
||||||
def loadAddresslist(self, account, where="", what=""):
|
def loadAddresslist(self, account, where="", what=""):
|
||||||
"""Clock Schdule for method AddressBook."""
|
"""Clock Schdule for method AddressBook"""
|
||||||
if state.searcing_text:
|
if state.searcing_text:
|
||||||
|
self.ids.scroll_y.scroll_y = 1.0
|
||||||
where = ['label', 'address']
|
where = ['label', 'address']
|
||||||
what = state.searcing_text
|
what = state.searcing_text
|
||||||
xAddress = ''
|
xAddress = ''
|
||||||
queryreturn = kivy_helper_search.search_sql(
|
self.queryreturn = kivy_helper_search.search_sql(
|
||||||
xAddress, account, "addressbook", where, what, False)
|
xAddress, account, "addressbook", where, what, False)
|
||||||
if queryreturn:
|
self.queryreturn = [obj for obj in reversed(self.queryreturn)]
|
||||||
for item in queryreturn:
|
if self.queryreturn:
|
||||||
|
self.has_refreshed = True
|
||||||
|
self.set_mdList(0, 20)
|
||||||
|
self.ids.scroll_y.bind(scroll_y=self.check_scroll_y)
|
||||||
|
else:
|
||||||
|
content = MDLabel(
|
||||||
|
font_style='Body1',
|
||||||
|
theme_text_color='Primary',
|
||||||
|
text="No contact found!" if state.searcing_text
|
||||||
|
else "No contact found yet...... ",
|
||||||
|
halign='center',
|
||||||
|
bold=True,
|
||||||
|
size_hint_y=None,
|
||||||
|
valign='top')
|
||||||
|
self.ids.ml.add_widget(content)
|
||||||
|
|
||||||
|
def set_mdList(self, start_index, end_index):
|
||||||
|
"""Creating the mdList"""
|
||||||
|
for item in self.queryreturn[start_index:end_index]:
|
||||||
meny = TwoLineAvatarIconListItem(
|
meny = TwoLineAvatarIconListItem(
|
||||||
text=item[0],
|
text=item[0],
|
||||||
secondary_text=item[1],
|
secondary_text=item[1],
|
||||||
theme_text_color='Custom',
|
theme_text_color='Custom',
|
||||||
text_color=NavigateApp().theme_cls.primary_color)
|
text_color=NavigateApp().theme_cls.primary_color)
|
||||||
meny.add_widget(AvatarSampleWidget(
|
meny.add_widget(AvatarSampleWidget(
|
||||||
source='./images/text_images/{}.png'.format(avatarImageFirstLetter(item[0].strip()))))
|
source='./images/text_images/{}.png'.format(
|
||||||
|
avatarImageFirstLetter(item[0].strip()))))
|
||||||
meny.bind(on_press=partial(
|
meny.bind(on_press=partial(
|
||||||
self.addBook_detail, item[1], item[0]))
|
self.addBook_detail, item[1], item[0]))
|
||||||
carousel = Carousel(direction='right')
|
carousel = Carousel(direction='right')
|
||||||
|
@ -365,69 +489,73 @@ class AddressBook(Screen):
|
||||||
carousel.add_widget(meny)
|
carousel.add_widget(meny)
|
||||||
carousel.index = 1
|
carousel.index = 1
|
||||||
self.ids.ml.add_widget(carousel)
|
self.ids.ml.add_widget(carousel)
|
||||||
|
|
||||||
|
def check_scroll_y(self, instance, somethingelse):
|
||||||
|
"""Load data on scroll"""
|
||||||
|
if self.ids.scroll_y.scroll_y <= -0.0 and self.has_refreshed:
|
||||||
|
self.ids.scroll_y.scroll_y = 0.06
|
||||||
|
exist_addresses = len(self.ids.ml.children)
|
||||||
|
if exist_addresses != len(self.queryreturn):
|
||||||
|
self.update_addressBook_on_scroll(exist_addresses)
|
||||||
|
self.has_refreshed = True if exist_addresses != len(
|
||||||
|
self.queryreturn) else False
|
||||||
else:
|
else:
|
||||||
content = MDLabel(
|
pass
|
||||||
font_style='Body1',
|
|
||||||
theme_text_color='Primary',
|
def update_addressBook_on_scroll(self, exist_addresses):
|
||||||
text="No contact found!" if state.searcing_text
|
"""Load more data on scroll down"""
|
||||||
else "No contact found yet...... ",
|
self.set_mdList(exist_addresses, exist_addresses + 5)
|
||||||
halign='center',
|
|
||||||
bold=True,
|
|
||||||
size_hint_y=None,
|
|
||||||
valign='top')
|
|
||||||
self.ids.ml.add_widget(content)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def refreshs(*args):
|
def refreshs(*args):
|
||||||
"""Refresh the Widget."""
|
"""Refresh the Widget"""
|
||||||
# state.navinstance.ids.sc11.ids.ml.clear_widgets()
|
# state.navinstance.ids.sc11.ids.ml.clear_widgets()
|
||||||
# state.navinstance.ids.sc11.loadAddresslist(None, 'All', '')
|
# state.navinstance.ids.sc11.loadAddresslist(None, 'All', '')
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def addBook_detail(address, label, *args):
|
def addBook_detail(address, label, *args):
|
||||||
"""Addressbook Details."""
|
"""Addressbook details"""
|
||||||
p = AddbookDetailPopup()
|
p = AddbookDetailPopup()
|
||||||
p.open()
|
p.open()
|
||||||
p.set_addbook_data(address, label)
|
p.set_addbook_data(address, label)
|
||||||
|
|
||||||
def delete_address(self, address, instance, *args):
|
def delete_address(self, address, instance, *args):
|
||||||
"""Delete inbox mail from inbox listing."""
|
"""Delete inbox mail from inbox listing"""
|
||||||
self.ids.ml.remove_widget(instance.parent.parent)
|
self.ids.ml.remove_widget(instance.parent.parent)
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
"DELETE FROM addressbook WHERE address = '{}';".format(address))
|
"DELETE FROM addressbook WHERE address = '{}';".format(address))
|
||||||
|
|
||||||
|
|
||||||
class SelectableRecycleBoxLayout(FocusBehavior, LayoutSelectionBehavior,
|
class SelectableRecycleBoxLayout(
|
||||||
RecycleBoxLayout):
|
FocusBehavior, LayoutSelectionBehavior, RecycleBoxLayout):
|
||||||
"""Adds selection and focus behaviour to the view."""
|
"""Adds selection and focus behaviour to the view"""
|
||||||
|
# pylint: disable = too-many-ancestors, duplicate-bases
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class SelectableLabel(RecycleDataViewBehavior, Label):
|
class SelectableLabel(RecycleDataViewBehavior, Label):
|
||||||
"""Add selection support to the Label."""
|
"""Add selection support to the Label"""
|
||||||
|
|
||||||
index = None
|
index = None
|
||||||
selected = BooleanProperty(False)
|
selected = BooleanProperty(False)
|
||||||
selectable = BooleanProperty(True)
|
selectable = BooleanProperty(True)
|
||||||
|
|
||||||
def refresh_view_attrs(self, rv, index, data):
|
def refresh_view_attrs(self, rv, index, data):
|
||||||
"""Catch and handle the view changes."""
|
"""Catch and handle the view changes"""
|
||||||
self.index = index
|
self.index = index
|
||||||
return super(SelectableLabel, self).refresh_view_attrs(
|
return super(SelectableLabel, self).refresh_view_attrs(
|
||||||
rv, index, data)
|
rv, index, data)
|
||||||
|
|
||||||
# pylint: disable=inconsistent-return-statements
|
# pylint: disable=inconsistent-return-statements
|
||||||
def on_touch_down(self, touch):
|
def on_touch_down(self, touch):
|
||||||
"""Add selection on touch down."""
|
"""Add selection on touch down"""
|
||||||
if super(SelectableLabel, self).on_touch_down(touch):
|
if super(SelectableLabel, self).on_touch_down(touch):
|
||||||
return True
|
return True
|
||||||
if self.collide_point(*touch.pos) and self.selectable:
|
if self.collide_point(*touch.pos) and self.selectable:
|
||||||
return self.parent.select_with_touch(self.index, touch)
|
return self.parent.select_with_touch(self.index, touch)
|
||||||
|
|
||||||
def apply_selection(self, rv, index, is_selected):
|
def apply_selection(self, rv, index, is_selected):
|
||||||
"""Respond to the selection of items in the view."""
|
"""Respond to the selection of items in the view"""
|
||||||
self.selected = is_selected
|
self.selected = is_selected
|
||||||
if is_selected:
|
if is_selected:
|
||||||
print "selection changed to {0}".format(rv.data[index])
|
print "selection changed to {0}".format(rv.data[index])
|
||||||
|
@ -436,23 +564,22 @@ class SelectableLabel(RecycleDataViewBehavior, Label):
|
||||||
|
|
||||||
|
|
||||||
class RV(RecycleView):
|
class RV(RecycleView):
|
||||||
"""Recycling View."""
|
"""Recycling View"""
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs): # pylint: disable=useless-super-delegation
|
||||||
"""Recycling Method."""
|
"""Recycling Method"""
|
||||||
# pylint: disable=useless-super-delegation
|
|
||||||
super(RV, self).__init__(**kwargs)
|
super(RV, self).__init__(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
class DropDownWidget(BoxLayout):
|
class DropDownWidget(BoxLayout):
|
||||||
"""Adding Dropdown Widget."""
|
"""Adding Dropdown Widget"""
|
||||||
# pylint: disable=too-many-statements, inconsistent-return-statements, too-many-locals
|
# pylint: disable=too-many-statements, too-many-locals
|
||||||
|
# pylint: disable=inconsistent-return-statements
|
||||||
txt_input = ObjectProperty()
|
txt_input = ObjectProperty()
|
||||||
rv = ObjectProperty()
|
rv = ObjectProperty()
|
||||||
|
|
||||||
def send(self, navApp):
|
def send(self, navApp):
|
||||||
"""Send message from one address to another."""
|
"""Send message from one address to another"""
|
||||||
fromAddress = str(self.ids.ti.text)
|
fromAddress = str(self.ids.ti.text)
|
||||||
toAddress = str(self.ids.txt_input.text)
|
toAddress = str(self.ids.txt_input.text)
|
||||||
subject = self.ids.subject.text.encode('utf-8').strip()
|
subject = self.ids.subject.text.encode('utf-8').strip()
|
||||||
|
@ -462,10 +589,12 @@ class DropDownWidget(BoxLayout):
|
||||||
sendMessageToPeople = True
|
sendMessageToPeople = True
|
||||||
if sendMessageToPeople:
|
if sendMessageToPeople:
|
||||||
if toAddress != '' and subject and message:
|
if toAddress != '' and subject and message:
|
||||||
from addresses import decodeAddress
|
status, addressVersionNumber, streamNumber, ripe = (
|
||||||
status, addressVersionNumber, streamNumber, ripe = decodeAddress(toAddress)
|
decodeAddress(toAddress))
|
||||||
if status == 'success':
|
if status == 'success':
|
||||||
if state.detailPageType == 'draft' and state.send_draft_mail:
|
navApp.root.ids.sc3.children[0].active = True
|
||||||
|
if state.detailPageType == 'draft' \
|
||||||
|
and state.send_draft_mail:
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
"UPDATE sent SET toaddress = ?"
|
"UPDATE sent SET toaddress = ?"
|
||||||
", fromaddress = ? , subject = ?"
|
", fromaddress = ? , subject = ?"
|
||||||
|
@ -478,15 +607,13 @@ class DropDownWidget(BoxLayout):
|
||||||
str(state.send_draft_mail))
|
str(state.send_draft_mail))
|
||||||
self.parent.parent.screens[15].clear_widgets()
|
self.parent.parent.screens[15].clear_widgets()
|
||||||
self.parent.parent.screens[15].add_widget(Draft())
|
self.parent.parent.screens[15].add_widget(Draft())
|
||||||
state.detailPageType = ''
|
|
||||||
state.send_draft_mail = None
|
|
||||||
else:
|
else:
|
||||||
from addresses import addBMIfNotPresent
|
|
||||||
toAddress = addBMIfNotPresent(toAddress)
|
toAddress = addBMIfNotPresent(toAddress)
|
||||||
statusIconColor = 'red'
|
statusIconColor = 'red'
|
||||||
if addressVersionNumber > 4 or addressVersionNumber <= 1:
|
if (addressVersionNumber > 4) or (
|
||||||
print "addressVersionNumber > 4 \
|
addressVersionNumber <= 1):
|
||||||
or addressVersionNumber <= 1"
|
print "addressVersionNumber > 4"\
|
||||||
|
" or addressVersionNumber <= 1"
|
||||||
if streamNumber > 1 or streamNumber == 0:
|
if streamNumber > 1 or streamNumber == 0:
|
||||||
print "streamNumber > 1 or streamNumber == 0"
|
print "streamNumber > 1 or streamNumber == 0"
|
||||||
if statusIconColor == 'red':
|
if statusIconColor == 'red':
|
||||||
|
@ -495,7 +622,7 @@ class DropDownWidget(BoxLayout):
|
||||||
'bitmessagesettings', 'ackstealthlevel')
|
'bitmessagesettings', 'ackstealthlevel')
|
||||||
from helper_ackPayload import genAckPayload
|
from helper_ackPayload import genAckPayload
|
||||||
ackdata = genAckPayload(streamNumber, stealthLevel)
|
ackdata = genAckPayload(streamNumber, stealthLevel)
|
||||||
t = ()
|
# t = ()
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
'''INSERT INTO sent VALUES
|
'''INSERT INTO sent VALUES
|
||||||
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''',
|
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''',
|
||||||
|
@ -517,20 +644,23 @@ class DropDownWidget(BoxLayout):
|
||||||
'bitmessagesettings', 'ttl'))
|
'bitmessagesettings', 'ttl'))
|
||||||
state.check_sent_acc = fromAddress
|
state.check_sent_acc = fromAddress
|
||||||
state.msg_counter_objs = self.parent.parent.parent.parent\
|
state.msg_counter_objs = self.parent.parent.parent.parent\
|
||||||
.parent.parent.children[0].children[2].children[0].ids
|
.parent.parent.children[2].children[0].ids
|
||||||
self.parent.parent.screens[3].ids.ml.clear_widgets()
|
if state.detailPageType == 'draft' \
|
||||||
self.parent.parent.screens[3].loadSent(state.association)
|
and state.send_draft_mail:
|
||||||
self.parent.parent.screens[16].clear_widgets()
|
state.draft_count = str(int(state.draft_count) - 1)
|
||||||
self.parent.parent.screens[16].add_widget(Allmails())
|
state.msg_counter_objs.draft_cnt.badge_text = state.draft_count
|
||||||
toLabel = ''
|
state.detailPageType = ''
|
||||||
|
state.send_draft_mail = None
|
||||||
|
# self.parent.parent.screens[0].ids.ml.clear_widgets()
|
||||||
|
# self.parent.parent.screens[0].loadMessagelist(state.association)
|
||||||
|
self.parent.parent.screens[3].update_sent_messagelist()
|
||||||
|
# self.parent.parent.screens[16].clear_widgets()
|
||||||
|
# self.parent.parent.screens[16].add_widget(Allmails())
|
||||||
|
Clock.schedule_once(self.callback_for_msgsend, 3)
|
||||||
queues.workerQueue.put(('sendmessage', toAddress))
|
queues.workerQueue.put(('sendmessage', toAddress))
|
||||||
print "sqlExecute successfully #######################"
|
print "sqlExecute successfully #######################"
|
||||||
self.parent.parent.current = 'inbox'
|
|
||||||
state.in_composer = True
|
state.in_composer = True
|
||||||
navApp.back_press()
|
return
|
||||||
toast('send')
|
|
||||||
return None
|
|
||||||
else:
|
else:
|
||||||
msg = 'Enter a valid recipients address'
|
msg = 'Enter a valid recipients address'
|
||||||
elif not toAddress:
|
elif not toAddress:
|
||||||
|
@ -539,9 +669,17 @@ class DropDownWidget(BoxLayout):
|
||||||
msg = 'Please fill the form'
|
msg = 'Please fill the form'
|
||||||
self.address_error_message(msg)
|
self.address_error_message(msg)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def callback_for_msgsend(dt=0):
|
||||||
|
"""Callback method for messagesend"""
|
||||||
|
state.kivyapp.root.ids.sc3.children[0].active = False
|
||||||
|
state.in_sent_method = True
|
||||||
|
state.kivyapp.back_press()
|
||||||
|
toast('sent')
|
||||||
|
|
||||||
# pylint: disable=attribute-defined-outside-init
|
# pylint: disable=attribute-defined-outside-init
|
||||||
def address_error_message(self, msg):
|
def address_error_message(self, msg):
|
||||||
"""Show Error Message."""
|
"""Generates error message"""
|
||||||
msg_dialog = MDDialog(
|
msg_dialog = MDDialog(
|
||||||
text=msg,
|
text=msg,
|
||||||
title='', size_hint=(.8, .25), text_button_ok='Ok',
|
title='', size_hint=(.8, .25), text_button_ok='Ok',
|
||||||
|
@ -550,11 +688,11 @@ class DropDownWidget(BoxLayout):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def callback_for_menu_items(text_item):
|
def callback_for_menu_items(text_item):
|
||||||
"""Method is used for getting the callback of alert box"""
|
"""Callback of alert box"""
|
||||||
toast(text_item)
|
toast(text_item)
|
||||||
|
|
||||||
def reset_composer(self):
|
def reset_composer(self):
|
||||||
"""Method will reset composer."""
|
"""Method will reset composer"""
|
||||||
self.ids.ti.text = ''
|
self.ids.ti.text = ''
|
||||||
self.ids.btn.text = 'Select'
|
self.ids.btn.text = 'Select'
|
||||||
self.ids.txt_input.text = ''
|
self.ids.txt_input.text = ''
|
||||||
|
@ -563,27 +701,25 @@ class DropDownWidget(BoxLayout):
|
||||||
toast("Reset message")
|
toast("Reset message")
|
||||||
|
|
||||||
def auto_fill_fromaddr(self):
|
def auto_fill_fromaddr(self):
|
||||||
"""Mehtod used to fill the text automatically From Address."""
|
"""Fill the text automatically From Address"""
|
||||||
self.ids.ti.text = self.ids.btn.text
|
self.ids.ti.text = self.ids.btn.text
|
||||||
self.ids.ti.focus = True
|
self.ids.ti.focus = True
|
||||||
|
|
||||||
|
|
||||||
class MyTextInput(TextInput):
|
class MyTextInput(TextInput):
|
||||||
"""Takes the text input in the field."""
|
"""Takes the text input in the field"""
|
||||||
|
|
||||||
txt_input = ObjectProperty()
|
txt_input = ObjectProperty()
|
||||||
flt_list = ObjectProperty()
|
flt_list = ObjectProperty()
|
||||||
word_list = ListProperty()
|
word_list = ListProperty()
|
||||||
starting_no = NumericProperty(3)
|
starting_no = NumericProperty(3)
|
||||||
suggestion_text = ''
|
suggestion_text = ''
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs): # pylint: disable=useless-super-delegation
|
||||||
"""Getting Text Input."""
|
"""Getting Text Input"""
|
||||||
# pylint: disable=useless-super-delegation
|
|
||||||
super(MyTextInput, self).__init__(**kwargs)
|
super(MyTextInput, self).__init__(**kwargs)
|
||||||
|
|
||||||
def on_text(self, instance, value):
|
def on_text(self, instance, value):
|
||||||
"""Find all the occurrence of the word."""
|
"""Find all the occurrence of the word"""
|
||||||
self.parent.parent.parent.parent.ids.rv.data = []
|
self.parent.parent.parent.parent.ids.rv.data = []
|
||||||
matches = [self.word_list[i] for i in range(
|
matches = [self.word_list[i] for i in range(
|
||||||
len(self.word_list)) if self.word_list[
|
len(self.word_list)) if self.word_list[
|
||||||
|
@ -598,7 +734,7 @@ class MyTextInput(TextInput):
|
||||||
self.parent.height = 400
|
self.parent.height = 400
|
||||||
|
|
||||||
def keyboard_on_key_down(self, window, keycode, text, modifiers):
|
def keyboard_on_key_down(self, window, keycode, text, modifiers):
|
||||||
"""Key Down."""
|
"""Key Down"""
|
||||||
if self.suggestion_text and keycode[1] == 'tab':
|
if self.suggestion_text and keycode[1] == 'tab':
|
||||||
self.insert_text(self.suggestion_text + ' ')
|
self.insert_text(self.suggestion_text + ' ')
|
||||||
return True
|
return True
|
||||||
|
@ -607,36 +743,37 @@ class MyTextInput(TextInput):
|
||||||
|
|
||||||
|
|
||||||
class Payment(Screen):
|
class Payment(Screen):
|
||||||
"""Payment Method."""
|
"""Payment module"""
|
||||||
|
|
||||||
def get_available_credits(self, instance):
|
def get_available_credits(self, instance): # pylint: disable=no-self-use
|
||||||
"""Method helps to get the available credits"""
|
"""Get the available credits"""
|
||||||
# pylint: disable=no-self-use
|
|
||||||
state.availabe_credit = instance.parent.children[1].text
|
state.availabe_credit = instance.parent.children[1].text
|
||||||
existing_credits = state.kivyapp.root.ids.sc18.ids.ml.children[0].children[0].children[0].children[0].text
|
existing_credits = (
|
||||||
|
state.kivyapp.root.ids.sc18.ids.ml.children[0].children[
|
||||||
|
0].children[0].children[0].text)
|
||||||
if len(existing_credits.split(' ')) > 1:
|
if len(existing_credits.split(' ')) > 1:
|
||||||
toast('We already have added free coins for the subscription to your account!')
|
toast(
|
||||||
|
'We already have added free coins'
|
||||||
|
' for the subscription to your account!')
|
||||||
else:
|
else:
|
||||||
toast('Coins added to your account!')
|
toast('Coins added to your account!')
|
||||||
state.kivyapp.root.ids.sc18.ids.ml.children[0].children[0].children[
|
state.kivyapp.root.ids.sc18.ids.ml.children[0].children[
|
||||||
0].children[0].text = '{0}'.format(state.availabe_credit)
|
0].children[0].children[0].text = '{0}'.format(
|
||||||
|
state.availabe_credit)
|
||||||
|
|
||||||
|
|
||||||
class Credits(Screen):
|
class Credits(Screen):
|
||||||
"""Credits Method"""
|
"""Credits Module"""
|
||||||
available_credits = StringProperty(
|
available_credits = StringProperty('{0}'.format('0'))
|
||||||
'{0}'.format('0'))
|
|
||||||
|
|
||||||
|
|
||||||
class Login(Screen):
|
class Login(Screen):
|
||||||
"""Login Screeen."""
|
"""Login Screeen"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class NetworkStat(Screen):
|
class NetworkStat(Screen):
|
||||||
"""Method used to show network stat."""
|
"""Method used to show network stat"""
|
||||||
|
|
||||||
text_variable_1 = StringProperty(
|
text_variable_1 = StringProperty(
|
||||||
'{0}::{1}'.format('Total Connections', '0'))
|
'{0}::{1}'.format('Total Connections', '0'))
|
||||||
text_variable_2 = StringProperty(
|
text_variable_2 = StringProperty(
|
||||||
|
@ -648,12 +785,12 @@ class NetworkStat(Screen):
|
||||||
'Processed {0} object to be synced'.format('0'))
|
'Processed {0} object to be synced'.format('0'))
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""Init method for network stat."""
|
"""Init method for network stat"""
|
||||||
super(NetworkStat, self).__init__(*args, **kwargs)
|
super(NetworkStat, self).__init__(*args, **kwargs)
|
||||||
Clock.schedule_interval(self.init_ui, 1)
|
Clock.schedule_interval(self.init_ui, 1)
|
||||||
|
|
||||||
def init_ui(self, dt=0):
|
def init_ui(self, dt=0):
|
||||||
"""Clock Schdule for method inbox accounts."""
|
"""Clock Schdule for method networkstat screen"""
|
||||||
import network.stats
|
import network.stats
|
||||||
import shared
|
import shared
|
||||||
from network import objectracker
|
from network import objectracker
|
||||||
|
@ -670,25 +807,27 @@ class NetworkStat(Screen):
|
||||||
|
|
||||||
|
|
||||||
class ContentNavigationDrawer(Navigatorss):
|
class ContentNavigationDrawer(Navigatorss):
|
||||||
"""Navigate Content Drawer."""
|
"""Navigate Content Drawer"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Random(Screen):
|
class Random(Screen):
|
||||||
"""Generates Random Address."""
|
"""Generates Random Address"""
|
||||||
|
|
||||||
is_active = BooleanProperty(False)
|
is_active = BooleanProperty(False)
|
||||||
checked = StringProperty("")
|
checked = StringProperty("")
|
||||||
|
|
||||||
def generateaddress(self, navApp):
|
def generateaddress(self, navApp):
|
||||||
"""Method for Address Generator."""
|
"""Method for Address Generator"""
|
||||||
|
entered_label = str(self.ids.label.text).strip()
|
||||||
streamNumberForAddress = 1
|
streamNumberForAddress = 1
|
||||||
label = self.ids.label.text
|
label = self.ids.label.text
|
||||||
eighteenByteRipe = False
|
eighteenByteRipe = False
|
||||||
nonceTrialsPerByte = 1000
|
nonceTrialsPerByte = 1000
|
||||||
payloadLengthExtraBytes = 1000
|
payloadLengthExtraBytes = 1000
|
||||||
if str(self.ids.label.text).strip():
|
lables = [BMConfigParser().get(obj, 'label')
|
||||||
|
for obj in BMConfigParser().addresses()]
|
||||||
|
if entered_label and entered_label not in lables:
|
||||||
|
toast('Address Creating...')
|
||||||
queues.addressGeneratorQueue.put((
|
queues.addressGeneratorQueue.put((
|
||||||
'createRandomAddress',
|
'createRandomAddress',
|
||||||
4, streamNumberForAddress,
|
4, streamNumberForAddress,
|
||||||
|
@ -696,23 +835,48 @@ class Random(Screen):
|
||||||
nonceTrialsPerByte,
|
nonceTrialsPerByte,
|
||||||
payloadLengthExtraBytes))
|
payloadLengthExtraBytes))
|
||||||
self.ids.label.text = ''
|
self.ids.label.text = ''
|
||||||
self.parent.parent.parent.parent.ids.toolbar.opacity = 1
|
self.parent.parent.children[1].opacity = 1
|
||||||
self.parent.parent.parent.parent.ids.toolbar.disabled = False
|
self.parent.parent.children[1].disabled = False
|
||||||
self.parent.parent.parent.parent.ids.sc10.ids.ml.clear_widgets()
|
state.kivyapp.root.ids.sc10.children[1].active = True
|
||||||
self.manager.current = 'myaddress'
|
|
||||||
self.parent.parent.parent.parent.ids.sc10.init_ui()
|
|
||||||
self.manager.current = 'myaddress'
|
self.manager.current = 'myaddress'
|
||||||
|
Clock.schedule_once(self.address_created_callback, 6)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def address_created_callback(dt=0):
|
||||||
|
"""New address created"""
|
||||||
|
state.kivyapp.root.ids.sc10.children[1].active = False
|
||||||
|
state.kivyapp.root.ids.sc10.ids.ml.clear_widgets()
|
||||||
|
state.kivyapp.root.ids.sc10.is_add_created = True
|
||||||
|
state.kivyapp.root.ids.sc10.init_ui()
|
||||||
toast('New address created')
|
toast('New address created')
|
||||||
|
|
||||||
|
def add_validation(self, instance):
|
||||||
|
"""Checking validation at address creation time"""
|
||||||
|
entered_label = str(instance.text.strip())
|
||||||
|
lables = [BMConfigParser().get(obj, 'label')
|
||||||
|
for obj in BMConfigParser().addresses()]
|
||||||
|
if entered_label in lables:
|
||||||
|
self.ids.label.error = True
|
||||||
|
self.ids.label.helper_text = 'Label name is already exist you'\
|
||||||
|
' can try this Ex. ( {0}_1, {0}_2 )'.format(
|
||||||
|
entered_label)
|
||||||
|
elif entered_label:
|
||||||
|
self.ids.label.error = False
|
||||||
|
else:
|
||||||
|
self.ids.label.error = False
|
||||||
|
self.ids.label.helper_text = 'This field is required'
|
||||||
|
|
||||||
class AddressSuccessful(Screen):
|
def reset_address_label(self):
|
||||||
"""Getting Address Detail."""
|
"""Resetting address labels"""
|
||||||
|
self.ids.label.text = ''
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class Sent(Screen):
|
class Sent(Screen):
|
||||||
"""Sent Screen uses screen to show widgets of screens."""
|
"""Sent Screen uses screen to show widgets of screens"""
|
||||||
|
queryreturn = ListProperty()
|
||||||
|
has_refreshed = True
|
||||||
|
account = StringProperty()
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""Association with the screen."""
|
"""Association with the screen."""
|
||||||
super(Sent, self).__init__(*args, **kwargs)
|
super(Sent, self).__init__(*args, **kwargs)
|
||||||
|
@ -722,42 +886,60 @@ class Sent(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 sent accounts"""
|
||||||
self.sentaccounts()
|
self.loadSent()
|
||||||
print dt
|
print dt
|
||||||
|
|
||||||
def sentaccounts(self):
|
def loadSent(self, where="", what=""):
|
||||||
"""Load sent accounts."""
|
|
||||||
account = state.association
|
|
||||||
self.loadSent(account, 'All', '')
|
|
||||||
|
|
||||||
def loadSent(self, account, where="", what=""):
|
|
||||||
"""Load Sent list for Sent messages."""
|
"""Load Sent list for Sent messages."""
|
||||||
|
self.account = state.association
|
||||||
if state.searcing_text:
|
if state.searcing_text:
|
||||||
|
self.ids.scroll_y.scroll_y = 1.0
|
||||||
where = ['subject', 'message']
|
where = ['subject', 'message']
|
||||||
what = state.searcing_text
|
what = state.searcing_text
|
||||||
xAddress = 'fromaddress'
|
xAddress = 'fromaddress'
|
||||||
data = []
|
data = []
|
||||||
queryreturn = kivy_helper_search.search_sql(
|
self.sentDataQuery(xAddress, where, what)
|
||||||
xAddress, account, "sent", where, what, False)
|
if self.queryreturn:
|
||||||
if state.msg_counter_objs and state.association == state.check_sent_acc:
|
self.set_sentCount(state.sent_count)
|
||||||
state.msg_counter_objs.send_cnt.badge_text = str(len(queryreturn))
|
for mail in self.queryreturn:
|
||||||
state.sent_count = str(int(state.sent_count) + 1)
|
|
||||||
state.all_count = str(int(state.all_count) + 1)
|
|
||||||
state.msg_counter_objs.allmail_cnt.badge_text = state.all_count
|
|
||||||
state.check_sent_acc = None
|
|
||||||
|
|
||||||
if queryreturn:
|
|
||||||
src_mng_obj = state.kivyapp.root.children[2].children[0].ids
|
|
||||||
src_mng_obj.send_cnt.badge_text = str(len(queryreturn))
|
|
||||||
state.sent_count = str(len(queryreturn))
|
|
||||||
for mail in queryreturn:
|
|
||||||
data.append({
|
data.append({
|
||||||
'text': mail[1].strip(),
|
'text': mail[1].strip(),
|
||||||
'secondary_text': mail[2][:50] + '........' if len(
|
'secondary_text': mail[2][:50] + '........' if len(
|
||||||
mail[2]) >= 50 else (
|
mail[2]) >= 50 else (mail[2] + ',' + mail[3].replace(
|
||||||
mail[2] + ',' + mail[3].replace('\n', ''))[0:50] + '........',
|
'\n', ''))[0:50] + '........',
|
||||||
'ackdata': mail[5]})
|
'ackdata': mail[5]})
|
||||||
|
self.set_mdlist(data, 0)
|
||||||
|
self.has_refreshed = True
|
||||||
|
self.ids.scroll_y.bind(scroll_y=self.check_scroll_y)
|
||||||
|
else:
|
||||||
|
content = MDLabel(
|
||||||
|
font_style='Body1',
|
||||||
|
theme_text_color='Primary',
|
||||||
|
text="No message found!" if state.searcing_text
|
||||||
|
else "yet no message for this account!!!!!!!!!!!!!",
|
||||||
|
halign='center',
|
||||||
|
bold=True,
|
||||||
|
size_hint_y=None,
|
||||||
|
valign='top')
|
||||||
|
self.ids.ml.add_widget(content)
|
||||||
|
|
||||||
|
# pylint: disable=too-many-arguments
|
||||||
|
def sentDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
||||||
|
"""This method is used to retrieving data from sent table"""
|
||||||
|
self.queryreturn = kivy_helper_search.search_sql(
|
||||||
|
xAddress,
|
||||||
|
self.account,
|
||||||
|
"sent",
|
||||||
|
where,
|
||||||
|
what,
|
||||||
|
False,
|
||||||
|
start_indx,
|
||||||
|
end_indx)
|
||||||
|
|
||||||
|
def set_mdlist(self, data, set_index=0):
|
||||||
|
"""This method is used to create the mdList"""
|
||||||
|
total_sent_msg = len(self.ids.ml.children)
|
||||||
for item in data:
|
for item in data:
|
||||||
meny = TwoLineAvatarIconListItem(
|
meny = TwoLineAvatarIconListItem(
|
||||||
text=item['text'],
|
text=item['text'],
|
||||||
|
@ -788,21 +970,71 @@ class Sent(Screen):
|
||||||
self.archive, item['ackdata']))
|
self.archive, item['ackdata']))
|
||||||
carousel.add_widget(ach_btn)
|
carousel.add_widget(ach_btn)
|
||||||
carousel.index = 1
|
carousel.index = 1
|
||||||
self.ids.ml.add_widget(carousel)
|
self.ids.ml.add_widget(carousel, index=set_index)
|
||||||
|
updated_msgs = len(self.ids.ml.children)
|
||||||
|
self.has_refreshed = True if total_sent_msg != updated_msgs else False
|
||||||
|
|
||||||
|
def update_sent_messagelist(self):
|
||||||
|
"""This method is used to update screen when new mail is sent"""
|
||||||
|
self.account = state.association
|
||||||
|
if len(self.ids.ml.children) < 3:
|
||||||
|
self.ids.ml.clear_widgets()
|
||||||
|
self.loadSent()
|
||||||
|
total_sent = int(state.sent_count) + 1
|
||||||
|
self.set_sentCount(total_sent)
|
||||||
else:
|
else:
|
||||||
content = MDLabel(
|
data = []
|
||||||
font_style='Body1',
|
self.sentDataQuery('fromaddress', '', '', 0, 1)
|
||||||
theme_text_color='Primary',
|
total_sent = int(state.sent_count) + 1
|
||||||
text="No message found!" if state.searcing_text
|
self.set_sentCount(total_sent)
|
||||||
else "yet no message for this account!!!!!!!!!!!!!",
|
for mail in self.queryreturn:
|
||||||
halign='center',
|
data.append({
|
||||||
bold=True,
|
'text': mail[1].strip(),
|
||||||
size_hint_y=None,
|
'secondary_text': mail[2][:50] + '........' if len(
|
||||||
valign='top')
|
mail[2]) >= 50 else (mail[2] + ',' + mail[3].replace(
|
||||||
self.ids.ml.add_widget(content)
|
'\n', ''))[0:50] + '........',
|
||||||
|
'ackdata': mail[5]})
|
||||||
|
self.set_mdlist(data, total_sent - 1)
|
||||||
|
if state.msg_counter_objs and state.association == (
|
||||||
|
state.check_sent_acc):
|
||||||
|
state.all_count = str(int(state.all_count) + 1)
|
||||||
|
state.msg_counter_objs.allmail_cnt.badge_text = state.all_count
|
||||||
|
state.check_sent_acc = None
|
||||||
|
|
||||||
|
def check_scroll_y(self, instance, somethingelse):
|
||||||
|
"""Load data on scroll down"""
|
||||||
|
if self.ids.scroll_y.scroll_y <= -0.0 and self.has_refreshed:
|
||||||
|
self.ids.scroll_y.scroll_y = 0.06
|
||||||
|
total_sent_msg = len(self.ids.ml.children)
|
||||||
|
self.update_sent_screen_on_scroll(total_sent_msg)
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def update_sent_screen_on_scroll(self, total_sent_msg, where="", what=""):
|
||||||
|
"""This method is used to load more data on scroll down"""
|
||||||
|
if state.searcing_text:
|
||||||
|
where = ['subject', 'message']
|
||||||
|
what = state.searcing_text
|
||||||
|
self.sentDataQuery('fromaddress', where, what, total_sent_msg, 5)
|
||||||
|
data = []
|
||||||
|
for mail in self.queryreturn:
|
||||||
|
data.append({
|
||||||
|
'text': mail[1].strip(),
|
||||||
|
'secondary_text': mail[2][:50] + '........' if len(
|
||||||
|
mail[2]) >= 50 else (mail[2] + ',' + mail[3].replace(
|
||||||
|
'\n', ''))[0:50] + '........',
|
||||||
|
'ackdata': mail[5]})
|
||||||
|
self.set_mdlist(data, 0)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def set_sentCount(total_sent):
|
||||||
|
"""Set the total no. of sent message count"""
|
||||||
|
src_mng_obj = state.kivyapp.root.children[2].children[0].ids
|
||||||
|
src_mng_obj.send_cnt.badge_text = str(total_sent)
|
||||||
|
state.sent_count = str(total_sent)
|
||||||
|
|
||||||
def sent_detail(self, ackdata, *args):
|
def sent_detail(self, ackdata, *args):
|
||||||
"""Load sent mail details."""
|
"""Load sent mail details"""
|
||||||
state.detailPageType = 'sent'
|
state.detailPageType = 'sent'
|
||||||
state.mail_id = ackdata
|
state.mail_id = ackdata
|
||||||
if self.manager:
|
if self.manager:
|
||||||
|
@ -814,7 +1046,7 @@ class Sent(Screen):
|
||||||
src_mng_obj.current = 'mailDetail'
|
src_mng_obj.current = 'mailDetail'
|
||||||
|
|
||||||
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:
|
try:
|
||||||
msg_count_objs = self.parent.parent.parent.parent.children[
|
msg_count_objs = self.parent.parent.parent.parent.children[
|
||||||
2].children[0].ids
|
2].children[0].ids
|
||||||
|
@ -839,7 +1071,7 @@ class Sent(Screen):
|
||||||
self.update_trash()
|
self.update_trash()
|
||||||
|
|
||||||
def archive(self, data_index, instance, *args):
|
def archive(self, data_index, instance, *args):
|
||||||
"""Archive sent mail from sent mail listing."""
|
"""Archive sent mail from sent mail listing"""
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
"UPDATE sent SET folder = 'trash'"
|
"UPDATE sent SET folder = 'trash'"
|
||||||
" WHERE ackdata = ?;", str(data_index))
|
" WHERE ackdata = ?;", str(data_index))
|
||||||
|
@ -847,7 +1079,7 @@ class Sent(Screen):
|
||||||
self.update_trash()
|
self.update_trash()
|
||||||
|
|
||||||
def update_trash(self):
|
def update_trash(self):
|
||||||
"""Update trash screen mails which is deleted from inbox."""
|
"""Update trash screen mails which is deleted from inbox"""
|
||||||
try:
|
try:
|
||||||
self.parent.screens[4].clear_widgets()
|
self.parent.screens[4].clear_widgets()
|
||||||
self.parent.screens[4].add_widget(Trash())
|
self.parent.screens[4].add_widget(Trash())
|
||||||
|
@ -861,38 +1093,62 @@ class Sent(Screen):
|
||||||
|
|
||||||
|
|
||||||
class Trash(Screen):
|
class Trash(Screen):
|
||||||
"""Trash Screen uses screen to show widgets of screens."""
|
"""Trash Screen uses screen to show widgets of screens"""
|
||||||
|
trash_messages = ListProperty()
|
||||||
|
has_refreshed = True
|
||||||
|
delete_index = StringProperty()
|
||||||
|
table_name = StringProperty()
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""Trash method, delete sent message and add in Trash."""
|
"""Trash method, delete sent message and add in Trash"""
|
||||||
super(Trash, self).__init__(*args, **kwargs)
|
super(Trash, 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 inbox accounts."""
|
"""Clock Schdule for method trash screen."""
|
||||||
if state.association == '':
|
if state.association == '':
|
||||||
if BMConfigParser().addresses():
|
if BMConfigParser().addresses():
|
||||||
state.association = BMConfigParser().addresses()[0]
|
state.association = BMConfigParser().addresses()[0]
|
||||||
inbox = sqlQuery(
|
self.trashDataQuery(0, 20)
|
||||||
"SELECT toaddress, fromaddress, subject, message, folder, received from"
|
if self.trash_messages:
|
||||||
" inbox WHERE folder = 'trash' and toaddress = '{}';".format(
|
|
||||||
state.association))
|
|
||||||
sent = sqlQuery(
|
|
||||||
"SELECT toaddress, fromaddress, subject, message, folder, lastactiontime from"
|
|
||||||
" sent WHERE folder = 'trash' and fromaddress = '{}';".format(
|
|
||||||
state.association))
|
|
||||||
trash_data = inbox + sent
|
|
||||||
|
|
||||||
if trash_data:
|
|
||||||
src_mng_obj = state.kivyapp.root.children[2].children[0].ids
|
src_mng_obj = state.kivyapp.root.children[2].children[0].ids
|
||||||
src_mng_obj.trash_cnt.badge_text = str(len(trash_data))
|
src_mng_obj.trash_cnt.badge_text = state.trash_count
|
||||||
state.trash_count = str(len(trash_data))
|
self.set_mdList()
|
||||||
for item in trash_data:
|
self.ids.scroll_y.bind(scroll_y=self.check_scroll_y)
|
||||||
|
else:
|
||||||
|
content = MDLabel(
|
||||||
|
font_style='Body1',
|
||||||
|
theme_text_color='Primary',
|
||||||
|
text="yet no trashed message for this account!!!!!!!!!!!!!",
|
||||||
|
halign='center',
|
||||||
|
bold=True,
|
||||||
|
size_hint_y=None,
|
||||||
|
valign='top')
|
||||||
|
self.ids.ml.add_widget(content)
|
||||||
|
|
||||||
|
def trashDataQuery(self, start_indx, end_indx):
|
||||||
|
"""Trash message query"""
|
||||||
|
self.trash_messages = sqlQuery(
|
||||||
|
"SELECT toaddress, fromaddress, subject, message,"
|
||||||
|
" folder ||',' || 'sent' as folder, ackdata As"
|
||||||
|
" id, DATE(lastactiontime) As actionTime FROM sent"
|
||||||
|
" WHERE folder = 'trash' and fromaddress = '{0}' UNION"
|
||||||
|
" SELECT toaddress, fromaddress, subject, message,"
|
||||||
|
" folder ||',' || 'inbox' as folder, msgid As id,"
|
||||||
|
" DATE(received) As actionTime FROM inbox"
|
||||||
|
" WHERE folder = 'trash' and toaddress = '{0}'"
|
||||||
|
" ORDER BY actionTime DESC limit {1}, {2}".format(
|
||||||
|
state.association, start_indx, end_indx))
|
||||||
|
|
||||||
|
def set_mdList(self):
|
||||||
|
"""This method is used to create the mdlist"""
|
||||||
|
total_trash_msg = len(self.ids.ml.children)
|
||||||
|
for item in self.trash_messages:
|
||||||
meny = TwoLineAvatarIconListItem(
|
meny = TwoLineAvatarIconListItem(
|
||||||
text=item[1],
|
text=item[1],
|
||||||
secondary_text=item[2][:50] + '........' if len(
|
secondary_text=item[2][:50] + '........' if len(
|
||||||
item[2]) >= 50 else (
|
item[2]) >= 50 else (item[2] + ',' + item[3].replace(
|
||||||
item[2] + ',' + item[3].replace('\n', ''))[0:50] + '........',
|
'\n', ''))[0:50] + '........',
|
||||||
theme_text_color='Custom',
|
theme_text_color='Custom',
|
||||||
text_color=NavigateApp().theme_cls.primary_color)
|
text_color=NavigateApp().theme_cls.primary_color)
|
||||||
img_latter = './images/text_images/{}.png'.format(
|
img_latter = './images/text_images/{}.png'.format(
|
||||||
|
@ -909,38 +1165,87 @@ class Trash(Screen):
|
||||||
del_btn.background_normal = ''
|
del_btn.background_normal = ''
|
||||||
del_btn.background_color = (1, 0, 0, 1)
|
del_btn.background_color = (1, 0, 0, 1)
|
||||||
del_btn.bind(on_press=partial(
|
del_btn.bind(on_press=partial(
|
||||||
self.delete_permanently, item[5]))
|
self.delete_permanently, item[5], item[4]))
|
||||||
carousel.add_widget(del_btn)
|
carousel.add_widget(del_btn)
|
||||||
carousel.add_widget(meny)
|
carousel.add_widget(meny)
|
||||||
carousel.index = 1
|
carousel.index = 1
|
||||||
self.ids.ml.add_widget(carousel)
|
self.ids.ml.add_widget(carousel)
|
||||||
else:
|
self.has_refreshed = True if total_trash_msg != len(
|
||||||
content = MDLabel(
|
self.ids.ml.children) else False
|
||||||
font_style='Body1',
|
|
||||||
theme_text_color='Primary',
|
|
||||||
text="yet no trashed message for this account!!!!!!!!!!!!!",
|
|
||||||
halign='center',
|
|
||||||
bold=True,
|
|
||||||
size_hint_y=None,
|
|
||||||
valign='top')
|
|
||||||
self.ids.ml.add_widget(content)
|
|
||||||
|
|
||||||
def delete_permanently(self, data_index, instance, *args):
|
def check_scroll_y(self, instance, somethingelse):
|
||||||
"""Deleting trash mail permanently."""
|
"""Load data on scroll"""
|
||||||
|
if self.ids.scroll_y.scroll_y <= -0.0 and self.has_refreshed:
|
||||||
|
self.ids.scroll_y.scroll_y = 0.06
|
||||||
|
total_trash_msg = len(self.ids.ml.children)
|
||||||
|
self.update_trash_screen_on_scroll(total_trash_msg)
|
||||||
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def update_trash_screen_on_scroll(self, total_trash_msg):
|
||||||
|
"""Load more data on scroll down"""
|
||||||
|
self.trashDataQuery(total_trash_msg, 5)
|
||||||
|
self.set_mdList()
|
||||||
|
|
||||||
|
def delete_permanently(self, data_index, folder, instance, *args):
|
||||||
|
"""Deleting trash mail permanently"""
|
||||||
|
self.table_name = folder.split(',')[1]
|
||||||
|
self.delete_index = data_index
|
||||||
|
self.delete_confirmation()
|
||||||
|
|
||||||
|
def callback_for_screen_load(self, dt=0):
|
||||||
|
"""This methos is for loading screen"""
|
||||||
|
self.ids.ml.clear_widgets()
|
||||||
|
self.init_ui(0)
|
||||||
|
self.children[1].active = False
|
||||||
|
toast('Message is permanently deleted')
|
||||||
|
|
||||||
|
def delete_confirmation(self):
|
||||||
|
"""Show confirmation delete popup"""
|
||||||
|
delete_msg_dialog = MDDialog(
|
||||||
|
text='Are you sure you want to delete this'
|
||||||
|
' message permanently from trash?',
|
||||||
|
title='',
|
||||||
|
size_hint=(.8, .25),
|
||||||
|
text_button_ok='Yes',
|
||||||
|
text_button_cancel='No',
|
||||||
|
events_callback=self.callback_for_delete_msg)
|
||||||
|
delete_msg_dialog.open()
|
||||||
|
|
||||||
|
def callback_for_delete_msg(self, text_item):
|
||||||
|
"""Getting the callback of alert box"""
|
||||||
|
if text_item == 'Yes':
|
||||||
|
self.delete_message_from_trash()
|
||||||
|
else:
|
||||||
|
toast(text_item)
|
||||||
|
|
||||||
|
def delete_message_from_trash(self):
|
||||||
|
"""Deleting message from trash"""
|
||||||
|
self.children[1].active = True
|
||||||
|
if self.table_name == 'inbox':
|
||||||
|
sqlExecute("DELETE FROM inbox WHERE msgid = ?;", str(
|
||||||
|
self.delete_index))
|
||||||
|
elif self.table_name == 'sent':
|
||||||
|
sqlExecute("DELETE FROM sent WHERE ackdata = ?;", str(
|
||||||
|
self.delete_index))
|
||||||
|
msg_count_objs = state.kivyapp.root.children[2].children[0].ids
|
||||||
|
if int(state.trash_count) > 0:
|
||||||
|
msg_count_objs.trash_cnt.badge_text = str(
|
||||||
|
int(state.trash_count) - 1)
|
||||||
|
state.trash_count = str(int(state.trash_count) - 1)
|
||||||
|
Clock.schedule_once(self.callback_for_screen_load, 1)
|
||||||
|
|
||||||
|
|
||||||
class Page(Screen):
|
class Page(Screen):
|
||||||
"""Page Screen show widgets of page."""
|
"""Page Screen show widgets of page"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Create(Screen):
|
class Create(Screen):
|
||||||
"""Creates the screen widgets."""
|
"""Creates the screen widgets"""
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
"""Getting Labels and address from addressbook."""
|
"""Getting Labels and address from addressbook"""
|
||||||
super(Create, self).__init__(**kwargs)
|
super(Create, self).__init__(**kwargs)
|
||||||
widget_1 = DropDownWidget()
|
widget_1 = DropDownWidget()
|
||||||
widget_1.ids.txt_input.word_list = [
|
widget_1.ids.txt_input.word_list = [
|
||||||
|
@ -951,15 +1256,12 @@ class Create(Screen):
|
||||||
|
|
||||||
|
|
||||||
class Setting(Screen):
|
class Setting(Screen):
|
||||||
"""Setting the Screen components."""
|
"""Setting the Screen components"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class NavigateApp(App):
|
class NavigateApp(App): # pylint: disable=too-many-public-methods
|
||||||
"""Navigation Layout of class."""
|
"""Navigation Layout of class"""
|
||||||
# pylint: disable=too-many-public-methods
|
|
||||||
|
|
||||||
theme_cls = ThemeManager()
|
theme_cls = ThemeManager()
|
||||||
previous_date = ObjectProperty()
|
previous_date = ObjectProperty()
|
||||||
obj_1 = ObjectProperty()
|
obj_1 = ObjectProperty()
|
||||||
|
@ -988,7 +1290,7 @@ class NavigateApp(App):
|
||||||
]
|
]
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
"""Method builds the widget."""
|
"""Method builds the widget"""
|
||||||
main_widget = Builder.load_file(
|
main_widget = Builder.load_file(
|
||||||
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()
|
||||||
|
@ -1000,14 +1302,14 @@ class NavigateApp(App):
|
||||||
return main_widget
|
return main_widget
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""Running the widgets."""
|
"""Running the widgets"""
|
||||||
kivyuisignaler.release()
|
kivyuisignaler.release()
|
||||||
super(NavigateApp, self).run()
|
super(NavigateApp, self).run()
|
||||||
|
|
||||||
# pylint: disable=inconsistent-return-statements
|
# pylint: disable=inconsistent-return-statements
|
||||||
@staticmethod
|
@staticmethod
|
||||||
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":
|
||||||
if BMConfigParser().addresses():
|
if BMConfigParser().addresses():
|
||||||
return BMConfigParser().addresses()[0][:16] + '..'
|
return BMConfigParser().addresses()[0][:16] + '..'
|
||||||
|
@ -1019,25 +1321,253 @@ class NavigateApp(App):
|
||||||
return "valuesdemo"
|
return "valuesdemo"
|
||||||
|
|
||||||
def getCurrentAccountData(self, text):
|
def getCurrentAccountData(self, text):
|
||||||
"""Get Current Address Account Data."""
|
"""Get Current Address Account Data"""
|
||||||
self.set_identicon(text)
|
self.set_identicon(text)
|
||||||
address_label = self.current_address_label(
|
address_label = self.current_address_label(
|
||||||
BMConfigParser().get(text, 'label'), text)
|
BMConfigParser().get(text, 'label'), text)
|
||||||
self.root_window.children[1].ids.toolbar.title = address_label
|
self.root_window.children[1].ids.toolbar.title = address_label
|
||||||
state.association = text
|
state.association = text
|
||||||
state.searcing_text = ''
|
state.searcing_text = ''
|
||||||
|
LoadingPopup().open()
|
||||||
|
self.set_message_count()
|
||||||
|
Clock.schedule_once(self.setCurrentAccountData, 0.5)
|
||||||
|
|
||||||
|
def setCurrentAccountData(self, dt=0):
|
||||||
|
"""This method set the current accout data on all the screens."""
|
||||||
self.root.ids.sc1.ids.ml.clear_widgets()
|
self.root.ids.sc1.ids.ml.clear_widgets()
|
||||||
self.root.ids.sc1.loadMessagelist(state.association)
|
self.root.ids.sc1.loadMessagelist(state.association)
|
||||||
|
|
||||||
|
self.root.ids.sc4.ids.ml.clear_widgets()
|
||||||
|
self.root.ids.sc4.children[2].children[1].ids.search_field.text = ''
|
||||||
|
self.root.ids.sc4.loadSent(state.association)
|
||||||
|
|
||||||
|
self.root.ids.sc16.clear_widgets()
|
||||||
|
self.root.ids.sc16.add_widget(Draft())
|
||||||
|
|
||||||
|
self.root.ids.sc5.clear_widgets()
|
||||||
|
self.root.ids.sc5.add_widget(Trash())
|
||||||
|
|
||||||
|
self.root.ids.sc17.clear_widgets()
|
||||||
|
self.root.ids.sc17.add_widget(Allmails())
|
||||||
|
|
||||||
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(
|
@staticmethod
|
||||||
sqlQuery(
|
def getCurrentAccount():
|
||||||
"SELECT COUNT(*) FROM sent WHERE fromaddress = '{}' and"
|
"""It uses to get current account label"""
|
||||||
" folder = 'sent' ;".format(state.association))[0][0])
|
if state.association:
|
||||||
|
return state.association
|
||||||
|
return "Bitmessage Login"
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def addingtoaddressbook():
|
||||||
|
"""Adding to address Book"""
|
||||||
|
p = GrashofPopup()
|
||||||
|
p.open()
|
||||||
|
|
||||||
|
def getDefaultAccData(self):
|
||||||
|
"""Getting Default Account Data"""
|
||||||
|
if BMConfigParser().addresses():
|
||||||
|
img = identiconGeneration.generate(BMConfigParser().addresses()[0])
|
||||||
|
self.createFolder('./images/default_identicon/')
|
||||||
|
if platform == 'android':
|
||||||
|
# android_path = os.path.expanduser
|
||||||
|
# ("~/user/0/org.test.bitapp/files/app/")
|
||||||
|
android_path = os.path.join(
|
||||||
|
os.environ['ANDROID_PRIVATE'] + '/app/')
|
||||||
|
img.texture.save('{1}/images/default_identicon/{0}.png'.format(
|
||||||
|
BMConfigParser().addresses()[0], android_path))
|
||||||
|
else:
|
||||||
|
img.texture.save(
|
||||||
|
'./images/default_identicon/{}.png'.format(
|
||||||
|
BMConfigParser().addresses()[0]))
|
||||||
|
return BMConfigParser().addresses()[0]
|
||||||
|
return 'Select Address'
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def createFolder(directory):
|
||||||
|
"""Create directory when app starts"""
|
||||||
|
try:
|
||||||
|
if not os.path.exists(directory):
|
||||||
|
os.makedirs(directory)
|
||||||
|
except OSError:
|
||||||
|
print 'Error: Creating directory. ' + directory
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_default_image():
|
||||||
|
"""Getting default image on address"""
|
||||||
|
if BMConfigParser().addresses():
|
||||||
|
return './images/default_identicon/{}.png'.format(
|
||||||
|
BMConfigParser().addresses()[0])
|
||||||
|
return './images/no_identicons.png'
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def addressexist():
|
||||||
|
"""Checking address existence"""
|
||||||
|
if BMConfigParser().addresses():
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def on_key(self, window, key, *args):
|
||||||
|
"""Method is used for going on previous screen"""
|
||||||
|
if key == 27:
|
||||||
|
if state.in_search_mode and self.root.ids.scr_mngr.current != (
|
||||||
|
"mailDetail"):
|
||||||
|
self.closeSearchScreen()
|
||||||
|
elif self.root.ids.scr_mngr.current == "mailDetail":
|
||||||
|
self.root.ids.scr_mngr.current = 'sent'\
|
||||||
|
if state.detailPageType == 'sent' else 'inbox' \
|
||||||
|
if state.detailPageType == 'inbox' else 'draft'
|
||||||
|
self.back_press()
|
||||||
|
elif self.root.ids.scr_mngr.current == "create":
|
||||||
|
self.save_draft()
|
||||||
|
self.set_common_header()
|
||||||
|
state.in_composer = False
|
||||||
|
self.root.ids.scr_mngr.current = 'inbox'
|
||||||
|
elif self.root.ids.scr_mngr.current == "showqrcode":
|
||||||
|
self.root.ids.scr_mngr.current = 'myaddress'
|
||||||
|
elif self.root.ids.scr_mngr.current == "random":
|
||||||
|
self.root.ids.scr_mngr.current = 'login'
|
||||||
|
else:
|
||||||
|
self.root.ids.scr_mngr.current = 'inbox'
|
||||||
|
self.root.ids.scr_mngr.transition.direction = 'right'
|
||||||
|
self.root.ids.scr_mngr.transition.bind(on_complete=self.reset)
|
||||||
|
return True
|
||||||
|
elif key == 13 and state.searcing_text:
|
||||||
|
if state.search_screen == 'inbox':
|
||||||
|
self.root.ids.sc1.children[1].active = True
|
||||||
|
Clock.schedule_once(self.search_callback, 0.5)
|
||||||
|
elif state.search_screen == 'addressbook':
|
||||||
|
self.root.ids.sc11.children[1].active = True
|
||||||
|
Clock.schedule_once(self.search_callback, 0.5)
|
||||||
|
elif state.search_screen == 'myaddress':
|
||||||
|
self.root.ids.sc10.children[1].active = True
|
||||||
|
Clock.schedule_once(self.search_callback, 0.5)
|
||||||
|
elif state.search_screen == 'sent':
|
||||||
|
self.root.ids.sc4.children[1].active = True
|
||||||
|
Clock.schedule_once(self.search_callback, 0.5)
|
||||||
|
|
||||||
|
def search_callback(self, dt=0):
|
||||||
|
"""Show data after loader is loaded"""
|
||||||
|
if state.search_screen == 'inbox':
|
||||||
|
self.root.ids.sc1.ids.ml.clear_widgets()
|
||||||
|
self.root.ids.sc1.loadMessagelist(state.association)
|
||||||
|
self.root.ids.sc1.children[1].active = False
|
||||||
|
elif state.search_screen == 'addressbook':
|
||||||
|
self.root.ids.sc11.ids.ml.clear_widgets()
|
||||||
|
self.root.ids.sc11.loadAddresslist(None, 'All', '')
|
||||||
|
self.root.ids.sc11.children[1].active = False
|
||||||
|
elif state.search_screen == 'myaddress':
|
||||||
|
self.root.ids.sc10.ids.ml.clear_widgets()
|
||||||
|
self.root.ids.sc10.init_ui()
|
||||||
|
self.root.ids.sc10.children[1].active = False
|
||||||
|
else:
|
||||||
|
self.root.ids.sc4.ids.ml.clear_widgets()
|
||||||
|
self.root.ids.sc4.loadSent(state.association)
|
||||||
|
self.root.ids.sc4.children[1].active = False
|
||||||
|
self.root.ids.scr_mngr.current = state.search_screen
|
||||||
|
|
||||||
|
def save_draft(self):
|
||||||
|
"""Saving drafts messages"""
|
||||||
|
composer_objs = self.root
|
||||||
|
from_addr = str(self.root.ids.sc3.children[1].ids.ti.text)
|
||||||
|
to_addr = str(self.root.ids.sc3.children[1].ids.txt_input.text)
|
||||||
|
if from_addr and to_addr and state.detailPageType != 'draft' \
|
||||||
|
and not state.in_sent_method:
|
||||||
|
Draft().draft_msg(composer_objs)
|
||||||
|
return
|
||||||
|
|
||||||
|
def reset(self, *args):
|
||||||
|
"""Set transition direction"""
|
||||||
|
self.root.ids.scr_mngr.transition.direction = 'left'
|
||||||
|
self.root.ids.scr_mngr.transition.unbind(on_complete=self.reset)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def status_dispatching(data):
|
||||||
|
"""Dispatching Status acknowledgment"""
|
||||||
|
ackData, message = data
|
||||||
|
if state.ackdata == ackData:
|
||||||
|
state.status.status = message
|
||||||
|
|
||||||
|
def clear_composer(self):
|
||||||
|
"""If slow down, the new composer edit screen"""
|
||||||
|
self.set_navbar_for_composer()
|
||||||
|
composer_obj = self.root.ids.sc3.children[1].ids
|
||||||
|
composer_obj.ti.text = ''
|
||||||
|
composer_obj.btn.text = 'Select'
|
||||||
|
composer_obj.txt_input.text = ''
|
||||||
|
composer_obj.subject.text = ''
|
||||||
|
composer_obj.body.text = ''
|
||||||
|
state.in_composer = True
|
||||||
|
state.in_sent_method = False
|
||||||
|
|
||||||
|
def set_navbar_for_composer(self):
|
||||||
|
"""Clearing toolbar data when composer open"""
|
||||||
|
self.root.ids.toolbar.left_action_items = [
|
||||||
|
['arrow-left', lambda x: self.back_press()]]
|
||||||
|
self.root.ids.toolbar.right_action_items = [
|
||||||
|
['refresh',
|
||||||
|
lambda x: self.root.ids.sc3.children[1].reset_composer()],
|
||||||
|
['send',
|
||||||
|
lambda x: self.root.ids.sc3.children[1].send(self)]]
|
||||||
|
|
||||||
|
def set_common_header(self):
|
||||||
|
"""Common header for all window"""
|
||||||
|
self.root.ids.toolbar.right_action_items = [
|
||||||
|
['account-plus', lambda x: self.addingtoaddressbook()]]
|
||||||
|
self.root.ids.toolbar.left_action_items = [
|
||||||
|
['menu', lambda x: self.root.toggle_nav_drawer()]]
|
||||||
|
return
|
||||||
|
|
||||||
|
def back_press(self):
|
||||||
|
"""Method for, reverting composer to previous page"""
|
||||||
|
self.save_draft()
|
||||||
|
if self.root.ids.scr_mngr.current == \
|
||||||
|
'mailDetail' and state.in_search_mode:
|
||||||
|
toolbar_obj = self.root.ids.toolbar
|
||||||
|
toolbar_obj.left_action_items = [
|
||||||
|
['arrow-left', lambda x: self.closeSearchScreen()]]
|
||||||
|
toolbar_obj.right_action_items = []
|
||||||
|
self.root.ids.toolbar.title = ''
|
||||||
|
else:
|
||||||
|
self.set_common_header()
|
||||||
|
self.root.ids.scr_mngr.current = 'inbox' \
|
||||||
|
if state.in_composer else 'allmails'\
|
||||||
|
if state.is_allmail else state.detailPageType\
|
||||||
|
if state.detailPageType else 'inbox'
|
||||||
|
self.root.ids.scr_mngr.transition.direction = 'right'
|
||||||
|
self.root.ids.scr_mngr.transition.bind(on_complete=self.reset)
|
||||||
|
if state.is_allmail or state.detailPageType == 'draft':
|
||||||
|
state.is_allmail = False
|
||||||
|
state.detailPageType = ''
|
||||||
|
state.in_composer = False
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_inbox_count():
|
||||||
|
"""Getting inbox count"""
|
||||||
state.inbox_count = str(
|
state.inbox_count = str(
|
||||||
sqlQuery(
|
sqlQuery(
|
||||||
"SELECT COUNT(*) FROM inbox WHERE toaddress = '{}' and"
|
"SELECT COUNT(*) FROM inbox WHERE toaddress = '{}' and"
|
||||||
" folder = 'inbox' ;".format(state.association))[0][0])
|
" folder = 'inbox' ;".format(state.association))[0][0])
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_sent_count():
|
||||||
|
"""Getting sent count"""
|
||||||
|
state.sent_count = str(
|
||||||
|
sqlQuery(
|
||||||
|
"SELECT COUNT(*) FROM sent WHERE fromaddress = '{}' and"
|
||||||
|
" folder = 'sent' ;".format(state.association))[0][0])
|
||||||
|
|
||||||
|
def set_message_count(self):
|
||||||
|
"""Setting message count"""
|
||||||
|
try:
|
||||||
|
msg_counter_objs = (
|
||||||
|
self.root_window.children[0].children[2].children[0].ids)
|
||||||
|
except Exception:
|
||||||
|
msg_counter_objs = (
|
||||||
|
self.root_window.children[2].children[2].children[0].ids)
|
||||||
|
self.get_inbox_count()
|
||||||
|
self.get_sent_count()
|
||||||
state.trash_count = str(sqlQuery(
|
state.trash_count = str(sqlQuery(
|
||||||
"SELECT (SELECT count(*) FROM sent"
|
"SELECT (SELECT count(*) FROM sent"
|
||||||
" where fromaddress = '{0}' and folder = 'trash' )"
|
" where fromaddress = '{0}' and folder = 'trash' )"
|
||||||
|
@ -1056,140 +1586,20 @@ class NavigateApp(App):
|
||||||
msg_counter_objs.draft_cnt.badge_text = state.draft_count
|
msg_counter_objs.draft_cnt.badge_text = state.draft_count
|
||||||
msg_counter_objs.allmail_cnt.badge_text = state.all_count
|
msg_counter_objs.allmail_cnt.badge_text = state.all_count
|
||||||
|
|
||||||
@staticmethod
|
def on_start(self):
|
||||||
def getCurrentAccount():
|
"""Method activates on start"""
|
||||||
"""It uses to get current account label."""
|
self.set_message_count()
|
||||||
if state.association:
|
|
||||||
return state.association
|
|
||||||
return "Bitmessage Login"
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def addingtoaddressbook():
|
|
||||||
"""Adding to address Book."""
|
|
||||||
p = GrashofPopup()
|
|
||||||
p.open()
|
|
||||||
|
|
||||||
def getDefaultAccData(self):
|
|
||||||
"""Getting Default Account Data."""
|
|
||||||
if BMConfigParser().addresses():
|
|
||||||
img = identiconGeneration.generate(BMConfigParser().addresses()[0])
|
|
||||||
self.createFolder('./images/default_identicon/')
|
|
||||||
if platform == 'android':
|
|
||||||
# android_path = os.path.expanduser("~/user/0/org.test.bitapp/files/app/")
|
|
||||||
android_path = os.path.join(os.environ['ANDROID_PRIVATE'] + '/app/')
|
|
||||||
img.texture.save('{1}/images/default_identicon/{0}.png'.format(
|
|
||||||
BMConfigParser().addresses()[0], android_path))
|
|
||||||
else:
|
|
||||||
img.texture.save('./images/default_identicon/{}.png'.format(BMConfigParser().addresses()[0]))
|
|
||||||
return BMConfigParser().addresses()[0]
|
|
||||||
return 'Select Address'
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def createFolder(directory):
|
|
||||||
"""This method is used to create the directory when app starts"""
|
|
||||||
try:
|
|
||||||
if not os.path.exists(directory):
|
|
||||||
os.makedirs(directory)
|
|
||||||
except OSError:
|
|
||||||
print 'Error: Creating directory. ' + directory
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_default_image():
|
|
||||||
"""Getting default image on address"""
|
|
||||||
if BMConfigParser().addresses():
|
|
||||||
return './images/default_identicon/{}.png'.format(BMConfigParser().addresses()[0])
|
|
||||||
return './images/no_identicons.png'
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def addressexist():
|
|
||||||
"""Checking address existence."""
|
|
||||||
if BMConfigParser().addresses():
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def on_key(self, window, key, *args):
|
|
||||||
"""Method is used for going on previous screen."""
|
|
||||||
if key == 27:
|
|
||||||
if self.root.ids.scr_mngr.current == "mailDetail":
|
|
||||||
self.root.ids.scr_mngr.current = 'sent'\
|
|
||||||
if state.detailPageType == 'sent' else 'inbox' \
|
|
||||||
if state.detailPageType == 'inbox' else 'draft'
|
|
||||||
self.back_press()
|
|
||||||
elif self.root.ids.scr_mngr.current == "create":
|
|
||||||
composer_objs = self.root
|
|
||||||
from_addr = str(self.root.ids.sc3.children[0].ids.ti.text)
|
|
||||||
to_addr = str(self.root.ids.sc3.children[0].ids.txt_input.text)
|
|
||||||
if from_addr and to_addr and state.detailPageType != 'draft':
|
|
||||||
Draft().draft_msg(composer_objs)
|
|
||||||
self.root.ids.scr_mngr.current = 'inbox'
|
|
||||||
self.back_press()
|
|
||||||
elif self.root.ids.scr_mngr.current == "showqrcode":
|
|
||||||
self.root.ids.scr_mngr.current = 'myaddress'
|
|
||||||
elif self.root.ids.scr_mngr.current == "random":
|
|
||||||
self.root.ids.scr_mngr.current = 'login'
|
|
||||||
else:
|
|
||||||
self.root.ids.scr_mngr.current = 'inbox'
|
|
||||||
self.root.ids.scr_mngr.transition.direction = 'right'
|
|
||||||
self.root.ids.scr_mngr.transition.bind(on_complete=self.reset)
|
|
||||||
return True
|
|
||||||
|
|
||||||
def reset(self, *args):
|
|
||||||
"""Method used to set transition direction."""
|
|
||||||
self.root.ids.scr_mngr.transition.direction = 'left'
|
|
||||||
self.root.ids.scr_mngr.transition.unbind(on_complete=self.reset)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def status_dispatching(data):
|
|
||||||
"""Method used for status dispatching acknowledgment."""
|
|
||||||
ackData, message = data
|
|
||||||
if state.ackdata == ackData:
|
|
||||||
state.status.status = message
|
|
||||||
|
|
||||||
def clear_composer(self):
|
|
||||||
"""If slow down the nwe will make new composer edit screen."""
|
|
||||||
self.set_navbar_for_composer()
|
|
||||||
# self.root.ids.search_bar.clear_widgets()
|
|
||||||
composer_obj = self.root.ids.sc3.children[0].ids
|
|
||||||
composer_obj.ti.text = ''
|
|
||||||
composer_obj.btn.text = 'Select'
|
|
||||||
composer_obj.txt_input.text = ''
|
|
||||||
composer_obj.subject.text = ''
|
|
||||||
composer_obj.body.text = ''
|
|
||||||
state.in_composer = True
|
|
||||||
|
|
||||||
def set_navbar_for_composer(self):
|
|
||||||
"""This method is used for clearing toolbar data when composer open"""
|
|
||||||
self.root.ids.toolbar.left_action_items = [
|
|
||||||
['arrow-left', lambda x: self.back_press()]]
|
|
||||||
self.root.ids.toolbar.right_action_items = [
|
|
||||||
['refresh', lambda x: self.root.ids.sc3.children[0].reset_composer()],
|
|
||||||
['send', lambda x: self.root.ids.sc3.children[0].send(self)]]
|
|
||||||
|
|
||||||
def back_press(self):
|
|
||||||
"""Method used for going back from composer to previous page."""
|
|
||||||
self.root.ids.toolbar.right_action_items = [['account-plus', lambda x: self.addingtoaddressbook()]]
|
|
||||||
self.root.ids.toolbar.left_action_items = [['menu', lambda x: self.root.toggle_nav_drawer()]]
|
|
||||||
self.root.ids.scr_mngr.current = 'inbox' \
|
|
||||||
if state.in_composer else 'allmails'\
|
|
||||||
if state.is_allmail else state.detailPageType\
|
|
||||||
if state.detailPageType else 'inbox'
|
|
||||||
self.root.ids.scr_mngr.transition.direction = 'right'
|
|
||||||
self.root.ids.scr_mngr.transition.bind(on_complete=self.reset)
|
|
||||||
if state.is_allmail or state.detailPageType == 'draft':
|
|
||||||
state.is_allmail = False
|
|
||||||
state.detailPageType = ''
|
|
||||||
state.in_composer = False
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def on_stop():
|
def on_stop():
|
||||||
"""On stop methos is used for stoping the runing script."""
|
"""On stop methos is used for stoping the runing script"""
|
||||||
print "*******************EXITING FROM APPLICATION*******************"
|
print "*******************EXITING FROM APPLICATION*******************"
|
||||||
import shutdown
|
import shutdown
|
||||||
shutdown.doCleanShutdown()
|
shutdown.doCleanShutdown()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def current_address_label(current_add_label=None, current_addr=None):
|
def current_address_label(current_add_label=None, current_addr=None):
|
||||||
"""Getting current address labels."""
|
"""Getting current address labels"""
|
||||||
if BMConfigParser().addresses():
|
if BMConfigParser().addresses():
|
||||||
if current_add_label:
|
if current_add_label:
|
||||||
first_name = current_add_label
|
first_name = current_add_label
|
||||||
|
@ -1198,100 +1608,133 @@ class NavigateApp(App):
|
||||||
addr = BMConfigParser().addresses()[0]
|
addr = BMConfigParser().addresses()[0]
|
||||||
first_name = BMConfigParser().get(addr, 'label')
|
first_name = BMConfigParser().get(addr, 'label')
|
||||||
f_name = first_name.split()
|
f_name = first_name.split()
|
||||||
label = f_name[0][:14].capitalize() + '...' if len(f_name[0]) > 15 else f_name[0].capitalize()
|
label = f_name[0][:14].capitalize() + '...' if len(
|
||||||
|
f_name[0]) > 15 else f_name[0].capitalize()
|
||||||
address = ' (' + addr + '...)'
|
address = ' (' + addr + '...)'
|
||||||
return label + address
|
return label + address
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
def searchQuery(self, instance):
|
def searchQuery(self, instance):
|
||||||
"""Method used for showing searched mails."""
|
"""Showing searched mails"""
|
||||||
state.search_screen = self.root.ids.scr_mngr.current
|
state.search_screen = self.root.ids.scr_mngr.current
|
||||||
state.searcing_text = str(instance.text).strip()
|
state.searcing_text = str(instance.text).strip()
|
||||||
if state.search_screen == 'inbox':
|
if instance.focus and state.searcing_text:
|
||||||
self.root.ids.sc1.ids.ml.clear_widgets()
|
toolbar_obj = self.root.ids.toolbar
|
||||||
self.root.ids.sc1.loadMessagelist(state.association)
|
toolbar_obj.left_action_items = [
|
||||||
elif state.search_screen == 'addressbook':
|
['arrow-left', lambda x: self.closeSearchScreen()]]
|
||||||
self.root.ids.sc11.ids.ml.clear_widgets()
|
toolbar_obj.right_action_items = []
|
||||||
self.root.ids.sc11.loadAddresslist(None, 'All', '')
|
self.root.ids.toolbar.title = ''
|
||||||
elif state.search_screen == 'myaddress':
|
state.in_search_mode = True
|
||||||
self.root.ids.sc10.ids.ml.clear_widgets()
|
|
||||||
self.root.ids.sc10.init_ui()
|
|
||||||
else:
|
|
||||||
self.root.ids.sc4.ids.ml.clear_widgets()
|
|
||||||
self.root.ids.sc4.loadSent(state.association)
|
|
||||||
self.root.ids.scr_mngr.current = state.search_screen
|
|
||||||
|
|
||||||
def refreshScreen(self, instance):
|
def closeSearchScreen(self):
|
||||||
"""Method show search button only on inbox or sent screen."""
|
"""Function for close search screen"""
|
||||||
|
self.set_common_header()
|
||||||
|
address_label = self.current_address_label(
|
||||||
|
BMConfigParser().get(
|
||||||
|
state.association, 'label'), state.association)
|
||||||
|
self.root.ids.toolbar.title = address_label
|
||||||
state.searcing_text = ''
|
state.searcing_text = ''
|
||||||
if instance.text == 'Sent':
|
self.refreshScreen()
|
||||||
self.root.ids.sc4.ids.ml.clear_widgets()
|
state.in_search_mode = False
|
||||||
self.root.ids.sc4.children[1].children[1].ids.search_field.text = ''
|
|
||||||
self.root.ids.sc4.loadSent(state.association)
|
def refreshScreen(self): # pylint: disable=unused-variable
|
||||||
elif instance.text == 'Inbox':
|
"""Method show search button only on inbox or sent screen"""
|
||||||
self.root.ids.sc1.ids.ml.clear_widgets()
|
state.searcing_text = ''
|
||||||
|
if state.search_screen == 'inbox':
|
||||||
try:
|
try:
|
||||||
self.root.ids.sc1.children[2].children[1].ids.search_field.text = ''
|
self.root.ids.sc1.children[
|
||||||
|
3].children[1].ids.search_field.text = ''
|
||||||
except Exception:
|
except Exception:
|
||||||
self.root.ids.sc1.children[1].children[1].ids.search_field.text = ''
|
self.root.ids.sc1.children[
|
||||||
self.root.ids.sc1.loadMessagelist(state.association)
|
2].children[1].ids.search_field.text = ''
|
||||||
elif instance.text == 'Draft':
|
self.root.ids.sc1.children[1].active = True
|
||||||
self.root.ids.sc16.clear_widgets()
|
Clock.schedule_once(self.search_callback, 0.5)
|
||||||
self.root.ids.sc16.add_widget(Draft())
|
elif state.search_screen == 'addressbook':
|
||||||
elif instance.text == 'Trash':
|
self.root.ids.sc11.children[
|
||||||
self.root.ids.sc5.clear_widgets()
|
2].children[1].ids.search_field.text = ''
|
||||||
self.root.ids.sc5.add_widget(Trash())
|
self.root.ids.sc11.children[
|
||||||
elif instance.text == 'All Mails':
|
1].active = True
|
||||||
self.root.ids.sc17.clear_widgets()
|
Clock.schedule_once(self.search_callback, 0.5)
|
||||||
self.root.ids.sc17.add_widget(Allmails())
|
elif state.search_screen == 'myaddress':
|
||||||
elif instance.text == 'Address Book':
|
|
||||||
self.root.ids.sc11.ids.ml.clear_widgets()
|
|
||||||
self.root.ids.sc11.children[1].children[1].ids.search_field.text = ''
|
|
||||||
self.root.ids.sc11.loadAddresslist(None, 'All', '')
|
|
||||||
elif instance.text == 'My Addresses':
|
|
||||||
self.root.ids.sc10.ids.ml.clear_widgets()
|
|
||||||
try:
|
try:
|
||||||
self.root.ids.sc10.children[1].children[1].ids.search_field.text = ''
|
self.root.ids.sc10.children[
|
||||||
|
3].children[1].ids.search_field.text = ''
|
||||||
except Exception:
|
except Exception:
|
||||||
self.root.ids.sc10.children[2].children[1].ids.search_field.text = ''
|
self.root.ids.sc10.children[
|
||||||
self.root.ids.sc10.init_ui()
|
2].children[1].ids.search_field.text = ''
|
||||||
|
self.root.ids.sc10.children[1].active = True
|
||||||
|
Clock.schedule_once(self.search_callback, 0.5)
|
||||||
|
else:
|
||||||
|
self.root.ids.sc4.children[
|
||||||
|
2].children[1].ids.search_field.text = ''
|
||||||
|
self.root.ids.sc4.children[1].active = True
|
||||||
|
Clock.schedule_once(self.search_callback, 0.5)
|
||||||
return
|
return
|
||||||
|
|
||||||
def set_identicon(self, text):
|
def set_identicon(self, text):
|
||||||
"""This method is use for showing identicon in address spinner"""
|
"""Show identicon in address spinner"""
|
||||||
img = identiconGeneration.generate(text)
|
img = identiconGeneration.generate(text)
|
||||||
self.root.children[2].children[0].ids.btn.children[1].texture = img.texture
|
self.root.children[2].children[0].ids.btn.children[1].texture = (
|
||||||
|
img.texture)
|
||||||
@staticmethod
|
|
||||||
def address_identicon():
|
|
||||||
"""Address identicon"""
|
|
||||||
return './images/drawer_logo1.png'
|
|
||||||
|
|
||||||
def set_mail_detail_header(self):
|
def set_mail_detail_header(self):
|
||||||
"""Method is used for setting the details of the page"""
|
"""Setting the details of the page"""
|
||||||
toolbar_obj = self.root.ids.toolbar
|
toolbar_obj = self.root.ids.toolbar
|
||||||
toolbar_obj.left_action_items = [['arrow-left', lambda x: self.back_press()]]
|
toolbar_obj.left_action_items = [
|
||||||
delete_btn = ['delete-forever', lambda x: self.root.ids.sc14.delete_mail()]
|
['arrow-left', lambda x: self.back_press()]]
|
||||||
|
delete_btn = ['delete-forever',
|
||||||
|
lambda x: self.root.ids.sc14.delete_mail()]
|
||||||
dynamic_list = []
|
dynamic_list = []
|
||||||
if state.detailPageType == 'inbox':
|
if state.detailPageType == 'inbox':
|
||||||
dynamic_list = [['reply', lambda x: self.root.ids.sc14.inbox_reply()], delete_btn]
|
dynamic_list = [
|
||||||
|
['reply', lambda x: self.root.ids.sc14.inbox_reply()],
|
||||||
|
delete_btn]
|
||||||
elif state.detailPageType == 'sent':
|
elif state.detailPageType == 'sent':
|
||||||
dynamic_list = [delete_btn]
|
dynamic_list = [delete_btn]
|
||||||
elif state.detailPageType == 'draft':
|
elif state.detailPageType == 'draft':
|
||||||
dynamic_list = [['pencil', lambda x: self.root.ids.sc14.write_msg(self)], delete_btn]
|
dynamic_list = [
|
||||||
|
['pencil', lambda x: self.root.ids.sc14.write_msg(self)],
|
||||||
|
delete_btn]
|
||||||
toolbar_obj.right_action_items = dynamic_list
|
toolbar_obj.right_action_items = dynamic_list
|
||||||
|
|
||||||
|
def load_screen(self, instance):
|
||||||
|
"""This method is used for loading screen on every click"""
|
||||||
|
if instance.text == 'Inbox':
|
||||||
|
self.root.ids.scr_mngr.current = 'inbox'
|
||||||
|
self.root.ids.sc1.children[1].active = True
|
||||||
|
elif instance.text == 'All Mails':
|
||||||
|
self.root.ids.scr_mngr.current = 'allmails'
|
||||||
|
try:
|
||||||
|
self.root.ids.sc17.children[1].active = True
|
||||||
|
except Exception:
|
||||||
|
self.root.ids.sc17.children[0].children[1].active = True
|
||||||
|
Clock.schedule_once(partial(self.load_screen_callback, instance), 1)
|
||||||
|
|
||||||
|
def load_screen_callback(self, instance, dt=0):
|
||||||
|
"""This method is rotating loader for few seconds"""
|
||||||
|
if instance.text == 'Inbox':
|
||||||
|
self.root.ids.sc1.ids.ml.clear_widgets()
|
||||||
|
self.root.ids.sc1.loadMessagelist(state.association)
|
||||||
|
self.root.ids.sc1.children[1].active = False
|
||||||
|
elif instance.text == 'All Mails':
|
||||||
|
self.root.ids.sc17.clear_widgets()
|
||||||
|
self.root.ids.sc17.add_widget(Allmails())
|
||||||
|
try:
|
||||||
|
self.root.ids.sc17.children[1].active = False
|
||||||
|
except Exception:
|
||||||
|
self.root.ids.sc17.children[0].children[1].active = False
|
||||||
|
|
||||||
|
|
||||||
class GrashofPopup(Popup):
|
class GrashofPopup(Popup):
|
||||||
"""Methods for saving contacts, error messages."""
|
"""Moule for save contacts and error messages"""
|
||||||
|
valid = False
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs): # pylint: disable=useless-super-delegation
|
||||||
"""Grash of pop screen settings."""
|
"""Grash of pop screen settings"""
|
||||||
# pylint: disable=useless-super-delegation
|
|
||||||
super(GrashofPopup, self).__init__(**kwargs)
|
super(GrashofPopup, self).__init__(**kwargs)
|
||||||
|
|
||||||
def savecontact(self):
|
def savecontact(self):
|
||||||
"""Method is used for Saving Contacts."""
|
"""Method is used for saving contacts"""
|
||||||
label = self.ids.label.text.strip()
|
label = self.ids.label.text.strip()
|
||||||
address = self.ids.address.text.strip()
|
address = self.ids.address.text.strip()
|
||||||
if label == '' and address == '':
|
if label == '' and address == '':
|
||||||
|
@ -1304,19 +1747,22 @@ class GrashofPopup(Popup):
|
||||||
|
|
||||||
stored_address = [addr[1] for addr in kivy_helper_search.search_sql(
|
stored_address = [addr[1] for addr in kivy_helper_search.search_sql(
|
||||||
folder="addressbook")]
|
folder="addressbook")]
|
||||||
if label and address and address not in stored_address:
|
stored_labels = [labels[0] for labels in kivy_helper_search.search_sql(
|
||||||
|
folder="addressbook")]
|
||||||
|
if label and address and address not in stored_address \
|
||||||
|
and label not in stored_labels and self.valid:
|
||||||
# state.navinstance = self.parent.children[1]
|
# state.navinstance = self.parent.children[1]
|
||||||
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)
|
||||||
state.kivyapp.root.ids.sc11.ids.ml.clear_widgets()
|
self.parent.children[1].ids.sc11.ids.ml.clear_widgets()
|
||||||
state.kivyapp.root.ids.sc11.loadAddresslist(None, 'All', '')
|
self.parent.children[1].ids.sc11.loadAddresslist(None, 'All', '')
|
||||||
self.parent.children[1].ids.scr_mngr.current = 'addressbook'
|
self.parent.children[1].ids.scr_mngr.current = 'addressbook'
|
||||||
toast('Saved')
|
toast('Saved')
|
||||||
|
|
||||||
# pylint: disable=attribute-defined-outside-init
|
# pylint: disable=attribute-defined-outside-init
|
||||||
def show_error_message(self):
|
def show_error_message(self):
|
||||||
"""Showing error message."""
|
"""Showing error message"""
|
||||||
content = MDLabel(
|
content = MDLabel(
|
||||||
font_style='Body1',
|
font_style='Body1',
|
||||||
theme_text_color='Secondary',
|
theme_text_color='Secondary',
|
||||||
|
@ -1336,12 +1782,13 @@ class GrashofPopup(Popup):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def close_pop():
|
def close_pop():
|
||||||
"""Pop is Canceled."""
|
"""Pop is Canceled"""
|
||||||
toast('Canceled')
|
toast('Canceled')
|
||||||
|
|
||||||
def checkAddress_valid(self, instance):
|
def checkAddress_valid(self, instance):
|
||||||
"""Checking is address is valid or not"""
|
"""Checking address is valid or not"""
|
||||||
my_addresses = self.parent.children[1].children[2].children[0].ids.btn.values
|
my_addresses = (
|
||||||
|
self.parent.children[1].children[2].children[0].ids.btn.values)
|
||||||
add_book = [addr[1] for addr in kivy_helper_search.search_sql(
|
add_book = [addr[1] for addr in kivy_helper_search.search_sql(
|
||||||
folder="addressbook")]
|
folder="addressbook")]
|
||||||
entered_text = str(instance.text).strip()
|
entered_text = str(instance.text).strip()
|
||||||
|
@ -1349,57 +1796,95 @@ class GrashofPopup(Popup):
|
||||||
text = 'Address is already in the addressbook.'
|
text = 'Address is already in the addressbook.'
|
||||||
elif entered_text in my_addresses:
|
elif entered_text in my_addresses:
|
||||||
text = 'You can not save your own address.'
|
text = 'You can not save your own address.'
|
||||||
|
elif entered_text:
|
||||||
|
text = self.addressChanged(entered_text)
|
||||||
|
|
||||||
if entered_text in my_addresses or entered_text in add_book:
|
if entered_text in my_addresses or entered_text in add_book:
|
||||||
if len(self.ids.popup_box.children) <= 2:
|
self.ids.address.error = True
|
||||||
err_msg = MDLabel(
|
self.ids.address.helper_text = text
|
||||||
id='erro_msg',
|
elif entered_text and self.valid:
|
||||||
font_style='Body2',
|
self.ids.address.error = False
|
||||||
text=text,
|
elif entered_text:
|
||||||
font_size=5)
|
self.ids.address.error = True
|
||||||
err_msg.color = 1, 0, 0, 1
|
self.ids.address.helper_text = text
|
||||||
self.ids.popup_box.add_widget(err_msg)
|
else:
|
||||||
self.ids.save_addr.disabled = True
|
self.ids.address.error = False
|
||||||
elif len(self.ids.popup_box.children) > 2:
|
self.ids.address.helper_text = 'This field is required'
|
||||||
self.ids.popup_box.remove_widget(self.ids.popup_box.children[0])
|
|
||||||
self.ids.save_addr.disabled = False
|
def checkLabel_valid(self, instance):
|
||||||
|
"""Checking address label is unique or not"""
|
||||||
|
entered_label = instance.text.strip()
|
||||||
|
addr_labels = [labels[0] for labels in kivy_helper_search.search_sql(
|
||||||
|
folder="addressbook")]
|
||||||
|
if entered_label in addr_labels:
|
||||||
|
self.ids.label.error = True
|
||||||
|
self.ids.label.helper_text = 'label name already exists.'
|
||||||
|
elif entered_label:
|
||||||
|
self.ids.label.error = False
|
||||||
|
else:
|
||||||
|
self.ids.label.error = False
|
||||||
|
self.ids.label.helper_text = 'This field is required'
|
||||||
|
|
||||||
|
def _onSuccess(self, addressVersion, streamNumber, ripe):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def addressChanged(self, addr):
|
||||||
|
"""Address validation callback, performs validation and gives feedback"""
|
||||||
|
status, addressVersion, streamNumber, ripe = decodeAddress(
|
||||||
|
str(addr))
|
||||||
|
self.valid = status == 'success'
|
||||||
|
if self.valid:
|
||||||
|
text = "Address is valid."
|
||||||
|
self._onSuccess(addressVersion, streamNumber, ripe)
|
||||||
|
elif status == 'missingbm':
|
||||||
|
text = "The address should start with ''BM-''"
|
||||||
|
elif status == 'checksumfailed':
|
||||||
|
text = "The address is not typed or copied correctly(the checksum failed)."
|
||||||
|
elif status == 'versiontoohigh':
|
||||||
|
text = "The version number of this address is higher"\
|
||||||
|
" than this software can support. Please upgrade Bitmessage."
|
||||||
|
elif status == 'invalidcharacters':
|
||||||
|
text = "The address contains invalid characters."
|
||||||
|
elif status == 'ripetooshort':
|
||||||
|
text = "Some data encoded in the address is too short."
|
||||||
|
elif status == 'ripetoolong':
|
||||||
|
text = "Some data encoded in the address is too long."
|
||||||
|
elif status == 'varintmalformed':
|
||||||
|
text = "Some data encoded in the address is malformed."
|
||||||
|
return text
|
||||||
|
|
||||||
|
|
||||||
class AvatarSampleWidget(ILeftBody, Image):
|
class AvatarSampleWidget(ILeftBody, Image):
|
||||||
"""Avatar Sample Widget."""
|
"""Avatar Sample Widget"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class IconLeftSampleWidget(ILeftBodyTouch, MDIconButton):
|
class IconLeftSampleWidget(ILeftBodyTouch, MDIconButton):
|
||||||
"""Left icon sample widget."""
|
"""Left icon sample widget"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class IconRightSampleWidget(IRightBodyTouch, MDCheckbox):
|
class IconRightSampleWidget(IRightBodyTouch, MDCheckbox):
|
||||||
"""Right icon sample widget."""
|
"""Right icon sample widget"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class NavigationDrawerTwoLineListItem(
|
class NavigationDrawerTwoLineListItem(
|
||||||
TwoLineListItem, NavigationDrawerHeaderBase):
|
TwoLineListItem, NavigationDrawerHeaderBase):
|
||||||
"""Navigation Drawer in Listitems."""
|
"""Navigation Drawer in Listitems"""
|
||||||
|
|
||||||
address_property = StringProperty()
|
address_property = StringProperty()
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
"""Method for Navigation Drawer."""
|
"""Method for Navigation Drawer"""
|
||||||
super(NavigationDrawerTwoLineListItem, self).__init__(**kwargs)
|
super(NavigationDrawerTwoLineListItem, self).__init__(**kwargs)
|
||||||
Clock.schedule_once(lambda dt: self.setup())
|
Clock.schedule_once(lambda dt: self.setup())
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
"""Bind Controller.current_account property."""
|
"""Bind Controller.current_account property"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def on_current_account(self, account):
|
def on_current_account(self, account):
|
||||||
"""Account detail."""
|
"""Account detail"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _update_specific_text_color(self, instance, value):
|
def _update_specific_text_color(self, instance, value):
|
||||||
|
@ -1410,8 +1895,7 @@ class NavigationDrawerTwoLineListItem(
|
||||||
|
|
||||||
|
|
||||||
class MailDetail(Screen):
|
class MailDetail(Screen):
|
||||||
"""MailDetail 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()
|
||||||
|
@ -1420,12 +1904,12 @@ class MailDetail(Screen):
|
||||||
page_type = StringProperty()
|
page_type = StringProperty()
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""Mail Details method."""
|
"""Mail Details method"""
|
||||||
super(MailDetail, 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 MailDetail mails."""
|
"""Clock Schdule for method MailDetail mails"""
|
||||||
self.page_type = state.detailPageType if state.detailPageType else ''
|
self.page_type = state.detailPageType if state.detailPageType else ''
|
||||||
if state.detailPageType == 'sent' or state.detailPageType == 'draft':
|
if state.detailPageType == 'sent' or state.detailPageType == 'draft':
|
||||||
data = sqlQuery(
|
data = sqlQuery(
|
||||||
|
@ -1443,7 +1927,7 @@ class MailDetail(Screen):
|
||||||
state.kivyapp.set_mail_detail_header()
|
state.kivyapp.set_mail_detail_header()
|
||||||
|
|
||||||
def assign_mail_details(self, data):
|
def assign_mail_details(self, data):
|
||||||
"""Assigning mail details."""
|
"""Assigning mail details"""
|
||||||
self.to_addr = data[0][0]
|
self.to_addr = data[0][0]
|
||||||
self.from_addr = data[0][1]
|
self.from_addr = data[0][1]
|
||||||
self.subject = data[0][2].upper(
|
self.subject = data[0][2].upper(
|
||||||
|
@ -1457,9 +1941,13 @@ class MailDetail(Screen):
|
||||||
'message': self.message}
|
'message': self.message}
|
||||||
|
|
||||||
def delete_mail(self):
|
def delete_mail(self):
|
||||||
"""Method for mail delete."""
|
"""Method for mail delete"""
|
||||||
msg_count_objs = state.kivyapp.root.children[2].children[0].ids
|
msg_count_objs = state.kivyapp.root.children[2].children[0].ids
|
||||||
|
state.searcing_text = ''
|
||||||
|
self.children[0].children[0].active = True
|
||||||
if state.detailPageType == 'sent':
|
if state.detailPageType == 'sent':
|
||||||
|
state.kivyapp.root.ids.sc4.children[
|
||||||
|
2].children[1].ids.search_field.text = ''
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
"UPDATE sent SET folder = 'trash' WHERE"
|
"UPDATE sent SET folder = 'trash' WHERE"
|
||||||
" ackdata = ?;", str(state.mail_id))
|
" ackdata = ?;", str(state.mail_id))
|
||||||
|
@ -1468,68 +1956,84 @@ class MailDetail(Screen):
|
||||||
self.parent.screens[3].ids.ml.clear_widgets()
|
self.parent.screens[3].ids.ml.clear_widgets()
|
||||||
self.parent.screens[3].loadSent(state.association)
|
self.parent.screens[3].loadSent(state.association)
|
||||||
elif state.detailPageType == 'inbox':
|
elif state.detailPageType == 'inbox':
|
||||||
|
state.kivyapp.root.ids.sc1.children[
|
||||||
|
2].children[1].ids.search_field.text = ''
|
||||||
|
self.parent.screens[0].children[2].children[
|
||||||
|
1].ids.search_field.text = ''
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
"UPDATE inbox SET folder = 'trash' WHERE"
|
"UPDATE inbox SET folder = 'trash' WHERE"
|
||||||
" msgid = ?;", str(state.mail_id))
|
" msgid = ?;", str(state.mail_id))
|
||||||
msg_count_objs.inbox_cnt.badge_text = str(int(state.inbox_count) - 1)
|
msg_count_objs.inbox_cnt.badge_text = str(
|
||||||
|
int(state.inbox_count) - 1)
|
||||||
state.inbox_count = str(int(state.inbox_count) - 1)
|
state.inbox_count = str(int(state.inbox_count) - 1)
|
||||||
self.parent.screens[0].ids.ml.clear_widgets()
|
self.parent.screens[0].ids.ml.clear_widgets()
|
||||||
self.parent.screens[0].loadMessagelist(state.association)
|
self.parent.screens[0].loadMessagelist(state.association)
|
||||||
|
|
||||||
elif state.detailPageType == 'draft':
|
elif state.detailPageType == 'draft':
|
||||||
sqlExecute("DELETE FROM sent WHERE ackdata = ?;", str(
|
sqlExecute("DELETE FROM sent WHERE ackdata = ?;", str(
|
||||||
state.mail_id))
|
state.mail_id))
|
||||||
msg_count_objs.draft_cnt.badge_text = str(int(state.draft_count) - 1)
|
msg_count_objs.draft_cnt.badge_text = str(
|
||||||
|
int(state.draft_count) - 1)
|
||||||
state.draft_count = str(int(state.draft_count) - 1)
|
state.draft_count = str(int(state.draft_count) - 1)
|
||||||
self.parent.screens[15].clear_widgets()
|
self.parent.screens[15].clear_widgets()
|
||||||
self.parent.screens[15].add_widget(Draft())
|
self.parent.screens[15].add_widget(Draft())
|
||||||
|
|
||||||
self.parent.current = 'allmails' if state.is_allmail else state.detailPageType
|
# self.parent.current = 'allmails' \
|
||||||
|
# if state.is_allmail else state.detailPageType
|
||||||
if state.detailPageType != 'draft':
|
if state.detailPageType != 'draft':
|
||||||
msg_count_objs.trash_cnt.badge_text = str(int(state.trash_count) + 1)
|
msg_count_objs.trash_cnt.badge_text = str(
|
||||||
msg_count_objs.allmail_cnt.badge_text = str(int(state.all_count) - 1)
|
int(state.trash_count) + 1)
|
||||||
|
msg_count_objs.allmail_cnt.badge_text = str(
|
||||||
|
int(state.all_count) - 1)
|
||||||
state.trash_count = str(int(state.trash_count) + 1)
|
state.trash_count = str(int(state.trash_count) + 1)
|
||||||
state.all_count = str(int(state.all_count) - 1)
|
state.all_count = str(int(state.all_count) - 1)
|
||||||
self.parent.screens[4].clear_widgets()
|
self.parent.screens[4].clear_widgets()
|
||||||
self.parent.screens[4].add_widget(Trash())
|
self.parent.screens[4].add_widget(Trash())
|
||||||
self.parent.screens[16].clear_widgets()
|
self.parent.screens[16].ids.ml.clear_widgets()
|
||||||
self.parent.screens[16].add_widget(Allmails())
|
self.parent.screens[16].init_ui(dt=0)
|
||||||
state.kivyapp.back_press()
|
Clock.schedule_once(self.callback_for_delete, 4)
|
||||||
|
|
||||||
|
def callback_for_delete(self, dt=0):
|
||||||
|
"""Delete method from allmails"""
|
||||||
|
self.children[0].children[0].active = False
|
||||||
|
state.kivyapp.set_common_header()
|
||||||
|
self.parent.current = 'allmails' \
|
||||||
|
if state.is_allmail else state.detailPageType
|
||||||
|
state.detailPageType = ''
|
||||||
toast('Deleted')
|
toast('Deleted')
|
||||||
|
|
||||||
def inbox_reply(self):
|
def inbox_reply(self):
|
||||||
"""Method used for replying inbox messages."""
|
"""Reply inbox messages"""
|
||||||
data = sqlQuery(
|
data = sqlQuery(
|
||||||
"select toaddress, fromaddress, subject, message from inbox where"
|
"select toaddress, fromaddress, subject, message from inbox where"
|
||||||
" msgid = ?;", str(state.mail_id))
|
" msgid = ?;", str(state.mail_id))
|
||||||
composer_obj = self.parent.screens[2].children[0].ids
|
composer_obj = self.parent.screens[2].children[1].ids
|
||||||
composer_obj.ti.text = data[0][0]
|
composer_obj.ti.text = data[0][0]
|
||||||
composer_obj.btn.text = data[0][0]
|
composer_obj.btn.text = data[0][0]
|
||||||
composer_obj.txt_input.text = data[0][1]
|
composer_obj.txt_input.text = data[0][1]
|
||||||
composer_obj.subject.text = data[0][2]
|
composer_obj.subject.text = data[0][2]
|
||||||
composer_obj.body.text = ''
|
composer_obj.body.text = ''
|
||||||
state.kivyapp.root.ids.sc3.children[0].ids.rv.data = ''
|
state.kivyapp.root.ids.sc3.children[1].ids.rv.data = ''
|
||||||
self.parent.current = 'create'
|
self.parent.current = 'create'
|
||||||
state.kivyapp.set_navbar_for_composer()
|
state.kivyapp.set_navbar_for_composer()
|
||||||
|
|
||||||
def copy_sent_mail(self):
|
|
||||||
"""Method used for copying sent mail to the composer."""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def write_msg(self, navApp):
|
def write_msg(self, navApp):
|
||||||
"""Method used to write on draft mail."""
|
"""Write on draft mail"""
|
||||||
state.send_draft_mail = state.mail_id
|
state.send_draft_mail = state.mail_id
|
||||||
composer_ids = self.parent.parent.parent.parent.ids.sc3.children[0].ids
|
composer_ids = (
|
||||||
|
self.parent.parent.parent.parent.parent.ids.sc3.children[1].ids)
|
||||||
composer_ids.ti.text = state.write_msg['from_addr']
|
composer_ids.ti.text = state.write_msg['from_addr']
|
||||||
composer_ids.btn.text = state.write_msg['from_addr']
|
composer_ids.btn.text = state.write_msg['from_addr']
|
||||||
composer_ids.txt_input.text = state.write_msg['to_addr']
|
composer_ids.txt_input.text = state.write_msg['to_addr']
|
||||||
composer_ids.subject.text = state.write_msg['subject']
|
composer_ids.subject.text = state.write_msg[
|
||||||
|
'subject'] if state.write_msg['subject'] != '(no subject)' else ''
|
||||||
composer_ids.body.text = state.write_msg['message']
|
composer_ids.body.text = state.write_msg['message']
|
||||||
self.parent.current = 'create'
|
self.parent.current = 'create'
|
||||||
navApp.set_navbar_for_composer()
|
navApp.set_navbar_for_composer()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def copy_composer_text(instance, *args):
|
def copy_composer_text(instance, *args):
|
||||||
"""This method is used for copying the data from mail detail page"""
|
"""Copy the data from mail detail page"""
|
||||||
if len(instance.parent.text.split(':')) > 1:
|
if len(instance.parent.text.split(':')) > 1:
|
||||||
cpy_text = instance.parent.text.split(':')[1].strip()
|
cpy_text = instance.parent.text.split(':')[1].strip()
|
||||||
else:
|
else:
|
||||||
|
@ -1539,87 +2043,109 @@ class MailDetail(Screen):
|
||||||
|
|
||||||
|
|
||||||
class MyaddDetailPopup(Popup):
|
class MyaddDetailPopup(Popup):
|
||||||
"""MyaddDetailPopup pop is used for showing my address detail."""
|
"""MyaddDetailPopup pop is used for showing my address detail"""
|
||||||
|
|
||||||
address_label = StringProperty()
|
address_label = StringProperty()
|
||||||
address = StringProperty()
|
address = StringProperty()
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs): # pylint: disable=useless-super-delegation
|
||||||
"""My Address Details screen setting."""
|
"""My Address Details screen setting"""
|
||||||
# pylint: disable=useless-super-delegation
|
|
||||||
super(MyaddDetailPopup, self).__init__(**kwargs)
|
super(MyaddDetailPopup, self).__init__(**kwargs)
|
||||||
|
|
||||||
def set_address(self, address, label):
|
def set_address(self, address, label):
|
||||||
"""Getting address for displaying details on popup."""
|
"""Getting address for displaying details on popup"""
|
||||||
self.address_label = label
|
self.address_label = label
|
||||||
self.address = address
|
self.address = address
|
||||||
|
|
||||||
def send_message_from(self):
|
def send_message_from(self):
|
||||||
"""Method used to fill from address of composer autofield."""
|
"""Method used to fill from address of composer autofield"""
|
||||||
|
state.kivyapp.set_navbar_for_composer()
|
||||||
window_obj = self.parent.children[1].ids
|
window_obj = self.parent.children[1].ids
|
||||||
window_obj.sc3.children[0].ids.ti.text = self.address
|
window_obj.sc3.children[1].ids.ti.text = self.address
|
||||||
window_obj.sc3.children[0].ids.btn.text = self.address
|
window_obj.sc3.children[1].ids.btn.text = self.address
|
||||||
window_obj.sc3.children[0].ids.txt_input.text = ''
|
window_obj.sc3.children[1].ids.txt_input.text = ''
|
||||||
window_obj.sc3.children[0].ids.subject.text = ''
|
window_obj.sc3.children[1].ids.subject.text = ''
|
||||||
window_obj.sc3.children[0].ids.body.text = ''
|
window_obj.sc3.children[1].ids.body.text = ''
|
||||||
window_obj.scr_mngr.current = 'create'
|
window_obj.scr_mngr.current = 'create'
|
||||||
self.dismiss()
|
self.dismiss()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def close_pop():
|
def close_pop():
|
||||||
"""Pop is Canceled."""
|
"""Pop is Canceled"""
|
||||||
toast('Canceled')
|
toast('Canceled')
|
||||||
|
|
||||||
|
|
||||||
class AddbookDetailPopup(Popup):
|
class AddbookDetailPopup(Popup):
|
||||||
"""AddbookDetailPopup pop is used for showing my address detail."""
|
"""AddbookDetailPopup pop is used for showing my address detail"""
|
||||||
|
|
||||||
address_label = StringProperty()
|
address_label = StringProperty()
|
||||||
address = StringProperty()
|
address = StringProperty()
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
"""Method used set screen of address detail page."""
|
"""Set screen of address detail page"""
|
||||||
# pylint: disable=useless-super-delegation
|
# pylint: disable=useless-super-delegation
|
||||||
super(AddbookDetailPopup, self).__init__(**kwargs)
|
super(AddbookDetailPopup, self).__init__(**kwargs)
|
||||||
|
|
||||||
def set_addbook_data(self, address, label):
|
def set_addbook_data(self, address, label):
|
||||||
"""Getting address book data for detial dipaly."""
|
"""Getting address book data for detial dipaly"""
|
||||||
self.address_label = label
|
self.address_label = label
|
||||||
self.address = address
|
self.address = address
|
||||||
|
|
||||||
def update_addbook_label(self, address):
|
def update_addbook_label(self, address):
|
||||||
"""Updating the label of address book address."""
|
"""Updating the label of address book address"""
|
||||||
if str(self.ids.add_label.text):
|
address_list = kivy_helper_search.search_sql(folder="addressbook")
|
||||||
|
stored_labels = [labels[0] for labels in address_list]
|
||||||
|
add_dict = dict(address_list)
|
||||||
|
label = str(self.ids.add_label.text)
|
||||||
|
if label in stored_labels and self.address == add_dict[label]:
|
||||||
|
stored_labels.remove(label)
|
||||||
|
if label and label not in stored_labels:
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
"UPDATE addressbook SET label = '{}' WHERE"
|
"UPDATE addressbook SET label = '{}' WHERE"
|
||||||
" address = '{}';".format(str(self.ids.add_label.text), address))
|
" address = '{}';".format(
|
||||||
|
str(self.ids.add_label.text), address))
|
||||||
self.parent.children[1].ids.sc11.ids.ml.clear_widgets()
|
self.parent.children[1].ids.sc11.ids.ml.clear_widgets()
|
||||||
self.parent.children[1].ids.sc11.loadAddresslist(None, 'All', '')
|
self.parent.children[1].ids.sc11.loadAddresslist(None, 'All', '')
|
||||||
self.dismiss()
|
self.dismiss()
|
||||||
toast('Saved')
|
toast('Saved')
|
||||||
|
|
||||||
def send_message_to(self):
|
def send_message_to(self):
|
||||||
"""Method used to fill to_address of composer autofield."""
|
"""Method used to fill to_address of composer autofield"""
|
||||||
|
state.kivyapp.set_navbar_for_composer()
|
||||||
window_obj = self.parent.children[1].ids
|
window_obj = self.parent.children[1].ids
|
||||||
window_obj.sc3.children[0].ids.txt_input.text = self.address
|
window_obj.sc3.children[1].ids.txt_input.text = self.address
|
||||||
window_obj.sc3.children[0].ids.ti.text = ''
|
window_obj.sc3.children[1].ids.ti.text = ''
|
||||||
window_obj.sc3.children[0].ids.btn.text = 'Select'
|
window_obj.sc3.children[1].ids.btn.text = 'Select'
|
||||||
window_obj.sc3.children[0].ids.subject.text = ''
|
window_obj.sc3.children[1].ids.subject.text = ''
|
||||||
window_obj.sc3.children[0].ids.body.text = ''
|
window_obj.sc3.children[1].ids.body.text = ''
|
||||||
window_obj.scr_mngr.current = 'create'
|
window_obj.scr_mngr.current = 'create'
|
||||||
self.dismiss()
|
self.dismiss()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def close_pop():
|
def close_pop():
|
||||||
"""Pop is Canceled."""
|
"""Pop is Canceled"""
|
||||||
toast('Canceled')
|
toast('Canceled')
|
||||||
|
|
||||||
|
def checkLabel_valid(self, instance):
|
||||||
|
"""Checking address label is unique of not"""
|
||||||
|
entered_label = str(instance.text.strip())
|
||||||
|
address_list = kivy_helper_search.search_sql(folder="addressbook")
|
||||||
|
addr_labels = [labels[0] for labels in address_list]
|
||||||
|
add_dict = dict(address_list)
|
||||||
|
if self.address and entered_label in addr_labels \
|
||||||
|
and self.address != add_dict[entered_label]:
|
||||||
|
self.ids.add_label.error = True
|
||||||
|
self.ids.add_label.helper_text = 'label name already exists.'
|
||||||
|
elif entered_label:
|
||||||
|
self.ids.add_label.error = False
|
||||||
|
else:
|
||||||
|
self.ids.add_label.error = False
|
||||||
|
self.ids.add_label.helper_text = 'This field is required'
|
||||||
|
|
||||||
|
|
||||||
class ShowQRCode(Screen):
|
class ShowQRCode(Screen):
|
||||||
"""ShowQRCode Screen uses to show the detail of mails."""
|
"""ShowQRCode Screen uses to show the detail of mails"""
|
||||||
|
|
||||||
def qrdisplay(self):
|
def qrdisplay(self):
|
||||||
"""Method used for showing QR Code."""
|
"""Showing QR Code"""
|
||||||
# self.manager.parent.parent.parent.ids.search_bar.clear_widgets()
|
# self.manager.parent.parent.parent.ids.search_bar.clear_widgets()
|
||||||
self.ids.qr.clear_widgets()
|
self.ids.qr.clear_widgets()
|
||||||
from kivy.garden.qrcode import QRCodeWidget
|
from kivy.garden.qrcode import QRCodeWidget
|
||||||
|
@ -1629,12 +2155,14 @@ class ShowQRCode(Screen):
|
||||||
|
|
||||||
|
|
||||||
class Draft(Screen):
|
class Draft(Screen):
|
||||||
"""Draft screen is used to show the list of draft messages."""
|
"""Draft screen is used to show the list of draft messages"""
|
||||||
|
|
||||||
data = ListProperty()
|
data = ListProperty()
|
||||||
|
account = StringProperty()
|
||||||
|
queryreturn = ListProperty()
|
||||||
|
has_refreshed = True
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""Method used for storing draft messages."""
|
"""Method used for storing draft messages"""
|
||||||
super(Draft, self).__init__(*args, **kwargs)
|
super(Draft, self).__init__(*args, **kwargs)
|
||||||
if state.association == '':
|
if state.association == '':
|
||||||
if BMConfigParser().addresses():
|
if BMConfigParser().addresses():
|
||||||
|
@ -1642,36 +2170,65 @@ class Draft(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 draft accounts."""
|
"""Clock Schdule for method draft accounts"""
|
||||||
self.sentaccounts()
|
self.sentaccounts()
|
||||||
print dt
|
print dt
|
||||||
|
|
||||||
def sentaccounts(self):
|
def sentaccounts(self):
|
||||||
"""Load draft accounts."""
|
"""Load draft accounts."""
|
||||||
account = state.association
|
self.account = state.association
|
||||||
self.loadDraft(account, 'All', '')
|
self.loadDraft()
|
||||||
|
|
||||||
def loadDraft(self, account, where="", what=""):
|
def loadDraft(self, where="", what=""):
|
||||||
"""Load draft list for Draft messages."""
|
"""Load draft list for Draft messages."""
|
||||||
xAddress = 'fromaddress'
|
xAddress = 'fromaddress'
|
||||||
queryreturn = kivy_helper_search.search_sql(
|
self.draftDataQuery(xAddress, where, what)
|
||||||
xAddress, account, "draft", where, what, False)
|
|
||||||
if state.msg_counter_objs:
|
if state.msg_counter_objs:
|
||||||
state.msg_counter_objs.draft_cnt.badge_text = str(len(queryreturn))
|
state.msg_counter_objs.draft_cnt.badge_text = str(
|
||||||
if queryreturn:
|
len(self.queryreturn))
|
||||||
|
if self.queryreturn:
|
||||||
src_mng_obj = state.kivyapp.root.children[2].children[0].ids
|
src_mng_obj = state.kivyapp.root.children[2].children[0].ids
|
||||||
src_mng_obj.draft_cnt.badge_text = str(len(queryreturn))
|
src_mng_obj.draft_cnt.badge_text = state.draft_count
|
||||||
state.draft_count = str(len(queryreturn))
|
self.set_mdList()
|
||||||
for mail in queryreturn:
|
self.ids.scroll_y.bind(scroll_y=self.check_scroll_y)
|
||||||
|
else:
|
||||||
|
content = MDLabel(
|
||||||
|
font_style='Body1',
|
||||||
|
theme_text_color='Primary',
|
||||||
|
text="yet no message for this account!!!!!!!!!!!!!",
|
||||||
|
halign='center',
|
||||||
|
bold=True,
|
||||||
|
size_hint_y=None,
|
||||||
|
valign='top')
|
||||||
|
self.ids.ml.add_widget(content)
|
||||||
|
|
||||||
|
# pylint: disable=too-many-arguments
|
||||||
|
def draftDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
||||||
|
"""This methosd is for retrieving draft messages"""
|
||||||
|
self.queryreturn = kivy_helper_search.search_sql(
|
||||||
|
xAddress,
|
||||||
|
self.account,
|
||||||
|
"draft",
|
||||||
|
where,
|
||||||
|
what,
|
||||||
|
False,
|
||||||
|
start_indx,
|
||||||
|
end_indx)
|
||||||
|
|
||||||
|
def set_mdList(self):
|
||||||
|
"""This method is used to create mdlist"""
|
||||||
|
data = []
|
||||||
|
total_draft_msg = len(self.ids.ml.children)
|
||||||
|
for mail in self.queryreturn:
|
||||||
third_text = mail[3].replace('\n', ' ')
|
third_text = mail[3].replace('\n', ' ')
|
||||||
self.data.append({
|
data.append({
|
||||||
'text': mail[1].strip(),
|
'text': mail[1].strip(),
|
||||||
'secondary_text': mail[2][:10] + '...........' if len(
|
'secondary_text': mail[2][:10] + '...........' if len(
|
||||||
mail[2]) > 10 else mail[2] + '\n' + " " + (
|
mail[2]) > 10 else mail[2] + '\n' + " " + (
|
||||||
third_text[:25] + '...!') if len(
|
third_text[:25] + '...!') if len(
|
||||||
third_text) > 25 else third_text,
|
third_text) > 25 else third_text,
|
||||||
'ackdata': mail[5]})
|
'ackdata': mail[5]})
|
||||||
for item in self.data:
|
for item in data:
|
||||||
meny = TwoLineAvatarIconListItem(
|
meny = TwoLineAvatarIconListItem(
|
||||||
text='Draft',
|
text='Draft',
|
||||||
secondary_text=item['text'],
|
secondary_text=item['text'],
|
||||||
|
@ -1696,19 +2253,25 @@ class Draft(Screen):
|
||||||
carousel.add_widget(meny)
|
carousel.add_widget(meny)
|
||||||
carousel.index = 1
|
carousel.index = 1
|
||||||
self.ids.ml.add_widget(carousel)
|
self.ids.ml.add_widget(carousel)
|
||||||
|
updated_msg = len(self.ids.ml.children)
|
||||||
|
self.has_refreshed = True if total_draft_msg != updated_msg else False
|
||||||
|
|
||||||
|
def check_scroll_y(self, instance, somethingelse):
|
||||||
|
"""Load data on scroll"""
|
||||||
|
if self.ids.scroll_y.scroll_y <= -0.0 and self.has_refreshed:
|
||||||
|
self.ids.scroll_y.scroll_y = 0.06
|
||||||
|
total_draft_msg = len(self.ids.ml.children)
|
||||||
|
self.update_draft_screen_on_scroll(total_draft_msg)
|
||||||
else:
|
else:
|
||||||
content = MDLabel(
|
pass
|
||||||
font_style='Body1',
|
|
||||||
theme_text_color='Primary',
|
def update_draft_screen_on_scroll(self, total_draft_msg, where='', what=''):
|
||||||
text="yet no message for this account!!!!!!!!!!!!!",
|
"""Load more data on scroll down"""
|
||||||
halign='center',
|
self.draftDataQuery('fromaddress', where, what, total_draft_msg, 5)
|
||||||
bold=True,
|
self.set_mdList()
|
||||||
size_hint_y=None,
|
|
||||||
valign='top')
|
|
||||||
self.ids.ml.add_widget(content)
|
|
||||||
|
|
||||||
def draft_detail(self, ackdata, *args):
|
def draft_detail(self, ackdata, *args):
|
||||||
"""Method used to show draft Details."""
|
"""Show draft Details"""
|
||||||
state.detailPageType = 'draft'
|
state.detailPageType = 'draft'
|
||||||
state.mail_id = ackdata
|
state.mail_id = ackdata
|
||||||
if self.manager:
|
if self.manager:
|
||||||
|
@ -1720,11 +2283,13 @@ class Draft(Screen):
|
||||||
src_mng_obj.current = 'mailDetail'
|
src_mng_obj.current = 'mailDetail'
|
||||||
|
|
||||||
def delete_draft(self, data_index, instance, *args):
|
def delete_draft(self, data_index, instance, *args):
|
||||||
"""Method used to delete draft message permanently."""
|
"""Delete draft message permanently"""
|
||||||
sqlExecute("DELETE FROM sent WHERE ackdata = ?;", str(
|
sqlExecute("DELETE FROM sent WHERE ackdata = ?;", str(
|
||||||
data_index))
|
data_index))
|
||||||
try:
|
try:
|
||||||
msg_count_objs = self.parent.parent.parent.parent.children[2].children[0].ids
|
msg_count_objs = (
|
||||||
|
self.parent.parent.parent.parent.parent.parent.children[
|
||||||
|
2].children[0].ids)
|
||||||
except Exception:
|
except Exception:
|
||||||
msg_count_objs = self.parent.parent.parent.parent.parent.children[
|
msg_count_objs = self.parent.parent.parent.parent.parent.children[
|
||||||
2].children[0].ids
|
2].children[0].ids
|
||||||
|
@ -1736,11 +2301,9 @@ class Draft(Screen):
|
||||||
toast('Deleted')
|
toast('Deleted')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def draft_msg(src_object):
|
def draft_msg(src_object): # pylint: disable=too-many-locals
|
||||||
"""Method used for saving draft mails."""
|
"""Save draft mails"""
|
||||||
# pylint: disable=too-many-locals
|
composer_object = state.kivyapp.root.ids.sc3.children[1].ids
|
||||||
composer_object = src_object.children[1].children[0].children[
|
|
||||||
0].children[0].children[0].ids
|
|
||||||
fromAddress = str(composer_object.ti.text)
|
fromAddress = str(composer_object.ti.text)
|
||||||
toAddress = str(composer_object.txt_input.text)
|
toAddress = str(composer_object.txt_input.text)
|
||||||
subject = str(composer_object.subject.text)
|
subject = str(composer_object.subject.text)
|
||||||
|
@ -1748,16 +2311,12 @@ class Draft(Screen):
|
||||||
encoding = 3
|
encoding = 3
|
||||||
sendMessageToPeople = True
|
sendMessageToPeople = True
|
||||||
if sendMessageToPeople:
|
if sendMessageToPeople:
|
||||||
from addresses import decodeAddress
|
streamNumber, ripe = decodeAddress(toAddress)[2:]
|
||||||
status, addressVersionNumber, streamNumber, ripe = decodeAddress(toAddress)
|
|
||||||
from addresses import addBMIfNotPresent
|
|
||||||
toAddress = addBMIfNotPresent(toAddress)
|
toAddress = addBMIfNotPresent(toAddress)
|
||||||
statusIconColor = 'red'
|
|
||||||
stealthLevel = BMConfigParser().safeGetInt(
|
stealthLevel = BMConfigParser().safeGetInt(
|
||||||
'bitmessagesettings', 'ackstealthlevel')
|
'bitmessagesettings', 'ackstealthlevel')
|
||||||
from helper_ackPayload import genAckPayload
|
from helper_ackPayload import genAckPayload
|
||||||
ackdata = genAckPayload(streamNumber, stealthLevel)
|
ackdata = genAckPayload(streamNumber, stealthLevel)
|
||||||
t = ()
|
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
'''INSERT INTO sent VALUES
|
'''INSERT INTO sent VALUES
|
||||||
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''',
|
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''',
|
||||||
|
@ -1786,18 +2345,20 @@ class Draft(Screen):
|
||||||
|
|
||||||
|
|
||||||
class CustomSpinner(Spinner):
|
class CustomSpinner(Spinner):
|
||||||
"""This class is used for setting spinner size."""
|
"""This class is used for setting spinner size"""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""Method used for setting size of spinner."""
|
"""Setting size of spinner"""
|
||||||
super(CustomSpinner, self).__init__(*args, **kwargs)
|
super(CustomSpinner, self).__init__(*args, **kwargs)
|
||||||
self.dropdown_cls.max_height = Window.size[1] / 3
|
self.dropdown_cls.max_height = Window.size[1] / 3
|
||||||
|
|
||||||
|
|
||||||
class Allmails(Screen):
|
class Allmails(Screen):
|
||||||
"""all mails Screen uses screen to show widgets of screens."""
|
"""All mails Screen uses screen to show widgets of screens"""
|
||||||
|
|
||||||
data = ListProperty()
|
data = ListProperty()
|
||||||
|
has_refreshed = True
|
||||||
|
all_mails = ListProperty()
|
||||||
|
account = StringProperty()
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""Method Parsing the address."""
|
"""Method Parsing the address."""
|
||||||
|
@ -1808,31 +2369,57 @@ class Allmails(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 all mails."""
|
"""Clock Schdule for method all mails"""
|
||||||
self.mailaccounts()
|
self.loadMessagelist()
|
||||||
print dt
|
print dt
|
||||||
|
|
||||||
def mailaccounts(self):
|
def loadMessagelist(self):
|
||||||
"""Load all mails for account."""
|
|
||||||
account = state.association
|
|
||||||
self.loadMessagelist(account, 'All', '')
|
|
||||||
|
|
||||||
def loadMessagelist(self, account, where="", what=""):
|
|
||||||
"""Load Inbox, Sent anf Draft list of messages."""
|
"""Load Inbox, Sent anf Draft list of messages."""
|
||||||
all_mails = sqlQuery(
|
self.account = state.association
|
||||||
"SELECT toaddress, fromaddress, subject, message, folder, ackdata As id, DATE(lastactiontime)"
|
self.allMessageQuery(0, 20)
|
||||||
" As actionTime FROM sent WHERE folder = 'sent' UNION"
|
if self.all_mails:
|
||||||
" SELECT toaddress, fromaddress, subject, message, folder, msgid As id, DATE(received) As"
|
state.kivyapp.get_inbox_count()
|
||||||
" actionTime FROM inbox WHERE folder = 'inbox' ORDER BY actionTime DESC")
|
state.kivyapp.get_sent_count()
|
||||||
if all_mails:
|
state.all_count = str(
|
||||||
state.kivyapp.root.children[2].children[0].ids.allmail_cnt.badge_text = str(len(all_mails))
|
int(state.sent_count) + int(state.inbox_count))
|
||||||
state.all_count = str(len(all_mails))
|
state.kivyapp.root.children[2].children[
|
||||||
for item in all_mails:
|
0].ids.allmail_cnt.badge_text = state.all_count
|
||||||
|
self.set_mdlist()
|
||||||
|
# self.ids.refresh_layout.bind(scroll_y=self.check_scroll_y)
|
||||||
|
self.ids.scroll_y.bind(scroll_y=self.check_scroll_y)
|
||||||
|
else:
|
||||||
|
content = MDLabel(
|
||||||
|
font_style='Body1',
|
||||||
|
theme_text_color='Primary',
|
||||||
|
text="yet no message for this account!!!!!!!!!!!!!",
|
||||||
|
halign='center',
|
||||||
|
bold=True,
|
||||||
|
size_hint_y=None,
|
||||||
|
valign='top')
|
||||||
|
self.ids.ml.add_widget(content)
|
||||||
|
|
||||||
|
def allMessageQuery(self, start_indx, end_indx):
|
||||||
|
"""Retrieving data from inbox or sent both tables"""
|
||||||
|
self.all_mails = sqlQuery(
|
||||||
|
"SELECT toaddress, fromaddress, subject, message, folder, ackdata"
|
||||||
|
" As id, DATE(lastactiontime) As actionTime FROM sent WHERE"
|
||||||
|
" folder = 'sent' and fromaddress = '{0}'"
|
||||||
|
" UNION SELECT toaddress, fromaddress, subject, message, folder,"
|
||||||
|
" msgid As id, DATE(received) As actionTime FROM inbox"
|
||||||
|
" WHERE folder = 'inbox' and toaddress = '{0}'"
|
||||||
|
" ORDER BY actionTime DESC limit {1}, {2}".format(
|
||||||
|
self.account, start_indx, end_indx))
|
||||||
|
|
||||||
|
def set_mdlist(self):
|
||||||
|
"""This method is used to create mdList for allmaills"""
|
||||||
|
data_exist = len(self.ids.ml.children)
|
||||||
|
for item in self.all_mails:
|
||||||
meny = TwoLineAvatarIconListItem(
|
meny = TwoLineAvatarIconListItem(
|
||||||
text=item[1],
|
text=item[1],
|
||||||
secondary_text=item[2][:50] + '........' if len(
|
secondary_text=item[2][:50] + '........' if len(
|
||||||
item[2]) >= 50 else (
|
item[2]) >= 50 else (
|
||||||
item[2] + ',' + item[3].replace('\n', ''))[0:50] + '........',
|
item[2] + ',' + item[3].replace(
|
||||||
|
'\n', ''))[0:50] + '........',
|
||||||
theme_text_color='Custom',
|
theme_text_color='Custom',
|
||||||
text_color=NavigateApp().theme_cls.primary_color)
|
text_color=NavigateApp().theme_cls.primary_color)
|
||||||
meny.add_widget(AvatarSampleWidget(
|
meny.add_widget(AvatarSampleWidget(
|
||||||
|
@ -1855,19 +2442,26 @@ class Allmails(Screen):
|
||||||
carousel.add_widget(meny)
|
carousel.add_widget(meny)
|
||||||
carousel.index = 1
|
carousel.index = 1
|
||||||
self.ids.ml.add_widget(carousel)
|
self.ids.ml.add_widget(carousel)
|
||||||
|
updated_data = len(self.ids.ml.children)
|
||||||
|
self.has_refreshed = True if data_exist != updated_data else False
|
||||||
|
|
||||||
|
def check_scroll_y(self, instance, somethingelse):
|
||||||
|
"""Scroll fixed length"""
|
||||||
|
if self.ids.scroll_y.scroll_y <= -0.00 and self.has_refreshed:
|
||||||
|
self.ids.scroll_y.scroll_y = .06
|
||||||
|
load_more = len(self.ids.ml.children)
|
||||||
|
self.updating_allmail(load_more)
|
||||||
else:
|
else:
|
||||||
content = MDLabel(
|
pass
|
||||||
font_style='Body1',
|
|
||||||
theme_text_color='Primary',
|
def updating_allmail(self, load_more):
|
||||||
text="yet no message for this account!!!!!!!!!!!!!",
|
"""This method is used to update the all mail
|
||||||
halign='center',
|
listing value on the scroll of screen"""
|
||||||
bold=True,
|
self.allMessageQuery(load_more, 5)
|
||||||
size_hint_y=None,
|
self.set_mdlist()
|
||||||
valign='top')
|
|
||||||
self.ids.ml.add_widget(content)
|
|
||||||
|
|
||||||
def mail_detail(self, unique_id, folder, *args):
|
def mail_detail(self, unique_id, folder, *args):
|
||||||
"""Load sent and inbox mail details."""
|
"""Load sent and inbox mail details"""
|
||||||
state.detailPageType = folder
|
state.detailPageType = folder
|
||||||
state.is_allmail = True
|
state.is_allmail = True
|
||||||
state.mail_id = unique_id
|
state.mail_id = unique_id
|
||||||
|
@ -1880,7 +2474,7 @@ class Allmails(Screen):
|
||||||
src_mng_obj.current = 'mailDetail'
|
src_mng_obj.current = 'mailDetail'
|
||||||
|
|
||||||
def swipe_delete(self, unique_id, folder, instance, *args):
|
def swipe_delete(self, unique_id, folder, instance, *args):
|
||||||
"""Delete inbox mail from all mail listing listing."""
|
"""Delete inbox mail from all mail listing"""
|
||||||
if folder == 'inbox':
|
if folder == 'inbox':
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
"UPDATE inbox SET folder = 'trash' WHERE msgid = ?;", str(
|
"UPDATE inbox SET folder = 'trash' WHERE msgid = ?;", str(
|
||||||
|
@ -1891,13 +2485,13 @@ class Allmails(Screen):
|
||||||
unique_id))
|
unique_id))
|
||||||
self.ids.ml.remove_widget(instance.parent.parent)
|
self.ids.ml.remove_widget(instance.parent.parent)
|
||||||
try:
|
try:
|
||||||
msg_count_objs = self.parent.parent.parent.parent.children[
|
|
||||||
2].children[0].ids
|
|
||||||
nav_lay_obj = self.parent.parent.parent.parent.ids
|
|
||||||
except Exception:
|
|
||||||
msg_count_objs = self.parent.parent.parent.parent.parent.children[
|
msg_count_objs = self.parent.parent.parent.parent.parent.children[
|
||||||
2].children[0].ids
|
2].children[0].ids
|
||||||
nav_lay_obj = self.parent.parent.parent.parent.parent.ids
|
nav_lay_obj = self.parent.parent.parent.parent.parent.ids
|
||||||
|
except Exception:
|
||||||
|
msg_count_objs = self.parent.parent.parent.parent.parent.parent.children[
|
||||||
|
2].children[0].ids
|
||||||
|
nav_lay_obj = self.parent.parent.parent.parent.parent.parent.ids
|
||||||
if folder == 'inbox':
|
if folder == 'inbox':
|
||||||
msg_count_objs.inbox_cnt.badge_text = str(
|
msg_count_objs.inbox_cnt.badge_text = str(
|
||||||
int(state.inbox_count) - 1)
|
int(state.inbox_count) - 1)
|
||||||
|
@ -1918,14 +2512,14 @@ class Allmails(Screen):
|
||||||
state.all_count = str(int(state.all_count) - 1)
|
state.all_count = str(int(state.all_count) - 1)
|
||||||
nav_lay_obj.sc5.clear_widgets()
|
nav_lay_obj.sc5.clear_widgets()
|
||||||
nav_lay_obj.sc5.add_widget(Trash())
|
nav_lay_obj.sc5.add_widget(Trash())
|
||||||
nav_lay_obj.sc17.clear_widgets()
|
nav_lay_obj.sc17.remove_widget(instance.parent.parent)
|
||||||
nav_lay_obj.sc17.add_widget(Allmails())
|
|
||||||
|
|
||||||
# pylint: disable=attribute-defined-outside-init
|
# pylint: disable=attribute-defined-outside-init
|
||||||
def refresh_callback(self, *args):
|
def refresh_callback(self, *args):
|
||||||
"""Method updates the state of application, While the spinner remains on the screen."""
|
"""Method updates the state of application,
|
||||||
|
While the spinner remains on the screen"""
|
||||||
def refresh_callback(interval):
|
def refresh_callback(interval):
|
||||||
"""Method used for loading the allmails screen data."""
|
"""Load the allmails screen data"""
|
||||||
self.ids.ml.clear_widgets()
|
self.ids.ml.clear_widgets()
|
||||||
self.remove_widget(self.children[1])
|
self.remove_widget(self.children[1])
|
||||||
try:
|
try:
|
||||||
|
@ -1937,32 +2531,51 @@ class Allmails(Screen):
|
||||||
self.tick = 0
|
self.tick = 0
|
||||||
Clock.schedule_once(refresh_callback, 1)
|
Clock.schedule_once(refresh_callback, 1)
|
||||||
|
|
||||||
|
def set_root_layout(self):
|
||||||
|
"""Setting root layout"""
|
||||||
|
try:
|
||||||
|
return self.manager.parent.parent
|
||||||
|
except Exception:
|
||||||
|
return state.kivyapp.root.ids.float_box
|
||||||
|
|
||||||
|
|
||||||
def avatarImageFirstLetter(letter_string):
|
def avatarImageFirstLetter(letter_string):
|
||||||
"""This method is used to the first letter for the avatar image"""
|
"""This function is used to the first letter for the avatar image"""
|
||||||
|
if letter_string:
|
||||||
if letter_string[0].upper() >= 'A' and letter_string[0].upper() <= 'Z':
|
if letter_string[0].upper() >= 'A' and letter_string[0].upper() <= 'Z':
|
||||||
img_latter = letter_string[0].upper()
|
img_latter = letter_string[0].upper()
|
||||||
elif int(letter_string[0]) >= 0 and int(letter_string[0]) <= 9:
|
elif int(letter_string[0]) >= 0 and int(letter_string[0]) <= 9:
|
||||||
img_latter = letter_string[0]
|
img_latter = letter_string[0]
|
||||||
else:
|
else:
|
||||||
img_latter = '!'
|
img_latter = '!'
|
||||||
|
else:
|
||||||
|
img_latter = '!'
|
||||||
return img_latter
|
return img_latter
|
||||||
|
|
||||||
|
|
||||||
class Starred(Screen):
|
class Starred(Screen):
|
||||||
"""Starred Screen show widgets of page."""
|
"""Starred Screen show widgets of page"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Archieve(Screen):
|
class Archieve(Screen):
|
||||||
"""Archieve Screen show widgets of page."""
|
"""Archieve Screen show widgets of page"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Spam(Screen):
|
class Spam(Screen):
|
||||||
"""Spam Screen show widgets of page."""
|
"""Spam Screen show widgets of page"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class LoadingPopup(Popup):
|
||||||
|
"""Class for loading Popup"""
|
||||||
|
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
super(LoadingPopup, self).__init__(**kwargs)
|
||||||
|
# call dismiss_popup in 2 seconds
|
||||||
|
Clock.schedule_once(self.dismiss_popup, 0.5)
|
||||||
|
|
||||||
|
def dismiss_popup(self, dt):
|
||||||
|
"""Dismiss popups"""
|
||||||
|
self.dismiss()
|
||||||
|
|
|
@ -13,7 +13,7 @@ package.domain = org.test
|
||||||
source.dir = .
|
source.dir = .
|
||||||
|
|
||||||
# (list) Source files to include (let empty to include all the files)
|
# (list) Source files to include (let empty to include all the files)
|
||||||
source.include_exts = py,png,jpg,kv,atlas
|
source.include_exts = py,png,jpg,kv,atlas,gif,zip
|
||||||
|
|
||||||
# (list) List of inclusions using pattern matching
|
# (list) List of inclusions using pattern matching
|
||||||
#source.include_patterns = assets/*,images/*.png
|
#source.include_patterns = assets/*,images/*.png
|
||||||
|
|
|
@ -21,12 +21,12 @@ It resends messages when there has been no response:
|
||||||
# pylint: disable=relative-import, protected-access
|
# pylint: disable=relative-import, protected-access
|
||||||
import gc
|
import gc
|
||||||
import os
|
import os
|
||||||
|
from datetime import datetime, timedelta
|
||||||
import time
|
import time
|
||||||
import shared
|
import shared
|
||||||
|
|
||||||
import knownnodes
|
import knownnodes
|
||||||
import queues
|
import queues
|
||||||
import shared
|
|
||||||
import state
|
import state
|
||||||
import tr
|
import tr
|
||||||
from bmconfigparser import BMConfigParser
|
from bmconfigparser import BMConfigParser
|
||||||
|
@ -111,7 +111,7 @@ class singleCleaner(StoppableThread):
|
||||||
self.resendPubkeyRequest(toAddress)
|
self.resendPubkeyRequest(toAddress)
|
||||||
elif status == 'msgsent':
|
elif status == 'msgsent':
|
||||||
self.resendMsg(ackData)
|
self.resendMsg(ackData)
|
||||||
|
deleteTrashMsgPermonantly()
|
||||||
try:
|
try:
|
||||||
# Cleanup knownnodes and handle possible severe exception
|
# Cleanup knownnodes and handle possible severe exception
|
||||||
# while writing it to disk
|
# while writing it to disk
|
||||||
|
@ -193,3 +193,12 @@ class singleCleaner(StoppableThread):
|
||||||
'updateStatusBar',
|
'updateStatusBar',
|
||||||
'Doing work necessary to again attempt to deliver a message...'
|
'Doing work necessary to again attempt to deliver a message...'
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
|
def deleteTrashMsgPermonantly():
|
||||||
|
"""This method is used to delete old messages"""
|
||||||
|
ndays_before_time = datetime.now() - timedelta(days=30)
|
||||||
|
old_messages = time.mktime(ndays_before_time.timetuple())
|
||||||
|
sqlExecute("delete from sent where folder = 'trash' and lastactiontime <= ?;", int(old_messages))
|
||||||
|
sqlExecute("delete from inbox where folder = 'trash' and received <= ?;", int(old_messages))
|
||||||
|
return
|
||||||
|
|
BIN
src/images/3.zip
Normal file
BIN
src/images/3.zip
Normal file
Binary file not shown.
BIN
src/images/loader.gif
Normal file
BIN
src/images/loader.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
src/images/loader.zip
Normal file
BIN
src/images/loader.zip
Normal file
Binary file not shown.
|
@ -121,3 +121,7 @@ in_composer = False
|
||||||
write_msg = {}
|
write_msg = {}
|
||||||
|
|
||||||
availabe_credit = 0
|
availabe_credit = 0
|
||||||
|
|
||||||
|
in_sent_method = False
|
||||||
|
|
||||||
|
in_search_mode = False
|
||||||
|
|
Reference in New Issue
Block a user