I believe, from my limited PyQt knowledge, that the QListWidget is
behaving badly due to the order of operations in creating it.
Specifically, you are setting the list to be parented to self, but you
are not setting your widget's layout to be the layout you're adding the
list to. Try adding self.setLayout(self.homeLayout) to the end of
createLayouts, like so:
def createLayouts(self):
#Home Layout
self.homeLayout = QtGui.QGridLayout(self)
self.homeLayout.setObjectName("homeLayout")
self.homeLayout.addWidget(self.objectsList, 0, 0, 1, 1)
self.setLayout(self.homeLayout)
With that said, I didn't get any errors from the code once I removed the pymel
search for an existing window from the createWindow() function.
A possible replacement (which is on this list from a few days ago) is this:
global renamerWindow
try:
renamerWindow.deleteLater()
except:
pass
renamerWindow = RenameWindow(parent=mayaPythonMainWindow())
Seems to work fine that way, but it could just be me...
Joe
On 10/7/2013 5:40 PM, Drew Bradford wrote:
Hello Everyone,
I am trying to get a QListWidget to update with a users current
selection. So far it is working very temperamentally, and seems to
throw and error whenever it feels like it. I think the problem
originates with cmds.scriptJob. I am using the scriptJob to monitor
when the user selection changes. I have been trying to set the
scriptJob's parent to the window so that when I close the window the
script job gets deleted. I'm hoping that helps alleviate the problem.
I am new to PySide and there doesn't seem to be something as simple as
window = cmds.window().
Any help would be fantastic! It almost seems as if self is referencing
the window in PySide?
Check out my code here:
http://pastebin.ubuntu.com/6207412/
# Error: Internal C++ object (PySide.QtGui.QListWidget) already deleted.
# Traceback (most recent call last):
# File "/Volumes/Macintosh
HD/Users/drew/Library/Preferences/Autodesk/maya/2014-x64/scripts/dbTools/selObjectsQListWidget.py",
line 55, in populateList
# self.objectsList.clear()
# File "/Volumes/Macintosh
HD/Users/drew/Library/Preferences/Autodesk/maya/2014-x64/scripts/dbTools/selObjectsQListWidget.py",
line 55, in populateList
# self.objectsList.clear()
# RuntimeError: Internal C++ object (PySide.QtGui.QListWidget) already
deleted. #
--
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/87239f13-c764-4167-8809-d32b24f33363%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
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/52537C46.1060201%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.