if __name__ == "__main__":try:cam_ui.deleteLater()except:passcam_ui = smRealCameras()try:cam_ui.create()cam_ui.show()except:cam_ui.deleteLater()traceback.print_exc()
Failed to execute userSetup.pyTraceback (most recent call last):File "K:\ifs\resources\3D_resources\workgroups\maya_workgroup\net_modules\sm_module\scripts\userSetup.py", line 11, in <module>from create_cam_class import smRealCamerasFile "K:\ifs\resources\3D_resources\workgroups\maya_workgroup\net_modules\sm_module\scripts\create_cam_class.py", line 36, in <module>class smRealCameras (QtGui.QDialog) :File "K:\ifs\resources\3D_resources\workgroups\maya_workgroup\net_modules\sm_module\scripts\create_cam_class.py", line 37, in smRealCamerasdef __init__(self, parent=maya_main_window()):File "K:\ifs\resources\3D_resources\workgroups\maya_workgroup\net_modules\sm_module\scripts\create_cam_class.py", line 33, in maya_main_windowreturn wrapInstance(long(main_window_ptr), QtGui.QWidget)TypeError: long() argument must be a string or a number, not 'NoneType'
import tracebackimport maya.cmds as cmdsimport maya.mel as melimport maya.utils as utils
import sm_CreateProjectPlugin
from sm_CreateProjectPlugin_Maya_v0003 import *import create_cam_classfrom create_cam_class import smRealCamerascmds.evalDeferred("build_menu()")def build_menu():if cmds.menu('sm_menu', exists=1):cmds.deleteUI('sm_menu')sm_menu = cmds.menu('sm_menu', parent='MayaWindow', tearOff=True, allowOptionBoxes=True, label='[===my menu===]')cmds.menuItem( divider=True)cmds.menuItem(parent=sm_menu, subMenu = True, label="Pipeline ")cmds.menuItem(l="create project", c = createProjectWindow)cmds.menuItem(l ="real cams" c = smRealCameras)cmds.menuItem(parent=sm_menu, divider=True)cmds.menuItem(parent=sm_menu, subMenu = True, label="Rendering", enable=True)cmds.menuItem(label="setup passes")cmds.menuItem(label="render manager")cmds.menuItem(parent=sm_menu, label="Modeling",enable=False)cmds.menuItem(parent=sm_menu, label="Lighting",enable=False)cmds.menuItem(parent=sm_menu, divider=True)
// Error: 'PySide.QtGui.QDialog' called with wrong argument types:
# PySide.QtGui.QDialog(bool)
# Supported signatures:
# PySide.QtGui.QDialog(PySide.QtGui.QWidget = None, PySide.QtCore.Qt.WindowFlags = 0)
# Traceback (most recent call last):
# File "K:\ifs\resources\3D_resources\workgroups\maya_workgroup\net_modules\sm_module\scripts\create_cam_class.py", line 38, in __init__
# super(smRealCameras, self).__init__(parent)
# TypeError: 'PySide.QtGui.QDialog' called with wrong argument types:
# PySide.QtGui.QDialog(bool)
# Supported signatures:
# PySide.QtGui.QDialog(PySide.QtGui.QWidget = None, PySide.QtCore.Qt.WindowFlags = 0) //
... ... ... .... etc etc
I get this error in my script editor when I try to execute the script from the menu after moving the lines you mentioned....
// Error: 'PySide.QtGui.QDialog' called with wrong argument types:
# PySide.QtGui.QDialog(bool)
# Supported signatures:
# PySide.QtGui.QDialog(PySide.QtGui.QWidget = None, PySide.QtCore.Qt.WindowFlags = 0)
# Traceback (most recent call last):
# File "K:\ifs\resources\3D_resources\workgroups\maya_workgroup\net_modules\sm_module\scripts\create_cam_class.py", line 38, in __init__
# super(smRealCameras, self).__init__(parent)
# TypeError: 'PySide.QtGui.QDialog' called with wrong argument types:
# PySide.QtGui.QDialog(bool)
# Supported signatures:
# PySide.QtGui.QDialog(PySide.QtGui.QWidget = None, PySide.QtCore.Qt.WindowFlags = 0) //
--the line in my script which refer to QDialog are :
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/e2a38a35-c4e3-4bfa-989a-d63da6f0d2a6%40googlegroups.com.
| David Moulder Technical Animator / Artist squi...@gmail.com Professional Profile | Mobile: +44 (0)7814033242 |
| See who we know in common | Want a signature like this? |
I am passing the result of maya_main_window which is a result of wrapInstance ... I thought I needed to do this in order to get Maya to be the parent window .. otherwise my dialogs could fall behind Maya ... no ?
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/c25f434b-5149-4e3b-95c8-0e9c2aebb5d9%40googlegroups.com.
Yes .. the menu call back is instantiating the the class. When I run the script from the script editor or call it form the command line it runs fine.
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/650dace4-2a1d-4ef7-91eb-6273f120c8a1%40googlegroups.com.
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/a1e2f96e-28d7-4f94-ba28-89de6d477591%40googlegroups.com.
Hey man i suggest that use this method for running your window in maya:
class YourClass():
....
def getMainWindow():
mainWindow = QtGui.QApplication.activeWindow()
while True:
lastWin = mainWindow.parent()
if lastWin:
mainWindow = lastWin
else:
break
return mainWindow
def show():
win = YourClass(parent=getMainWindow())
win.show()
about your menu, just i can say put path of userSetup.py in your PYTHONPATH
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAAjrnHvMC8CzxmiTzC94fDb9%3DMtOTidLpMPwx%3DExeK4pJSW_Xw%40mail.gmail.com.
Hey man i suggest that use this method for running your window in maya:
class YourClass(): .... def getMainWindow(): mainWindow = QtGui.QApplication.activeWindow() while True: lastWin = mainWindow.parent() if lastWin: mainWindow = lastWin else: break return mainWindow def show(): win = YourClass(parent=getMainWindow()) win.show()
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CADvbQwJSg-J5ZNxP-FOiDBW08RmVQ4XjU%2B8C1ZwGhr-iVh7RZA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2t4keg2fLVHFfp1Z6cd%3DOv5HB6J2XebFBAVT1bgC%2BQKQ%40mail.gmail.com.
let me knowYes, it is reliable for me so far, and i should say that this will work in nuke and houdini too.i tested the code in script editor, and importing it in maya, it works. i like to know maybe it run in maya and don't return maya main window as active window?
from PySide import QtGui
def getMainWindow():
mainWindow = QtGui.QApplication.activeWindow()
while True:
lastWin = mainWindow.parent()
if lastWin:
mainWindow = lastWin
else:
break
return mainWindow
def printMainWindow():
print "I think the Maya main window is:", getMainWindow()
d = QtGui.QDialog()
b = QtGui.QPushButton("Print Main Window", d)
b.clicked.connect(printMainWindow)
d.resize(180,100)
d.show()
d.raise_()
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CADvbQwJK--%2BvDdNKMUnuevEdJ%3DH%3DaR%3DvSd8CamTwvzy_e7A3bQ%40mail.gmail.com.
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/339bbd0f-6498-4c87-905e-793baf1658c6%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3nWWLYoee7UJiQ9DZ1Osv_Z5WMnrFz%2BN%3DJvq6xjo1i5g%40mail.gmail.com.
Justin, got it, i'm on your boat, but i mean if there is a situation that give me wrong result i like to know. why not!
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CADvbQw%2BsStz-Pf6G-FNSpWqsXR6UWCLm5YqbX%3Db9R0GwgzzH0w%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0ofeY97s1cC%3DitobkNwN_481j6uPkLXSnMCET6V8sKkA%40mail.gmail.com.