Replaced variable_1 with identity_list

This commit is contained in:
shekhar-cis 2022-08-10 15:57:19 +05:30
parent 425b31da84
commit e47e61741d
Signed by untrusted user: shekhar-cis
GPG Key ID: F4F00AB04E83F9A7
16 changed files with 52 additions and 50 deletions

View File

@ -34,8 +34,8 @@ class Allmails(Screen):
"""Method Parsing the address"""
super(Allmails, self).__init__(*args, **kwargs)
if state.association == '':
if state.kivyapp.variable_1:
state.association = state.kivyapp.variable_1[0]
if state.kivyapp.identity_list:
state.association = state.kivyapp.identity_list[0]
Clock.schedule_once(self.init_ui, 0)
def init_ui(self, dt=0):

View File

@ -54,8 +54,8 @@ class Draft(Screen, HelperDraft):
self.kivy_running_app = App.get_running_app()
self.kivy_state = self.kivy_running_app.kivy_state_obj
if self.kivy_state.association == '':
if state.kivyapp.variable_1:
self.kivy_state.association = state.kivyapp.variable_1[0]
if state.kivyapp.identity_list:
self.kivy_state.association = state.kivyapp.identity_list[0]
Clock.schedule_once(self.init_ui, 0)
def init_ui(self, dt=0):

View File

@ -40,8 +40,8 @@ class Inbox(Screen):
def set_defaultAddress():
"""This method set's default address"""
if state.association == "":
if state.kivyapp.variable_1:
state.association = state.kivyapp.variable_1[0]
if state.kivyapp.identity_list:
state.association = state.kivyapp.identity_list[0]
def init_ui(self, dt=0):
"""Clock schdule for method inbox accounts"""

View File

@ -68,9 +68,9 @@ class Random(Screen):
def address_created_callback(self, dt=0): # pylint: disable=unused-argument
"""New address created"""
App.get_running_app().loadMyAddressScreen(False)
App.get_running_app().root.ids.sc10.ids.ml.clear_widgets()
App.get_running_app().root.ids.sc10.is_add_created = True
App.get_running_app().root.ids.sc10.init_ui()
App.get_running_app().root.ids.id_myaddress.ids.ml.clear_widgets()
App.get_running_app().root.ids.id_myaddress.is_add_created = True
App.get_running_app().root.ids.id_myaddress.init_ui()
self.reset_address_spinner()
toast('New address created')

View File

@ -71,7 +71,7 @@ class MyAddress(Screen, HelperMyAddress):
def init_ui(self, dt=0):
"""Clock schdule for method Myaddress accounts"""
# pylint: disable=unnecessary-lambda, deprecated-lambda
# self.addresses_list = state.kivyapp.variable_1
# self.addresses_list = state.kivyapp.identity_list
self.addresses_list = BMConfigParser().addresses()
if self.kivy_state.searcing_text:
self.ids.refresh_layout.scroll_y = 1.0
@ -211,7 +211,7 @@ class MyAddress(Screen, HelperMyAddress):
def refresh_callback(interval):
"""Method used for loading the myaddress screen data"""
self.kivy_state.searcing_text = ''
# state.kivyapp.root.ids.sc10.children[2].active = False
# state.kivyapp.root.ids.id_myaddress.children[2].active = False
self.ids.search_bar.ids.search_field.text = ''
self.has_refreshed = True
self.ids.ml.clear_widgets()
@ -261,7 +261,7 @@ class MyAddress(Screen, HelperMyAddress):
if BMConfigParser().get(str(addr), 'enabled') == 'true']
self.parent.parent.ids.content_drawer.ids.btn.values = addresses
self.parent.parent.ids.sc3.children[1].ids.btn.values = addresses
state.kivyapp.variable_1 = addresses
state.kivyapp.identity_list = addresses
def toggleAction(self, instance):
"""This method is used for enable or disable address"""

View File

