def __init__(self, selection, selectedPresets, parent=None): super(NimHieroExport.NimExportDialog, self).__init__(parent) self.app = nimFile.get_app() self.prefs = nimPrefs.read() try: self.user = self.prefs['NIM_User'] self.pref_job = self.prefs[self.app + '_Job'] self.pref_show = self.prefs[self.app + '_Show'] self.pref_server = self.prefs[self.app + '_ServerPath'] except: #return False pass self.nim_OS = platform.system() self.nim_userID = nimAPI.get_userID(self.user) if not self.nim_userID: nimUI.GUI().update_user() userInfo = nim.NIM().userInfo() self.user = userInfo['name'] self.nim_userID = userInfo['ID'] print "NIM: user=%s" % self.user print "NIM: userID=%s" % self.nim_userID print "NIM: default job=%s" % self.pref_job self.nim_jobPaths = {} self.nim_showPaths = {} self.nim_shotPaths = {} self.nim_showFolder = '' self.nim_servers = {} self.nim_serverID = None self.nim_serverOSPath = '' #Get NIM Jobs self.nim_jobID = None self.nim_jobs = nimAPI.get_jobs(self.nim_userID) if not self.nim_jobs: print "No Jobs Found" self.nim_jobs["None"] = "0" self.nim_shows = [] self.nim_showDict = {} self.nim_showID = None self.setWindowTitle("NIM Update Selected Shots") self.setSizeGripEnabled(True) self._exportTemplate = None tag_jobID = None tag_showID = None nimConnect = nimHieroConnector.NimHieroConnector() # Check Sequence for existing showID for trackItem in selection: sequence = trackItem.parentSequence() nim_sequence_tag = nimConnect.getNimTag(sequence) if (nim_sequence_tag != False): tag_showID = nim_sequence_tag.metadata().value( "tag.showID") print "NIM: Sequence showID=%s" % tag_showID if (tag_showID != ''): showInfo = nimAPI.get_showInfo(tag_showID) if len(showInfo) > 0: for showInfoDetails in showInfo: tag_jobID = showInfoDetails['jobID'] print "NIM: Sequence jobID=%s" % tag_jobID break layout = QVBoxLayout() formLayout = QFormLayout() groupBox = QGroupBox() groupLayout = QFormLayout() groupBox.setLayout(groupLayout) # JOBS: List box for job selection horizontalLayout = QHBoxLayout() horizontalLayout.setSpacing(-1) horizontalLayout.setSizeConstraint(QLayout.SetDefaultConstraint) horizontalLayout.setObjectName("HorizontalLayout") self.nimJobLabel = QLabel() self.nimJobLabel.setFixedWidth(40) self.nimJobLabel.setText("Job:") horizontalLayout.addWidget(self.nimJobLabel) self.nim_jobChooser = QComboBox() self.nim_jobChooser.setToolTip( "Choose the job you wish to export shots to.") horizontalLayout.addWidget(self.nim_jobChooser) horizontalLayout.setStretch(1, 40) groupLayout.setLayout(0, QFormLayout.SpanningRole, horizontalLayout) # JOBS: Add dictionary in ordered list jobIndex = 0 jobIter = 0 if len(self.nim_jobs) > 0: for key, value in sorted(self.nim_jobs.items(), reverse=True): self.nim_jobChooser.addItem(key) if nimHieroConnector.g_nim_jobID: if nimHieroConnector.g_nim_jobID == value: print "Found matching jobID, job=", key self.pref_job = key jobIndex = jobIter else: if self.pref_job == key: print "Found matching Job Name, job=", key jobIndex = jobIter jobIter += 1 if self.pref_job != '': self.nim_jobChooser.setCurrentIndex(jobIndex) self.nim_jobChooser.currentIndexChanged.connect( self.nim_jobChanged) #self.nim_jobChanged() #trigger job changed to load choosers ''' # SERVERS: List box for server selection horizontalLayout2 = QHBoxLayout() horizontalLayout2.setSpacing(-1) horizontalLayout2.setSizeConstraint(QLayout.SetDefaultConstraint) horizontalLayout2.setObjectName("HorizontalLayout2") self.nimServerLabel = QLabel() self.nimServerLabel.setFixedWidth(40) self.nimServerLabel.setText("Server:") horizontalLayout2.addWidget(self.nimServerLabel) self.nim_serverChooser = QComboBox() self.nim_serverChooser.setToolTip("Choose the server you wish to export shots to.") horizontalLayout2.addWidget(self.nim_serverChooser) horizontalLayout2.setStretch(1, 40) groupLayout.setLayout(1, QFormLayout.SpanningRole, horizontalLayout2) # SERVERS: Add dictionary in ordered list serverIndex = 0 serverIter=0 if len(self.nim_servers)>0: for server in self.nim_servers: self.nim_serverDict[server['server']] = server['ID'] for key, value in sorted(self.nim_serverDict.items(), reverse=False): self.nim_serverChooser.addItem(key) if nimHieroConnector.g_nim_serverID == value: self.pref_server = key serverIndex = serverIter #print "Found matching serverID, server=", key #print "serverIndex=",serverIndex serverIter +=1 if self.pref_server != '': #print "self.pref_server=",self.pref_server self.nim_serverChooser.setCurrentIndex(serverIndex) self.nim_serverChooser.currentIndexChanged.connect(self.nim_serverChanged) self.nim_serverChanged() ''' # SHOWS: List box for show selection horizontalLayout3 = QHBoxLayout() horizontalLayout3.setSpacing(-1) horizontalLayout3.setSizeConstraint(QLayout.SetDefaultConstraint) horizontalLayout3.setObjectName("HorizontalLayout3") self.nimShowLabel = QLabel() self.nimShowLabel.setFixedWidth(40) self.nimShowLabel.setText("Show:") horizontalLayout3.addWidget(self.nimShowLabel) self.nim_showChooser = QComboBox() self.nim_showChooser.setToolTip( "Choose the show you wish to export shots to.") horizontalLayout3.addWidget(self.nim_showChooser) horizontalLayout3.setStretch(1, 40) groupLayout.setLayout(1, QFormLayout.SpanningRole, horizontalLayout3) self.nim_showChooser.currentIndexChanged.connect( self.nim_showChanged) # Add the standard ok/cancel buttons, default to ok. self._buttonbox = QDialogButtonBox( QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel) self._buttonbox.button( QDialogButtonBox.StandardButton.Ok).setText("Update") self._buttonbox.button( QDialogButtonBox.StandardButton.Ok).setDefault(True) self._buttonbox.button( QDialogButtonBox.StandardButton.Ok).setToolTip( "Executes exports on selection for each selected preset") self._buttonbox.accepted.connect(self.acceptTest) self._buttonbox.rejected.connect(self.reject) horizontalLayout4 = QHBoxLayout() horizontalLayout4.setSpacing(-1) horizontalLayout4.setSizeConstraint(QLayout.SetDefaultConstraint) horizontalLayout4.setObjectName("HorizontalLayout4") spacerItem4 = QSpacerItem(175, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) horizontalLayout4.addItem(spacerItem4) horizontalLayout4.addWidget(self._buttonbox) horizontalLayout4.setStretch(1, 40) groupLayout.setLayout(2, QFormLayout.SpanningRole, horizontalLayout4) self.setLayout(groupLayout) layout.addWidget(groupBox) self.nim_jobChanged() #trigger job changed to load choosers
def __init__(self, preset, itemTypes): IProcessorUI.__init__(self) self._preset = None self._exportTemplate = None self._exportStructureViewer = None self._contentElement = None self._contentScrollArea = None self._contentUI = None self._editMode = IProcessorUI.ReadOnly self._itemTypes = itemTypes self._tags = [] self._project = None self._exportItems = [] self.setPreset(preset) ''' ####################################################### # NIM VARS ''' self.app = nimFile.get_app() self.prefs = nimPrefs.read() try: self.user = self.prefs['NIM_User'] self.pref_job = self.prefs[self.app + '_Job'] self.pref_show = self.prefs[self.app + '_Show'] self.pref_server = self.prefs[self.app + '_ServerPath'] except: #return False pass self.nim_OS = platform.system() self.nim_userID = nimAPI.get_userID(self.user) if not self.nim_userID: nimUI.GUI().update_user() userInfo = nim.NIM().userInfo() self.user = userInfo['name'] self.nim_userID = userInfo['ID'] print "NIM: user=%s" % self.user print "NIM: userID=%s" % self.nim_userID print "NIM: default job=%s" % self.pref_job #Get NIM Jobs self.nim_jobID = None self.nim_jobs = nimAPI.get_jobs(self.nim_userID) if not self.nim_jobs: print "No Jobs Found" self.nim_jobs["None"] = "0" #self.nim_shows = [] self.nim_servers = {} self.nim_shows = {} self.nim_showDict = {} self.nim_showChooser = QtWidgets.QComboBox() self.nim_serverChooser = QtWidgets.QComboBox() self.nim_jobPaths = {} self.nim_showPaths = {} self.nim_showFolder = '' self.nim_serverOSPath = '' #Get NIM Element Types self.pref_elementType = '' self.element = '' self.elementID = None self.nim_elementTypes = [] self.nim_elementTypesDict = {} self.nim_elementTypes = nimAPI.get_elementTypes() #Get NIM Task Types self.pref_taskType = '' self.task = '' self.taskID = None self.nim_taskTypes = [] self.nim_taskTypesDict = {} self.nim_taskFolderDict = {} self.nim_taskTypes = nimAPI.get_tasks(app='NUKE', userType='all') self.nim_publishElementCheckbox = QtWidgets.QCheckBox() self.nim_publishElement = False self.nim_publishCompCheckbox = QtWidgets.QCheckBox() self.nim_publishComp = False self.loadingNimUI = False '''