Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zbarcam.kv (and xcamera.kv) are loaded multiple times #35

Open
misl6 opened this issue Jul 2, 2020 · 1 comment
Open

zbarcam.kv (and xcamera.kv) are loaded multiple times #35

misl6 opened this issue Jul 2, 2020 · 1 comment

Comments

@misl6
Copy link
Collaborator

misl6 commented Jul 2, 2020

Loading multiple times zbarcam.kv

Builder.load_file(os.path.join(MODULE_DIRECTORY, "zbarcam.kv"))

Leads to multiple issues:

The usage is pretty the same mentioned in the example,

DEMO_APP_KV_LANG = """
but it's in a specific "page" of the app (in my case the pages are some FloatLayout managed via https://github.com/kivy-garden/garden.router).

  • Android: First time works fine, also if it logs that the operation could lead to issues. Starting from the second time that the page is opened and xcamera is initialized n times equals to the times the user visited the page that hosts the ZBarcam widget.

  • Ubuntu + OpenCV: First time works fine, also if it logs that the operation could lead to issues. At the second time that the page is visited, this error is thrown:

   File "/mnt/....../venv/lib/python3.8/site-packages/Kivy-2.0.0rc2-py3.8-linux-x86_64.egg/kivy/core/camera/camera_opencv.py", line 120, in init_camera
     self._resolution = (int(frame.shape[1]), int(frame.shape[0]))
 AttributeError: 'NoneType' object has no attribute 'shape'
@AndreMiras
Copy link
Collaborator

Thanks for the report. How about using a class attribute to known if it has been loaded already?
Also if we do so we should probably demo it with a unit test so we don't introduce a regression

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants