Fix code quality checks and refactor with Inbox loading

This commit is contained in:
surbhi 2019-05-13 17:01:33 +05:30
parent ed6cd83cae
commit 5db1c3971c
No known key found for this signature in database
GPG Key ID: 88928762974D3618
3 changed files with 116 additions and 220 deletions

View File

@ -12,7 +12,7 @@ def search_sql(xAddress="toaddress", account=None, folder="inbox", where=None, w
SELECT toaddress, fromaddress, subject, message, status, ackdata, lastactiontime SELECT toaddress, fromaddress, subject, message, status, ackdata, lastactiontime
FROM sent ''' FROM sent '''
else: else:
sqlStatementBase = '''SELECT folder, msgid, toaddress, fromaddress, subject, received, read sqlStatementBase = '''SELECT folder, msgid, toaddress, message, fromaddress, subject, received, read
FROM inbox ''' FROM inbox '''
sqlStatementParts = [] sqlStatementParts = []
sqlArguments = [] sqlArguments = []

View File

@ -266,12 +266,14 @@ NavigationLayout:
spacing: 15 spacing: 15
BoxLayout: BoxLayout:
orientation: 'vertical' orientation: 'vertical'
TextInput: MDTextField:
id: ti id: ti
hint_text: 'type or select sender address' hint_text: 'type or select sender address'
size_hint_y: None size_hint_y: None
height: 100 height: 100
multiline: False multiline: False
required: True
helper_text_mode: "on_error"
BoxLayout: BoxLayout:
size_hint_y: None size_hint_y: None
@ -288,7 +290,7 @@ NavigationLayout:
txt_input: txt_input txt_input: txt_input
rv: rv rv: rv
size : (890, 60) size : (890, 60)
size_hint: 1,2 size_hint: 1,1
MyTextInput: MyTextInput:
id: txt_input id: txt_input
size_hint_y: None size_hint_y: None
@ -296,29 +298,32 @@ NavigationLayout:
hint_text: 'type or search recipients address starting with BM-' hint_text: 'type or search recipients address starting with BM-'
RV: RV:
id: rv id: rv
TextInput: MDTextField:
id: subject id: subject
hint_text: 'subject' hint_text: 'subject'
size_hint_y: None required: True
height: 100 height: 100
size_hint_y: None
multiline: False multiline: False
TextInput: helper_text_mode: "on_error"
MDTextField:
id: body id: body
multiline: True
hint_text: 'body' hint_text: 'body'
size_hint_y: None size_hint_y: None
height: 100 required: True
multiline:True helper_text_mode: "on_error"
size_hint: 1,2
BoxLayout: BoxLayout:
AnchorLayout: AnchorLayout:
MDRaisedButton: MDRaisedButton:
size_hint: .8, .6 size_hint: .8, .3
text: 'send' text: 'send'
on_press: root.send() on_press: root.send()
BoxLayout: BoxLayout:
AnchorLayout: AnchorLayout:
MDRaisedButton: MDRaisedButton:
size_hint: .8, .6 size_hint: .8, .3
text: 'reset' text: 'reset'
on_press: app.root.ids.scr_mngr.current = 'random' on_press: app.root.ids.scr_mngr.current = 'random'
@ -441,7 +446,8 @@ NavigationLayout:
multiline: True multiline: True
hint_text: "Label" hint_text: "Label"
helper_text: "Label (not shown to anyone except you)" helper_text: "Label (not shown to anyone except you)"
helper_text_mode: "persistent" required: True
helper_text_mode: "on_error"
MDRaisedButton: MDRaisedButton:
text: 'next' text: 'next'
size_hint_y: 0.13 size_hint_y: 0.13

View File

@ -49,42 +49,55 @@ from kivy.core.window import Window
userAddress = '' userAddress = ''
class Navigatorss(MDNavigationDrawer): class Navigatorss(MDNavigationDrawer):
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()
# print("priiiiiiiiiiiiinnnnnnnnnnnnnnnnnnnnnttttttttttthethingsss.................", )
class Inbox(Screen): class Inbox(Screen):
"""Inbox Screen uses screen to show widgets of screens.""" """Inbox Screen uses screen to show widgets of screens."""
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(Inbox, self).__init__(*args, **kwargs) super(Inbox, self).__init__(*args, **kwargs)
# if state.association == '': if state.association == '':
# state.association = 'BM-2cTuPpAPbu44sbkfVJN2F99sXGJoeNpDBh' if BMConfigParser().addresses():
# print(self.get_address_via_split(state.association)) state.association = BMConfigParser().addresses()[0]
Clock.schedule_once(self.init_ui, 0) Clock.schedule_once(self.init_ui, 0)
def init_ui(self, dt=0): def init_ui(self, dt=0):
"""Clock Schdule for method inbox accounts.""" """Clock Schdule for method sent accounts."""
print("generateaddressgenerateaddressgenerateaddressgenerateaddressgenerateaddress", BMConfigParser().addresses()) self.inboxaccounts()
if BMConfigParser().addresses(): print(dt)
data = [{'text': "surbhi cis222222", 'secondary_text': "party invitation..........." + '\n' + " " + "lets gather for party on 1st JANUARY...!"},
{'text': "peter surda", 'secondary_text': "party invitation..........." + '\n' + " " + "lets gather for party on 1st JANUARY...!"}, def inboxaccounts(self):
{'text': "uber", 'secondary_text': "party invitation..........." + '\n' + " " + "lets gather for party on 1st JANUARY...!"}, """Load inbox accounts."""
{'text': "ola", 'secondary_text': "party invitation..........." + '\n' + " " + "lets gather for party on 1st JANUARY...!"}, account = state.association
{'text': "glitch", 'secondary_text': "party invitation..........." + '\n' + " " + "lets gather for party on 1st JANUARY...!"}, self.loadMessagelist(account, 'All', '')
{'text': "github", 'secondary_text': "party invitation..........." + '\n' + " " + "lets gather for party on 1st JANUARY...!"},
{'text': "amazon", 'secondary_text': "party invitation..........." + '\n' + " " + "lets gather for party on 1st JANUARY...!"}, def loadMessagelist(self, account, where="", what=""):
{'text': "onkar", 'secondary_text': "party invitation..........." + '\n' + " " + "lets gather for party on 1st JANUARY...!"}, """Load Sent list for Sent messages."""
{'text': "kivy", 'secondary_text': "party invitation..........." + '\n' + " " + "lets gather for party on 1st JANUARY...!"}, xAddress = 'toaddress'
{'text': "andrew", 'secondary_text': "party invitation..........." + '\n' + " " + "lets gather for party on 1st JANUARY...!"}] data = []
queryreturn = kivy_helper_search.search_sql(
xAddress, account, "inbox", where, what, False)
if queryreturn:
for mail in queryreturn:
third_text = mail[3].replace('\n', ' ')
data.append({'text': mail[2].strip(), 'secondary_text': mail[5][:10] + '...........' if len(mail[2]) > 10 else mail[2] + '\n' + " " + (third_text[:25] + '...!') if len(third_text) > 25 else third_text })
for item in data: for item in data:
meny = ThreeLineAvatarIconListItem(text=item['text'], secondary_text=item['secondary_text'], theme_text_color= 'Custom',text_color=NavigateApp().theme_cls.primary_color) meny = ThreeLineAvatarIconListItem(text=item['text'], secondary_text=item['secondary_text'], theme_text_color= 'Custom', text_color=NavigateApp().theme_cls.primary_color)
meny.add_widget(AvatarSampleWidget(source='./images/kivymd_logo.png')) meny.add_widget(AvatarSampleWidget(source='./images/avatar.png'))
self.ids.ml.add_widget(meny) self.ids.ml.add_widget(meny)
else: else:
self.manager.current = 'login' content = MDLabel(font_style='Body1',
theme_text_color='Primary',
text="yet no message for this account!!!!!!!!!!!!!",
halign='center',
bold=True,
size_hint_y=None,
valign='top')
self.ids.ml.add_widget(content)
class MyAddress(Screen): class MyAddress(Screen):
@ -95,25 +108,23 @@ class MyAddress(Screen):
def init_ui(self, dt=0): def init_ui(self, dt=0):
"""Clock Schdule for method inbox accounts.""" """Clock Schdule for method inbox accounts."""
pass if BMConfigParser().addresses():
# if BMConfigParser().AddressSuccessful(): data = []
# data = [{'text': "me", 'secondary_text': "BM-2cWyUfBdY2FbgyuCb7abFZ49JYxSzUhNFe"}, for address in BMConfigParser().addresses():
# {'text': "me", 'secondary_text': "BM-2cWyTfBdY2FbgyuCb7abFZ49JYxSzUhNFe"}, data.append({'text': BMConfigParser().get(address, 'label'), 'secondary_text': address})
# {'text': "me", 'secondary_text': "BM-2cWyVfBdY2FbgyuCb7abFZ49JYxSzUhNFe"}, for item in data:
# {'text': "me", 'secondary_text': "BM-2cWySfBdY2FbgyuCb7abFZ49JYxSzUhNFe"}, meny = TwoLineAvatarIconListItem(text=item['text'], secondary_text=item['secondary_text'], theme_text_color= 'Custom',text_color=NavigateApp().theme_cls.primary_color)
# {'text': "me", 'secondary_text': "BM-2cWyHfBdY2FbgyuCb7abFZ49JYxSzUhNFe"}, meny.add_widget(AvatarSampleWidget(source='./images/avatar.png'))
# {'text': "me", 'secondary_text': "BM-2cWyJfBdY2FbgyuCb7abFZ49JYxSzUhNFe"}, self.ids.ml.add_widget(meny)
# {'text': "me", 'secondary_text': "BM-2cWyKfBdY2FbgyuCb7abFZ49JYxSzUhNFe"}, else:
# {'text': "me", 'secondary_text': "BM-2cWyMnBdY2FbgyuCb7abFZ49JYxSzUhNFe"}, content = MDLabel(font_style='Body1',
# {'text': "me", 'secondary_text': "BM-2cWyOkBdY2FbgyuCb7abFZ49JYxSzUhNFe"}, theme_text_color='Primary',
# {'text': "me", 'secondary_text': "BM-2cWyWuBdY2FbgyuCb7abFZ49JYxSzUhNFe"}] text="yet no address is created by user!!!!!!!!!!!!!",
# for item in data: halign='center',
# meny = TwoLineAvatarIconListItem(text=item['text'], secondary_text=item['secondary_text'], theme_text_color= 'Custom',text_color=NavigateApp().theme_cls.primary_color) bold=True,
# meny.add_widget(AvatarSampleWidget(source='./images/avatar.png')) size_hint_y=None,
# self.ids.ml.add_widget(meny) valign='top')
# else: self.ids.ml.add_widget(content)
# self.manager.current = 'login'
class AddressBook(Screen): class AddressBook(Screen):
@ -124,7 +135,6 @@ class AddressBook(Screen):
def init_ui(self, dt=0): def init_ui(self, dt=0):
"""Clock Schdule for method inbox accounts.""" """Clock Schdule for method inbox accounts."""
# sqlExecute("DELETE FROM addressbook WHERE label='' ")
data = sqlQuery("SELECT label, address from addressbook") data = sqlQuery("SELECT label, address from addressbook")
if data: if data:
for item in data: for item in data:
@ -140,16 +150,16 @@ class AddressBook(Screen):
size_hint_y=None, size_hint_y=None,
valign='top') valign='top')
self.ids.ml.add_widget(content) self.ids.ml.add_widget(content)
print("chek iniiiiiiiiiiiiiittttttttttttttttttttttttttttttttt", self)
# self.ids.ml.clear_widgets()
def refreshs(self, *args): def refreshs(self, *args):
state.navinstance.ids.sc11.clear_widgets() state.navinstance.ids.sc11.clear_widgets()
state.navinstance.ids.sc11.add_widget(AddressBook()) state.navinstance.ids.sc11.add_widget(AddressBook())
class SelectableRecycleBoxLayout(FocusBehavior, LayoutSelectionBehavior, class SelectableRecycleBoxLayout(FocusBehavior, LayoutSelectionBehavior,
RecycleBoxLayout): RecycleBoxLayout):
''' Adds selection and focus behaviour to the view. ''' ''' Adds selection and focus behaviour to the view. '''
pass
class SelectableLabel(RecycleDataViewBehavior, Label): class SelectableLabel(RecycleDataViewBehavior, Label):
@ -191,51 +201,32 @@ class DropDownWidget(BoxLayout):
def send(self): def send(self):
"""Send message from one address to another.""" """Send message from one address to another."""
fromAddress = str(self.ids.ti.text) fromAddress = str(self.ids.ti.text)
# For now we are using static address i.e we are not using recipent field value.
# toAddress = str(self.ids.txt_input.text)
# print("hiiiiiiiiiiiiiiiiii i am hereeeeeeeeeeeeeeeeeeeeee..............")
# print("hiiiiiiiiiseeeee to addresssssssssss..........................", self.ids)
# print("ssssssssssseeeeeeeeeeeeeeeeeeetheeeeeeeeeeetexttinput....data...", self.ids.txt_input.text)
# toAddress = "BM-2cVJ8Bb9CM5XTEjZK1CZ9pFhm7jNA1rsa6"
# print("every thng is good for the day..................", str(self.ids.txt_input.text))
toAddress = str(self.ids.txt_input.text) toAddress = str(self.ids.txt_input.text)
print("alllllllllllllllllllllllllllsss wel ends wellllllllllllllll", )
subject = str(self.ids.subject.text) subject = str(self.ids.subject.text)
message = str(self.ids.body.text) message = str(self.ids.body.text)
print("RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR")
encoding = 3 encoding = 3
print("message: ", self.ids.body.text) print("message: ", self.ids.body.text)
sendMessageToPeople = True sendMessageToPeople = True
print("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS")
if sendMessageToPeople: if sendMessageToPeople:
print("TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT") if toAddress != '' and subject and message:
print("did_addresssssssssssssssss_existsssssssssssssssssssss.........buyyyyy", toAddress)
if toAddress != '':
print("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU")
from addresses import decodeAddress from addresses import decodeAddress
status, addressVersionNumber, streamNumber, ripe = decodeAddress( status, addressVersionNumber, streamNumber, ripe = decodeAddress(
toAddress) toAddress)
print("VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV")
if status == 'success': if status == 'success':
from addresses import * from addresses import *
toAddress = addBMIfNotPresent(toAddress) toAddress = addBMIfNotPresent(toAddress)
statusIconColor = 'red' statusIconColor = 'red'
print("WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW")
if addressVersionNumber > 4 or addressVersionNumber <= 1: if addressVersionNumber > 4 or 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':
print("shared.statusIconColor == 'red'") print("shared.statusIconColor == 'red'")
print("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
stealthLevel = BMConfigParser().safeGetInt( stealthLevel = BMConfigParser().safeGetInt(
'bitmessagesettings', 'ackstealthlevel') 'bitmessagesettings', 'ackstealthlevel')
print("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
from helper_ackPayload import genAckPayload from helper_ackPayload import genAckPayload
ackdata = genAckPayload(streamNumber, stealthLevel) ackdata = genAckPayload(streamNumber, stealthLevel)
print("YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY")
t = () t = ()
print("ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ")
sqlExecute( sqlExecute(
'''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''', '''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''',
'', '',
@ -253,26 +244,38 @@ class DropDownWidget(BoxLayout):
'sent', 'sent',
encoding, encoding,
BMConfigParser().getint('bitmessagesettings', 'ttl')) BMConfigParser().getint('bitmessagesettings', 'ttl'))
print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
self.parent.parent.screens[3].clear_widgets() self.parent.parent.screens[3].clear_widgets()
self.parent.parent.screens[3].add_widget(Sent()) self.parent.parent.screens[3].add_widget(Sent())
toLabel = '' toLabel = ''
queues.workerQueue.put(('sendmessage', toAddress)) queues.workerQueue.put(('sendmessage', toAddress))
print("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB")
print("DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD")
print("sqlExecute successfully #######################") print("sqlExecute successfully #######################")
self.ids.body.text = '' self.ids.body.text = ''
self.ids.ti.text = '' self.ids.ti.text = ''
self.ids.subject.text = '' self.ids.subject.text = ''
self.ids.txt_input.text = '' self.ids.txt_input.text = ''
# self.manager.current
# self.ids.scr_mngr.current = 'add_sucess'
self.parent.parent.current = 'sent' self.parent.parent.current = 'sent'
# print("whattttttttttttttttisdebuggerbtnssssssssss........................", self.ids)
self.ids.btn.text = 'select' self.ids.btn.text = 'select'
self.ids.ti.text = '' self.ids.ti.text = ''
print("sssssssssssuvvvvvvvvvvvvvvvvvtttttttttttttttttt...............")
return None return None
else:
msg = 'Enter a valid recipients address'
self.address_error_message(msg)
elif not toAddress:
msg = 'Enter a recipients address'
self.address_error_message(msg)
def address_error_message(self, msg):
self.box = FloatLayout()
self.lab = (Label(text=msg, font_size=25,
size_hint=(None, None), pos_hint={'x': .25, 'y': .6}))
self.box.add_widget(self.lab)
self.but = (Button(text="dismiss", size_hint=(None, None),
width=200, height=50, pos_hint={'x': .3, 'y': 0}))
self.box.add_widget(self.but)
self.main_pop = Popup(title="Error", content=self.box,
size_hint=(None, None), size=(550, 400), auto_dismiss=False, title_size=30)
self.but.bind(on_press=self.main_pop.dismiss)
self.main_pop.open()
class MyTextInput(TextInput): class MyTextInput(TextInput):
@ -297,7 +300,7 @@ class MyTextInput(TextInput):
self.parent.parent.parent.parent.ids.rv.data = display_data self.parent.parent.parent.parent.ids.rv.data = display_data
# ensure the size is okay # ensure the size is okay
if len(matches) <= 10: if len(matches) <= 10:
self.parent.height = (250 + (len(matches)*20)) self.parent.height = (250 + (len(matches) * 20))
else: else:
self.parent.height = 400 self.parent.height = 400
@ -311,6 +314,7 @@ class MyTextInput(TextInput):
class Payment(Screen): class Payment(Screen):
pass pass
class Login(Screen): class Login(Screen):
pass pass
@ -355,6 +359,7 @@ class Random(Screen):
eighteenByteRipe = False eighteenByteRipe = False
nonceTrialsPerByte = 1000 nonceTrialsPerByte = 1000
payloadLengthExtraBytes = 1000 payloadLengthExtraBytes = 1000
if self.ids.label.text:
queues.addressGeneratorQueue.put(( queues.addressGeneratorQueue.put((
'createRandomAddress', 'createRandomAddress',
4, streamNumberForAddress, 4, streamNumberForAddress,
@ -363,31 +368,7 @@ class Random(Screen):
payloadLengthExtraBytes) payloadLengthExtraBytes)
) )
self.manager.current = 'add_sucess' self.manager.current = 'add_sucess'
print("whhhheeeeeeee55566666666666666666666..................", self)
print("what is the screeen forrrrrrrrrrrrrrrrr...............", self.ids)
self.ids.label.text = '' self.ids.label.text = ''
# print("whatttttt99999999999999999999999999999999999988888888......", self.parent.parent)
# print("go.....more...parenxccccccccccccccccccccccc555559955555555555", self.parent.parent.parent)
# print("ssssshooooocxvxcvxcvoooouuuuuuuuuuuuuuuuuueeeettttttttteeeeeeeeeee............... ", ContentNavigationDrawer().ids.btn)
# print("spiiiiinnnxcvxcxc99999999999999999999999999999999999999tttt..........", ContentNavigationDrawer().ids.btn.text)
# print("text_dirrrrrrrrrrrrrrrrrrrrrr9999999999999999fgdg.............................", dir(ContentNavigationDrawer().ids.btn))
# print("ttttttttttttttiiiiiiiiilllllllllllllllttttleeeeeeeee9999999999999999999", ContentNavigationDrawer().ids.btn.text)
# prnit("55555557777777777777777888888888888888888jjjjjjjjjj", ContentNavigationDrawer().ids.btn.text)
# print("what account is associated..............................", state.association)
# print("pppppppppp999999999666666666663333333333333333333333..............", BMConfigParser().addresses())
# print("whatssssssssssssssssssssssstheva,lllllllllllleeeeeeeee...........")
# print("wh.....................8888888899999999999999999999999999", queues.addressGeneratorQueue.get())
# print("ljjkkkkkkkkkkkkkkkkkkk666666666666666666666666666666666", self.parent.parent.parent.parent.parent)
# ContentNavigationDrawer().ids.btn.text = BMConfigParser().addresses()[0]
# if BMConfigParser().addresses():
# print("iiiinnnnnnnnnnnnnnnnnnnnnnnnnnsssssssssssiiiiiiiiiideeeeeeeee")
# ContentNavigationDrawer().ids.btn.text = BMConfigParser().addresses()[0]
# return BMConfigParser().addresses()[0]
# print("iiiiiiiiiiiiiihhhhhhhhhhhhhhhhh5555555555555555555....", ContentNavigationDrawer())
# print("khhhhhhhhhhhhhyaaaaaaaaaaaaaaaa5555555555555555...............", ContentNavigationDrawer().ids)
# print("it is sccccccccccccefssssfulllllll............................", ContentNavigationDrawer().ids.btn.text)
# ids.btn.text
class AddressSuccessful(Screen): class AddressSuccessful(Screen):
@ -397,81 +378,43 @@ class AddressSuccessful(Screen):
class NavigationLayout(): class NavigationLayout():
pass pass
class Sent(Screen): class Sent(Screen):
"""Sent Screen uses screen to show widgets of screens.""" """Sent Screen uses screen to show widgets of screens."""
data = ListProperty() data = ListProperty()
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(Sent, self).__init__(*args, **kwargs) super(Sent, self).__init__(*args, **kwargs)
# print("I amuuuuuupfatgd vale should get..................... .", ContentNavigationDrawer().ids.btn.text)
# print("yyyyyyuuuuuuuuuuuuuuuuuoooooooooouuuyyyyyyyyyyyy...............", ContentNavigationDrawer().ids.btn.values)
# print("ccchekkkkkkkkkccccccccccclre..................................................", ContentNavigationDrawer().ids.btn)
# print("llllllllllleeeeetttttttttttttttttttttheeeeeeeeemmmmmmcheccccccccccckkk........", dir(ContentNavigationDrawer().ids.btn))
# print("llllllllllllllllllllllllllleeeeeeeeeeeeeeeeeeeeeeeexfgcgcgvcgvcvgbeeechhhhhhhhhhheck", state.association)
if state.association == '': if state.association == '':
# state.association = Navigatocoming inside thew methoddddddddddddddddddds1buildrss().ids.btn.text
print("uuuuuuuuuuuuuuuuuuuuuuuuu999999999999999999999999999999")
print("lllllllllllllllllllllllllllllll55555555556666666666", BMConfigParser().addresses())
if BMConfigParser().addresses(): if BMConfigParser().addresses():
state.association = BMConfigParser().addresses()[0] state.association = BMConfigParser().addresses()[0]
print("kkkkkkkkkkkkkkkkkkkkkkkkkkkk6666666666888888888888888888...................", state.association)
Clock.schedule_once(self.init_ui, 0) Clock.schedule_once(self.init_ui, 0)
def init_ui(self, dt=0): def init_ui(self, dt=0):
"""Clock Schdule for method sent accounts.""" """Clock Schdule for method sent accounts."""
print("oooooooooooooooooooooooooooo999999999999999999999000000000")
self.sentaccounts() self.sentaccounts()
print(dt) print(dt)
def sentaccounts(self): def sentaccounts(self):
"""Load sent accounts.""" """Load sent accounts."""
print("mmmmmmmmmmmmmmmmmmmmmmmm44444444444444444455555555555__........")
account = state.association account = state.association
print("zzzzzzzzzzzzzzzzzzzzzzz99999999999999999999999999999999999", account)
self.loadSent(account, 'All', '') self.loadSent(account, 'All', '')
def loadSent(self, account, where="", what=""): def loadSent(self, account, where="", what=""):
"""Load Sent list for Sent messages.""" """Load Sent list for Sent messages."""
# print("uuuuuuuuuuuuuuuuyyyyyyyyyrrrrrrrrrrrinside_loadSent..........")
xAddress = 'fromaddress' xAddress = 'fromaddress'
data = [] data = []
# print("check--------thre.................somethiong.......cvmnvb mvn xmnvcxv.")
queryreturn = kivy_helper_search.search_sql( queryreturn = kivy_helper_search.search_sql(
xAddress, account, "sent", where, what, False) xAddress, account, "sent", where, what, False)
print("qqqqqqqq77777777777777777777777777777777555hhhhhhhhhhhhhhhfffffff....", queryreturn)
if queryreturn: if queryreturn:
# for mail in sqlQuery("SELECT toaddress, subject, message FROM addressbook a, sent s WHERE a.address = s.fromaddress and s.fromaddress = 'BM-2cUz6dniZHjFTqv6j2es2wBSe3NydZdk4R';"):
for mail in queryreturn: for mail in queryreturn:
third_text = mail[3].replace('\n', ' ') third_text = mail[3].replace('\n', ' ')
print("whatttttttttttttttttttttttttttisssssssssssssssssssssssserrrrrrrrrrrrror")
print("nowwwwwwwwww9999999999999999999999999999999..................", third_text)
# print("sssssssssssssssseeeeeeeeeeeeeeeeeeeeeeeeeeeepprob.....", mail[2][:20] + '.....' if len(mail[2]) > 20 else mail[2])
# data.append({'text': mail[0].strip(), 'secondary_text': mail[2][:20] + '.....' if len(mail[2]) > 20 else mail[2] + '\n' + " " + (third_text[:35] + '...!') if len(third_text) > 35 else third_text })
# data.append({'text': '', 'secondary_text': mail[2] + '\n' + " " + (third_text[:35] + '...!') if len(third_text) > 35 else third_text })
data.append({'text': mail[0].strip(), 'secondary_text': mail[2][:10] + '...........' if len(mail[2]) > 10 else mail[2] + '\n' + " " + (third_text[:25] + '...!') if len(third_text) > 25 else third_text }) data.append({'text': mail[0].strip(), 'secondary_text': mail[2][:10] + '...........' if len(mail[2]) > 10 else mail[2] + '\n' + " " + (third_text[:25] + '...!') if len(third_text) > 25 else third_text })
print("kyaaaaaaaaaaaaaaaaaaaaaaaaaayhaaaaaaaaaaaaerorrrrrrrrrr")
# self.data = [{
# 'data_index': i,
# 'index': 1,
# 'height': 48,
# 'text': row[2],
# }
# for i, row in enumerate(queryreturn)
# ]
print("show 6666666666666666666eeeeeee555555555555555daaaaaaaaaaa.......", data)
for item in data: for item in data:
meny = ThreeLineAvatarIconListItem(text=item['text'], secondary_text=item['secondary_text'], theme_text_color= 'Custom',text_color=NavigateApp().theme_cls.primary_color) meny = ThreeLineAvatarIconListItem(text=item['text'], secondary_text=item['secondary_text'], theme_text_color= 'Custom', text_color=NavigateApp().theme_cls.primary_color)
meny.add_widget(AvatarSampleWidget(source='./images/avatar.png')) meny.add_widget(AvatarSampleWidget(source='./images/avatar.png'))
self.ids.ml.add_widget(meny) self.ids.ml.add_widget(meny)
print("uyyyyyyyyyyyyyyyyyyyyyyyyyuuuuuuuuuggg558888888888gggggggoooooooooooooooooooooooooooooooooooooooo....")
# print("ufffffffffffffffffffffffff6666666666666ffffyyyyyyyyyyyyyyyyyyyyyyyyypp.......", self.data)
else: else:
# self.data = [{
# 'data_index': 1,
# 'index': 1,
# 'height': 48,
# 'text': "yet no message for this account!!!!!!!!!!!!!"}
# ]
content = MDLabel(font_style='Body1', content = MDLabel(font_style='Body1',
theme_text_color='Primary', theme_text_color='Primary',
text="yet no message for this account!!!!!!!!!!!!!", text="yet no message for this account!!!!!!!!!!!!!",
@ -481,6 +424,7 @@ class Sent(Screen):
valign='top') valign='top')
self.ids.ml.add_widget(content) self.ids.ml.add_widget(content)
class Trash(Screen): class Trash(Screen):
"""Trash Screen uses screen to show widgets of screens.""" """Trash Screen uses screen to show widgets of screens."""
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -512,20 +456,13 @@ class Page(Screen):
class Create(Screen): class Create(Screen):
def __init__(self, **kwargs): def __init__(self, **kwargs):
super(Create, self).__init__(**kwargs) super(Create, self).__init__(**kwargs)
# from kivy.core.window import Window
print("cheeeeeeeeeeeehn888888888888888888888888gggkkkkkkkthe windowwwwwwwwwwwwwwww", Window.size)
# print("take the onlyyyyyyyyyyyyyyyyyyyyyyyyyyyy x axssssssssssssssssssssssswindow", Window.size[0])
# print("realllllllllllyyyyyyyyyyyyy yyyyyyyyyyyoooooouuuuuuu wwwwwwaaaaaaaaaaaannnnnnnnnntttt", Window._get_width)
# print("mmmmmmmmmmmmmminnnnnnnnnnnnnnnn and mmmmmmmmaaaaaaaaxxxxxxxesssssssss", Window.minimum_height, Window.minimum_width)
# print("dir in windowwwwwwwwwkkkkkkkkkkkww of the mobile screen", dir(Window))
# print("cheeeeeeeeeeeeeeeeeckkkkkkkkkkkkkkkk width and heightttttttttttttttttttt", Window.width, window.height)
widget_1 = DropDownWidget() widget_1 = DropDownWidget()
from helper_sql import * from helper_sql import *
widget_1.ids.txt_input.word_list = [addr[1] for addr in sqlQuery("SELECT label, address from addressbook")] widget_1.ids.txt_input.word_list = [addr[1] for addr in sqlQuery("SELECT label, address from addressbook")]
# widget_1.ids.txt_input.word_list = ['how to use python', 'how to use kivy', 'how to use django', 'BM-2cTik2JBHAS92U633LPY', 'BM-2cUYmQofWjTQeUitL7']
widget_1.ids.txt_input.starting_no = 2 widget_1.ids.txt_input.starting_no = 2
self.add_widget(widget_1) self.add_widget(widget_1)
class AddressSuccessful(Screen): class AddressSuccessful(Screen):
pass pass
@ -540,10 +477,9 @@ class NavigateApp(App):
obj_1 = ObjectProperty() obj_1 = ObjectProperty()
variable_1 = ListProperty(BMConfigParser().addresses()) variable_1 = ListProperty(BMConfigParser().addresses())
nav_drawer = ObjectProperty() nav_drawer = ObjectProperty()
# user_address = StringProperty('jai') sentmail = NumericProperty(0)
scr_size = Window.size[0] scr_size = Window.size[0]
title = "PyBitmessage"
title = "KivyMD"
count = 0 count = 0
menu_items = [ menu_items = [
{'viewclass': 'MDMenuItem', {'viewclass': 'MDMenuItem',
@ -563,9 +499,6 @@ class NavigateApp(App):
] ]
def build(self): def build(self):
print('kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkllllllllllrrrrrrrrrrahut......')
print('chreckoooooooooooooooo........................', self.variable_1)
print("dsssssssssssoddddddddd77777777777777777777eeeeeeeeetheroot", dir(self))
import os import os
main_widget = Builder.load_file( main_widget = Builder.load_file(
os.path.join(os.path.dirname(__file__), 'main.kv')) os.path.join(os.path.dirname(__file__), 'main.kv'))
@ -595,17 +528,7 @@ class NavigateApp(App):
"That's pretty awesome right!", "That's pretty awesome right!",
size_hint_y=None, size_hint_y=None,
valign='top') valign='top')
print("9063 I am pressed...............................................................")
content.bind(texture_size=content.setter('size')) content.bind(texture_size=content.setter('size'))
print("9064 I am pressed...............................................................")
# self.dialog = MDDialog(content=content,
# size_hint=(.8, None),
# height=dp(200),
# auto_dismiss=False)
print("9065 I am pressed...............................................................")
# self.dialog.add_action_button("Dismiss",
# action=lambda *x: self.dialog.dismiss())
print("966 I am pressed...............................................................")
self.dialog.open() self.dialog.open()
@staticmethod @staticmethod
@ -622,31 +545,16 @@ class NavigateApp(App):
return [address[:16] + '..' for address in BMConfigParser().addresses()] return [address[:16] + '..' for address in BMConfigParser().addresses()]
else: else:
return "valuesdemo" return "valuesdemo"
# return [BMConfigParser().get(address, 'label')[:12] + '..' for address in BMConfigParser().sections()[1:]]
# return BMConfigParser().addresses()
def getCurrentAccountData(self, text): def getCurrentAccountData(self, text):
"""Get Current Address Account Data.""" """Get Current Address Account Data."""
print("self tttttttttttttttttttttteeeeeeeeeexfgvbcvgfcgfdgfdgfgxxxxxxxxtttttttttzzzzzzzz ", text)
state.association = text state.association = text
# print("eeeeeeeeeeeeerrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrorrrrrrrrrrrrrrrrrr", self.root)
# print("iiiiiiiiiiiiiidddddddddddddddddeeeeeeeessssssssssssssssss55......", self.root.ids)
self.root.ids.sc1.clear_widgets() self.root.ids.sc1.clear_widgets()
self.root.ids.sc4.clear_widgets() self.root.ids.sc4.clear_widgets()
self.root.ids.sc5.clear_widgets() self.root.ids.sc5.clear_widgets()
# print("resffffffffffffffffffffffffffffuuuuuuuuuuuuuuuuuuurrrrrrrrrrrrr......")
self.root.ids.sc1.add_widget(Inbox()) self.root.ids.sc1.add_widget(Inbox())
self.root.ids.sc4.add_widget(Sent()) self.root.ids.sc4.add_widget(Sent())
self.root.ids.sc5.add_widget(Trash()) self.root.ids.sc5.add_widget(Trash())
# print("again aaaaddddddddddddddddddinggggggggggggggggguuuuuuuuuuuuuuuu1 ........")
# self.root.ids.toolbar.title = BMConfigParser().get(
# state.association, 'label') + '({})'.format(state.association)
# print("what theyyyyyyyyyyyyyyyyyyyy areeeeeeeeeeeee printing11........", self.root.ids.toolbar.title)
# Inbox()
# Sent()
# Trash()
# print("finish gamneeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee!")
def getInboxMessageDetail(self, instance): def getInboxMessageDetail(self, instance):
"""It will get message detail after make selected message description.""" """It will get message detail after make selected message description."""
@ -669,9 +577,6 @@ class NavigateApp(App):
p.open() p.open()
def getDefaultAccData(self): def getDefaultAccData(self):
print("coming inside thew methodddddddddddddddddddsdcassdfs1")
print("combbbbbbbbbbbbggggffffffdfgdgfffffffgggggggggggggggggggllllllloooo", BMConfigParser().addresses())
# return BMConfigParser.addresses[0]
if BMConfigParser().addresses(): if BMConfigParser().addresses():
return BMConfigParser().addresses()[0] return BMConfigParser().addresses()[0]
return 'Select Address' return 'Select Address'
@ -684,19 +589,13 @@ class GrashofPopup(Popup):
self.size_hint_x = 0.9 self.size_hint_x = 0.9
def savecontact(self): def savecontact(self):
print("show the addedes addess in databaseeeeeeeeeeeeeeeeee............................")
print("1110 I am pressed...............................................................")
label = self.ids.label.text label = self.ids.label.text
print("2210 I am pressed...............................................................")
address = self.ids.address.text address = self.ids.address.text
print("3310 I am pressed...............................................................")
if label and address: if label and address:
state.navinstance = self.parent.children[1] state.navinstance = self.parent.children[1]
queues.UISignalQueue.put(('rerenderAddressBook', '')) queues.UISignalQueue.put(('rerenderAddressBook', ''))
self.dismiss() self.dismiss()
sqlExecute("INSERT INTO addressbook VALUES(?,?)", label, address) sqlExecute("INSERT INTO addressbook VALUES(?,?)", label, address)
# self.parent.children[1].ids.sc11.clear_widgets()
# self.parent.children[1].ids.sc11.add_widget(AddressBook())
def show_error_message(self): def show_error_message(self):
content = MDLabel(font_style='Body1', content = MDLabel(font_style='Body1',
@ -743,18 +642,9 @@ class NavigationDrawerTwoLineListItem(
Binds Controller.current_account property. Binds Controller.current_account property.
""" """
pass pass
# self.controller = App.get_running_app().controller
# self.controller.bind(
# current_account=lambda _, value: self.on_current_account(value))
def on_current_account(self, account): def on_current_account(self, account):
pass pass
# e.g. deleting the last account, would set
# Controller.current_account to None
# if account is None:
# return
# address = "0x" + account.address.encode("hex")
# self.address_property = address
def _update_specific_text_color(self, instance, value): def _update_specific_text_color(self, instance, value):
pass pass