diff --git a/src/bitmessagekivy/baseclass/allmail.py b/src/bitmessagekivy/baseclass/allmail.py index d4cbbc2e..db797b02 100644 --- a/src/bitmessagekivy/baseclass/allmail.py +++ b/src/bitmessagekivy/baseclass/allmail.py @@ -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): diff --git a/src/bitmessagekivy/baseclass/draft.py b/src/bitmessagekivy/baseclass/draft.py index 9b709312..44dd53a3 100644 --- a/src/bitmessagekivy/baseclass/draft.py +++ b/src/bitmessagekivy/baseclass/draft.py @@ -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): diff --git a/src/bitmessagekivy/baseclass/inbox.py b/src/bitmessagekivy/baseclass/inbox.py index 34d24791..d148338c 100644 --- a/src/bitmessagekivy/baseclass/inbox.py +++ b/src/bitmessagekivy/baseclass/inbox.py @@ -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""" diff --git a/src/bitmessagekivy/baseclass/login.py b/src/bitmessagekivy/baseclass/login.py index 74ba9def..dba29b6f 100644 --- a/src/bitmessagekivy/baseclass/login.py +++ b/src/bitmessagekivy/baseclass/login.py @@ -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') diff --git a/src/bitmessagekivy/baseclass/myaddress.py b/src/bitmessagekivy/baseclass/myaddress.py index 9196fed9..3c0ade61 100644 --- a/src/bitmessagekivy/baseclass/myaddress.py +++ b/src/bitmessagekivy/baseclass/myaddress.py @@ -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""" diff --git a/src/bitmessagekivy/baseclass/network.py b/src/bitmessagekivy/baseclass/network.py index bdc79068..aad1ce7f 100644 --- a/src/bitmessagekivy/baseclass/network.py +++ b/src/bitmessagekivy/baseclass/network.py @@ -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)) diff --git a/src/bitmessagekivy/baseclass/sent.py b/src/bitmessagekivy/baseclass/sent.py index bfa309ec..d6fe0df8 100644 --- a/src/bitmessagekivy/baseclass/sent.py +++ b/src/bitmessagekivy/baseclass/sent.py @@ -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): diff --git a/src/bitmessagekivy/baseclass/trash.py b/src/bitmessagekivy/baseclass/trash.py index f6a436a0..d255458e 100644 --- a/src/bitmessagekivy/baseclass/trash.py +++ b/src/bitmessagekivy/baseclass/trash.py @@ -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): diff --git a/src/bitmessagekivy/kivy_state.py b/src/bitmessagekivy/kivy_state.py index a813bd06..0c58a96e 100644 --- a/src/bitmessagekivy/kivy_state.py +++ b/src/bitmessagekivy/kivy_state.py @@ -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() diff --git a/src/bitmessagekivy/kv/common_widgets.kv b/src/bitmessagekivy/kv/common_widgets.kv index 4a734266..82460b56 100644 --- a/src/bitmessagekivy/kv/common_widgets.kv +++ b/src/bitmessagekivy/kv/common_widgets.kv @@ -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) : canvas: diff --git a/src/bitmessagekivy/kv/msg_composer.kv b/src/bitmessagekivy/kv/msg_composer.kv index 0a9f0b5b..8619af68 100644 --- a/src/bitmessagekivy/kv/msg_composer.kv +++ b/src/bitmessagekivy/kv/msg_composer.kv @@ -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 diff --git a/src/bitmessagekivy/kv/myaddress.kv b/src/bitmessagekivy/kv/myaddress.kv index 93496eeb..a407fa42 100644 --- a/src/bitmessagekivy/kv/myaddress.kv +++ b/src/bitmessagekivy/kv/myaddress.kv @@ -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) \ No newline at end of file + on_active: app.root.ids.id_myaddress.toggleAction(self) \ No newline at end of file diff --git a/src/bitmessagekivy/kv/network.kv b/src/bitmessagekivy/kv/network.kv index b77dea26..829f8b3e 100644 --- a/src/bitmessagekivy/kv/network.kv +++ b/src/bitmessagekivy/kv/network.kv @@ -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' diff --git a/src/bitmessagekivy/main.kv b/src/bitmessagekivy/main.kv index 1b2a337b..231f0dbe 100644 --- a/src/bitmessagekivy/main.kv +++ b/src/bitmessagekivy/main.kv @@ -261,7 +261,7 @@ MDNavigationLayout: Setting: id:sc9 MyAddress: - id:sc10 + id:id_myaddress AddressBook: id:sc11 Payment: diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 001b7859..a40a4861 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -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) diff --git a/src/bitmessagekivy/uikivysignaler.py b/src/bitmessagekivy/uikivysignaler.py index 92829adc..102a8810 100644 --- a/src/bitmessagekivy/uikivysignaler.py +++ b/src/bitmessagekivy/uikivysignaler.py @@ -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)