Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LUIInputField does not work anymore when pressing a button #53

Open
nerdnils opened this issue Jan 16, 2019 · 19 comments
Open

LUIInputField does not work anymore when pressing a button #53

nerdnils opened this issue Jan 16, 2019 · 19 comments

Comments

@nerdnils
Copy link

This is the error I get on Keydown:

Traceback (most recent call last):
File "luibuiltin/LUIInputField.py", line 139, in on_keydown
self.trigger_event("changed", self._value)
TypeError: Arguments must match:
trigger_event(const LUIBaseElement self, str event_name, unicode message, const LPoint2f coords)
trigger_event(const LUIBaseElement self, LUIEventData data)

:util(error): Exception occurred in PythonCallbackObject
Traceback (most recent call last):
File "luibuiltin/LUIInputField.py", line 105, in on_tick
frame_time = globalClock.get_frame_time() - self._tickstart
File "luibuiltin/LUIInputField.py", line 139, in on_keydown
self.trigger_event("changed", self._value)
TypeError: Arguments must match:
trigger_event(const LUIBaseElement self, str event_name, unicode message, const LPoint2f coords)
trigger_event(const LUIBaseElement self, LUIEventData data)

:util(error): Exception occurred in PythonCallbackObject
Traceback (most recent call last):
File "/usr/share/panda3d/direct/showbase/ShowBase.py", line 1987, in __igLoop
self.graphicsEngine.renderFrame()
File "luibuiltin/LUIInputField.py", line 105, in on_tick
frame_time = globalClock.get_frame_time() - self._tickstart
File "luibuiltin/LUIInputField.py", line 139, in on_keydown
self.trigger_event("changed", self._value)
TypeError: Arguments must match:
trigger_event(const LUIBaseElement self, str event_name, unicode message, const LPoint2f coords)
trigger_event(const LUIBaseElement self, LUIEventData data)

:task(error): Exception occurred in PythonTask igLoop
Traceback (most recent call last):
File "main.py", line 338, in
spiel.run()
File "/usr/share/panda3d/direct/showbase/ShowBase.py", line 3109, in run
self.taskMgr.run()
File "/usr/share/panda3d/direct/task/Task.py", line 531, in run
self.step()
File "/usr/share/panda3d/direct/task/Task.py", line 485, in step
self.mgr.poll()
File "/usr/share/panda3d/direct/showbase/ShowBase.py", line 1987, in __igLoop
self.graphicsEngine.renderFrame()
File "luibuiltin/LUIInputField.py", line 105, in on_tick
frame_time = globalClock.get_frame_time() - self._tickstart
File "luibuiltin/LUIInputField.py", line 139, in on_keydown
self.trigger_event("changed", self._value)
TypeError: Arguments must match:
trigger_event(const LUIBaseElement self, str event_name, unicode message, const LPoint2f coords)
trigger_event(const LUIBaseElement self, LUIEventData data)

@JoelStienlet
Copy link
Contributor

Hello,
Which version of panda are you using?
Does this bug also appear when running Demos/B_InputField.py ?
I've tried LUI's demo with the latest github's version of panda with python3, but sadly I haven't been able to reproduce this bug.

@nerdnils
Copy link
Author

panda v1.10.0.r48.gcb375f5758-1
Demos/B_InputField.py throws this error:
Traceback (most recent call last):
File "B_InputField.py", line 2, in
from DemoFramework import DemoFramework
File "/home/nils/luigit/LUI/Demos/DemoFramework.py", line 15, in
from LUIRegion import LUIRegion
File "../Builtin/LUIRegion.py", line 7, in
from panda3d.lui import LUIRegion as __LUIRegion
ModuleNotFoundError: No module named 'panda3d.lui'

@JoelStienlet
Copy link
Contributor

This time it looks like the library is not installed. This is strange, because in your first error message python found the library, apparently.
Did you switch between python 2 and python 3 in the meantime? (My install is using python 3, but I converted all the files using 2to3, with some light rework, using this script:
#39
LUI works only with python 2 out of the box.)
To install the library system-wide, you can try copying LUI/lui.so ; LUI/Builtin/.py and LUI/Skins to:
/usr/lib64/python2.7/site-packages/panda3d/
or LUI/Builtin3/
.py etc... to /usr/lib64/python3.7/site-packages/panda3d/ if you use python3.
That should at least solve the "No module named 'panda3d.lui'" problem.

@nerdnils
Copy link
Author

nerdnils commented Jan 20, 2019

Yes, I switched from python2 to python3 but i recompiled lui und put the lui.so into /usr/lib/panda3d/
Let me try to copy it where you suggested and test again.

