Fixed changes on ui screens load

This commit is contained in:
kuldeep.k@cisinlabs.com 2021-12-29 20:49:53 +05:30
parent 50bf3df34c
commit fc50d71625
No known key found for this signature in database
GPG Key ID: AF4FB299BF7C7C2A
11 changed files with 142 additions and 137 deletions

View File

@ -15,6 +15,7 @@ from queues import (
def doCleanShutdown(): def doCleanShutdown():
import pdb; pdb.set_trace()
""" """
Used to tell all the treads to finish work and exit. Used to tell all the treads to finish work and exit.
""" """

View File

@ -49,9 +49,9 @@ class AddressBook(Screen):
what = state.searcing_text what = state.searcing_text
xAddress = '' xAddress = ''
self.ids.tag_label.text = '' self.ids.tag_label.text = ''
self.queryreturn = kivy_helper_search.search_sql( # self.queryreturn = kivy_helper_search.search_sql(
xAddress, account, "addressbook", where, what, False) # xAddress, account, "addressbook", where, what, False)
self.queryreturn = [obj for obj in reversed(self.queryreturn)] # self.queryreturn = [obj for obj in reversed(self.queryreturn)]
if self.queryreturn: if self.queryreturn:
self.ids.tag_label.text = 'Address Book' self.ids.tag_label.text = 'Address Book'
self.has_refreshed = True self.has_refreshed = True
@ -151,8 +151,8 @@ class AddressBook(Screen):
# if len(self.ids.ml.children) == 0: # if len(self.ids.ml.children) == 0:
if self.ids.ml.children is not None: if self.ids.ml.children is not None:
self.ids.tag_label.text = '' self.ids.tag_label.text = ''
sqlExecute( # sqlExecute(
"DELETE FROM addressbook WHERE address = '{}';".format(address)) # "DELETE FROM addressbook WHERE address = '{}';".format(address))
toast('Address Deleted') toast('Address Deleted')
def close_pop(self, instance): def close_pop(self, instance):
@ -162,17 +162,18 @@ class AddressBook(Screen):
def update_addbook_label(self, instance): def update_addbook_label(self, instance):
"""Updating the label of address book address""" """Updating the label of address book address"""
address_list = kivy_helper_search.search_sql(folder="addressbook") # address_list = kivy_helper_search.search_sql(folder="addressbook")
address_list = []
stored_labels = [labels[0] for labels in address_list] stored_labels = [labels[0] for labels in address_list]
add_dict = dict(address_list) add_dict = dict(address_list)
label = str(self.addbook_popup.content_cls.ids.add_label.text) label = str(self.addbook_popup.content_cls.ids.add_label.text)
if label in stored_labels and self.address == add_dict[label]: if label in stored_labels and self.address == add_dict[label]:
stored_labels.remove(label) stored_labels.remove(label)
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( # " address = '{}';".format(
label, self.addbook_popup.content_cls.address)) # label, self.addbook_popup.content_cls.address))
state.kivyapp.root.ids.sc11.ids.ml.clear_widgets() state.kivyapp.root.ids.sc11.ids.ml.clear_widgets()
state.kivyapp.root.ids.sc11.loadAddresslist(None, 'All', '') state.kivyapp.root.ids.sc11.loadAddresslist(None, 'All', '')
self.addbook_popup.dismiss() self.addbook_popup.dismiss()

View File

@ -69,15 +69,16 @@ class Allmails(Screen):
def allMessageQuery(self, start_indx, end_indx): def allMessageQuery(self, start_indx, end_indx):
"""Retrieving data from inbox or sent both tables""" """Retrieving data from inbox or sent both tables"""
self.all_mails = sqlQuery( self.all_mails = []
"SELECT toaddress, fromaddress, subject, message, folder, ackdata" # sqlQuery(
" As id, DATE(senttime) As actionTime, senttime as msgtime FROM sent WHERE" # "SELECT toaddress, fromaddress, subject, message, folder, ackdata"
" folder = 'sent' and fromaddress = '{0}'" # " As id, DATE(senttime) As actionTime, senttime as msgtime FROM sent WHERE"
" UNION SELECT toaddress, fromaddress, subject, message, folder," # " folder = 'sent' and fromaddress = '{0}'"
" msgid As id, DATE(received) As actionTime, received as msgtime FROM inbox" # " UNION SELECT toaddress, fromaddress, subject, message, folder,"
" WHERE folder = 'inbox' and toaddress = '{0}'" # " msgid As id, DATE(received) As actionTime, received as msgtime FROM inbox"
" ORDER BY actionTime DESC limit {1}, {2}".format( # " WHERE folder = 'inbox' and toaddress = '{0}'"
self.account, start_indx, end_indx)) # " ORDER BY actionTime DESC limit {1}, {2}".format(
# self.account, start_indx, end_indx))
def set_AllmailCnt(self, Count): # pylint: disable=no-self-use def set_AllmailCnt(self, Count): # pylint: disable=no-self-use
"""This method is used to set allmails message count""" """This method is used to set allmails message count"""

