implemented QrCode scanner feature for android and dekstop app
This commit is contained in:
parent
1afb59a2ad
commit
9333ade8cc
|
@ -60,6 +60,8 @@ class ScanScreen(Screen):
|
|||
else:
|
||||
print("Camera is not available!")
|
||||
self.camera_avaialbe = False
|
||||
else:
|
||||
self.camera_avaialbe = True
|
||||
|
||||
def get_screen(self, screen_name, instance=None):
|
||||
"""This method is used for getting previous screen name"""
|
||||
|
@ -74,7 +76,8 @@ class ScanScreen(Screen):
|
|||
"""
|
||||
if not self.children:
|
||||
tmp = Builder.load_file(
|
||||
os.path.join(os.path.dirname(__file__), "kv/{}.kv").format("scanner")
|
||||
os.path.join(
|
||||
os.path.dirname(os.path.dirname(__file__)), "kv/{}.kv").format("scanner")
|
||||
)
|
||||
self.add_widget(tmp)
|
||||
if platform == "android":
|
||||
|
|
|
@ -58,11 +58,11 @@ import ast
|
|||
|
||||
from bitmessagekivy.baseclass.common import toast
|
||||
|
||||
from kivy_garden.zbarcam import ZBarCam
|
||||
from pyzbar.pyzbar import ZBarSymbol
|
||||
|
||||
if platform != "android":
|
||||
from kivy.config import Config
|
||||
from kivy_garden.zbarcam import ZBarCam
|
||||
from pyzbar.pyzbar import ZBarSymbol
|
||||
|
||||
Config.set("input", "mouse", "mouse, multitouch_on_demand")
|
||||
elif platform == "android":
|
||||
from jnius import autoclass, cast
|
||||
|
@ -944,10 +944,10 @@ class NavigateApp(MDApp):
|
|||
print("Purchasing {} through {}".format(self.product_id, method_name))
|
||||
|
||||
def _after_scan(self, text):
|
||||
if platform == 'android':
|
||||
text = cast(CharSequence, String(text))
|
||||
show_toast(text, Toast.LENGTH_SHORT)
|
||||
elif self.root.ids.sc23.previous_open_screen == 'composer':
|
||||
# if platform == 'android':
|
||||
# toast_txt = cast(CharSequence, String(text))
|
||||
# show_toast(toast_txt, Toast.LENGTH_SHORT)
|
||||
if self.root.ids.sc23.previous_open_screen == 'composer':
|
||||
self.root.ids.sc3.children[1].ids.txt_input.text = text
|
||||
self.root.ids.scr_mngr.current = 'create'
|
||||
elif self.root.ids.sc23.previous_open_screen:
|
||||
|
|
|
@ -46,10 +46,9 @@ requirements =
|
|||
libiconv,
|
||||
libzbar,
|
||||
pillow,
|
||||
pyzbar,
|
||||
bitmsghash,
|
||||
#git+https://github.com/navjotcis/KivyMD#egg=kivymd,
|
||||
git+https://github.com/kivymd/KivyMD#egg=kivymd,
|
||||
#kivymd,
|
||||
qrcode,
|
||||
msgpack
|
||||
|
||||
|
@ -100,7 +99,7 @@ fullscreen = 0
|
|||
#android.presplash_color = #FFFFFF
|
||||
|
||||
# (list) Permissions
|
||||
android.permissions = INTERNET, WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE
|
||||
android.permissions = INTERNET, WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE, CAMERA
|
||||
|
||||
# (int) Target Android API, should be as high as possible.
|
||||
android.api = 29
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
icon_size: dp(70)
|
||||
|
||||
id: camera
|
||||
resolution: 640, 480 #1920, 1080 # #
|
||||
# resolution: 640, 480 #1920, 1080 # #
|
||||
allow_stretch: True
|
||||
|
||||
# Shoot button
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
XCamera:
|
||||
id: xcamera
|
||||
play: True
|
||||
resolution: root.resolution
|
||||
# resolution: root.resolution
|
||||
allow_stretch: True
|
||||
keep_ratio: True
|
||||
center: self.size and proxy.center
|
||||
|
|
Reference in New Issue
Block a user