EtalumaSupport / LumaViewPro

MIT License
6 stars 6 forks source link

Crash in 1.8- GUI bug #363

Closed ericweiner closed 2 months ago

ericweiner commented 6 months ago

in v1.8

Steps to reproduce:

(if that doesn't make it crash, then delete the number, then press escape)

Crash: [INFO ] [LVP Main ] MicroscopeSettings.frame_size() [INFO ] [Base ] Leaving application in progress... Traceback (most recent call last): File "C:\Users\chris\Downloads\LumaViewPro-main-1.8\LumaViewPro-main\lumaviewpro.py", line 5462, in LumaViewProApp().run() File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\app.py", line 956, in run runTouchApp() File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\base.py", line 574, in runTouchApp EventLoop.mainloop() File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\base.py", line 341, in mainloop self.window.mainloop() File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\core\window\window_sdl2.py", line 776, in mainloop if self.dispatch('on_key_down', key, File "kivy_event.pyx", line 727, in kivy._event.EventDispatcher.dispatch File "kivy_event.pyx", line 1307, in kivy._event.EventObservers.dispatch File "kivy_event.pyx", line 1231, in kivy._event.EventObservers._dispatch File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\core\window__init.py", line 163, in _on_window_key_down return self.dispatch('on_key_down', keycode, text, modifiers) File "kivy_event.pyx", line 727, in kivy._event.EventDispatcher.dispatch File "kivy_event.pyx", line 1307, in kivy._event.EventObservers.dispatch File "kivy_event.pyx", line 1231, in kivy._event.EventObservers._dispatch File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\uix\textinput.py", line 2936, in keyboard_on_key_down self.focus = False File "kivy\properties.pyx", line 520, in kivy.properties.Property.set File "kivy\properties.pyx", line 567, in kivy.properties.Property.set File "kivy\properties.pyx", line 606, in kivy.properties.Property._dispatch File "kivy_event.pyx", line 1307, in kivy._event.EventObservers.dispatch File "kivy_event.pyx", line 1189, in kivy._event.EventObservers._dispatch File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\lang\builder.py", line 55, in custom_callback exec(kvlang__.co_value, idmap) File "C:\Users\chris\Downloads\LumaViewPro-main-1.8\LumaViewPro-main\lumaviewpro.kv", line 1637, in on_focus: if not self.focus: root.frame_size() File "C:\Users\chris\Downloads\LumaViewPro-main-1.8\LumaViewPro-main\lumaviewpro.py", line 4757, in frame_size w = int(self.ids['frame_width_id'].text) ValueError: invalid literal for int() with base 10: ''

ericweiner commented 5 months ago

Can we add the same validation we added in issue #364 into every single text/number input box?

So they only allow 0-9 and "."

jmcoreymv commented 5 months ago

This should be resolved on the feature/imagej branch now.

ericweiner commented 5 months ago

now pressing escape quits the program. Gracefully, it does not crash. This same thing happens in the previous version (1.8). So I guess this is the default behavior in Kivy..? Is this possible to change? (this is true regardless of where the cursor is).

jmcoreymv commented 5 months ago

I've updated the feature/imagej branch to disable the program exit when pressing the escape key.

ericweiner commented 5 months ago

Using ImageJ branch from 5/28

if you type in an non-number into the resolution box, it crashes. Could we do my second suggestion above, to only allow 0-9 and "." in all numerical boxes?

Traceback (most recent call last): File "C:\Users\chris\Downloads\LumaViewPro-feature-imagej-2024-05-28\LumaViewPro-feature-imagej\lumaviewpro.py", line 5005, in LumaViewProApp().run() File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\app.py", line 956, in run runTouchApp() File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\base.py", line 574, in runTouchApp EventLoop.mainloop() File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\base.py", line 341, in mainloop self.window.mainloop() File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\core\window\window_sdl2.py", line 776, in mainloop if self.dispatch('on_key_down', key, File "kivy\_event.pyx", line 727, in kivy._event.EventDispatcher.dispatch File "kivy\_event.pyx", line 1307, in kivy._event.EventObservers.dispatch File "kivy\_event.pyx", line 1231, in kivy._event.EventObservers._dispatch File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\core\window__init.py", line 163, in _on_window_key_down return self.dispatch('on_key_down', keycode, text, modifiers) File "kivy\_event.pyx", line 727, in kivy._event.EventDispatcher.dispatch File "kivy\_event.pyx", line 1307, in kivy._event.EventObservers.dispatch File "kivy\_event.pyx", line 1231, in kivy._event.EventObservers._dispatch File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\uix\textinput.py", line 2984, in keyboard_on_key_down self._key_down(key) File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\uix\textinput.py", line 2890, in _key_down self.dispatch('on_text_validate') File "kivy\_event.pyx", line 727, in kivy._event.EventDispatcher.dispatch File "kivy\_event.pyx", line 1307, in kivy._event.EventObservers.dispatch File "kivy\_event.pyx", line 1191, in kivy._event.EventObservers._dispatch File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\lang\builder.py", line 60, in custom_callback exec(kvlang__.co_value, idmap) File "C:\Users\chris\Downloads\LumaViewPro-feature-imagej-2024-05-28\LumaViewPro-feature-imagej\lumaviewpro.kv", line 1700, in on_text_validate: root.frame_size() File "C:\Users\chris\Downloads\LumaViewPro-feature-imagej-2024-05-28\LumaViewPro-feature-imagej\lumaviewpro.py", line 4247, in frame_size lumaview.scope.set_frame_size(width, height) File "C:\Users\chris\Downloads\LumaViewPro-feature-imagej-2024-05-28\LumaViewPro-feature-imagej\lumascope_api.py", line 523, in set_frame_size self.camera.set_frame_size(w, h) File "C:\Users\chris\Downloads\LumaViewPro-feature-imagej-2024-05-28\LumaViewPro-feature-imagej\pyloncamera.py", line 282, in set_frame_size camera.Width.SetValue(width) File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\pypylon\genicam.py", line 1903, in SetValue return _genicam.IInteger_SetValue(self, Value, Verify) _genicam.OutOfRangeException: Value = 0 must be equal or greater than Min = 4. : OutOfRangeException thrown in node 'Width' while calling 'Width.SetValue()' (file 'integert.h', line 79)

ericweiner commented 5 months ago

The escape key fix works- the program no longer exits.

ericweiner commented 5 months ago

This happens if you enter in a letter in the "step size" dialog, for example.

Traceback (most recent call last): File "C:\Users\chris\Downloads\LumaViewPro-feature-imagej-2024-05-28\LumaViewPro-feature-imagej\lumaviewpro.py", line 5005, in LumaViewProApp().run() File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\app.py", line 956, in run runTouchApp() File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\base.py", line 574, in runTouchApp EventLoop.mainloop() File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\base.py", line 339, in mainloop self.idle() File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\base.py", line 383, in idle self.dispatch_input() File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\base.py", line 334, in dispatch_input post_dispatch_input(*pop(0)) File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\base.py", line 263, in post_dispatch_input listener.dispatch('on_motion', etype, me) File "kivy\_event.pyx", line 731, in kivy._event.EventDispatcher.dispatch File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\core\window__init.py", line 1714, in on_motion FocusBehavior._handle_post_on_touch_up(me) File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\uix\behaviors\focus.py", line 488, in _handle_post_on_touch_up focusable.focus = False File "kivy\properties.pyx", line 520, in kivy.properties.Property.set File "kivy\properties.pyx", line 567, in kivy.properties.Property.set File "kivy\properties.pyx", line 606, in kivy.properties.Property._dispatch File "kivy\_event.pyx", line 1307, in kivy._event.EventObservers.dispatch File "kivy\_event.pyx", line 1189, in kivy._event.EventObservers._dispatch File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\kivy\lang\builder.py", line 60, in custom_callback exec(kvlang__.co_value, idmap) File "C:\Users\chris\Downloads\LumaViewPro-feature-imagej-2024-05-28\LumaViewPro-feature-imagej\lumaviewpro.kv", line 485, in on_focus: if not self.focus: root.set_steps() File "C:\Users\chris\Downloads\LumaViewPro-feature-imagej-2024-05-28\LumaViewPro-feature-imagej\lumaviewpro.py", line 4452, in set_steps settings['zstack']['step_size'] = float(self.ids['zstack_stepsize_id'].text) ValueError: could not convert string to float: ''

jmcoreymv commented 5 months ago

I've updated the feature/imagej branch to resolve all the input boxes I've found. They already had Kivy input filters applied to them to limit the characters to be integer or float (as required), but the issue stemmed from leaving the field blank. This was then interpreted as a string and failed to cast to int/float.

In the frame size resolution error, I added boundary checking based on what the camera will allow (for both min and max) now.