Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/kivy_garden/zbarcam/zbarcam.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
import os
from collections import namedtuple

Expand Down Expand Up @@ -210,3 +211,19 @@ def stop(self):
self.xcamera.play = False
if platform == "android":
self.xcamera._camera._release_camera()

def unload_zbarcam(self):
id ZBarCam.kv_loaded:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean if?
Pity we no longer have working tests for this repo, this would have been caught easily

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, sorry for typo.

I will fix this and create a new commit

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pity we no longer have working tests for this repo, this would have been caught easily

Maybe I can work with some github-action to do this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we would love to 👍

# unload zbarcam.kv
zbar_kv_path = os.path.join(MODULE_DIRECTORY, 'zbarcam.kv')
Builder.unload_file(zbar_kv_path)

# unload xcamera.kv
mod_path = os.path.dirname(
sys.modules['kivy_garden.xcamera'].__file__
)
xcam_kv_path = os.path.join(mod_path, 'xcamera.kv')
Builder.unload_file(xcam_kv_path)

# set kv_loaded = false
ZBarCam.kv_loaded = False