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
Hey Guys,--I am building my own Maya menu through userSetup.py ...I have written another python script which is basically just a pySide class. I want to call this script from the menu created in userSetup.py.There is no main function .. just the class that gets instantiated at the bottom of the script with the following code. The script runs fine when run from the script editor.Any insight would be awesome.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()I get this error in the command window when Maya launches ...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'... here is my userSetup.py that builds the menuimport tracebackimport maya.cmds as cmdsimport maya.mel as melimport maya.utils as utilsimport sm_CreateProjectPluginfrom 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='[===smoke && mirrors===]')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)Mike
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/ae3a6541-6982-4583-81fa-2d946e2c5029%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.