Tiny bug in DirectGuiBase.py

in version 1.3.2 there is a bug in DirectGuiBase.py in line 1045.
it says

messenger.send(PRINT + child.getName(), [indent + 2])

but PRINT is undefined. i guesset that it should mean “PRINT” with “” and it seems to work with it.

messenger.send("PRINT" + child.getName(), [indent + 2])

someone please check it and apply the fix to the svn/cvs. thx :slight_smile:

I don’t think so, Thomas. Yes, sure there is a miss, but there is nothing accepts “PRINT”+…
I inserted the line to print the dashes to the loop.
This is the result with “PRINT” :

PRINT is a global in DirectGuiGlobals.py.

# User can bind commands to these gui events
DESTROY = 'destroy-'
PRINT = 'print-'

The result with DGG.PRINT :

Thomas, what do you think about –[THIS]– ?
Do you have any suggestion for that ?

well panda still crashed when i tried to use it :stuck_out_tongue:
speaking about aspect2d stuff… looks intresting but i havent looked into the very details. is your code something like an gui-editor?

Really ? What did you change ?
You only need to change PRINT to DGG.PRINT.
That’s all, no need for “” :

    def printConfig(self, indent = 0):
        space = ' ' * indent
        print space + self.guiId, '-', self.__class__.__name__
        print space + 'Pos:   ' + self.getPos().pPrintValues()
        print space + 'Scale: ' + self.getScale().pPrintValues()
        # Print out children info
        for child in self.getChildrenAsList():
            print '  -----------------------------------------'
            messenger.send(DGG.PRINT + child.getName(), [indent + 2])

That’s the goal, to visually transform the nodes (any node, Direct GUI or not) on-the-fly, anytime I want, and save the result to “config” file.

Fine, “” or DGG., but that still leaves us with the error.

It hasn’t been committed to CVS yet. Someone needs to change PRINT to DGG.PRINT indeed on line 1074 of ]direct/src/gui/DirectGuiBase.py.

Tell me, how do you guys trigger the “print-yourDGUIname” ? You have to send it using the messenger, right ?
Then it requires me to know the name of every DGUI objects in my scene. That’s what make me added “self.printConfig()” to editStop method at my very 1st attempt on this long time ago, so everytime I release my MMB, the transform get printed. Perhaps by doing so, I bypass the problem you guys suffer from.
oh, BTW, what’s the error ?

relevant error… left aside the trace up to the line i execute:

  File "ff8online.py", line 117, in hideChat
  File "/usr/share/panda3d/direct/src/gui/DirectGuiBase.py", line 1045, in printConfig
    messenger.send(PRINT + child.getName(), [indent + 2])
NameError: global name 'PRINT' is not defined

Thomas, I meant the error after changing it to DGG.PRINT

DGG.PRINT is correct. I have made the correction; thanks for discovering it. At some point over the last year we changed from an implicit import of all the symbols in DirectGuiGlobals to an explicit import, and thus we had to make a lot of changes of the form PRINT -> DGG.PRINT. This is one that slipped through the cracks; sorry about that.


oh… well there is no error anymore^^ thought you where talking about the one i got without the fix. :slight_smile: seems like the world is back to normal^^

So what was that all about ?