kpiorno / kivy3dgui

Pure Kivy library to display and interact with Kivy widgets in a 3D mesh.
MIT License
127 stars 29 forks source link

checkers.py crashes on a touchscreen with kivy 2.1 #20

Closed schoolsplay closed 1 year ago

schoolsplay commented 1 year ago

On a desktop with a mouse everything works ok. But on a touchscreen, HP All-in-One system the checkers.py crashed. I suspect the problem lies in the fact that on a touchscreen a "touch_move" event is generated iso a "touch_up/down". Both systems are Ubuntu 22.04 with a python v3.8 virtual environment with kivy 2.1 installed and the kivy3dgui placed inside the tree.

To reproduce, start checkers.py and touch any stone.

This is the complete traceback:

[.[1;32mINFO.[0m   ] [Logger      ] Record log in /home/user/.kivy/logs/kivy_22-09-22_5.txt
[.[1;32mINFO.[0m   ] [Kivy        ] v2.1.0
[.[1;32mINFO.[0m   ] [Kivy        ] Installed at "/opt/App/.venv3.8/lib/python3.8/site-packages/kivy/__init__.py"
[.[1;32mINFO.[0m   ] [Python      ] v3.8.13 (default, Apr 19 2022, 02:32:06)
[GCC 11.2.0]
[.[1;32mINFO.[0m   ] [Python      ] Interpreter at "/opt/App/.venv3.8/bin/python3"
[.[1;32mINFO.[0m   ] [Logger      ] Purge log fired. Processing...
[.[1;32mINFO.[0m   ] [Logger      ] Purge finished!
[.[1;32mINFO.[0m   ] [Factory     ] 189 symbols loaded
[.[1;32mINFO.[0m   ] [ImageLoaderFFPy] Using ffpyplayer 4.3.1
[.[1;32mINFO.[0m   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_ffpyplayer
[.[1;32mINFO.[0m   ] [Text        ] Provider: sdl2
[.[1;32mINFO.[0m   ] [Window      ] Provider: sdl2
[.[1;32mINFO.[0m   ] [GL          ] Using the "OpenGL" graphics system
[.[1;32mINFO.[0m   ] [GL          ] Backend used <sdl2>
[.[1;32mINFO.[0m   ] [GL          ] OpenGL version <b'4.6 (Compatibility Profile) Mesa 22.0.1'>
[.[1;32mINFO.[0m   ] [GL          ] OpenGL vendor <b'Intel'>
[.[1;32mINFO.[0m   ] [GL          ] OpenGL renderer <b'Mesa Intel(R) UHD Graphics 610 (CFL GT1)'>
[.[1;32mINFO.[0m   ] [GL          ] OpenGL parsed version: 4, 6
[.[1;32mINFO.[0m   ] [GL          ] Shading version <b'4.60'>
[.[1;32mINFO.[0m   ] [GL          ] Texture max size <16384>
[.[1;32mINFO.[0m   ] [GL          ] Texture max units <32>
[.[1;32mINFO.[0m   ] [Window      ] auto add sdl2 input provider
[.[1;32mINFO.[0m   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[.[1;32mINFO.[0m   ] [GL          ] NPOT texture support is available
[.[1;32mINFO.[0m   ] [Shader      ] Read </opt/App/BtpKivy_Xf_16.6/kivy3dgui/gles2.0/toonshader/toon_shadows.glsl>
[.[1;32mINFO.[0m   ] [Shader      ] Read </opt/App/BtpKivy_Xf_16.6/kivy3dgui/gles2.0/shaders/shadowpass.glsl>
[.[1;32mINFO.[0m   ] [Shader      ] Read </opt/App/BtpKivy_Xf_16.6/kivy3dgui/gles2.0/shaders/selection.glsl>
[.[1;32mINFO.[0m   ] [Shader      ] Read </opt/App/BtpKivy_Xf_16.6/kivy3dgui/gles2.0/shaders/dop.glsl>
[.[1;32mINFO.[0m   ] [ProbeSysfs  ] device match: /dev/input/event8
[.[1;32mINFO.[0m   ] [MTD         ] Read event from </dev/input/event8>
[.[1;32mINFO.[0m   ] [Base        ] Start application main loop
[.[1;32mINFO.[0m   ] [MTD         ] </dev/input/event8> range position X is 0 - 4095
[.[1;32mINFO.[0m   ] [MTD         ] </dev/input/event8> range position Y is 0 - 4095
[.[1;32mINFO.[0m   ] [MTD         ] </dev/input/event8> range touch major is 0 - 0
[.[1;32mINFO.[0m   ] [MTD         ] </dev/input/event8> range touch minor is 0 - 0
[.[1;32mINFO.[0m   ] [MTD         ] </dev/input/event8> range pressure is 0 - 255
[.[1;32mINFO.[0m   ] [MTD         ] </dev/input/event8> axes invertion: X is 0, Y is 0
[.[1;32mINFO.[0m   ] [MTD         ] </dev/input/event8> rotation set to 0
[.[1;32mINFO.[0m   ] [Base        ] Leaving application in progress...
 Traceback (most recent call last):
   File "checker.py", line 136, in <module>
     CheckerApp().run()
   File "/opt/App/.venv3.8/lib/python3.8/site-packages/kivy/app.py", line 955, in run
     runTouchApp()
   File "/opt/App/.venv3.8/lib/python3.8/site-packages/kivy/base.py", line 574, in runTouchApp
     EventLoop.mainloop()
   File "/opt/App/.venv3.8/lib/python3.8/site-packages/kivy/base.py", line 339, in mainloop
     self.idle()
   File "/opt/App/.venv3.8/lib/python3.8/site-packages/kivy/base.py", line 383, in idle
     self.dispatch_input()
   File "/opt/App/.venv3.8/lib/python3.8/site-packages/kivy/base.py", line 334, in dispatch_input
     post_dispatch_input(*pop(0))
   File "/opt/App/.venv3.8/lib/python3.8/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 "/opt/App/.venv3.8/lib/python3.8/site-packages/kivy/core/window/__init__.py", line 1662, in on_motion
     self.dispatch('on_touch_move', me)
   File "kivy/_event.pyx", line 731, in kivy._event.EventDispatcher.dispatch
   File "/opt/App/.venv3.8/lib/python3.8/site-packages/kivy/core/window/__init__.py", line 1689, in on_touch_move
     if w.dispatch('on_touch_move', touch):
   File "kivy/_event.pyx", line 731, in kivy._event.EventDispatcher.dispatch
   File "/opt/App/.venv3.8/lib/python3.8/site-packages/kivy/uix/widget.py", line 600, in on_touch_move
     if child.dispatch('on_touch_move', touch):
   File "kivy/_event.pyx", line 731, in kivy._event.EventDispatcher.dispatch
   File "/opt/App/BtpKivy_Xf_16.6/kivy3dgui/canvas3d.py", line 770, in on_touch_move
     if 'right' in t_touch.button:
 TypeError: argument of type 'NoneType' is not iterable
schoolsplay commented 1 year ago

Fixed by disabling the mouse events on MTD devices by setting the config option "mouse=none". It turn out that Kivy 2.1 (with python3.8) generates double events even with the config option "disable_multitouch". The last one doesn't seems to prevent the mouse event being fired. Probably a bug in Kivy 2.1. Will file a bugreport against it.