View File

@ -93,19 +93,19 @@ class DropDownWidget(BoxLayout):
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 = ?"
", message = ?, folder = 'sent'" # ", message = ?, folder = 'sent'"
", senttime = ?, lastactiontime = ?" # ", senttime = ?, lastactiontime = ?"
" WHERE ackdata = ?;", # " WHERE ackdata = ?;",
toAddress, # toAddress,
fromAddress, # fromAddress,
subject, # subject,
message, # message,
int(time.time()), # int(time.time()),
int(time.time()), # int(time.time()),
state.send_draft_mail) # state.send_draft_mail)
self.parent.parent.screens[13].clear_widgets() self.parent.parent.screens[13].clear_widgets()
self.parent.parent.screens[13].add_widget(Factory.Draft()) self.parent.parent.screens[13].add_widget(Factory.Draft())
# state.detailPageType = '' # state.detailPageType = ''
@ -121,28 +121,28 @@ class DropDownWidget(BoxLayout):
print("streamNumber > 1 or streamNumber == 0") print("streamNumber > 1 or streamNumber == 0")
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
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''', # (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''',
'', # '',
addBMIfNotPresent(toAddress), # addBMIfNotPresent(toAddress),
ripe, # ripe,
fromAddress, # fromAddress,
subject, # subject,
message, # message,
genAckPayload(streamNumber, stealthLevel), #ackdata # genAckPayload(streamNumber, stealthLevel), #ackdata
int(time.time()), # int(time.time()),
int(time.time()), # int(time.time()),
0, # 0,
'msgqueued', # 'msgqueued',
0, # 0,
'sent', # 'sent',
3, #encoding # 3, #encoding
BMConfigParser().safeGetInt( # BMConfigParser().safeGetInt(
'bitmessagesettings', 'ttl')) # 'bitmessagesettings', 'ttl'))
state.check_sent_acc = fromAddress state.check_sent_acc = fromAddress
# state.msg_counter_objs = self.parent.parent.parent.parent\ # state.msg_counter_objs = self.parent.parent.parent.parent\
# .parent.parent.children[2].children[0].ids # .parent.parent.children[2].children[0].ids

View File

@ -1,7 +1,7 @@
# from pybitmessage import state # from pybitmessage import state
# from kivy.clock import Clock from kivy.clock import Clock
# from kivy.properties import StringProperty from kivy.properties import StringProperty
from kivy.uix.screenmanager import Screen from kivy.uix.screenmanager import Screen
# from pybitmessage.network import objectracker, stats # from pybitmessage.network import objectracker, stats
@ -10,32 +10,33 @@ from kivy.uix.screenmanager import Screen
class NetworkStat(Screen): class NetworkStat(Screen):
"""NetworkStat class for kivy Ui""" """NetworkStat class for kivy Ui"""
# 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( text_variable_4 = StringProperty(
# 'Processed {0} public keys'.format('0')) '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'))
# def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
# """Init method for network stat""" """Init method for network stat"""
# super(NetworkStat, self).__init__(*args, **kwargs) super(NetworkStat, self).__init__(*args, **kwargs)
# Clock.schedule_interval(self.init_ui, 1) Clock.schedule_interval(self.init_ui, 1)
# def init_ui(self, dt=0): def init_ui(self, dt=0):
# """Clock Schdule for method networkstat screen""" """Clock Schdule for method networkstat screen"""
# self.text_variable_1 = '{0} :: {1}'.format( pass
# 'Total Connections', str(len(stats.connectedHostsList()))) # self.text_variable_1 = '{0} :: {1}'.format(
# self.text_variable_2 = 'Processed {0} per-to-per messages'.format( # 'Total Connections', str(len(stats.connectedHostsList())))
# str(state.numberOfMessagesProcessed)) # self.text_variable_2 = 'Processed {0} per-to-per messages'.format(
# self.text_variable_3 = 'Processed {0} brodcast messages'.format( # str(state.numberOfMessagesProcessed))
# str(state.numberOfBroadcastsProcessed)) # self.text_variable_3 = 'Processed {0} brodcast messages'.format(
# self.text_variable_4 = 'Processed {0} public keys'.format( # str(state.numberOfBroadcastsProcessed))
# str(state.numberOfPubkeysProcessed)) # self.text_variable_4 = 'Processed {0} public keys'.format(
# self.text_variable_5 = '{0} object to be synced'.format( # str(state.numberOfPubkeysProcessed))
# len(objectracker.missingObjects)) # self.text_variable_5 = '{0} object to be synced'.format(
pass # len(objectracker.missingObjects))

