def showMenu(self, pos): tabwid = self._getCurrentTab() item = tabwid.currentItem() if uiH.USEPYQT: asset = item.data(32).toPyObject() else: asset = item.data(32) menu=QtGui.QMenu(self) if INHOU: fils = menu.addMenu('Files') nukIcon = QtGui.QIcon( PYFILEDIR + '/icons/houdini.png' ) actionNewFile = QtGui.QAction(nukIcon,"New File", fils) fils.addAction( actionNewFile ) self.connect( actionNewFile, QtCore.SIGNAL( "triggered()" ), self.newHoudiniFile ) fils.addSeparator() #OPEN IN CURRENT NUKE fls = [ hfl.houdiniFile( a.path ) for a in fl.filesInDir( asset.dirPath, False ) if a.path.endswith('.hip')] for f in fls: nukIcon = QtGui.QIcon( PYFILEDIR + '/icons/houdini.png' ) actionOpenInCurrent = QtGui.QAction(nukIcon,f.name, fils) fils.addAction( actionOpenInCurrent ) self.connect( actionOpenInCurrent, QtCore.SIGNAL( "triggered()" ), lambda val = f : self.openHoudiniFile(val) ) propIcon = QtGui.QIcon( PYFILEDIR + '/icons/question.png' ) actionProperties = QtGui.QAction(propIcon, "Properties", menu) menu.addAction( actionProperties ) self.connect( actionProperties, QtCore.SIGNAL( "triggered()" ), self.properties ) folderIcon = QtGui.QIcon( PYFILEDIR + '/icons/folder.png' ) actionOpenInExplorer = QtGui.QAction(folderIcon,"Open File in explorer", menu) menu.addAction( actionOpenInExplorer ) self.connect( actionOpenInExplorer, QtCore.SIGNAL( "triggered()" ), self.openFileLocation ) #COPY PATH actionSaveScene = QtGui.QAction("Copy File Path", menu) menu.addAction( actionSaveScene ) self.connect( actionSaveScene, QtCore.SIGNAL( "triggered()" ), self.copyFilePath ) #OPEN RENDER PATH actionSaveScene = QtGui.QAction(folderIcon,"Open Render Folder", menu) menu.addAction( actionSaveScene ) self.connect( actionSaveScene, QtCore.SIGNAL( "triggered()" ), self.openRenderFolder ) #OPEN RENDER PATH videoIcon = QtGui.QIcon( PYFILEDIR + '/icons/video.png' ) actionOpenPlayblast = QtGui.QAction(videoIcon,"Open Playblast", menu) menu.addAction( actionOpenPlayblast ) self.connect( actionOpenPlayblast, QtCore.SIGNAL( "triggered()" ), self.openPlayblast ) menu.addSeparator() #DOWNLOAD UPLOAD downIcon = QtGui.QIcon( PYFILEDIR + '/icons/download.png' ) uploIcon = QtGui.QIcon( PYFILEDIR + '/icons/upload.png' ) actionCopyServer = QtGui.QAction( downIcon, "Download From Server", menu) actionCopyServer.setIcon( downIcon ) menu.addAction(actionCopyServer) self.connect( actionCopyServer, QtCore.SIGNAL( "triggered()" ), self.copyFromServer ) actionToServer = QtGui.QAction( uploIcon, "Upload To Server", menu) menu.addAction(actionToServer) self.connect( actionToServer, QtCore.SIGNAL( "triggered()" ), self.copyToServer ) menu.addSeparator() if INMAYA: fils = menu.addMenu('Versions') #OPEN IN CURRENT NUKE fls = [ mfl.mayaFile( a.path ) for a in fl.filesInDir( asset.dirPath+'/Versions/', False ) if a.path.endswith('.ma')] for f in fls: nukIcon = QtGui.QIcon( PYFILEDIR + '/icons/maya.png' ) actionOpenInCurrent = QtGui.QAction(nukIcon,f.name + ' - ' + f.date, fils) fils.addAction( actionOpenInCurrent ) self.connect( actionOpenInCurrent, QtCore.SIGNAL( "triggered()" ), lambda val = f : self.openMayaFile(val) ) #OPEN IN CURRENT MAYA mayaIcon = QtGui.QIcon( PYFILEDIR + '/icons/maya.png' ) actionOpenInCurrent = QtGui.QAction(mayaIcon,"Open in This Maya", menu) menu.addAction( actionOpenInCurrent ) self.connect( actionOpenInCurrent, QtCore.SIGNAL( "triggered()" ), self.openFileInCurrentMaya ) menu.addSeparator() #IMPORT impIcon = QtGui.QIcon( PYFILEDIR + '/icons/import.png' ) actionImport = QtGui.QAction(impIcon,"Import", menu) menu.addAction( actionImport ) self.connect( actionImport, QtCore.SIGNAL( "triggered()" ), self.importFile ) menu.addSeparator() #COPY TIME SETTINGS timeIcon = QtGui.QIcon( PYFILEDIR + '/icons/time.png' ) actionCopyTime = QtGui.QAction(timeIcon,"Copy Time Settings", menu) menu.addAction( actionCopyTime ) self.connect( actionCopyTime, QtCore.SIGNAL( "triggered()" ), self.copyTimeSettings ) menu.addSeparator() #REFERENCE refIcon = QtGui.QIcon( PYFILEDIR + '/icons/reference.png' ) actionReference = QtGui.QAction(refIcon,"Reference", menu) menu.addAction( actionReference ) self.connect( actionReference, QtCore.SIGNAL( "triggered()" ), self.reference ) menu.addSeparator() #SAVE IN THIS SCENE savIcon = QtGui.QIcon( PYFILEDIR + '/icons/save.png' ) actionSaveScene = QtGui.QAction(savIcon,"Save Scene Here!", menu) menu.addAction( actionSaveScene ) self.connect( actionSaveScene, QtCore.SIGNAL( "triggered()" ), self.saveScene ) elif INNUKE: #OPEN IN CURRENT NUKE nukIcon = QtGui.QIcon( PYFILEDIR + '/icons/nuke.png' ) actionOpenInCurrent = QtGui.QAction(nukIcon,"Open in This Nuke", menu) menu.addAction( actionOpenInCurrent ) self.connect( actionOpenInCurrent, QtCore.SIGNAL( "triggered()" ), self.openFileInCurrentNuke ) #SAVE IN THIS SCENE savIcon = QtGui.QIcon( PYFILEDIR + '/icons/save.png' ) actionSaveScene = QtGui.QAction(savIcon,"Save Scene Here!", menu) menu.addAction( actionSaveScene ) self.connect( actionSaveScene, QtCore.SIGNAL( "triggered()" ), self.saveNukeScene ) menu.popup(tabwid.viewport().mapToGlobal(pos))
def createFile(self): """create File""" name = str(self.fileName_le.text()) fi = hfl.houdiniFile( self._baseFile.dirPath + '/' + str( self.baseName_lbl.text()) + '_' + name + '.hip' ) fi.write( '' ) fi.open()