@ -10,7 +10,7 @@ from network import objectracker, stats
class NetworkStat(Screen):
"""NetworkStat class for kivy Ui"""
text_variable_1 = StringProperty(
text_identity_list = StringProperty(
'{0}::{1}'.format('Total Connections', '0'))
text_variable_2 = StringProperty(
'Processed {0} per-to-per messages'.format('0'))
@ -28,7 +28,7 @@ class NetworkStat(Screen):
def init_ui(self, dt=0):
"""Clock Schdule for method networkstat screen"""
self.text_variable_1 = '{0} :: {1}'.format(
self.text_identity_list = '{0} :: {1}'.format(
'Total Connections', str(len(stats.connectedHostsList())))
self.text_variable_2 = 'Processed {0} per-to-per messages'.format(
str(state.numberOfMessagesProcessed))

View File

@ -30,8 +30,8 @@ class Sent(Screen):
"""Association with the screen"""
super(Sent, self).__init__(*args, **kwargs)
if state.association == '':
if state.kivyapp.variable_1:
state.association = state.kivyapp.variable_1[0]
if state.kivyapp.identity_list:
state.association = state.kivyapp.identity_list[0]
Clock.schedule_once(self.init_ui, 0)
def init_ui(self, dt=0):

View File

@ -38,8 +38,8 @@ class Trash(Screen):
def init_ui(self, dt=0):
"""Clock Schdule for method trash screen"""
if state.association == '':
if state.kivyapp.variable_1:
state.association = state.kivyapp.variable_1[0]
if state.kivyapp.identity_list:
state.association = state.kivyapp.identity_list[0]
self.ids.tag_label.text = ''
self.trashDataQuery(0, 20)
if len(self.trash_messages):

View File

@ -5,6 +5,7 @@ Kivy State variables are assigned here, they are separated from state.py
=================================
"""
import os
import threading
@ -36,5 +37,7 @@ class KivyStateVariables(object):
self.in_sent_method = False
self.in_search_mode = False
self.imageDir = None
self.image_dir = os.path.abspath(os.path.join('images', 'kivy'))
# self.sqlReady = False # set to true by sqlTread when ready for processing
self.sql_ready = threading.Event()

View File

@ -49,7 +49,7 @@
size_hint: None, None
size: dp(36), dp(48)
pos_hint: {'center_x': .95, 'center_y': .4}
on_active: app.root.ids.sc10.toggleAction(self)
on_active: app.root.ids.id_myaddress.toggleAction(self)
<CustomTwoLineAvatarIconListItem>:
canvas:

View File

@ -38,7 +38,7 @@
CustomSpinner:
id: btn
background_color: app.theme_cls.primary_dark
values: app.variable_1
values: app.identity_list
on_text: root.auto_fill_fromaddr() if self.text != 'Select' else ''
option_cls: Factory.get("ComposerSpinnerOption")
#background_color: color_button if self.state == 'normal' else color_button_pressed

View File

@ -30,4 +30,4 @@
size_hint: None, None
size: dp(36), dp(48)
pos_hint: {'center_x': .95, 'center_y': .4}
on_active: app.root.ids.sc10.toggleAction(self)
on_active: app.root.ids.id_myaddress.toggleAction(self)

View File

@ -23,13 +23,13 @@
_no_ripple_effect: True
# size_hint: .6, 0
# height: dp(40)
text: app.tr._(root.text_variable_1)
text: app.tr._(root.text_identity_list)
elevation_normal: 2
opposite_colors: True
pos_hint: {'center_x': .5}
# MDLabel:
# font_style: 'H6'
# text: app.tr._(root.text_variable_1)
# text: app.tr._(root.text_identity_list)
# font_size: '13sp'
# color: (1,1,1,1)
# halign: 'center'

View File

@ -261,7 +261,7 @@ MDNavigationLayout:
Setting:
id:sc9
MyAddress:
id:sc10
id:id_myaddress
AddressBook:
id:sc11
Payment:

View File

@ -218,7 +218,7 @@ class NavigateApp(MDApp):
previous_date = ObjectProperty()
obj_1 = ObjectProperty()
variable_1 = ListProperty(addr for addr in BMConfigParser().addresses()
identity_list = ListProperty(addr for addr in BMConfigParser().addresses()
if BMConfigParser().get(str(addr), 'enabled') == 'true')
nav_drawer = ObjectProperty()
state.screen_density = Window.size
@ -229,8 +229,9 @@ class NavigateApp(MDApp):
count = 0
manager_open = False
file_manager = None
state.imageDir = os.path.join('./images', 'kivy')
image_path = state.imageDir
# state.imageDir = os.path.join(__file__, 'images', 'kivy')
state.imageDir = KivyStateVariables().image_dir
image_path = KivyStateVariables().image_dir
tr = Lang("en") # for changing in franch replace en with fr
def build(self):
@ -321,8 +322,8 @@ class NavigateApp(MDApp):
self.root.ids.sc17.clear_widgets()
self.root.ids.sc17.add_widget(Allmails())
self.root.ids.sc10.ids.ml.clear_widgets()
self.root.ids.sc10.init_ui()
self.root.ids.id_myaddress.ids.ml.clear_widgets()
self.root.ids.id_myaddress.init_ui()
self.root.ids.scr_mngr.current = 'inbox'
@ -423,8 +424,8 @@ class NavigateApp(MDApp):
def getDefaultAccData(self, instance):
"""Getting Default Account Data"""
if self.variable_1:
state.association = first_addr = self.variable_1[0]
if self.identity_list:
state.association = first_addr = self.identity_list[0]
# if BMConfigParser().get(str(first_addr), 'enabled') == 'true':
# img = identiconGeneration.generate(first_addr)
# print('line...........................................426')
@ -450,8 +451,8 @@ class NavigateApp(MDApp):
def get_default_logo(self, instance):
"""Getting default logo image"""
if self.variable_1:
first_addr = self.variable_1[0]
if self.identity_list:
first_addr = self.identity_list[0]
if BMConfigParser().get(str(first_addr), 'enabled') == 'true':
if os.path.exists(
state.imageDir + '/default_identicon/{}.png'.format(first_addr)):
@ -512,7 +513,7 @@ class NavigateApp(MDApp):
self.root.ids.scr_mngr.current = 'chlist'
self.root.ids.scr_mngr.transition = SlideTransition()
else:
if state.kivyapp.variable_1:
if state.kivyapp.identity_list:
self.root.ids.scr_mngr.current = 'inbox'
self.root.ids.scr_mngr.transition.direction = 'right'
self.root.ids.scr_mngr.transition.bind(on_complete=self.reset)
@ -542,8 +543,8 @@ class NavigateApp(MDApp):
self.root.ids.sc11.loadAddresslist(None, 'All', '')
self.root.ids.sc11.children[1].active = False
elif state.search_screen == 'myaddress':
self.root.ids.sc10.ids.ml.clear_widgets()
self.root.ids.sc10.init_ui()
self.root.ids.id_myaddress.ids.ml.clear_widgets()
self.root.ids.id_myaddress.init_ui()
self.loadMyAddressScreen(False)
else:
self.root.ids.sc4.ids.ml.clear_widgets()
@ -553,10 +554,10 @@ class NavigateApp(MDApp):
def loadMyAddressScreen(self, action):
"""loadMyAddressScreen method spin the loader"""
if len(self.root.ids.sc10.children) <= 2:
self.root.ids.sc10.children[0].active = action
if len(self.root.ids.id_myaddress.children) <= 2:
self.root.ids.id_myaddress.children[0].active = action
else:
self.root.ids.sc10.children[1].active = action
self.root.ids.id_myaddress.children[1].active = action
def save_draft(self):
"""Saving drafts messages"""
@ -772,12 +773,12 @@ class NavigateApp(MDApp):
1].active = True
Clock.schedule_once(self.search_callback, 0.5)
elif state.search_screen == 'myaddress':
self.root.ids.sc10.ids.search_bar.ids.search_field.text = ''
self.root.ids.id_myaddress.ids.search_bar.ids.search_field.text = ''
# try:
# self.root.ids.sc10.children[
# self.root.ids.id_myaddress.children[
# 1].children[2].ids.search_field.text = ''
# except Exception:
# self.root.ids.sc10.children[
# self.root.ids.id_myaddress.children[
# 2].children[2].ids.search_field.text = ''
self.loadMyAddressScreen(True)
Clock.schedule_once(self.search_callback, 0.5)

View File

@ -5,7 +5,8 @@ from threading import Thread
import queues
import state
from semaphores import kivyuisignaler
from kivy.app import App
from debug import logger
from bitmessagekivy.baseclass.common import kivy_state_variables
@ -24,13 +25,10 @@ class UIkivySignaler(Thread):
command, data = queues.UISignalQueue.get()
if command == 'writeNewAddressToTable':
address = data[1]
state.kivyapp.variable_1.append(address)
# elif command == 'rerenderAddressBook':
# state.kivyapp.obj_1.refreshs()
# Need to discuss this
App.get_running_app().identity_list.append(address)
elif command == 'updateSentItemStatusByAckdata':
App.get_running_app().status_dispatching(data)
elif command == 'writeNewpaymentAddressToTable':
pass
elif command == 'updateSentItemStatusByAckdata':
state.kivyapp.status_dispatching(data)
except Exception as e:
print(e)
logger.debug(e)