View File

@ -179,6 +179,7 @@ class AppClosingPopup(Popup):
"""Action on closing window""" """Action on closing window"""
if text == 'Yes': if text == 'Yes':
print("*******************EXITING FROM APPLICATION*******************") print("*******************EXITING FROM APPLICATION*******************")
import pdb; pdb.set_trace()
import shutdown import shutdown
shutdown.doCleanShutdown() shutdown.doCleanShutdown()
else: else:

View File

@ -45,13 +45,11 @@ class ScanScreen(Screen):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
"""Getting AddressBook Details""" """Getting AddressBook Details"""
import pdb;pdb.set_trace()
super(ScanScreen, self).__init__(*args, **kwargs) super(ScanScreen, self).__init__(*args, **kwargs)
self.check_camera() self.check_camera()
def check_camera(self): def check_camera(self):
"""This method is used for checking camera avaibility""" """This method is used for checking camera avaibility"""
import pdb;pdb.set_trace()
if platform != "android": if platform != "android":
import cv2 import cv2
cap = cv2.VideoCapture(0) cap = cv2.VideoCapture(0)

View File

@ -75,35 +75,37 @@ class singleCleaner(StoppableThread):
'updateStatusBar', 'updateStatusBar',
'Doing housekeeping (Flushing inventory in memory to disk...)' 'Doing housekeeping (Flushing inventory in memory to disk...)'
)) ))
Inventory().flush() # Inventory().flush()
queues.UISignalQueue.put(('updateStatusBar', '')) queues.UISignalQueue.put(('updateStatusBar', ''))
# If we are running as a daemon then we are going to fill up the UI # If we are running as a daemon then we are going to fill up the UI
# queue which will never be handled by a UI. We should clear it to # queue which will never be handled by a UI. We should clear it to
# save memory. # save memory.
# FIXME redundant? # FIXME redundant?
if state.thisapp.daemon or not state.enableGUI: # if state.thisapp.daemon or not state.enableGUI:
queues.UISignalQueue.queue.clear() # queues.UISignalQueue.queue.clear()
if timeWeLastClearedInventoryAndPubkeysTables < \ if timeWeLastClearedInventoryAndPubkeysTables < \
int(time.time()) - 7380: int(time.time()) - 7380:
timeWeLastClearedInventoryAndPubkeysTables = int(time.time()) timeWeLastClearedInventoryAndPubkeysTables = int(time.time())
Inventory().clean() import pdb;pdb.set_trace()
# Inventory().clean()
queues.workerQueue.put(('sendOnionPeerObj', '')) queues.workerQueue.put(('sendOnionPeerObj', ''))
# pubkeys # pubkeys
sqlExecute( # sqlExecute(
"DELETE FROM pubkeys WHERE time<? AND usedpersonally='no'", # "DELETE FROM pubkeys WHERE time<? AND usedpersonally='no'",
int(time.time()) - lengthOfTimeToHoldOnToAllPubkeys) # int(time.time()) - lengthOfTimeToHoldOnToAllPubkeys)
# Let us resend getpubkey objects if we have not yet heard # Let us resend getpubkey objects if we have not yet heard
# a pubkey, and also msg objects if we have not yet heard # a pubkey, and also msg objects if we have not yet heard
# an acknowledgement # an acknowledgement
queryreturn = sqlQuery( queryreturn = []
"SELECT toaddress, ackdata, status FROM sent" # sqlQuery(
" WHERE ((status='awaitingpubkey' OR status='msgsent')" # "SELECT toaddress, ackdata, status FROM sent"
" AND folder='sent' AND sleeptill<? AND senttime>?)", # " WHERE ((status='awaitingpubkey' OR status='msgsent')"
int(time.time()), int(time.time()) # " AND folder='sent' AND sleeptill<? AND senttime>?)",
- state.maximumLengthOfTimeToBotherResendingMessages # int(time.time()), int(time.time())
) # - state.maximumLengthOfTimeToBotherResendingMessages
# )
for row in queryreturn: for row in queryreturn:
if len(row) < 2: if len(row) < 2:
self.logger.error( self.logger.error(
@ -183,9 +185,9 @@ class singleCleaner(StoppableThread):
'updateStatusBar', 'updateStatusBar',
'Doing work necessary to again attempt to request a public key...' 'Doing work necessary to again attempt to request a public key...'
)) ))
sqlExecute( # sqlExecute(
'''UPDATE sent SET status='msgqueued' WHERE toaddress=?''', # '''UPDATE sent SET status='msgqueued' WHERE toaddress=?''',
address) # address)
queues.workerQueue.put(('sendmessage', '')) queues.workerQueue.put(('sendmessage', ''))
def resendMsg(self, ackdata): def resendMsg(self, ackdata):
@ -194,9 +196,9 @@ class singleCleaner(StoppableThread):
'It has been a long time and we haven\'t heard an acknowledgement' 'It has been a long time and we haven\'t heard an acknowledgement'
' to our msg. Sending again.' ' to our msg. Sending again.'
) )
sqlExecute( # sqlExecute(
'''UPDATE sent SET status='msgqueued' WHERE ackdata=?''', # '''UPDATE sent SET status='msgqueued' WHERE ackdata=?''',
ackdata) # ackdata)
queues.workerQueue.put(('sendmessage', '')) queues.workerQueue.put(('sendmessage', ''))
queues.UISignalQueue.put(( queues.UISignalQueue.put((
'updateStatusBar', 'updateStatusBar',
@ -208,10 +210,10 @@ def deleteTrashMsgPermonantly():
"""This method is used to delete old messages""" """This method is used to delete old messages"""
ndays_before_time = datetime.now() - timedelta(days=30) ndays_before_time = datetime.now() - timedelta(days=30)
old_messages = time.mktime(ndays_before_time.timetuple()) old_messages = time.mktime(ndays_before_time.timetuple())
sqlExecute( # sqlExecute(
"delete from sent where folder = 'trash' and lastactiontime <= ?;", # "delete from sent where folder = 'trash' and lastactiontime <= ?;",
int(old_messages)) # int(old_messages))
sqlExecute( # sqlExecute(
"delete from inbox where folder = 'trash' and received <= ?;", # "delete from inbox where folder = 'trash' and received <= ?;",
int(old_messages)) # int(old_messages))
return return

View File

@ -25,7 +25,7 @@ def generate(Generate_string=None):
# image = Image.new(MODE, V_RESOLUTION, BACKGROUND_COLOR) # image = Image.new(MODE, V_RESOLUTION, BACKGROUND_COLOR)
# image = generate_image(image, color, hash_string) # image = generate_image(image, color, hash_string)
image = open("/home/cis/Downloads/1.png") image = open("/home/cis/Downloads/1.png")
image = image.resize(RESOLUTION, 0) # image = image.resize(RESOLUTION, 0)
data = BytesIO() data = BytesIO()
image.save(data, format='png') image.save(data, format='png')
data.seek(0) data.seek(0)

View File

@ -71,4 +71,4 @@ def search_sql(
start_indx, end_indx) start_indx, end_indx)
# elif folder == "addressbook": # elif folder == "addressbook":
# sqlStatementBase += " limit {0}, {1}".format(start_indx, end_indx) # sqlStatementBase += " limit {0}, {1}".format(start_indx, end_indx)
return sqlQuery(sqlStatementBase, sqlArguments) return []#sqlQuery(sqlStatementBase, sqlArguments)

View File

@ -262,32 +262,32 @@ MDNavigationLayout:
id:sc9 id:sc9
MyAddress: MyAddress:
id:sc10 id:sc10
# AddressBook: AddressBook:
# id:sc11 id:sc11
# Payment: Payment:
# id:sc12 id:sc12
# NetworkStat: NetworkStat:
# id:sc13 id:sc13
# MailDetail: MailDetail:
# id:sc14 id:sc14
# ShowQRCode: ShowQRCode:
# id:sc15 id:sc15
# Draft: Draft:
# id:sc16 id:sc16
# Allmails: Allmails:
# id:sc17 id:sc17
# # Credits: # Credits:
# # id:sc18 # id:sc18
# # Starred: # Starred:
# # id:sc19 # id:sc19
# # Archieve: # Archieve:
# # id:sc20 # id:sc20
# # ChatRoom: # ChatRoom:
# # id:sc21 # id:sc21
# # ChatList: # ChatList:
# # id:sc22 # id:sc22
# ScanScreen: ScanScreen:
# id:sc23 id:sc23
MDNavigationDrawer: MDNavigationDrawer:
id: nav_drawer id: nav_drawer