Skip to content

Commit

Permalink
Avoid to load the kv file multiple times (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
misl6 authored Dec 13, 2021
1 parent 065f369 commit f9a240b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/kivy_garden/xcamera/xcamera.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,14 @@ class XCameraIconButton(ButtonBehavior, Label):

class XCamera(Camera):
directory = ObjectProperty(None)
kv_loaded = False
_previous_orientation = None
__events__ = ('on_picture_taken', 'on_camera_ready')

def __init__(self, **kwargs):
Builder.load_file(os.path.join(ROOT, "xcamera.kv"))
if not XCamera.kv_loaded:
Builder.load_file(os.path.join(ROOT, "xcamera.kv"))
XCamera.kv_loaded = True
super().__init__(**kwargs)

def _on_index(self, *largs):
Expand Down

0 comments on commit f9a240b

Please sign in to comment.