Hi everyone, I have an issue with the use of the `toggled` signal.
I loaded and created the GUI using .ui or uic module.

Example of my tool's code:
class MyWindow(QtGui.QWidget):
    def __init__(self):
        ...
        # self.informationVisBtn, `setChecked` and `setCheckable` field is 
checked in the .ui file
        self.informationVisBtn.toggled.connect(self.setInfoVis)

    def setInfoVis(self):
        self.toggleVisibility(
                self.informationVisBtn.isChecked()
            )

    def toggleVisibility(self, value):
        if value:
            self.uiInformationFrame.show()
            self.informationVisBtn.setText("-")
        else:
            self.uiInformationFrame.hide()
            self.informationVisBtn.setText("+")


As I load my tool, I had expected the button text to be '-' but instead it 
shows up as '+', even though the frame is still shown.

I had thought that by using toggled and having it initialized under the 
__init__(), it will reads both setInfoVis() and toggleVisibility() but when 
I tried adding in a couple of print statements, it does not seems to even 
go pass the `if` statement unless I clicked on the button, only will the 
print statements within the `if` will be executed, or if I added in 
setInfo() before the `xxx.toggled.connect()...`

Any ideas? Or any way that I can force the toggleVisibility() to be 
executed on started up?

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/dede49fa-6633-4fff-a7b6-ea4d31254098%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to