Browse Source

Loadmessage list feature with current account get and ngletters images icon

python3android
surbhi 4 years ago
parent
commit
c163001ee8
No known key found for this signature in database GPG Key ID: 88928762974D3618
  1. 41
      src/bitmessagekivy/kivy_helper_search.py
  2. 8
      src/bitmessagekivy/main.kv
  3. 76
      src/bitmessagekivy/mpybit.py
  4. BIN
      src/images/ngletteravatar/16.png
  5. BIN
      src/images/ngletteravatar/Galleryr_rcirclelogo_Small.jpg
  6. BIN
      src/images/ngletteravatar/i.png
  7. 0
      src/images/ngletteravatar/t.jpg
  8. BIN
      src/images/ngletteravatar/t.png
  9. BIN
      src/images/ngletteravatar/x.jpg

41
src/bitmessagekivy/kivy_helper_search.py

@ -0,0 +1,41 @@
from helper_sql import *
def search_sql(xAddress = "toaddress", account = None, folder = "inbox", where = None, what = None, unreadOnly = False):
if what is not None and what != "":
what = "%" + what + "%"
else:
what = None
sqlStatementBase = '''SELECT folder, msgid, toaddress, fromaddress, subject, received, read
FROM inbox '''
sqlStatementParts = []
sqlArguments = []
if account is not None:
if xAddress == 'both':
sqlStatementParts.append("(fromaddress = ? OR toaddress = ?)")
sqlArguments.append(account)
sqlArguments.append(account)
else:
sqlStatementParts.append(xAddress + " = ? ")
sqlArguments.append(account)
if folder is not None:
if folder == "new":
folder = "inbox"
unreadOnly = True
sqlStatementParts.append("folder = ? ")
sqlArguments.append(folder)
else:
sqlStatementParts.append("folder != ?")
sqlArguments.append("trash")
if what is not None:
sqlStatementParts.append("%s LIKE ?" % (where))
sqlArguments.append(what)
if unreadOnly:
sqlStatementParts.append("read = 0")
if len(sqlStatementParts) > 0:
sqlStatementBase += "WHERE " + " AND ".join(sqlStatementParts)
if folder == "sent":
sqlStatementBase += " ORDER BY lastactiontime"
return sqlQuery(sqlStatementBase, sqlArguments)

8
src/bitmessagekivy/main.kv

@ -10,8 +10,8 @@
pos_hint:{"x":0,"y":.3}
id: btn
background_color: app.theme_cls.primary_dark
text: '<address>'
values: app.showmeaddresses()
text: app.showmeaddresses(name='text')
values: app.showmeaddresses(name='values')
NavigationDrawerIconButton:
icon: 'email-open'
@ -148,8 +148,8 @@ BoxLayout:
pos_hint: {"x":0,"top":1.}
pos: 10,10
id: spinner_id
text: '<select>'
values: app.showmeaddresses()
text: app.showmeaddresses(name='text')
values: app.showmeaddresses(name='values')
BoxLayout:
size_hint_y: None

76
src/bitmessagekivy/mpybit.py

@ -1,4 +1,5 @@
import os
import kivy_helper_search
import queues
import random
import shutdown
@ -24,7 +25,7 @@ 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
from helper_sql import sqlExecute, sqlQuery
statusIconColor = 'red'
avatarlist = os.listdir("images/ngletteravatar")
@ -39,13 +40,19 @@ class NavigateApp(App, TextInput):
self.nav_drawer = Navigator()
return main_widget
# def setCurrentAccount(self, text):
# self.ids.btn.text = text
def say_exit(self):
print("**************************EXITING FROM APPLICATION*****************************")
App.get_running_app().stop()
shutdown.doCleanShutdown()
def showmeaddresses(self):
return BMConfigParser().addresses()
def showmeaddresses(self, name="text"):
if name == "text":
return BMConfigParser().addresses()[0]
elif name == "values":
return BMConfigParser().addresses()
class Navigator(NavigationDrawer):
@ -64,33 +71,52 @@ class Inbox(Screen):
self.create_button(self.ids.box_share)
def create_button(self, box_share):
account = Navigator().ids.btn.text
folder = 'inbox'
self.loadMessagelist(account, folder, box_share, 'All', '')
def loadMessagelist(self, account, folder, box_share, where="", what="", unreadOnly=False):
top_logo_share = 1.01
top_button_share = 1.1
top_label_share = 1.4
for i in range(50):
top_logo_share -= .4
top_button_share -= .4
top_label_share -= .4
logo_share = \
Image(source='images/ngletteravatar/{}'.format(self.list_random(avatarlist)),
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='email_{}'.format(i), background_color=NavigateApp.theme_cls.primary_dark)
button_share.bind(on_press=self.change_screen)
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.list_random(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.change_screen)
fl = FloatLayout(size_hint_y=None, height=25)
fl.add_widget(button_share)
fl.add_widget(logo_share)
box_share.add_widget(fl)
else:
label_share = \
Label(text=str(i), pos_hint={"x": 0, "top": top_label_share},
Label(text="yet you dont have any emails received", pos_hint={"x": 0, "top": top_label_share},
size_hint_y=None)
fl = FloatLayout(size_hint_y=None, height=25)
fl.add_widget(button_share)
fl.add_widget(logo_share)
fl.add_widget(label_share)
box_share.add_widget(fl)
def list_random(self, ran):
random.shuffle(ran)
return ran[0]
box_share.add_widget(label_share)
def list_random(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 change_screen(self, instance):
self.manager.current = 'page'

BIN
src/images/ngletteravatar/16.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 483 B

BIN
src/images/ngletteravatar/Galleryr_rcirclelogo_Small.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
src/images/ngletteravatar/i.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 397 B

After

Width:  |  Height:  |  Size: 483 B

0
src/images/ngletteravatar/2.jpg → src/images/ngletteravatar/t.jpg

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
src/images/ngletteravatar/t.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 449 B

BIN
src/images/ngletteravatar/x.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Loading…
Cancel
Save