Hello,
I have created a modified version of the dialogs module. In the forms dialogs, in addition to the included row types "text", "number", "check", "date", etc...., I added a row type "photo" that displays two buttons: take photo, and show photo. The "take photo" button calls the following function:
def take_photo(self, sender):
image = photos.capture_image()
if image:
time_now = datetime.datetime.now().strftime('%c')
photo_hash = hashlib.sha1(time_now.encode('UTF-8')).hexdigest()
self.card_photo_path = 'capture/' + photo_hash + '.jpeg'
self.values[self.photo_key] = self.card_photo_path
image.save(self.card_photo_path)
For those familiar with the dialogs module, you will recognize self.values[]. Also, the dialogs module uses a self.container_view variable of type_FormContainerView which contains all the ui elements of the form dialog.
When photos.capture_image() is called, the camera screen appears correctly. The problem I am facing is that at that point, self.container_view changes to NoneType. Specifically, I call the camera, camera view shows up, image is taken and saved correctly to the capture folder. And the view is returned to the form dialogs. At that point if I press on the Done button in the top right corner, I get an error NoneType has no attribute 'close' . The done button leads to calling self.container_view.close()
The change of type from _FormContainerView to NoneType occurs when photos.image_capture() is called.
Any help explaining this behaviour is appreciated. Sorry for the long message, don't know how to describe this in a shorter way.
G