Merge pull request #56 from navjotcis/codequalitykivy
mpybit quality fixes
This commit is contained in:
commit
c10bed42d2
|
@ -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,6 +1,5 @@
|
||||||
"""
|
"""
|
||||||
src/bitmessagekivy/kivy_helper_search.py
|
Sql queries for bitmessagekivy
|
||||||
=================================
|
|
||||||
"""
|
"""
|
||||||
from helper_sql import sqlQuery
|
from helper_sql import sqlQuery
|
||||||
|
|
||||||
|
@ -14,14 +13,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, ackdata,'''
|
||||||
FROM sent '''
|
''' 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 = []
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
"""
|
"""
|
||||||
src/bitmessagekivy/mpybit.py
|
Bitmessage kivy 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 functools import partial
|
||||||
|
@ -62,11 +62,10 @@ import state
|
||||||
from uikivysignaler import UIkivySignaler
|
from uikivysignaler import UIkivySignaler
|
||||||
|
|
||||||
import identiconGeneration
|
import identiconGeneration
|
||||||
# pylint: disable=unused-argument, too-few-public-methods
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
@ -74,8 +73,7 @@ def toast(text):
|
||||||
|
|
||||||
|
|
||||||
class Navigatorss(MDNavigationDrawer):
|
class Navigatorss(MDNavigationDrawer):
|
||||||
"""Navigators class contains image, title and logo."""
|
"""Navigator class contains 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()
|
||||||
|
@ -119,16 +117,17 @@ class Inbox(Screen):
|
||||||
src_mng_obj.inbox_cnt.badge_text = str(len(self.queryreturn))
|
src_mng_obj.inbox_cnt.badge_text = str(len(self.queryreturn))
|
||||||
state.inbox_count = str(len(self.queryreturn))
|
state.inbox_count = str(len(self.queryreturn))
|
||||||
for mail in self.queryreturn[:20]:
|
for mail in self.queryreturn[:20]:
|
||||||
third_text = mail[3].replace('\n', ' ')
|
# 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]})
|
||||||
self.has_refreshed = True
|
self.has_refreshed = True
|
||||||
self.set_mdList(data)
|
self.set_mdList(data)
|
||||||
self.children[2].children[0].children[0].bind(scroll_y=self.check_scroll_y)
|
self.children[2].children[0].children[0].bind(
|
||||||
|
scroll_y=self.check_scroll_y)
|
||||||
else:
|
else:
|
||||||
content = MDLabel(
|
content = MDLabel(
|
||||||
font_style='Body1',
|
font_style='Body1',
|
||||||
|
@ -177,12 +176,14 @@ class Inbox(Screen):
|
||||||
|
|
||||||
def check_scroll_y(self, instance, somethingelse):
|
def check_scroll_y(self, instance, somethingelse):
|
||||||
"""This method is used to load data on scroll"""
|
"""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:
|
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
|
self.children[2].children[0].children[0].scroll_y = 0.06
|
||||||
total_message = len(self.ids.ml.children)
|
total_message = len(self.ids.ml.children)
|
||||||
if total_message != len(self.queryreturn):
|
if total_message != len(self.queryreturn):
|
||||||
self.update_inbox_screen_on_scroll(total_message)
|
self.update_inbox_screen_on_scroll(total_message)
|
||||||
self.has_refreshed = True if total_message != len(self.queryreturn) else False
|
self.has_refreshed = True if total_message != len(
|
||||||
|
self.queryreturn) else False
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -190,12 +191,12 @@ class Inbox(Screen):
|
||||||
"""This method is used to load more data on scroll down"""
|
"""This method is used to load more data on scroll down"""
|
||||||
data = []
|
data = []
|
||||||
for mail in self.queryreturn[total_message:total_message + 5]:
|
for mail in self.queryreturn[total_message:total_message + 5]:
|
||||||
third_text = mail[3].replace('\n', ' ')
|
# 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]})
|
||||||
self.set_mdList(data)
|
self.set_mdList(data)
|
||||||
|
|
||||||
|
@ -217,9 +218,12 @@ class Inbox(Screen):
|
||||||
"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)
|
||||||
|
@ -257,7 +261,8 @@ 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 = ''
|
||||||
|
@ -271,6 +276,7 @@ class Inbox(Screen):
|
||||||
Clock.schedule_once(refresh_callback, 1)
|
Clock.schedule_once(refresh_callback, 1)
|
||||||
|
|
||||||
def set_root_layout(self):
|
def set_root_layout(self):
|
||||||
|
"""Setting root layout"""
|
||||||
return self.parent.parent.parent
|
return self.parent.parent.parent
|
||||||
|
|
||||||
|
|
||||||
|
@ -329,7 +335,8 @@ class MyAddress(Screen):
|
||||||
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['text'].strip()))))
|
source='./images/text_images/{}.png'.format(
|
||||||
|
avatarImageFirstLetter(item['text'].strip()))))
|
||||||
meny.bind(on_press=partial(
|
meny.bind(on_press=partial(
|
||||||
self.myadd_detail, item['secondary_text'], item['text']))
|
self.myadd_detail, item['secondary_text'], item['text']))
|
||||||
self.ids.ml.add_widget(meny)
|
self.ids.ml.add_widget(meny)
|
||||||
|
@ -341,7 +348,8 @@ class MyAddress(Screen):
|
||||||
my_addresses = len(self.ids.ml.children)
|
my_addresses = len(self.ids.ml.children)
|
||||||
if my_addresses != len(self.addresses_list):
|
if my_addresses != len(self.addresses_list):
|
||||||
self.update_addressBook_on_scroll(my_addresses)
|
self.update_addressBook_on_scroll(my_addresses)
|
||||||
self.has_refreshed = True if my_addresses != len(self.addresses_list) else False
|
self.has_refreshed = True if my_addresses != len(
|
||||||
|
self.addresses_list) else False
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -358,7 +366,8 @@ class MyAddress(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 myaddress screen data."""
|
"""Method used for loading the myaddress screen data."""
|
||||||
state.searcing_text = ''
|
state.searcing_text = ''
|
||||||
|
@ -382,6 +391,7 @@ class MyAddress(Screen):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def set_root_layout(self):
|
def set_root_layout(self):
|
||||||
|
"""Setting root layout"""
|
||||||
return self.manager.parent.parent
|
return self.manager.parent.parent
|
||||||
|
|
||||||
|
|
||||||
|
@ -434,7 +444,8 @@ class AddressBook(Screen):
|
||||||
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')
|
||||||
|
@ -459,7 +470,8 @@ class AddressBook(Screen):
|
||||||
exist_addresses = len(self.ids.ml.children)
|
exist_addresses = len(self.ids.ml.children)
|
||||||
if exist_addresses != len(self.queryreturn):
|
if exist_addresses != len(self.queryreturn):
|
||||||
self.update_addressBook_on_scroll(exist_addresses)
|
self.update_addressBook_on_scroll(exist_addresses)
|
||||||
self.has_refreshed = True if exist_addresses != len(self.queryreturn) else False
|
self.has_refreshed = True if exist_addresses != len(
|
||||||
|
self.queryreturn) else False
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -488,16 +500,16 @@ class AddressBook(Screen):
|
||||||
"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
|
||||||
|
|
||||||
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)
|
||||||
|
@ -536,8 +548,8 @@ class RV(RecycleView):
|
||||||
|
|
||||||
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()
|
||||||
|
|
||||||
|
@ -553,10 +565,12 @@ class DropDownWidget(BoxLayout):
|
||||||
if sendMessageToPeople:
|
if sendMessageToPeople:
|
||||||
if toAddress != '' and subject and message:
|
if toAddress != '' and subject and message:
|
||||||
from addresses import decodeAddress
|
from addresses import decodeAddress
|
||||||
status, addressVersionNumber, streamNumber, ripe = decodeAddress(toAddress)
|
status, addressVersionNumber, streamNumber, ripe = (
|
||||||
|
decodeAddress(toAddress))
|
||||||
if status == 'success':
|
if status == 'success':
|
||||||
navApp.root.ids.sc3.children[0].active = True
|
navApp.root.ids.sc3.children[0].active = True
|
||||||
if state.detailPageType == 'draft' and state.send_draft_mail:
|
if state.detailPageType == 'draft' \
|
||||||
|
and state.send_draft_mail:
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
"UPDATE sent SET toaddress = ?"
|
"UPDATE sent SET toaddress = ?"
|
||||||
", fromaddress = ? , subject = ?"
|
", fromaddress = ? , subject = ?"
|
||||||
|
@ -575,9 +589,10 @@ class DropDownWidget(BoxLayout):
|
||||||
from addresses import addBMIfNotPresent
|
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':
|
||||||
|
@ -586,7 +601,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
|
||||||
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''',
|
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''',
|
||||||
|
@ -618,7 +633,7 @@ class DropDownWidget(BoxLayout):
|
||||||
self.parent.parent.screens[16].add_widget(Allmails())
|
self.parent.parent.screens[16].add_widget(Allmails())
|
||||||
# toast('sending...')
|
# toast('sending...')
|
||||||
Clock.schedule_once(self.callback_for_msgsend, 3)
|
Clock.schedule_once(self.callback_for_msgsend, 3)
|
||||||
toLabel = ''
|
# toLabel = ''
|
||||||
queues.workerQueue.put(('sendmessage', toAddress))
|
queues.workerQueue.put(('sendmessage', toAddress))
|
||||||
print "sqlExecute successfully #######################"
|
print "sqlExecute successfully #######################"
|
||||||
state.in_composer = True
|
state.in_composer = True
|
||||||
|
@ -631,7 +646,9 @@ class DropDownWidget(BoxLayout):
|
||||||
msg = 'Please fill the form'
|
msg = 'Please fill the form'
|
||||||
self.address_error_message(msg)
|
self.address_error_message(msg)
|
||||||
|
|
||||||
def callback_for_msgsend(self, dt=0):
|
@staticmethod
|
||||||
|
def callback_for_msgsend(dt=0):
|
||||||
|
"""Callback method for messagesend"""
|
||||||
state.kivyapp.root.ids.sc3.children[0].active = False
|
state.kivyapp.root.ids.sc3.children[0].active = False
|
||||||
state.in_sent_method = True
|
state.in_sent_method = True
|
||||||
state.kivyapp.back_press()
|
state.kivyapp.back_press()
|
||||||
|
@ -668,7 +685,6 @@ class DropDownWidget(BoxLayout):
|
||||||
|
|
||||||
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()
|
||||||
|
@ -711,30 +727,32 @@ class Payment(Screen):
|
||||||
"""Method helps to get the available credits"""
|
"""Method helps to get the available credits"""
|
||||||
# pylint: disable=no-self-use
|
# 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 Method"""
|
||||||
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(
|
||||||
|
@ -769,13 +787,11 @@ 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("")
|
||||||
|
|
||||||
|
@ -787,7 +803,8 @@ class Random(Screen):
|
||||||
eighteenByteRipe = False
|
eighteenByteRipe = False
|
||||||
nonceTrialsPerByte = 1000
|
nonceTrialsPerByte = 1000
|
||||||
payloadLengthExtraBytes = 1000
|
payloadLengthExtraBytes = 1000
|
||||||
lables = [BMConfigParser().get(obj, 'label') for obj in BMConfigParser().addresses()]
|
lables = [BMConfigParser().get(obj, 'label')
|
||||||
|
for obj in BMConfigParser().addresses()]
|
||||||
if entered_label and entered_label not in lables:
|
if entered_label and entered_label not in lables:
|
||||||
toast('Address Creating...')
|
toast('Address Creating...')
|
||||||
queues.addressGeneratorQueue.put((
|
queues.addressGeneratorQueue.put((
|
||||||
|
@ -814,7 +831,8 @@ class Random(Screen):
|
||||||
def add_validation(self, instance):
|
def add_validation(self, instance):
|
||||||
"""Checking validation at address creation time."""
|
"""Checking validation at address creation time."""
|
||||||
entered_label = str(instance.text.strip())
|
entered_label = str(instance.text.strip())
|
||||||
lables = [BMConfigParser().get(obj, 'label') for obj in BMConfigParser().addresses()]
|
lables = [BMConfigParser().get(obj, 'label')
|
||||||
|
for obj in BMConfigParser().addresses()]
|
||||||
if entered_label in lables:
|
if entered_label in lables:
|
||||||
self.ids.label.error = True
|
self.ids.label.error = True
|
||||||
self.ids.label.helper_text = 'Label name is already exist'
|
self.ids.label.helper_text = 'Label name is already exist'
|
||||||
|
@ -857,8 +875,10 @@ class Sent(Screen):
|
||||||
data = []
|
data = []
|
||||||
self.queryreturn = kivy_helper_search.search_sql(
|
self.queryreturn = kivy_helper_search.search_sql(
|
||||||
xAddress, account, "sent", where, what, False)
|
xAddress, account, "sent", where, what, False)
|
||||||
if state.msg_counter_objs and state.association == state.check_sent_acc:
|
if state.msg_counter_objs and state.association == (
|
||||||
state.msg_counter_objs.send_cnt.badge_text = str(len(self.queryreturn))
|
state.check_sent_acc):
|
||||||
|
state.msg_counter_objs.send_cnt.badge_text = str(
|
||||||
|
len(self.queryreturn))
|
||||||
state.sent_count = str(int(state.sent_count) + 1)
|
state.sent_count = str(int(state.sent_count) + 1)
|
||||||
state.all_count = str(int(state.all_count) + 1)
|
state.all_count = str(int(state.all_count) + 1)
|
||||||
state.msg_counter_objs.allmail_cnt.badge_text = state.all_count
|
state.msg_counter_objs.allmail_cnt.badge_text = state.all_count
|
||||||
|
@ -870,8 +890,8 @@ class Sent(Screen):
|
||||||
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.set_mdlist(data, 0)
|
||||||
self.has_refreshed = True
|
self.has_refreshed = True
|
||||||
|
@ -938,8 +958,8 @@ class Sent(Screen):
|
||||||
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, total_sent - 1)
|
self.set_mdlist(data, total_sent - 1)
|
||||||
|
|
||||||
|
@ -950,7 +970,8 @@ class Sent(Screen):
|
||||||
total_sent_msg = len(self.ids.ml.children)
|
total_sent_msg = len(self.ids.ml.children)
|
||||||
if total_sent_msg != len(self.queryreturn):
|
if total_sent_msg != len(self.queryreturn):
|
||||||
self.update_sent_screen_on_scroll(total_sent_msg)
|
self.update_sent_screen_on_scroll(total_sent_msg)
|
||||||
self.has_refreshed = True if total_sent_msg != len(self.queryreturn) else False
|
self.has_refreshed = True if total_sent_msg != len(
|
||||||
|
self.queryreturn) else False
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -961,12 +982,13 @@ class Sent(Screen):
|
||||||
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.set_mdlist(data, 0)
|
||||||
|
|
||||||
def set_sentCount(self, total_sent):
|
@staticmethod
|
||||||
|
def set_sentCount(total_sent):
|
||||||
"""Set the total no. of sent message count"""
|
"""Set the total no. of sent message 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.send_cnt.badge_text = str(total_sent)
|
src_mng_obj.send_cnt.badge_text = str(total_sent)
|
||||||
|
@ -1047,10 +1069,11 @@ class Trash(Screen):
|
||||||
if BMConfigParser().addresses():
|
if BMConfigParser().addresses():
|
||||||
state.association = BMConfigParser().addresses()[0]
|
state.association = BMConfigParser().addresses()[0]
|
||||||
self.trash_messages = sqlQuery(
|
self.trash_messages = sqlQuery(
|
||||||
"SELECT toaddress, fromaddress, subject, message, folder, ackdata As id, DATE(lastactiontime)"
|
"SELECT toaddress, fromaddress, subject, message, folder, ackdata"
|
||||||
" As actionTime FROM sent WHERE folder = 'trash' UNION"
|
" As id, DATE(lastactiontime) As actionTime FROM sent WHERE"
|
||||||
" SELECT toaddress, fromaddress, subject, message, folder, msgid As id, DATE(received) As"
|
" folder = 'trash' UNION SELECT toaddress, fromaddress, subject,"
|
||||||
" actionTime FROM inbox WHERE folder = 'trash' ORDER BY actionTime DESC")
|
" message, folder, msgid As id, DATE(received) As actionTime FROM"
|
||||||
|
" inbox WHERE folder = 'trash' ORDER BY actionTime DESC")
|
||||||
if self.trash_messages:
|
if self.trash_messages:
|
||||||
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(self.trash_messages))
|
src_mng_obj.trash_cnt.badge_text = str(len(self.trash_messages))
|
||||||
|
@ -1074,8 +1097,8 @@ class Trash(Screen):
|
||||||
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(
|
||||||
|
@ -1105,7 +1128,8 @@ class Trash(Screen):
|
||||||
total_trash_msg = len(self.ids.ml.children)
|
total_trash_msg = len(self.ids.ml.children)
|
||||||
if total_trash_msg != len(self.trash_messages):
|
if total_trash_msg != len(self.trash_messages):
|
||||||
self.update_trash_screen_on_scroll(total_trash_msg)
|
self.update_trash_screen_on_scroll(total_trash_msg)
|
||||||
self.has_refreshed = True if total_trash_msg != len(self.trash_messages) else False
|
self.has_refreshed = True if total_trash_msg != len(
|
||||||
|
self.trash_messages) else False
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -1147,7 +1171,6 @@ class Setting(Screen):
|
||||||
class NavigateApp(App):
|
class NavigateApp(App):
|
||||||
"""Navigation Layout of class."""
|
"""Navigation Layout of class."""
|
||||||
# pylint: disable=too-many-public-methods
|
# pylint: disable=too-many-public-methods
|
||||||
|
|
||||||
theme_cls = ThemeManager()
|
theme_cls = ThemeManager()
|
||||||
previous_date = ObjectProperty()
|
previous_date = ObjectProperty()
|
||||||
obj_1 = ObjectProperty()
|
obj_1 = ObjectProperty()
|
||||||
|
@ -1232,7 +1255,8 @@ class NavigateApp(App):
|
||||||
self.root.ids.sc17.add_widget(Allmails())
|
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[2].children[2].children[0].ids
|
msg_counter_objs = (
|
||||||
|
self.root_window.children[2].children[2].children[0].ids)
|
||||||
state.sent_count = str(
|
state.sent_count = str(
|
||||||
sqlQuery(
|
sqlQuery(
|
||||||
"SELECT COUNT(*) FROM sent WHERE fromaddress = '{}' and"
|
"SELECT COUNT(*) FROM sent WHERE fromaddress = '{}' and"
|
||||||
|
@ -1278,12 +1302,16 @@ class NavigateApp(App):
|
||||||
img = identiconGeneration.generate(BMConfigParser().addresses()[0])
|
img = identiconGeneration.generate(BMConfigParser().addresses()[0])
|
||||||
self.createFolder('./images/default_identicon/')
|
self.createFolder('./images/default_identicon/')
|
||||||
if platform == 'android':
|
if platform == 'android':
|
||||||
# android_path = os.path.expanduser("~/user/0/org.test.bitapp/files/app/")
|
# android_path = os.path.expanduser
|
||||||
android_path = os.path.join(os.environ['ANDROID_PRIVATE'] + '/app/')
|
# ("~/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(
|
img.texture.save('{1}/images/default_identicon/{0}.png'.format(
|
||||||
BMConfigParser().addresses()[0], android_path))
|
BMConfigParser().addresses()[0], android_path))
|
||||||
else:
|
else:
|
||||||
img.texture.save('./images/default_identicon/{}.png'.format(BMConfigParser().addresses()[0]))
|
img.texture.save(
|
||||||
|
'./images/default_identicon/{}.png'.format(
|
||||||
|
BMConfigParser().addresses()[0]))
|
||||||
return BMConfigParser().addresses()[0]
|
return BMConfigParser().addresses()[0]
|
||||||
return 'Select Address'
|
return 'Select Address'
|
||||||
|
|
||||||
|
@ -1300,7 +1328,8 @@ class NavigateApp(App):
|
||||||
def get_default_image():
|
def get_default_image():
|
||||||
"""Getting default image on address"""
|
"""Getting default image on address"""
|
||||||
if BMConfigParser().addresses():
|
if BMConfigParser().addresses():
|
||||||
return './images/default_identicon/{}.png'.format(BMConfigParser().addresses()[0])
|
return './images/default_identicon/{}.png'.format(
|
||||||
|
BMConfigParser().addresses()[0])
|
||||||
return './images/no_identicons.png'
|
return './images/no_identicons.png'
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -1313,7 +1342,8 @@ class NavigateApp(App):
|
||||||
def on_key(self, window, key, *args):
|
def on_key(self, window, key, *args):
|
||||||
"""Method is used for going on previous screen."""
|
"""Method is used for going on previous screen."""
|
||||||
if key == 27:
|
if key == 27:
|
||||||
if state.in_search_mode and self.root.ids.scr_mngr.current != "mailDetail":
|
if state.in_search_mode and self.root.ids.scr_mngr.current != (
|
||||||
|
"mailDetail"):
|
||||||
self.closeSearchScreen()
|
self.closeSearchScreen()
|
||||||
elif self.root.ids.scr_mngr.current == "mailDetail":
|
elif self.root.ids.scr_mngr.current == "mailDetail":
|
||||||
self.root.ids.scr_mngr.current = 'sent'\
|
self.root.ids.scr_mngr.current = 'sent'\
|
||||||
|
@ -1369,10 +1399,12 @@ class NavigateApp(App):
|
||||||
self.root.ids.scr_mngr.current = state.search_screen
|
self.root.ids.scr_mngr.current = state.search_screen
|
||||||
|
|
||||||
def save_draft(self):
|
def save_draft(self):
|
||||||
|
"""Saving drafts messages"""
|
||||||
composer_objs = self.root
|
composer_objs = self.root
|
||||||
from_addr = str(self.root.ids.sc3.children[1].ids.ti.text)
|
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)
|
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:
|
if from_addr and to_addr and state.detailPageType != 'draft' \
|
||||||
|
and not state.in_sent_method:
|
||||||
Draft().draft_msg(composer_objs)
|
Draft().draft_msg(composer_objs)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -1405,20 +1437,27 @@ class NavigateApp(App):
|
||||||
self.root.ids.toolbar.left_action_items = [
|
self.root.ids.toolbar.left_action_items = [
|
||||||
['arrow-left', lambda x: self.back_press()]]
|
['arrow-left', lambda x: self.back_press()]]
|
||||||
self.root.ids.toolbar.right_action_items = [
|
self.root.ids.toolbar.right_action_items = [
|
||||||
['refresh', lambda x: self.root.ids.sc3.children[1].reset_composer()],
|
['refresh',
|
||||||
['send', lambda x: self.root.ids.sc3.children[1].send(self)]]
|
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):
|
def set_common_header(self):
|
||||||
self.root.ids.toolbar.right_action_items = [['account-plus', lambda x: self.addingtoaddressbook()]]
|
"""Common for all window"""
|
||||||
self.root.ids.toolbar.left_action_items = [['menu', lambda x: self.root.toggle_nav_drawer()]]
|
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
|
return
|
||||||
|
|
||||||
def back_press(self):
|
def back_press(self):
|
||||||
"""Method used for going back from composer to previous page."""
|
"""Method used for going back from composer to previous page."""
|
||||||
self.save_draft()
|
self.save_draft()
|
||||||
if self.root.ids.scr_mngr.current == 'mailDetail' and state.in_search_mode:
|
if self.root.ids.scr_mngr.current == 'mailDetail' \
|
||||||
|
and state.in_search_mode:
|
||||||
toolbar_obj = self.root.ids.toolbar
|
toolbar_obj = self.root.ids.toolbar
|
||||||
toolbar_obj.left_action_items = [['arrow-left', lambda x: self.closeSearchScreen()]]
|
toolbar_obj.left_action_items = [
|
||||||
|
['arrow-left', lambda x: self.closeSearchScreen()]]
|
||||||
toolbar_obj.right_action_items = []
|
toolbar_obj.right_action_items = []
|
||||||
self.root.ids.toolbar.title = ''
|
self.root.ids.toolbar.title = ''
|
||||||
else:
|
else:
|
||||||
|
@ -1452,7 +1491,8 @@ 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 ''
|
||||||
|
@ -1463,7 +1503,8 @@ class NavigateApp(App):
|
||||||
state.searcing_text = str(instance.text).strip()
|
state.searcing_text = str(instance.text).strip()
|
||||||
if instance.focus and state.searcing_text:
|
if instance.focus and state.searcing_text:
|
||||||
toolbar_obj = self.root.ids.toolbar
|
toolbar_obj = self.root.ids.toolbar
|
||||||
toolbar_obj.left_action_items = [['arrow-left', lambda x: self.closeSearchScreen()]]
|
toolbar_obj.left_action_items = [
|
||||||
|
['arrow-left', lambda x: self.closeSearchScreen()]]
|
||||||
toolbar_obj.right_action_items = []
|
toolbar_obj.right_action_items = []
|
||||||
self.root.ids.toolbar.title = ''
|
self.root.ids.toolbar.title = ''
|
||||||
state.in_search_mode = True
|
state.in_search_mode = True
|
||||||
|
@ -1472,35 +1513,43 @@ class NavigateApp(App):
|
||||||
"""Function for close search screen"""
|
"""Function for close search screen"""
|
||||||
self.set_common_header()
|
self.set_common_header()
|
||||||
address_label = self.current_address_label(
|
address_label = self.current_address_label(
|
||||||
BMConfigParser().get(state.association, 'label'), state.association)
|
BMConfigParser().get(
|
||||||
|
state.association, 'label'), state.association)
|
||||||
self.root.ids.toolbar.title = address_label
|
self.root.ids.toolbar.title = address_label
|
||||||
state.searcing_text = ''
|
state.searcing_text = ''
|
||||||
self.refreshScreen()
|
self.refreshScreen()
|
||||||
state.in_search_mode = False
|
state.in_search_mode = False
|
||||||
|
|
||||||
def refreshScreen(self):
|
def refreshScreen(self): # pylint: disable=unused-variable
|
||||||
"""Method show search button only on inbox or sent screen."""
|
"""Method show search button only on inbox or sent screen."""
|
||||||
state.searcing_text = ''
|
state.searcing_text = ''
|
||||||
if state.search_screen == 'inbox':
|
if state.search_screen == 'inbox':
|
||||||
try:
|
try:
|
||||||
self.root.ids.sc1.children[3].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[2].children[1].ids.search_field.text = ''
|
self.root.ids.sc1.children[
|
||||||
|
2].children[1].ids.search_field.text = ''
|
||||||
self.root.ids.sc1.children[1].active = True
|
self.root.ids.sc1.children[1].active = True
|
||||||
Clock.schedule_once(self.search_callback, 0.5)
|
Clock.schedule_once(self.search_callback, 0.5)
|
||||||
elif state.search_screen == 'addressbook':
|
elif state.search_screen == 'addressbook':
|
||||||
self.root.ids.sc11.children[2].children[1].ids.search_field.text = ''
|
self.root.ids.sc11.children[
|
||||||
self.root.ids.sc11.children[1].active = True
|
2].children[1].ids.search_field.text = ''
|
||||||
|
self.root.ids.sc11.children[
|
||||||
|
1].active = True
|
||||||
Clock.schedule_once(self.search_callback, 0.5)
|
Clock.schedule_once(self.search_callback, 0.5)
|
||||||
elif state.search_screen == 'myaddress':
|
elif state.search_screen == 'myaddress':
|
||||||
try:
|
try:
|
||||||
self.root.ids.sc10.children[3].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[
|
||||||
|
2].children[1].ids.search_field.text = ''
|
||||||
self.root.ids.sc10.children[1].active = True
|
self.root.ids.sc10.children[1].active = True
|
||||||
Clock.schedule_once(self.search_callback, 0.5)
|
Clock.schedule_once(self.search_callback, 0.5)
|
||||||
else:
|
else:
|
||||||
self.root.ids.sc4.children[2].children[1].ids.search_field.text = ''
|
self.root.ids.sc4.children[
|
||||||
|
2].children[1].ids.search_field.text = ''
|
||||||
self.root.ids.sc4.children[1].active = True
|
self.root.ids.sc4.children[1].active = True
|
||||||
Clock.schedule_once(self.search_callback, 0.5)
|
Clock.schedule_once(self.search_callback, 0.5)
|
||||||
return
|
return
|
||||||
|
@ -1508,20 +1557,27 @@ class NavigateApp(App):
|
||||||
def set_identicon(self, text):
|
def set_identicon(self, text):
|
||||||
"""This method is use for showing identicon in address spinner"""
|
"""This method is use for showing 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)
|
||||||
|
|
||||||
def set_mail_detail_header(self):
|
def set_mail_detail_header(self):
|
||||||
"""Method is used for setting the details of the page"""
|
"""Method is used for 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
|
||||||
|
|
||||||
|
|
||||||
|
@ -1549,7 +1605,8 @@ class GrashofPopup(Popup):
|
||||||
folder="addressbook")]
|
folder="addressbook")]
|
||||||
stored_labels = [labels[0] for labels in kivy_helper_search.search_sql(
|
stored_labels = [labels[0] for labels in kivy_helper_search.search_sql(
|
||||||
folder="addressbook")]
|
folder="addressbook")]
|
||||||
if label and address and address not in stored_address and label not in stored_labels:
|
if label and address and address not in stored_address \
|
||||||
|
and label not in stored_labels:
|
||||||
# state.navinstance = self.parent.children[1]
|
# state.navinstance = self.parent.children[1]
|
||||||
queues.UISignalQueue.put(('rerenderAddressBook', ''))
|
queues.UISignalQueue.put(('rerenderAddressBook', ''))
|
||||||
self.dismiss()
|
self.dismiss()
|
||||||
|
@ -1586,7 +1643,8 @@ class GrashofPopup(Popup):
|
||||||
|
|
||||||
def checkAddress_valid(self, instance):
|
def checkAddress_valid(self, instance):
|
||||||
"""Checking 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()
|
||||||
|
@ -1607,7 +1665,8 @@ class GrashofPopup(Popup):
|
||||||
def checkLabel_valid(self, instance):
|
def checkLabel_valid(self, instance):
|
||||||
"""Checking address label is unique of not"""
|
"""Checking address label is unique of not"""
|
||||||
entered_label = instance.text.strip()
|
entered_label = instance.text.strip()
|
||||||
addr_labels = [labels[0] for labels in kivy_helper_search.search_sql(folder="addressbook")]
|
addr_labels = [labels[0] for labels in kivy_helper_search.search_sql(
|
||||||
|
folder="addressbook")]
|
||||||
if entered_label in addr_labels:
|
if entered_label in addr_labels:
|
||||||
self.ids.label.error = True
|
self.ids.label.error = True
|
||||||
self.ids.label.helper_text = 'label name already exists.'
|
self.ids.label.helper_text = 'label name already exists.'
|
||||||
|
@ -1620,26 +1679,22 @@ class GrashofPopup(Popup):
|
||||||
|
|
||||||
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):
|
||||||
|
@ -1664,7 +1719,6 @@ 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()
|
||||||
|
@ -1725,22 +1779,27 @@ class MailDetail(Screen):
|
||||||
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()
|
||||||
|
@ -1772,11 +1831,13 @@ class MailDetail(Screen):
|
||||||
def write_msg(self, navApp):
|
def write_msg(self, navApp):
|
||||||
"""Method used to write on draft mail."""
|
"""Method used to 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.parent.ids.sc3.children[1].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'] if state.write_msg['subject'] != '(no subject)' else ''
|
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()
|
||||||
|
@ -1794,7 +1855,6 @@ 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()
|
||||||
|
|
||||||
|
@ -1828,7 +1888,6 @@ class MyaddDetailPopup(Popup):
|
||||||
|
|
||||||
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()
|
||||||
|
|
||||||
|
@ -1853,7 +1912,8 @@ class AddbookDetailPopup(Popup):
|
||||||
if label and label not in stored_labels:
|
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()
|
||||||
|
@ -1882,7 +1942,8 @@ class AddbookDetailPopup(Popup):
|
||||||
address_list = kivy_helper_search.search_sql(folder="addressbook")
|
address_list = kivy_helper_search.search_sql(folder="addressbook")
|
||||||
addr_labels = [labels[0] for labels in address_list]
|
addr_labels = [labels[0] for labels in address_list]
|
||||||
add_dict = dict(address_list)
|
add_dict = dict(address_list)
|
||||||
if self.address and entered_label in addr_labels and self.address != add_dict[entered_label]:
|
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.error = True
|
||||||
self.ids.add_label.helper_text = 'label name already exists.'
|
self.ids.add_label.helper_text = 'label name already exists.'
|
||||||
elif entered_label:
|
elif entered_label:
|
||||||
|
@ -1907,7 +1968,6 @@ 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()
|
||||||
queryreturn = ListProperty()
|
queryreturn = ListProperty()
|
||||||
has_refreshed = True
|
has_refreshed = True
|
||||||
|
@ -1936,7 +1996,8 @@ class Draft(Screen):
|
||||||
self.queryreturn = kivy_helper_search.search_sql(
|
self.queryreturn = kivy_helper_search.search_sql(
|
||||||
xAddress, account, "draft", where, what, False)
|
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(self.queryreturn))
|
state.msg_counter_objs.draft_cnt.badge_text = str(
|
||||||
|
len(self.queryreturn))
|
||||||
if 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(self.queryreturn))
|
src_mng_obj.draft_cnt.badge_text = str(len(self.queryreturn))
|
||||||
|
@ -1999,7 +2060,8 @@ class Draft(Screen):
|
||||||
total_draft_msg = len(self.ids.ml.children)
|
total_draft_msg = len(self.ids.ml.children)
|
||||||
if total_draft_msg != len(self.queryreturn):
|
if total_draft_msg != len(self.queryreturn):
|
||||||
self.update_draft_screen_on_scroll(total_draft_msg)
|
self.update_draft_screen_on_scroll(total_draft_msg)
|
||||||
self.has_refreshed = True if total_draft_msg != len(self.queryreturn) else False
|
self.has_refreshed = True if total_draft_msg != len(
|
||||||
|
self.queryreturn) else False
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -2024,7 +2086,8 @@ class Draft(Screen):
|
||||||
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.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
|
||||||
|
@ -2048,15 +2111,17 @@ class Draft(Screen):
|
||||||
sendMessageToPeople = True
|
sendMessageToPeople = True
|
||||||
if sendMessageToPeople:
|
if sendMessageToPeople:
|
||||||
from addresses import decodeAddress
|
from addresses import decodeAddress
|
||||||
status, addressVersionNumber, streamNumber, ripe = decodeAddress(toAddress)
|
# status, addressVersionNumber, streamNumber, ripe = decodeAddress(
|
||||||
|
# toAddress)
|
||||||
|
streamNumber, ripe = decodeAddress(toAddress)[2:]
|
||||||
from addresses import addBMIfNotPresent
|
from addresses import addBMIfNotPresent
|
||||||
toAddress = addBMIfNotPresent(toAddress)
|
toAddress = addBMIfNotPresent(toAddress)
|
||||||
statusIconColor = 'red'
|
# 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 = ()
|
# t = ()
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
'''INSERT INTO sent VALUES
|
'''INSERT INTO sent VALUES
|
||||||
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''',
|
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''',
|
||||||
|
@ -2095,7 +2160,6 @@ class CustomSpinner(Spinner):
|
||||||
|
|
||||||
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
|
has_refreshed = True
|
||||||
all_mails = ListProperty()
|
all_mails = ListProperty()
|
||||||
|
@ -2121,12 +2185,15 @@ class Allmails(Screen):
|
||||||
def loadMessagelist(self, account, where="", what=""):
|
def loadMessagelist(self, account, where="", what=""):
|
||||||
"""Load Inbox, Sent anf Draft list of messages."""
|
"""Load Inbox, Sent anf Draft list of messages."""
|
||||||
self.all_mails = sqlQuery(
|
self.all_mails = sqlQuery(
|
||||||
"SELECT toaddress, fromaddress, subject, message, folder, ackdata As id, DATE(lastactiontime)"
|
"SELECT toaddress, fromaddress, subject, message, folder, ackdata"
|
||||||
" As actionTime FROM sent WHERE folder = 'sent' UNION"
|
" As id, DATE(lastactiontime) As actionTime FROM sent WHERE"
|
||||||
" SELECT toaddress, fromaddress, subject, message, folder, msgid As id, DATE(received) As"
|
" folder = 'sent' UNION SELECT toaddress, fromaddress, subject,"
|
||||||
" actionTime FROM inbox WHERE folder = 'inbox' ORDER BY actionTime DESC")
|
" message, folder, msgid As id, DATE(received) As actionTime"
|
||||||
|
" FROM inbox WHERE folder = 'inbox' ORDER BY actionTime DESC")
|
||||||
if self.all_mails:
|
if self.all_mails:
|
||||||
state.kivyapp.root.children[2].children[0].ids.allmail_cnt.badge_text = str(len(self.all_mails))
|
state.kivyapp.root.children[2].children[
|
||||||
|
0].ids.allmail_cnt.badge_text = str(
|
||||||
|
len(self.all_mails))
|
||||||
state.all_count = str(len(self.all_mails))
|
state.all_count = str(len(self.all_mails))
|
||||||
self.set_mdlist(0, 20)
|
self.set_mdlist(0, 20)
|
||||||
self.ids.refresh_layout.bind(scroll_y=self.check_scroll_y)
|
self.ids.refresh_layout.bind(scroll_y=self.check_scroll_y)
|
||||||
|
@ -2148,7 +2215,8 @@ class Allmails(Screen):
|
||||||
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(
|
||||||
|
@ -2178,14 +2246,17 @@ class Allmails(Screen):
|
||||||
self.ids.refresh_layout.scroll_y = .06
|
self.ids.refresh_layout.scroll_y = .06
|
||||||
load_more = len(self.ids.ml.children)
|
load_more = len(self.ids.ml.children)
|
||||||
self.updating_allmail(load_more)
|
self.updating_allmail(load_more)
|
||||||
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def updating_allmail(self, load_more):
|
def updating_allmail(self, load_more):
|
||||||
"""This method is used to update the all mail listing value on the scroll of screen"""
|
"""This method is used to update the all mail
|
||||||
|
listing value on the scroll of screen"""
|
||||||
if self.all_mails and load_more != len(self.all_mails):
|
if self.all_mails and load_more != len(self.all_mails):
|
||||||
state.all_count = str(len(self.all_mails))
|
state.all_count = str(len(self.all_mails))
|
||||||
self.set_mdlist(load_more, load_more + 5)
|
self.set_mdlist(load_more, load_more + 5)
|
||||||
self.has_refreshed = True if load_more != len(self.all_mails) else False
|
self.has_refreshed = True if load_more != len(
|
||||||
|
self.all_mails) else False
|
||||||
|
|
||||||
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."""
|
||||||
|
@ -2201,7 +2272,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(
|
||||||
|
@ -2244,7 +2315,8 @@ class Allmails(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 allmails screen data."""
|
"""Method used for loading the allmails screen data."""
|
||||||
self.ids.ml.clear_widgets()
|
self.ids.ml.clear_widgets()
|
||||||
|
@ -2259,49 +2331,47 @@ class Allmails(Screen):
|
||||||
Clock.schedule_once(refresh_callback, 1)
|
Clock.schedule_once(refresh_callback, 1)
|
||||||
|
|
||||||
def set_root_layout(self):
|
def set_root_layout(self):
|
||||||
|
"""Setting root layout"""
|
||||||
try:
|
try:
|
||||||
return self.manager.parent.parent
|
return self.manager.parent.parent
|
||||||
except Exception as e:
|
except Exception:
|
||||||
return state.kivyapp.root.ids.float_box
|
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[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 = '!'
|
||||||
|
|
||||||
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 LoadingPopup(Popup):
|
||||||
"""Load Popup"""
|
"""Class for loading Popup"""
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
super(LoadingPopup, self).__init__(**kwargs)
|
super(LoadingPopup, self).__init__(**kwargs)
|
||||||
# call dismiss_popup in 2 seconds
|
# call dismiss_popup in 2 seconds
|
||||||
Clock.schedule_once(self.dismiss_popup, 0.5)
|
Clock.schedule_once(self.dismiss_popup, 0.5)
|
||||||
|
|
||||||
def dismiss_popup(self, dt):
|
def dismiss_popup(self, dt):
|
||||||
"""Dismissing popup"""
|
"""Dismiss popups"""
|
||||||
self.dismiss()
|
self.dismiss()
|
||||||
|
|
Reference in New Issue
Block a user