From 1b82088409292adbddd86b46c788387e78b7b84b Mon Sep 17 00:00:00 2001 From: navjot Date: Fri, 12 Jun 2020 21:29:57 +0530 Subject: [PATCH] fixed android image path issue and fixed APK creation issue --- src/api.py | 6 +- src/bitmessagekivy/kv/login.kv | 109 ++++++++++----------------------- src/bitmessagekivy/main.kv | 2 +- src/bitmessagekivy/mpybit.py | 14 ++--- src/buildozer.spec | 8 +-- src/main.py | 2 +- 6 files changed, 47 insertions(+), 94 deletions(-) diff --git a/src/api.py b/src/api.py index 37b94603..7e18b248 100644 --- a/src/api.py +++ b/src/api.py @@ -1226,7 +1226,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): initialHash = hashlib.sha512(encryptedPayload).digest() trialValue, nonce = proofofwork.run(target, initialHash) with threads.printLock: - print '(For msg message via API) Found proof of work', trialValue, 'Nonce:', nonce + print('(For msg message via API) Found proof of work', trialValue, 'Nonce:', nonce) try: print( 'POW took', int(time.time() - powStartTime), @@ -1245,7 +1245,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): int(time.time()) + TTL, '' ) with threads.printLock: - print 'Broadcasting inv for msg(API disseminatePreEncryptedMsg command):', hexlify(inventoryHash) + print('Broadcasting inv for msg(API disseminatePreEncryptedMsg command):', hexlify(inventoryHash)) queues.invQueue.put((toStreamNumber, inventoryHash)) def HandleTrashSentMessageByAckDAta(self, params): @@ -1299,7 +1299,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): objectType, pubkeyStreamNumber, payload, int(time.time()) + TTL, '' ) with threads.printLock: - print 'broadcasting inv within API command disseminatePubkey with hash:', hexlify(inventoryHash) + print('broadcasting inv within API command disseminatePubkey with hash:', hexlify(inventoryHash)) queues.invQueue.put((pubkeyStreamNumber, inventoryHash)) def HandleGetMessageDataByDestinationHash(self, params): diff --git a/src/bitmessagekivy/kv/login.kv b/src/bitmessagekivy/kv/login.kv index 22e86689..d09cb4f6 100644 --- a/src/bitmessagekivy/kv/login.kv +++ b/src/bitmessagekivy/kv/login.kv @@ -84,43 +84,6 @@ on_press: app.root.ids.sc7.reset_address_label(app) - - Screen: - name: "label_screen" - BoxLayout: - orientation: "vertical" - padding: 0, dp(5), 0, dp(5) - spacing: dp(5) - - #label area - AnchorLayout: - size_hint_y: None - height: dp(50) - MDLabel: - text: "Enter a label to generate address for:" - bold: True - halign: "center" - theme_text_color: "Custom" - text_color: .4,.4,.4,1 - - AnchorLayout: - size_hint_y: None - height: dp(40) - MDTextField: - hint_text: "Label" - required: True - size_hint_x: None - width: dp(190) - - AnchorLayout: - MDFillRoundFlatIconButton: - icon: "chevron-double-right" - text: "Proceed Next" - - Widget: - - - #info-area-outer BoxLayout: size_hint_y: .47 @@ -179,6 +142,9 @@ id:add_random_bx #buttons-area-outer BoxLayout: + orientation: "vertical" + # padding: 0, dp(5), 0, dp(5) + # spacing: dp(5) size_hint_y: .53 canvas: Color: @@ -186,48 +152,37 @@ Rectangle: pos: self.pos size: self.size - - ScreenManager: - id: check_screenmgr - Screen: - name: "label_screen" - BoxLayout: - orientation: "vertical" - padding: 0, dp(5), 0, dp(5) - spacing: dp(5) - #label area - AnchorLayout: - size_hint_y: None - height: dp(50) - MDLabel: - text: "Enter a label to generate address for:" - bold: True - halign: "center" - theme_text_color: "Custom" - text_color: .4,.4,.4,1 - - AnchorLayout: - size_hint_y: None - height: dp(40) - MDTextField: - id:lab - hint_text: "Label" - required: True - size_hint_x: None - width: dp(190) - helper_text_mode: "on_error" - helper_text: "Please enter your label name" - - AnchorLayout: - MDFillRoundFlatIconButton: - icon: "chevron-double-right" - text: "Proceed Next" - on_release: app.root.ids.sc7.generateaddress(app) - - Widget: + #label area + AnchorLayout: + size_hint_y: None + height: dp(50) + MDLabel: + text: "Enter a label to generate address for:" + bold: True + halign: "center" + theme_text_color: "Custom" + text_color: .4,.4,.4,1 - + AnchorLayout: + size_hint_y: None + height: dp(40) + MDTextField: + id:lab + hint_text: "Label" + required: True + size_hint_x: None + width: dp(190) + helper_text_mode: "on_error" + helper_text: "Please enter your label name" + + AnchorLayout: + MDFillRoundFlatIconButton: + icon: "chevron-double-right" + text: "Proceed Next" + on_release: app.root.ids.sc7.generateaddress(app) + + Widget: #info-area-outer BoxLayout: diff --git a/src/bitmessagekivy/main.kv b/src/bitmessagekivy/main.kv index d52de7da..a924d04e 100644 --- a/src/bitmessagekivy/main.kv +++ b/src/bitmessagekivy/main.kv @@ -16,7 +16,7 @@ #:import MDScrollViewRefreshLayout kivymd.uix.refreshlayout.MDScrollViewRefreshLayout #:import MDSpinner kivymd.uix.spinner.MDSpinner #:import MDTabsBase kivymd.uix.tab.MDTabsBase -#:import ZBarSymbol pyzbar.pyzbar.ZBarSymbol +##:import ZBarSymbol pyzbar.pyzbar.ZBarSymbol #:set color_button (0.784, 0.443, 0.216, 1) # brown diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index c2185483..21cda203 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -5,7 +5,6 @@ Bitmessage android(mobile) interface # pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation # pylint: disable=protected-access - from sys import platform as _sys_platform from os import environ @@ -139,10 +138,10 @@ from datetime import datetime from kivymd.uix.behaviors.elevation import RectangularElevationBehavior from kivymd.uix.bottomsheet import MDCustomBottomSheet from kivy.effects.dampedscroll import DampedScrollEffect -from kivy_garden.zbarcam import ZBarCam -from pyzbar.pyzbar import ZBarSymbol if platform != 'android': + from pyzbar.pyzbar import ZBarSymbol + from kivy_garden.zbarcam import ZBarCam from kivy.config import Config Config.set('input', 'mouse', 'mouse,multitouch_on_demand') # pylint: disable=too-few-public-methods,too-many-arguments,attribute-defined-outside-init @@ -1148,9 +1147,8 @@ class Random(Screen): entered_label = str(self.ids.lab.text).strip() if not entered_label: self.ids.lab.focus = True - # self.ids.add_random_bx.children[0].ids.label.focus = True - # self.ids.label.error = True - # self.ids.label.helper_text = 'This field is required' + #self.ids.lab.error = True + #self.ids.lab.helper_text = 'This field is required' streamNumberForAddress = 1 eighteenByteRipe = False nonceTrialsPerByte = 1000 @@ -1766,7 +1764,7 @@ class NavigateApp(MDApp): BMConfigParser().addresses()[0])): android_path = os.path.join( os.environ['ANDROID_PRIVATE'] + '/app/') - img.texture.save('{1}/kivy/default_identicon/{0}.png'.format( + img.texture.save('{1}/images/kivy/default_identicon/{0}.png'.format( BMConfigParser().addresses()[0], android_path)) else: if not os.path.exists(state.imageDir + '/default_identicon/{}.png'.format( @@ -2220,7 +2218,7 @@ class NavigateApp(MDApp): if platform == 'android': android_path = os.path.join( os.environ['ANDROID_PRIVATE'] + '/app/') - newImg.save('{1}/kivy/default_identicon/{0}.png'.format( + newImg.save('{1}/images/kivy/default_identicon/{0}.png'.format( state.association, android_path)) else: if not os.path.exists(state.imageDir + '/default_identicon/'): diff --git a/src/buildozer.spec b/src/buildozer.spec index 7410e96e..f8a1684e 100644 --- a/src/buildozer.spec +++ b/src/buildozer.spec @@ -1,13 +1,13 @@ [app] # (str) Title of your application -title = tor +title = py3 # (str) Package name -package.name = tor +package.name = py3 # (str) Package domain (needed for android/ios packaging) -package.domain = org.kel +package.domain = org.test # (str) Source code where the main.py live source.dir = . @@ -239,7 +239,7 @@ android.sdk = 20 #android.copy_libs = 1 # (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86, x86_64 -android.arch = arm64-v8a +android.arch = armeabi-v7a # # Python for android (p4a) specific diff --git a/src/main.py b/src/main.py index 4adbb1ae..3c2aea7b 100644 --- a/src/main.py +++ b/src/main.py @@ -1,8 +1,8 @@ """This module is for thread start.""" import state -from bitmessagemain import main if __name__ == '__main__': state.kivy = True print("Kivy Loading......") + from bitmessagemain import main main() \ No newline at end of file