Update: Nope:
[nils@cab Demos]$ python B_InputField.py
Using deprecated DirectStart interface.
Known pipe types:
glxGraphicsPipe
(all display modules loaded.)
:lui: Loading atlas description from /home/nils/luigit/LUI/Builtin/../Skins/Default/res/atlas.txt
:lui: Loading atlas texture from /home/nils/luigit/LUI/Builtin/../Skins/Default/res/atlas.png
:pnmimage:png(warning): iCCP: known incorrect sRGB profile
:pnmimage:png(warning): iCCP: known incorrect sRGB profile
Traceback (most recent call last):
File "B_InputField.py", line 8, in
f.prepare_demo("LUIInputField")
File "/home/nils/luigit/LUI/Demos/DemoFramework.py", line 82, in prepare_demo
font="header", pos=(120, 27))
File "../Builtin/LUILabel.py", line 23, in init
unicode(text),
NameError: name 'unicode' is not defined

LUIBuiltin is in python2, sorry I thought you where talking about your files… converting…

So after converting Builtin:
[nils@cab Demos]$ python B_InputField.py
Traceback (most recent call last):
File "B_InputField.py", line 2, in
from DemoFramework import DemoFramework
File "/home/nils/luigit/LUI/Demos/DemoFramework.py", line 17, in
from LUISprite import LUISprite
File "../Builtin/LUISprite.py", line 8, in
from .LUIInitialState import LUIInitialState
ImportError: attempted relative import with no known parent package

