From eb878bff77b6a7f52eb57cf48a1b979a94497b01 Mon Sep 17 00:00:00 2001 From: navjot Date: Wed, 10 Feb 2021 00:48:36 +0530 Subject: [PATCH 1/2] Fixed android app crashing and build crashing issue --- src/bitmessagekivy/main.kv | 2 +- src/bitmessagekivy/mpybit.py | 45 +++++++++++++++++++++--------------- src/buildozer.spec | 2 +- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/bitmessagekivy/main.kv b/src/bitmessagekivy/main.kv index b58b54c2..3960b38c 100644 --- a/src/bitmessagekivy/main.kv +++ b/src/bitmessagekivy/main.kv @@ -132,7 +132,7 @@ background_normal: '' background_color: app.theme_cls.primary_color #background_color: (0.62,0.67,0.72,1) - values: app.variable_1 + # values: app.variable_1 on_text:app.getCurrentAccountData(self.text) # Image: # source: app.get_default_image() diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index b2bf4b0b..5aa97174 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -532,7 +532,10 @@ class MyAddress(Screen): try: meny.canvas.children[6].rgba = [0, 0, 0, 0] if is_enable == 'true' else [0.5, 0.5, 0.5, 0.5] except Exception: - meny.canvas.children[9].rgba = [0, 0, 0, 0] if is_enable == 'true' else [0.5, 0.5, 0.5, 0.5] + try: + meny.canvas.children[9].rgba = [0, 0, 0, 0] if is_enable == 'true' else [0.5, 0.5, 0.5, 0.5] + except Exception as e: + print('Exception: ', e) meny.add_widget(AvatarSampleWidget( source=state.imageDir + '/text_images/{}.png'.format( avatarImageFirstLetter(item['text'].strip())))) @@ -620,6 +623,7 @@ class MyAddress(Screen): self.init_ui() self.ids.refresh_layout.refresh_done() self.tick = 0 + Clock.schedule_once(self.address_permision_callback, 0) Clock.schedule_once(refresh_callback, 1) @staticmethod @@ -1948,24 +1952,25 @@ class NavigateApp(MDApp): def getCurrentAccountData(self, text): """Get Current Address Account Data""" - if os.path.exists(state.imageDir + '/default_identicon/{}.png'.format(text)): - self.load_selected_Image(text) - else: - self.set_identicon(text) - self.root.ids.content_drawer.ids.reset_image.opacity = 0 - self.root.ids.content_drawer.ids.reset_image.disabled = True - address_label = self.current_address_label( - BMConfigParser().get(text, 'label'), text) - self.root_window.children[1].ids.toolbar.title = address_label - state.association = text - state.searcing_text = '' - LoadingPopup().open() - self.set_message_count() - for nav_obj in self.root.ids.content_drawer.children[ - 0].children[0].children[0].children: - nav_obj.active = True if nav_obj.text == 'Inbox' else False - self.fileManagerSetting() - Clock.schedule_once(self.setCurrentAccountData, 0.5) + if text != '': + if os.path.exists(state.imageDir + '/default_identicon/{}.png'.format(text)): + self.load_selected_Image(text) + else: + self.set_identicon(text) + self.root.ids.content_drawer.ids.reset_image.opacity = 0 + self.root.ids.content_drawer.ids.reset_image.disabled = True + address_label = self.current_address_label( + BMConfigParser().get(text, 'label'), text) + self.root_window.children[1].ids.toolbar.title = address_label + state.association = text + state.searcing_text = '' + LoadingPopup().open() + self.set_message_count() + for nav_obj in self.root.ids.content_drawer.children[ + 0].children[0].children[0].children: + nav_obj.active = True if nav_obj.text == 'Inbox' else False + self.fileManagerSetting() + Clock.schedule_once(self.setCurrentAccountData, 0.5) def fileManagerSetting(self): """This method is for file manager setting""" @@ -3183,6 +3188,8 @@ class CustomSpinner(Spinner): """Method used for setting size of spinner""" super(CustomSpinner, self).__init__(*args, **kwargs) self.dropdown_cls.max_height = Window.size[1] / 3 + self.values = list(addr for addr in BMConfigParser().addresses() + if BMConfigParser().get(str(addr), 'enabled') == 'true') class Allmails(Screen): diff --git a/src/buildozer.spec b/src/buildozer.spec index 85343d31..6f003918 100644 --- a/src/buildozer.spec +++ b/src/buildozer.spec @@ -41,7 +41,7 @@ requirements = android, openssl, sqlite3, - kivy, + kivy==1.11.1, pyjnius==1.2.1, libiconv, libzbar, From b3d0f4c7c2888db29dda5ec7b764e2c50c552afd Mon Sep 17 00:00:00 2001 From: navjot Date: Wed, 10 Feb 2021 13:40:35 +0530 Subject: [PATCH 2/2] fixed flake8 CQ issues --- src/bitmessagekivy/mpybit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 5aa97174..7d2bdd7a 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -3189,7 +3189,7 @@ class CustomSpinner(Spinner): super(CustomSpinner, self).__init__(*args, **kwargs) self.dropdown_cls.max_height = Window.size[1] / 3 self.values = list(addr for addr in BMConfigParser().addresses() - if BMConfigParser().get(str(addr), 'enabled') == 'true') + if BMConfigParser().get(str(addr), 'enabled') == 'true') class Allmails(Screen):