commit
aca97aca9e
|
@ -59,8 +59,7 @@ def random_color(hash_string):
|
||||||
r = rgb[:split]
|
r = rgb[:split]
|
||||||
g = rgb[split:2 * split]
|
g = rgb[split:2 * split]
|
||||||
b = rgb[2 * split:3 * split]
|
b = rgb[2 * split:3 * split]
|
||||||
color = (int(r, 16), int(g, 16),
|
color = (int(r, 16), int(g, 16), int(b, 16), 0xFF)
|
||||||
int(b, 16), 0xFF)
|
|
||||||
return color
|
return color
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,6 +77,5 @@ def generate_image(image, color, hash_string):
|
||||||
if int(hash_string[index], 16) % 2 == 0:
|
if int(hash_string[index], 16) % 2 == 0:
|
||||||
image.putpixel((x, y), color)
|
image.putpixel((x, y), color)
|
||||||
image.putpixel((limit_x - x, y), color)
|
image.putpixel((limit_x - x, y), color)
|
||||||
|
|
||||||
index = index + 1
|
index = index + 1
|
||||||
return image
|
return image
|
||||||
|
|
|
@ -7,22 +7,24 @@ from helper_sql import sqlQuery
|
||||||
def search_sql(
|
def search_sql(
|
||||||
xAddress="toaddress", account=None, folder="inbox", where=None,
|
xAddress="toaddress", account=None, folder="inbox", where=None,
|
||||||
what=None, unreadOnly=False, start_indx=0, end_indx=20):
|
what=None, unreadOnly=False, start_indx=0, end_indx=20):
|
||||||
"""Method helping for searching mails"""
|
|
||||||
# pylint: disable=too-many-arguments, too-many-branches
|
# pylint: disable=too-many-arguments, too-many-branches
|
||||||
|
"""Method helping for searching mails"""
|
||||||
if what is not None and what != "":
|
if what is not None and what != "":
|
||||||
what = "%" + what + "%"
|
what = "%" + what + "%"
|
||||||
else:
|
else:
|
||||||
what = None
|
what = None
|
||||||
if folder == "sent" or folder == "draft":
|
if folder in ("sent", "draft"):
|
||||||
sqlStatementBase = (
|
sqlStatementBase = (
|
||||||
'''SELECT toaddress, fromaddress, subject, message, status,'''
|
'''SELECT toaddress, fromaddress, subject, message, status,'''
|
||||||
''' ackdata, lastactiontime 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 = (
|
sqlStatementBase = (
|
||||||
'''SELECT folder, msgid, toaddress, message, fromaddress,'''
|
'''SELECT folder, msgid, toaddress, message, fromaddress,'''
|
||||||
''' subject, received, read FROM inbox ''')
|
''' subject, received, read FROM inbox '''
|
||||||
|
)
|
||||||
sqlStatementParts = []
|
sqlStatementParts = []
|
||||||
sqlArguments = []
|
sqlArguments = []
|
||||||
if account is not None:
|
if account is not None:
|
||||||
|
@ -59,7 +61,7 @@ def search_sql(
|
||||||
if sqlStatementParts:
|
if sqlStatementParts:
|
||||||
sqlStatementBase += "WHERE " + " AND ".join(sqlStatementParts)
|
sqlStatementBase += "WHERE " + " AND ".join(sqlStatementParts)
|
||||||
# if folder in ("sent", "draft"):
|
# if folder in ("sent", "draft"):
|
||||||
if folder == "sent" or folder == "draft":
|
if folder in ("sent", "draft"):
|
||||||
sqlStatementBase += \
|
sqlStatementBase += \
|
||||||
"ORDER BY lastactiontime DESC limit {0}, {1}".format(
|
"ORDER BY lastactiontime DESC limit {0}, {1}".format(
|
||||||
start_indx, end_indx)
|
start_indx, end_indx)
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
"""
|
"""
|
||||||
src/bitmessagekivy/mpybit.py
|
Bitmessage android(mobile) interface
|
||||||
=================================
|
|
||||||
"""
|
"""
|
||||||
# pylint: disable=import-error, no-name-in-module, too-many-lines
|
# pylint: disable=import-error,no-name-in-module,unused-argument,too-few-public-methods,too-many-arguments
|
||||||
# pylint: disable=too-few-public-methods, unused-argument, too-many-ancestors
|
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation,attribute-defined-outside-init
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
from bitmessagekivy import identiconGeneration
|
||||||
|
from bitmessagekivy import kivy_helper_search
|
||||||
|
from bitmessagekivy.uikivysignaler import UIkivySignaler
|
||||||
from bmconfigparser import BMConfigParser
|
from bmconfigparser import BMConfigParser
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from helper_sql import sqlExecute, sqlQuery
|
from helper_sql import sqlExecute, sqlQuery
|
||||||
|
@ -14,7 +16,6 @@ from kivy.clock import Clock
|
||||||
from kivy.core.clipboard import Clipboard
|
from kivy.core.clipboard import Clipboard
|
||||||
from kivy.core.window import Window
|
from kivy.core.window import Window
|
||||||
from kivy.lang import Builder
|
from kivy.lang import Builder
|
||||||
from kivy.metrics import dp
|
|
||||||
from kivy.properties import (
|
from kivy.properties import (
|
||||||
BooleanProperty,
|
BooleanProperty,
|
||||||
ListProperty,
|
ListProperty,
|
||||||
|
@ -37,7 +38,6 @@ 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
|
||||||
from bitmessagekivy import kivy_helper_search
|
|
||||||
from kivymd.uix.button import MDIconButton
|
from kivymd.uix.button import MDIconButton
|
||||||
from kivymd.uix.dialog import MDDialog
|
from kivymd.uix.dialog import MDDialog
|
||||||
from kivymd.uix.label import MDLabel
|
from kivymd.uix.label import MDLabel
|
||||||
|
@ -51,7 +51,8 @@ from kivymd.uix.list import (
|
||||||
)
|
)
|
||||||
from kivymd.uix.navigationdrawer import (
|
from kivymd.uix.navigationdrawer import (
|
||||||
MDNavigationDrawer,
|
MDNavigationDrawer,
|
||||||
NavigationDrawerHeaderBase)
|
NavigationDrawerHeaderBase
|
||||||
|
)
|
||||||
from kivymd.uix.selectioncontrol import MDCheckbox
|
from kivymd.uix.selectioncontrol import MDCheckbox
|
||||||
from kivymd.theming import ThemeManager
|
from kivymd.theming import ThemeManager
|
||||||
|
|
||||||
|
@ -59,16 +60,13 @@ import queues
|
||||||
from semaphores import kivyuisignaler
|
from semaphores import kivyuisignaler
|
||||||
|
|
||||||
import state
|
import state
|
||||||
|
from addresses import decodeAddress
|
||||||
from bitmessagekivy.uikivysignaler import UIkivySignaler
|
|
||||||
from bitmessagekivy import identiconGeneration
|
|
||||||
from addresses import addBMIfNotPresent, decodeAddress, encodeVarint
|
|
||||||
# pylint: disable=unused-argument, too-few-public-methods
|
|
||||||
|
|
||||||
|
|
||||||
def toast(text):
|
def toast(text):
|
||||||
"""Method will display the toast message"""
|
"""Method will display the toast message"""
|
||||||
from kivymd.toast.kivytoast import toast # pylint: disable=redefined-outer-name
|
# pylint: disable=redefined-outer-name
|
||||||
|
from kivymd.toast.kivytoast import toast
|
||||||
toast(text)
|
toast(text)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -83,6 +81,7 @@ 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()
|
queryreturn = ListProperty()
|
||||||
has_refreshed = True
|
has_refreshed = True
|
||||||
account = StringProperty()
|
account = StringProperty()
|
||||||
|
@ -105,7 +104,6 @@ class Inbox(Screen):
|
||||||
|
|
||||||
def loadMessagelist(self, where="", what=""):
|
def loadMessagelist(self, where="", what=""):
|
||||||
"""Load Inbox list for Inbox messages"""
|
"""Load Inbox list for Inbox messages"""
|
||||||
# pylint: disable=too-many-locals
|
|
||||||
self.set_defaultAddress()
|
self.set_defaultAddress()
|
||||||
self.account = state.association
|
self.account = state.association
|
||||||
if state.searcing_text:
|
if state.searcing_text:
|
||||||
|
@ -142,7 +140,6 @@ 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):
|
def inboxDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
||||||
"""This method used for retrieving inbox data"""
|
"""This method used for retrieving inbox data"""
|
||||||
self.queryreturn = kivy_helper_search.search_sql(
|
self.queryreturn = kivy_helper_search.search_sql(
|
||||||
|
@ -283,7 +280,6 @@ class Inbox(Screen):
|
||||||
self.parent.parent.screens[4].clear_widgets()
|
self.parent.parent.screens[4].clear_widgets()
|
||||||
self.parent.parent.screens[4].add_widget(Trash())
|
self.parent.parent.screens[4].add_widget(Trash())
|
||||||
|
|
||||||
# pylint: disable=attribute-defined-outside-init
|
|
||||||
def refresh_callback(self, *args):
|
def refresh_callback(self, *args):
|
||||||
"""Method updates the state of application,
|
"""Method updates the state of application,
|
||||||
While the spinner remains on the screen"""
|
While the spinner remains on the screen"""
|
||||||
|
@ -306,6 +302,7 @@ class Inbox(Screen):
|
||||||
|
|
||||||
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()
|
addresses_list = ListProperty()
|
||||||
has_refreshed = True
|
has_refreshed = True
|
||||||
is_add_created = False
|
is_add_created = False
|
||||||
|
@ -321,7 +318,10 @@ class MyAddress(Screen):
|
||||||
self.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
|
self.ids.refresh_layout.scroll_y = 1.0
|
||||||
filtered_list = [x for x in BMConfigParser().addresses() if self.filter_address(x)]
|
filtered_list = [
|
||||||
|
x for x in BMConfigParser().addresses()
|
||||||
|
if self.filter_address(x)
|
||||||
|
]
|
||||||
self.addresses_list = filtered_list
|
self.addresses_list = filtered_list
|
||||||
self.addresses_list = [obj for obj in reversed(self.addresses_list)]
|
self.addresses_list = [obj for obj in reversed(self.addresses_list)]
|
||||||
self.ids.identi_tag.children[0].text = ''
|
self.ids.identi_tag.children[0].text = ''
|
||||||
|
@ -389,7 +389,6 @@ class MyAddress(Screen):
|
||||||
p.open()
|
p.open()
|
||||||
p.set_address(fromaddress, label)
|
p.set_address(fromaddress, label)
|
||||||
|
|
||||||
# pylint: disable=attribute-defined-outside-init
|
|
||||||
def refresh_callback(self, *args):
|
def refresh_callback(self, *args):
|
||||||
"""Method updates the state of application,
|
"""Method updates the state of application,
|
||||||
While the spinner remains on the screen"""
|
While the spinner remains on the screen"""
|
||||||
|
@ -408,7 +407,13 @@ 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"""
|
||||||
if [x for x in [BMConfigParser().get(address, 'label').lower(), address.lower()] if (state.searcing_text).lower() in x]:
|
if [
|
||||||
|
x for x in [
|
||||||
|
BMConfigParser().get(address, 'label').lower(),
|
||||||
|
address.lower()
|
||||||
|
]
|
||||||
|
if (state.searcing_text).lower() in x
|
||||||
|
]:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -419,6 +424,7 @@ class MyAddress(Screen):
|
||||||
|
|
||||||
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()
|
queryreturn = ListProperty()
|
||||||
has_refreshed = True
|
has_refreshed = True
|
||||||
|
|
||||||
|
@ -526,10 +532,11 @@ 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 = duplicate-bases
|
# pylint: disable = duplicate-bases
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -565,14 +572,15 @@ class SelectableLabel(RecycleDataViewBehavior, Label):
|
||||||
class RV(RecycleView):
|
class RV(RecycleView):
|
||||||
"""Recycling View"""
|
"""Recycling View"""
|
||||||
|
|
||||||
def __init__(self, **kwargs): # pylint: disable=useless-super-delegation
|
def __init__(self, **kwargs):
|
||||||
"""Recycling Method"""
|
"""Recycling Method"""
|
||||||
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, too-many-locals
|
# pylint: disable=too-many-statements
|
||||||
|
|
||||||
txt_input = ObjectProperty()
|
txt_input = ObjectProperty()
|
||||||
rv = ObjectProperty()
|
rv = ObjectProperty()
|
||||||
|
|
||||||
|
@ -587,7 +595,6 @@ 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':
|
||||||
|
@ -614,7 +621,9 @@ class DropDownWidget(BoxLayout):
|
||||||
statusIconColor = 'red'
|
statusIconColor = 'red'
|
||||||
if (addressVersionNumber > 4) or (
|
if (addressVersionNumber > 4) or (
|
||||||
addressVersionNumber <= 1):
|
addressVersionNumber <= 1):
|
||||||
print("addressVersionNumber > 4 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':
|
||||||
|
@ -649,7 +658,8 @@ class DropDownWidget(BoxLayout):
|
||||||
if state.detailPageType == 'draft' \
|
if state.detailPageType == 'draft' \
|
||||||
and state.send_draft_mail:
|
and state.send_draft_mail:
|
||||||
state.draft_count = str(int(state.draft_count) - 1)
|
state.draft_count = str(int(state.draft_count) - 1)
|
||||||
state.msg_counter_objs.draft_cnt.badge_text = state.draft_count
|
state.msg_counter_objs.draft_cnt.badge_text = (
|
||||||
|
state.draft_count)
|
||||||
state.detailPageType = ''
|
state.detailPageType = ''
|
||||||
state.send_draft_mail = None
|
state.send_draft_mail = None
|
||||||
# self.parent.parent.screens[0].ids.ml.clear_widgets()
|
# self.parent.parent.screens[0].ids.ml.clear_widgets()
|
||||||
|
@ -678,7 +688,6 @@ class DropDownWidget(BoxLayout):
|
||||||
state.kivyapp.back_press()
|
state.kivyapp.back_press()
|
||||||
toast('sent')
|
toast('sent')
|
||||||
|
|
||||||
# pylint: disable=attribute-defined-outside-init
|
|
||||||
def address_error_message(self, msg):
|
def address_error_message(self, msg):
|
||||||
"""Generates error message"""
|
"""Generates error message"""
|
||||||
width = .8 if platform == 'android' else .55
|
width = .8 if platform == 'android' else .55
|
||||||
|
@ -717,7 +726,7 @@ class MyTextInput(TextInput):
|
||||||
starting_no = NumericProperty(3)
|
starting_no = NumericProperty(3)
|
||||||
suggestion_text = ''
|
suggestion_text = ''
|
||||||
|
|
||||||
def __init__(self, **kwargs): # pylint: disable=useless-super-delegation
|
def __init__(self, **kwargs):
|
||||||
"""Getting Text Input."""
|
"""Getting Text Input."""
|
||||||
super(MyTextInput, self).__init__(**kwargs)
|
super(MyTextInput, self).__init__(**kwargs)
|
||||||
|
|
||||||
|
@ -748,8 +757,9 @@ class MyTextInput(TextInput):
|
||||||
class Payment(Screen):
|
class Payment(Screen):
|
||||||
"""Payment module"""
|
"""Payment module"""
|
||||||
|
|
||||||
def get_available_credits(self, instance): # pylint: disable=no-self-use
|
def get_available_credits(self, instance):
|
||||||
"""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 = (
|
existing_credits = (
|
||||||
state.kivyapp.root.ids.sc18.ids.ml.children[0].children[
|
state.kivyapp.root.ids.sc18.ids.ml.children[0].children[
|
||||||
|
@ -767,6 +777,7 @@ class Payment(Screen):
|
||||||
|
|
||||||
class Credits(Screen):
|
class Credits(Screen):
|
||||||
"""Credits Method"""
|
"""Credits Method"""
|
||||||
|
|
||||||
available_credits = StringProperty(
|
available_credits = StringProperty(
|
||||||
'{0}'.format('0'))
|
'{0}'.format('0'))
|
||||||
|
|
||||||
|
@ -779,13 +790,15 @@ class Login(Screen):
|
||||||
|
|
||||||
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(
|
||||||
'Processed {0} per-to-per messages'.format('0'))
|
'Processed {0} per-to-per messages'.format('0'))
|
||||||
text_variable_3 = StringProperty(
|
text_variable_3 = StringProperty(
|
||||||
'Processed {0} brodcast messages'.format('0'))
|
'Processed {0} brodcast messages'.format('0'))
|
||||||
text_variable_4 = StringProperty('Processed {0} public keys'.format('0'))
|
text_variable_4 = StringProperty(
|
||||||
|
'Processed {0} public keys'.format('0'))
|
||||||
text_variable_5 = StringProperty(
|
text_variable_5 = StringProperty(
|
||||||
'Processed {0} object to be synced'.format('0'))
|
'Processed {0} object to be synced'.format('0'))
|
||||||
|
|
||||||
|
@ -813,12 +826,13 @@ class NetworkStat(Screen):
|
||||||
|
|
||||||
class ContentNavigationDrawer(Navigatorss):
|
class ContentNavigationDrawer(Navigatorss):
|
||||||
"""Navigate Content Drawer"""
|
"""Navigate Content Drawer"""
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
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("")
|
||||||
|
|
||||||
|
@ -879,6 +893,7 @@ class Random(Screen):
|
||||||
|
|
||||||
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()
|
queryreturn = ListProperty()
|
||||||
has_refreshed = True
|
has_refreshed = True
|
||||||
account = StringProperty()
|
account = StringProperty()
|
||||||
|
@ -931,7 +946,6 @@ class Sent(Screen):
|
||||||
valign='top')
|
valign='top')
|
||||||
self.ids.ml.add_widget(content)
|
self.ids.ml.add_widget(content)
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def sentDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
def sentDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
||||||
"""This method is used to retrieving data from sent table"""
|
"""This method is used to retrieving data from sent table"""
|
||||||
self.queryreturn = kivy_helper_search.search_sql(
|
self.queryreturn = kivy_helper_search.search_sql(
|
||||||
|
@ -1103,6 +1117,7 @@ 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()
|
trash_messages = ListProperty()
|
||||||
has_refreshed = True
|
has_refreshed = True
|
||||||
# delete_index = StringProperty()
|
# delete_index = StringProperty()
|
||||||
|
@ -1234,9 +1249,11 @@ class Trash(Screen):
|
||||||
"""Deleting message from trash"""
|
"""Deleting message from trash"""
|
||||||
self.children[1].active = True
|
self.children[1].active = True
|
||||||
if self.table_name == 'inbox':
|
if self.table_name == 'inbox':
|
||||||
sqlExecute("DELETE FROM inbox WHERE msgid = ?;", self.delete_index)
|
sqlExecute(
|
||||||
|
"DELETE FROM inbox WHERE msgid = ?;", self.delete_index)
|
||||||
elif self.table_name == 'sent':
|
elif self.table_name == 'sent':
|
||||||
sqlExecute("DELETE FROM sent WHERE ackdata = ?;", self.delete_index)
|
sqlExecute(
|
||||||
|
"DELETE FROM sent WHERE ackdata = ?;", self.delete_index)
|
||||||
msg_count_objs = state.kivyapp.root.children[2].children[0].ids
|
msg_count_objs = state.kivyapp.root.children[2].children[0].ids
|
||||||
if int(state.trash_count) > 0:
|
if int(state.trash_count) > 0:
|
||||||
msg_count_objs.trash_cnt.badge_text = str(
|
msg_count_objs.trash_cnt.badge_text = str(
|
||||||
|
@ -1271,8 +1288,10 @@ class Setting(Screen):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class NavigateApp(App): # pylint: disable=too-many-public-methods
|
class NavigateApp(App):
|
||||||
"""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()
|
||||||
|
@ -1319,10 +1338,10 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods
|
||||||
kivyuisignaler.release()
|
kivyuisignaler.release()
|
||||||
super(NavigateApp, self).run()
|
super(NavigateApp, self).run()
|
||||||
|
|
||||||
# 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"""
|
||||||
|
# pylint: disable=inconsistent-return-statements
|
||||||
if name == "text":
|
if name == "text":
|
||||||
if BMConfigParser().addresses():
|
if BMConfigParser().addresses():
|
||||||
return BMConfigParser().addresses()[0][:16] + '..'
|
return BMConfigParser().addresses()[0][:16] + '..'
|
||||||
|
@ -1649,8 +1668,9 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods
|
||||||
self.refreshScreen()
|
self.refreshScreen()
|
||||||
state.in_search_mode = False
|
state.in_search_mode = False
|
||||||
|
|
||||||
def refreshScreen(self): # pylint: disable=unused-variable
|
def refreshScreen(self):
|
||||||
"""Method show search button only on inbox or sent screen"""
|
"""Method show search button only on inbox or sent screen"""
|
||||||
|
# pylint: disable=unused-variable
|
||||||
state.searcing_text = ''
|
state.searcing_text = ''
|
||||||
if state.search_screen == 'inbox':
|
if state.search_screen == 'inbox':
|
||||||
try:
|
try:
|
||||||
|
@ -1743,9 +1763,10 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods
|
||||||
|
|
||||||
class GrashofPopup(Popup):
|
class GrashofPopup(Popup):
|
||||||
"""Moule for save contacts and error messages"""
|
"""Moule for save contacts and error messages"""
|
||||||
|
|
||||||
valid = False
|
valid = False
|
||||||
|
|
||||||
def __init__(self, **kwargs): # pylint: disable=useless-super-delegation
|
def __init__(self, **kwargs):
|
||||||
"""Grash of pop screen settings"""
|
"""Grash of pop screen settings"""
|
||||||
super(GrashofPopup, self).__init__(**kwargs)
|
super(GrashofPopup, self).__init__(**kwargs)
|
||||||
|
|
||||||
|
@ -1835,9 +1856,13 @@ class GrashofPopup(Popup):
|
||||||
elif status == 'missingbm':
|
elif status == 'missingbm':
|
||||||
text = "The address should start with ''BM-''"
|
text = "The address should start with ''BM-''"
|
||||||
elif status == 'checksumfailed':
|
elif status == 'checksumfailed':
|
||||||
text = "The address is not typed or copied correctly(the checksum failed)."
|
text = (
|
||||||
|
"The address is not typed or copied correctly"
|
||||||
|
" (the checksum failed).")
|
||||||
elif status == 'versiontoohigh':
|
elif status == 'versiontoohigh':
|
||||||
text = "The version number of this address is higher than this software can support. Please upgrade Bitmessage."
|
text = (
|
||||||
|
"The version number of this address is higher than this"
|
||||||
|
" software can support. Please upgrade Bitmessage.")
|
||||||
elif status == 'invalidcharacters':
|
elif status == 'invalidcharacters':
|
||||||
text = "The address contains invalid characters."
|
text = "The address contains invalid characters."
|
||||||
elif status == 'ripetooshort':
|
elif status == 'ripetooshort':
|
||||||
|
@ -1895,6 +1920,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()
|
||||||
|
@ -2042,10 +2068,11 @@ 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): # pylint: disable=useless-super-delegation
|
def __init__(self, **kwargs):
|
||||||
"""My Address Details screen setting"""
|
"""My Address Details screen setting"""
|
||||||
super(MyaddDetailPopup, self).__init__(**kwargs)
|
super(MyaddDetailPopup, self).__init__(**kwargs)
|
||||||
|
|
||||||
|
@ -2074,12 +2101,12 @@ 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()
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
"""Set screen of address detail page"""
|
"""Set screen of address detail page"""
|
||||||
# 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):
|
||||||
|
@ -2154,6 +2181,7 @@ 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()
|
account = StringProperty()
|
||||||
queryreturn = ListProperty()
|
queryreturn = ListProperty()
|
||||||
|
@ -2201,7 +2229,6 @@ class Draft(Screen):
|
||||||
valign='top')
|
valign='top')
|
||||||
self.ids.ml.add_widget(content)
|
self.ids.ml.add_widget(content)
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def draftDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
def draftDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
||||||
"""This methosd is for retrieving draft messages"""
|
"""This methosd is for retrieving draft messages"""
|
||||||
self.queryreturn = kivy_helper_search.search_sql(
|
self.queryreturn = kivy_helper_search.search_sql(
|
||||||
|
@ -2229,8 +2256,7 @@ class Draft(Screen):
|
||||||
'ackdata': mail[5]})
|
'ackdata': mail[5]})
|
||||||
for item in data:
|
for item in data:
|
||||||
meny = TwoLineAvatarIconListItem(
|
meny = TwoLineAvatarIconListItem(
|
||||||
text='Draft',
|
text='Draft', secondary_text=item['text'],
|
||||||
secondary_text=item['text'],
|
|
||||||
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(
|
||||||
|
@ -2286,10 +2312,12 @@ class Draft(Screen):
|
||||||
sqlExecute("DELETE FROM sent WHERE ackdata = ?;", data_index)
|
sqlExecute("DELETE FROM sent WHERE ackdata = ?;", data_index)
|
||||||
try:
|
try:
|
||||||
msg_count_objs = (
|
msg_count_objs = (
|
||||||
self.parent.parent.parent.parent.parent.children[2].children[0].ids)
|
self.parent.parent.parent.parent.parent.children[
|
||||||
|
2].children[0].ids)
|
||||||
except Exception:
|
except Exception:
|
||||||
msg_count_objs = self.parent.parent.parent.parent.parent.parent.children[
|
msg_count_objs = (
|
||||||
2].children[0].ids
|
self.parent.parent.parent.parent.parent.parent.children[
|
||||||
|
2].children[0].ids)
|
||||||
# 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
|
||||||
if int(state.draft_count) > 0:
|
if int(state.draft_count) > 0:
|
||||||
|
@ -2302,7 +2330,7 @@ class Draft(Screen):
|
||||||
toast('Deleted')
|
toast('Deleted')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def draft_msg(src_object): # pylint: disable=too-many-locals
|
def draft_msg(src_object):
|
||||||
"""Save draft mails"""
|
"""Save draft mails"""
|
||||||
composer_object = state.kivyapp.root.ids.sc3.children[1].ids
|
composer_object = state.kivyapp.root.ids.sc3.children[1].ids
|
||||||
fromAddress = str(composer_object.ti.text)
|
fromAddress = str(composer_object.ti.text)
|
||||||
|
@ -2312,7 +2340,6 @@ class Draft(Screen):
|
||||||
encoding = 3
|
encoding = 3
|
||||||
sendMessageToPeople = True
|
sendMessageToPeople = True
|
||||||
if sendMessageToPeople:
|
if sendMessageToPeople:
|
||||||
from addresses import decodeAddress
|
|
||||||
streamNumber, ripe = decodeAddress(toAddress)[2:]
|
streamNumber, ripe = decodeAddress(toAddress)[2:]
|
||||||
from addresses import addBMIfNotPresent
|
from addresses import addBMIfNotPresent
|
||||||
toAddress = addBMIfNotPresent(toAddress)
|
toAddress = addBMIfNotPresent(toAddress)
|
||||||
|
@ -2357,6 +2384,7 @@ 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()
|
||||||
|
@ -2480,18 +2508,21 @@ class Allmails(Screen):
|
||||||
"""Delete inbox mail from all mail listing"""
|
"""Delete inbox mail from all mail listing"""
|
||||||
if folder == 'inbox':
|
if folder == 'inbox':
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
"UPDATE inbox SET folder = 'trash' WHERE msgid = ?;", unique_id)
|
"UPDATE inbox SET folder = 'trash' WHERE msgid = ?;",
|
||||||
|
unique_id)
|
||||||
else:
|
else:
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
"UPDATE sent SET folder = 'trash' WHERE ackdata = ?;", unique_id)
|
"UPDATE sent SET folder = 'trash' WHERE ackdata = ?;",
|
||||||
|
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.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:
|
except Exception:
|
||||||
msg_count_objs = self.parent.parent.parent.parent.parent.parent.children[
|
msg_count_objs = (
|
||||||
2].children[0].ids
|
self.parent.parent.parent.parent.parent.parent.children[
|
||||||
|
2].children[0].ids)
|
||||||
nav_lay_obj = self.parent.parent.parent.parent.parent.parent.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(
|
||||||
|
@ -2517,7 +2548,6 @@ class Allmails(Screen):
|
||||||
nav_lay_obj.sc5.add_widget(Trash())
|
nav_lay_obj.sc5.add_widget(Trash())
|
||||||
nav_lay_obj.sc17.remove_widget(instance.parent.parent)
|
nav_lay_obj.sc17.remove_widget(instance.parent.parent)
|
||||||
|
|
||||||
# pylint: disable=attribute-defined-outside-init
|
|
||||||
def refresh_callback(self, *args):
|
def refresh_callback(self, *args):
|
||||||
"""Method updates the state of application,
|
"""Method updates the state of application,
|
||||||
While the spinner remains on the screen"""
|
While the spinner remains on the screen"""
|
||||||
|
@ -2558,19 +2588,16 @@ def avatarImageFirstLetter(letter_string):
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
|
||||||
|
@ -2589,4 +2616,5 @@ class LoadingPopup(Popup):
|
||||||
|
|
||||||
class AddressDropdown(OneLineIconListItem):
|
class AddressDropdown(OneLineIconListItem):
|
||||||
"""AddressDropdown showns all the addresses"""
|
"""AddressDropdown showns all the addresses"""
|
||||||
|
|
||||||
pass
|
pass
|
Reference in New Issue
Block a user