I guess at this point I need help again :(

@JoelStienlet
Copy link
Contributor

My conversion script actually makes two new folders for the python3 versions of the converted files:
Builtin3
Demos3
And it keeps the old folders "Builtin" and "Demos" unchanged.
The script makes some changes in the .py sources from the demos, so that they reference the correct version in "Builtin3". In the output you have pasted, they try to include the python2 version in "Builtin", because you ran the demos from the "Demos" directory, which is still in python 2.
Sorry, I should have explained this better.
Normally if everything is in python3 (panda and LUI), you should be able to run everything using:
cd /home/nils/luigit/LUI/Demos3/
python3 ./B_InputField.py

@nerdnils
Copy link
Author

So I converted the demos:
[nils@cab Demos]$ python B_InputField.py
Traceback (most recent call last):
File "B_InputField.py", line 2, in
from .DemoFramework import DemoFramework
ModuleNotFoundError: No module named 'main.DemoFramework'; 'main' is not a package

@JoelStienlet
Copy link
Contributor

I was able to reproduce your last error by adding a dot before "DemoFramework" in B_InputField.py L2:
from .DemoFramework import DemoFramework
Then when I run it:
$ python3 ./B_InputField.py
Traceback (most recent call last):
File "./B_InputField.py", line 2, in
from .DemoFramework import DemoFramework
ModuleNotFoundError: No module named 'main.DemoFramework'; 'main' is not a package

The line that is working correctly for me is:
from DemoFramework import DemoFramework

What I don't understand: there is no dot upsteam: https://github.com/tobspr/LUI/blob/master/Demos/B_InputField.py
So I wonder if you indeed have one in your version of B_InputField.py ?

Another point: perhaps your current python install is configured so that the current path is not searched for modules? You may wish to add the following two lines at the beginning of the Demo3 sources if python3 is unable to find "DemoFramework":
import sys
sys.path.append('.')

@nerdnils
Copy link
Author

nerdnils commented Jan 20, 2019

Yes, my Demo-Files and Builtin-Files are full of those dots… after removing them, the Demo seems to work. Only did a very short test for the initial error I posted in this thread.

My original code now throws this:
:lui(error): Atlas 'skin' not found!
Assertion failed: false at line 47 of /home/nils/luigit/LUI/source/./luiAtlasPool.I
Traceback (most recent call last):
File "main.py", line 338, in
spiel = Exitiere()
File "main.py", line 66, in init
self.showMenu()
File "main.py", line 85, in showMenu
self.menu.showMenu()
File "/media/eigene Spiele/exitiers/classes/menu.py", line 62, in showMenu
self._mazeframe = LUIFrame(width=640, style=LUIFrame.FS_sunken)
File "luibuiltin/LUIFrame.py", line 53, in init
self._layout = LUICornerLayout(parent=self, image_prefix=prefix)
File "luibuiltin/LUILayouts.py", line 28, in init
self._parts[i] = LUISprite(self, "blank", "skin")
File "luibuiltin/LUISprite.py", line 17, in init
_LUISprite.init(self, *args)
AssertionError: false at line 47 of /home/nils/luigit/LUI/source/./luiAtlasPool.I

Too late for me today to make sense of it.

@nerdnils
Copy link
Author

Should I open another issue or could this be my fault again?
Could anybody explain those Atlases to me?

@JoelStienlet
Copy link
Contributor

Hello Nils,
The general idea of the Atlas is to group many small graphical items into one big image, and have a file describing the position of each item in this big image.
The default Atlas for the widgets are in: /home/nils/luigit/LUI/Skins/Default/res/
where the "atlas.png" is the big image, and "atlas.txt" describes each element in the atlas.
The Atlas is opened in "LUISkin.py" :
L31: skin_location is set, which is the directory where LUI will look for the skins.
L51: that is where the skin atlas is actually loaded.
My suggestion: perhaps you can replace the relative path L31 by an absolute path, and install the atlas files in /usr/share/LUI/Skins/Default/

@nerdnils
Copy link
Author

nerdnils commented Jan 24, 2019

So I inserted the Skins-Folder into my gamefolder where the relative path should find it… no change.
Changed the path in my gamefolder to an absolute path… no change
Changed the path in /usr/lib64/python3.7/site-packages/panda3d/Builtin/LUISkin.py to an absolute path in /usr/lib64/python3.7/site-packages/panda3d/Skins/Default… no change.

It can't be the error that I used /usr/lib64/python3.7/site-packages/panda3d/Skins/Default and not /usr/share/LUI/Skins/Default/… or could it?

PS: How to set if the Builtin from my gamefolder or from /usr/lib64/python3.7/site-packages/panda3d/Builtin is used? But because I changed both it should not matter… The error says it is using "/media/eigene Spiele/exitiers/luibuiltin/LUIFrame.py"… and there was no "/media/eigene Spiele/exitiers/Skins" so that was the first thing I tried… results see above

@JoelStienlet
Copy link
Contributor

As long as the path in the source files is consistent with the path where the files actually are, it doesn't really matter where you put them.
The advantage of using an absolute path is that the program will run whatever the current working directory may be.

I have a question: do you call LUIDefaultSkin() somewhere?
In DemoFramework.py L56 and L58:
self._skin = LUIDefaultSkin()
self._skin.load()

@nerdnils
Copy link
Author

nerdnils commented Jan 26, 2019

This does not seem to be the same issue… But I am still trying to get the same game to run again…
So at the moment after fixing this I am getting:
"free(): invalid pointer
Abgebrochen (Speicherabzug geschrieben)"
Last line translated meaning "Canceled (memory dump written)"
I narrowed it down to this piece of code:

   self.mazeSize = LUIRadioboxGroup()
   self.mazeboxes = []
   for i in range(0, 4):
       print("before radio"+str(i))
       radio=LUIRadiobox(group=self.mazeSize, value=i, label=mazetext[i], active=i==0, color=(1,1,1))
       print("before if")
       if i<3:
           radio.bind("changed",self.changeMazeRadio)

Last thing written before the error comes up is "before radio0". So do you have any idea what could be wrong with the LUIRadiobox here? Thank you a lot this far!

ATM I am recompiling LUI using clean git, your script, move all *3 to original folders 2to3 to build.py and I'll see if that changes anything…

Update: The new one does not have any . at the beginning of the imports. But it makes no difference(I had cleaned the other version). Same error and I can not see any solution for it :( BUT!

This does not seem to be my mistake, same error goes for Demos/B_Radiobox.py:
$ python B_Radiobox.py
Using deprecated DirectStart interface.
Known pipe types:
glxGraphicsPipe
(all display modules loaded.)
:lui: Loading atlas description from /home/nils/luigit/LUI/Builtin/../Skins/Default/res/atlas.txt
:lui: Loading atlas texture from /home/nils/luigit/LUI/Builtin/../Skins/Default/res/atlas.png
:pnmimage:png(warning): iCCP: known incorrect sRGB profile
:pnmimage:png(warning): iCCP: known incorrect sRGB profile
munmap_chunk(): invalid pointer
Abgebrochen (Speicherabzug geschrieben)

@JoelStienlet
Copy link
Contributor

I can see your last error on my system too.
I didn't have it last week, so I think this is due to a recent change in panda3d itself.
(To make sure it is a change in panda3d I tried B_Radiobox with an elder version of panda 1.10 and the demo still works fine (as it did until today), no surprise here, but I like double-checking everything).
I'll investigate this further and keep you informed.

@JoelStienlet
Copy link
Contributor

Apparently this is an issue with optional arguments.
In LUIRadiobox.py, when I add an explicit 2nd argument:
self.trigger_event("changed","dummy")
I don't get this segfault. I suspect some changes have been made to interrogate.
I'll investigate further.

@JoelStienlet
Copy link
Contributor

JoelStienlet commented Jan 26, 2019

I've posted a bug report in panda3d:
panda3d/panda3d#542 (comment)

@JoelStienlet
Copy link
Contributor

The Interrogate bug has been fixed upstream in panda, can you check if you still have errors?

@nerdnils
Copy link
Author

nerdnils commented Jan 27, 2019

I recompiled panda from (newest)git(-version) but I still got the same error in both programs.

@JoelStienlet
Copy link
Contributor

After looking at your error again, I was able to reproduce the "free(): invalid pointer" error, but not the "munmap_chunk(): invalid pointer", so there were many problems, but it is difficult to debug it without the sources.
If you want to you can send me your project to: j.stienlet@gmail.com
I'll try to have a look at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants