|
|
|
@ -25,7 +25,8 @@ from kivy.uix.widget import Widget
|
|
|
|
|
from bmconfigparser import BMConfigParser
|
|
|
|
|
from helper_ackPayload import genAckPayload
|
|
|
|
|
from addresses import decodeAddress, addBMIfNotPresent
|
|
|
|
|
from helper_sql import sqlExecute, sqlQuery
|
|
|
|
|
from helper_sql import sqlExecute
|
|
|
|
|
|
|
|
|
|
statusIconColor = 'red'
|
|
|
|
|
avatarlist = os.listdir("images/ngletteravatar")
|
|
|
|
|
global belonging
|
|
|
|
@ -48,10 +49,13 @@ class NavigateApp(App, TextInput):
|
|
|
|
|
belonging = text
|
|
|
|
|
main_widget.ids.sc1.clear_widgets()
|
|
|
|
|
main_widget.ids.sc2.clear_widgets()
|
|
|
|
|
main_widget.ids.sc3.clear_widgets()
|
|
|
|
|
main_widget.ids.sc1.add_widget(Inbox())
|
|
|
|
|
main_widget.ids.sc2.add_widget(Sent())
|
|
|
|
|
main_widget.ids.sc3.add_widget(Trash())
|
|
|
|
|
Inbox()
|
|
|
|
|
Sent()
|
|
|
|
|
Trash()
|
|
|
|
|
|
|
|
|
|
def say_exit(self):
|
|
|
|
|
print("**************************EXITING FROM APPLICATION*****************************")
|
|
|
|
@ -64,6 +68,58 @@ class NavigateApp(App, TextInput):
|
|
|
|
|
elif name == "values":
|
|
|
|
|
return BMConfigParser().addresses()
|
|
|
|
|
|
|
|
|
|
def update_index(self, data_index, index):
|
|
|
|
|
if self.root.ids.scr_mngr.current == 'inbox':
|
|
|
|
|
self.root.ids.sc1.data[data_index]['index'] = index
|
|
|
|
|
elif self.root.ids.scr_mngr.current == 'sent':
|
|
|
|
|
self.root.ids.sc2.data[data_index]['index'] = index
|
|
|
|
|
elif self.root.ids.scr_mngr.current == 'trash':
|
|
|
|
|
self.root.ids.sc3.data[data_index]['index'] = index
|
|
|
|
|
|
|
|
|
|
def delete(self, data_index):
|
|
|
|
|
print("delete {}".format(data_index))
|
|
|
|
|
self._remove(data_index)
|
|
|
|
|
|
|
|
|
|
def archive(self, data_index):
|
|
|
|
|
print("archive {}".format(data_index))
|
|
|
|
|
self._remove(data_index)
|
|
|
|
|
|
|
|
|
|
def _remove(self, data_index):
|
|
|
|
|
if self.root.ids.scr_mngr.current == 'inbox':
|
|
|
|
|
self.root.ids.sc1.data.pop(data_index)
|
|
|
|
|
self.root.ids.sc1.data = [{
|
|
|
|
|
'data_index': i,
|
|
|
|
|
'index': d['index'],
|
|
|
|
|
'height': d['height'],
|
|
|
|
|
'text': d['text']}
|
|
|
|
|
for i, d in enumerate(self.root.ids.sc1.data)
|
|
|
|
|
]
|
|
|
|
|
elif self.root.ids.scr_mngr.current == 'sent':
|
|
|
|
|
self.root.ids.sc2.data.pop(data_index)
|
|
|
|
|
self.root.ids.sc2.data = [{
|
|
|
|
|
'data_index': i,
|
|
|
|
|
'index': d['index'],
|
|
|
|
|
'height': d['height'],
|
|
|
|
|
'text': d['text']}
|
|
|
|
|
for i, d in enumerate(self.root.ids.sc2.data)
|
|
|
|
|
]
|
|
|
|
|
elif self.root.ids.scr_mngr.current == 'trash':
|
|
|
|
|
self.root.ids.sc3.data.pop(data_index)
|
|
|
|
|
self.root.ids.sc3.data = [{
|
|
|
|
|
'data_index': i,
|
|
|
|
|
'index': d['index'],
|
|
|
|
|
'height': d['height'],
|
|
|
|
|
'text': d['text']}
|
|
|
|
|
for i, d in enumerate(self.root.ids.sc3.data)
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
def getInboxMessageDetail(self, instance):
|
|
|
|
|
try:
|
|
|
|
|
self.root.ids.scr_mngr.current = 'page'
|
|
|
|
|
except AttributeError:
|
|
|
|
|
self.parent.manager.current = 'page'
|
|
|
|
|
print('Message Clicked {}'.format(instance))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Navigator(NavigationDrawer):
|
|
|
|
|
image_source = StringProperty('images/qidenticon_two.png')
|
|
|
|
@ -71,6 +127,8 @@ class Navigator(NavigationDrawer):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Inbox(Screen):
|
|
|
|
|
data = ListProperty()
|
|
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
|
super(Inbox, self).__init__(*args, **kwargs)
|
|
|
|
|
global belonging
|
|
|
|
@ -81,62 +139,31 @@ class Inbox(Screen):
|
|
|
|
|
def init_ui(self, dt=0):
|
|
|
|
|
global belonging
|
|
|
|
|
self.orientation = "vertical"
|
|
|
|
|
self.inboxaccounts(self.ids.box_share)
|
|
|
|
|
self.inboxaccounts()
|
|
|
|
|
|
|
|
|
|
def inboxaccounts(self, box_share):
|
|
|
|
|
def inboxaccounts(self):
|
|
|
|
|
account = belonging
|
|
|
|
|
folder = 'inbox'
|
|
|
|
|
self.loadinboxlist(account, folder, box_share, 'All', '')
|
|
|
|
|
self.loadMessagelist(account, folder, 'All', '')
|
|
|
|
|
|
|
|
|
|
def loadinboxlist(self, account, folder, box_share, where="", what="", unreadOnly=False):
|
|
|
|
|
top_logo_share = 1.01
|
|
|
|
|
top_button_share = 1.1
|
|
|
|
|
top_label_share = 1.4
|
|
|
|
|
def loadMessagelist(self, account, folder, where="", what="", unreadOnly=False):
|
|
|
|
|
xAddress = "toaddress"
|
|
|
|
|
|
|
|
|
|
queryreturn = kivy_helper_search.search_sql(xAddress, account, folder, where, what, unreadOnly)
|
|
|
|
|
if queryreturn:
|
|
|
|
|
for row in queryreturn:
|
|
|
|
|
msgfolder, msgid, toAddress, fromAddress, subject, received, read = row
|
|
|
|
|
top_logo_share -= .4
|
|
|
|
|
top_button_share -= .4
|
|
|
|
|
top_label_share -= .4
|
|
|
|
|
logo_share = \
|
|
|
|
|
Image(source='images/ngletteravatar/{}'.format(self.getletterimage(avatarlist, subject)),
|
|
|
|
|
pos_hint={"center_x": .05, "top": top_logo_share},
|
|
|
|
|
size_hint_y=None, height=25)
|
|
|
|
|
button_share = \
|
|
|
|
|
Button(pos_hint={"x": 0, "top": top_button_share},
|
|
|
|
|
size_hint_y=None, height=40, text=subject, multiline=True, background_color=NavigateApp.theme_cls.primary_dark)
|
|
|
|
|
button_share.bind(on_press=self.getInboxMessageDetail)
|
|
|
|
|
fl = FloatLayout(size_hint_y=None, height=25)
|
|
|
|
|
fl.add_widget(button_share)
|
|
|
|
|
fl.add_widget(logo_share)
|
|
|
|
|
box_share.add_widget(fl)
|
|
|
|
|
self.data = [{
|
|
|
|
|
'data_index': i,
|
|
|
|
|
'index': 1,
|
|
|
|
|
'height': 48,
|
|
|
|
|
'text': row[4]}
|
|
|
|
|
for i, row in enumerate(queryreturn)
|
|
|
|
|
]
|
|
|
|
|
else:
|
|
|
|
|
label_share = \
|
|
|
|
|
Label(text="yet you dont have any emails received", pos_hint={"x": 0, "top": top_label_share},
|
|
|
|
|
size_hint_y=None)
|
|
|
|
|
box_share.add_widget(label_share)
|
|
|
|
|
|
|
|
|
|
def getletterimage(self, ran, subject):
|
|
|
|
|
limit = 5
|
|
|
|
|
for x in subject[:limit]:
|
|
|
|
|
if '{}.png'.format(x.lower()) in ran:
|
|
|
|
|
return '{}.png'.format(x.lower())
|
|
|
|
|
elif '{}.jpg'.format(x.lower()) in ran:
|
|
|
|
|
return '{}.jpg'.format(x.lower())
|
|
|
|
|
if x == limit:
|
|
|
|
|
random.shuffle(ran)
|
|
|
|
|
return ran[0]
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
def getInboxMessageDetail(self, instance):
|
|
|
|
|
try:
|
|
|
|
|
self.manager.current = 'page'
|
|
|
|
|
except AttributeError:
|
|
|
|
|
self.parent.manager.current = 'page'
|
|
|
|
|
print('I am {}'.format(instance.text))
|
|
|
|
|
self.data = [{
|
|
|
|
|
'data_index': 1,
|
|
|
|
|
'index': 1,
|
|
|
|
|
'height': 48,
|
|
|
|
|
'text': "yet no message for this account!!!!!!!!!!!!!"}
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Page(Screen):
|
|
|
|
@ -148,6 +175,8 @@ class AddressSuccessful(Screen):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Sent(Screen):
|
|
|
|
|
data = ListProperty()
|
|
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
|
super(Sent, self).__init__(*args, **kwargs)
|
|
|
|
|
global belonging
|
|
|
|
@ -158,54 +187,31 @@ class Sent(Screen):
|
|
|
|
|
def init_ui(self, dt=0):
|
|
|
|
|
global belonging
|
|
|
|
|
self.orientation = "vertical"
|
|
|
|
|
self.sentaccounts(self.ids.box_share)
|
|
|
|
|
self.sentaccounts()
|
|
|
|
|
|
|
|
|
|
def sentaccounts(self, box_share):
|
|
|
|
|
def sentaccounts(self):
|
|
|
|
|
account = belonging
|
|
|
|
|
folder = 'inbox'
|
|
|
|
|
self.loadSent(account, box_share, 'All', '')
|
|
|
|
|
self.loadSent(account, 'All', '')
|
|
|
|
|
|
|
|
|
|
def loadSent(self, account, box_share, where="", what=""):
|
|
|
|
|
top_logo_share = 1.01
|
|
|
|
|
top_button_share = 1.1
|
|
|
|
|
top_label_share = 1.4
|
|
|
|
|
def loadSent(self, account, where="", what=""):
|
|
|
|
|
xAddress = 'fromaddress'
|
|
|
|
|
queryreturn = kivy_helper_search.search_sql(xAddress, account, "sent", where, what, False)
|
|
|
|
|
if queryreturn:
|
|
|
|
|
for row in queryreturn:
|
|
|
|
|
toAddress, fromAddress, subject, status, ackdata, lastactiontime = row
|
|
|
|
|
top_logo_share -= .4
|
|
|
|
|
top_button_share -= .4
|
|
|
|
|
top_label_share -= .4
|
|
|
|
|
logo_share = \
|
|
|
|
|
Image(source='images/ngletteravatar/{}'.format(self.getletterimage(avatarlist, subject)),
|
|
|
|
|
pos_hint={"center_x": .05, "top": top_logo_share},
|
|
|
|
|
size_hint_y=None, height=25)
|
|
|
|
|
button_share = \
|
|
|
|
|
Button(pos_hint={"x": 0, "top": top_button_share},
|
|
|
|
|
size_hint_y=None, height=40, text=subject, multiline=True, background_color=NavigateApp.theme_cls.primary_dark)
|
|
|
|
|
button_share.bind(on_press=self.getSentMessageDetail)
|
|
|
|
|
fl = FloatLayout(size_hint_y=None, height=25)
|
|
|
|
|
fl.add_widget(button_share)
|
|
|
|
|
fl.add_widget(logo_share)
|
|
|
|
|
box_share.add_widget(fl)
|
|
|
|
|
self.data = [{
|
|
|
|
|
'data_index': i,
|
|
|
|
|
'index': 1,
|
|
|
|
|
'height': 48,
|
|
|
|
|
'text': row[2]}
|
|
|
|
|
for i, row in enumerate(queryreturn)
|
|
|
|
|
]
|
|
|
|
|
else:
|
|
|
|
|
label_share = \
|
|
|
|
|
Label(text="yet you dont have any emails received", pos_hint={"x": 0, "top": top_label_share},
|
|
|
|
|
size_hint_y=None)
|
|
|
|
|
box_share.add_widget(label_share)
|
|
|
|
|
|
|
|
|
|
def getletterimage(self, ran, subject):
|
|
|
|
|
limit = 5
|
|
|
|
|
for x in subject[:limit]:
|
|
|
|
|
if '{}.png'.format(x.lower()) in ran:
|
|
|
|
|
return '{}.png'.format(x.lower())
|
|
|
|
|
elif '{}.jpg'.format(x.lower()) in ran:
|
|
|
|
|
return '{}.jpg'.format(x.lower())
|
|
|
|
|
if x == limit:
|
|
|
|
|
random.shuffle(ran)
|
|
|
|
|
return ran[0]
|
|
|
|
|
break
|
|
|
|
|
self.data = [{
|
|
|
|
|
'data_index': 1,
|
|
|
|
|
'index': 1,
|
|
|
|
|
'height': 48,
|
|
|
|
|
'text': "yet no message for this account!!!!!!!!!!!!!"}
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
def getSentMessageDetail(self, instance):
|
|
|
|
|
try:
|
|
|
|
@ -216,16 +222,43 @@ class Sent(Screen):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Trash(Screen):
|
|
|
|
|
def __init__(self, **kwargs):
|
|
|
|
|
super(Trash, self).__init__(**kwargs)
|
|
|
|
|
val_y = .1
|
|
|
|
|
val_z = 0
|
|
|
|
|
my_box1 = BoxLayout(orientation='vertical')
|
|
|
|
|
for i in range(1, 5):
|
|
|
|
|
my_box1.add_widget(Label(text="I am in trash", size_hint=(.3, .1), pos_hint={
|
|
|
|
|
'x': val_z, 'top': val_y}, color=(0, 0, 0, 1), background_color=(0, 0, 0, 0)))
|
|
|
|
|
val_y += .1
|
|
|
|
|
self.add_widget(my_box1)
|
|
|
|
|
data = ListProperty()
|
|
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
|
super(Trash, self).__init__(*args, **kwargs)
|
|
|
|
|
global belonging
|
|
|
|
|
if belonging == '':
|
|
|
|
|
belonging = Navigator().ids.btn.text
|
|
|
|
|
Clock.schedule_once(self.init_ui, 0)
|
|
|
|
|
|
|
|
|
|
def init_ui(self, dt=0):
|
|
|
|
|
global belonging
|
|
|
|
|
self.orientation = "vertical"
|
|
|
|
|
self.inboxaccounts()
|
|
|
|
|
|
|
|
|
|
def inboxaccounts(self):
|
|
|
|
|
account = belonging
|
|
|
|
|
folder = 'trash'
|
|
|
|
|
self.loadTrashlist(account, folder, 'All', '')
|
|
|
|
|
|
|
|
|
|
def loadTrashlist(self, account, folder, where="", what="", unreadOnly=False):
|
|
|
|
|
xAddress = "toaddress"
|
|
|
|
|
queryreturn = kivy_helper_search.search_sql(xAddress, account, folder, where, what, unreadOnly)
|
|
|
|
|
if queryreturn:
|
|
|
|
|
self.data = [{
|
|
|
|
|
'data_index': i,
|
|
|
|
|
'index': 1,
|
|
|
|
|
'height': 48,
|
|
|
|
|
'text': row[4]}
|
|
|
|
|
for i, row in enumerate(queryreturn)
|
|
|
|
|
]
|
|
|
|
|
else:
|
|
|
|
|
self.data = [{
|
|
|
|
|
'data_index': 1,
|
|
|
|
|
'index': 1,
|
|
|
|
|
'height': 48,
|
|
|
|
|
'text': "yet no message for this account!!!!!!!!!!!!!"}
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Dialog(Screen):
|
|
|
|
@ -309,6 +342,7 @@ class Create(Screen):
|
|
|
|
|
class NewIdentity(Screen):
|
|
|
|
|
is_active = BooleanProperty(False)
|
|
|
|
|
checked = StringProperty("")
|
|
|
|
|
# self.manager.parent.ids.create.children[0].source = 'images/plus-4-xxl.png'
|
|
|
|
|
|
|
|
|
|
def generateaddress(self):
|
|
|
|
|
if self.checked == 'use a random number generator to make an address':
|
|
|
|
|