Exemplo n.º 1
0
	def save(self):
		""" Save data.
		"""
		if self.j.save():
			verbose.message("Job database saved.")
			return True
		else:
			verbose.error("Job database could not be saved.")
			return False
Exemplo n.º 2
0
	def saveAppPaths(self):
		""" Save the application paths to the data file.
		"""
		self.storeAppPathOSX()
		self.storeAppPathLinux()
		self.storeAppPathWin()

		if self.ap.save():
			verbose.message("Application paths data file saved.")
			return True
		else:
			verbose.error("Application paths data file could not be saved.")
			return False
    def createShots(self):
        """ Create the shot(s).

		"""
        success = 0
        existing = 0
        failure = 0
        shots_created = ""
        shots_existing = ""
        shots_failed = ""
        dialog_msg = ""

        for shot in self.shots_to_create:
            shot_datafile = self.getShotDatafile(shot)
            os_wrapper.createDir(os.path.dirname(shot_datafile))

            if self.shot_data.load(shot_datafile):
                existing += 1
                shots_existing += shot + "\n"
            elif self.shot_data.save():
                success += 1
                shots_created += shot + "\n"
            else:
                failure += 1
                shots_failed += shot + "\n"

        if success:
            message = "%d %s created successfully: " % (
                success, verbose.pluralise('shot', success))
            dialog_msg += "%s\n%s\n" % (message, shots_created)
            verbose.message(message + shots_created)

        if existing:
            message = "The following %d shot(s) were not created as they already exist: " % existing
            dialog_msg += "%s\n%s\n" % (message, shots_existing)
            verbose.warning(message + shots_existing)

        if failure:
            message = "The following %d shot(s) could not be created - please check write permissions and try again: " % failure
            dialog_msg += "%s\n%s\n" % (message, shots_failed)
            verbose.error(message + shots_failed)

        # Confirmation dialog
        dialog_title = "Shot Creator Results"
        dialog = prompt.dialog()
        dialog.display(dialog_msg, dialog_title, conf=True)

        self.populateShots()
    def deleteShots(self):
        """ Delete the selected shot(s).
			TODO: implement properly
		"""
        # Confirmation dialog
        dialog_title = "Delete shot: %s" % self.shot
        dialog_msg = "Are you sure?"
        dialog = prompt.dialog()
        if dialog.display(dialog_msg, dialog_title):
            shot_path = os_wrapper.absolutePath("%s/$IC_SHOTSDIR/%s" %
                                                (self.job_path, self.shot))
            result, msg = os_wrapper.remove(shot_path)
            if result:
                verbose.message("Shot '%s' deleted: %s" %
                                (self.shot, self.job_path))
                self.populateShots()
            else:
                dialog.display(msg, "Failed to delete shot", conf=True)
Exemplo n.º 5
0
def deploy():
    mayaShelvesDir = os.path.join(mc.about(preferences=True), 'prefs',
                                  'shelves')
    # mayaModulesDir = os.path.join(mc.about(preferences=True), 'modules')

    try:
        os_wrapper.copyDirContents(
            os.path.join(os.environ['IC_BASEDIR'], 'rsc', 'maya', 'shelves'),
            mayaShelvesDir)
        # os_wrapper.copyDirContents(os.path.join(os.environ['IC_BASEDIR'], 'rsc', 'maya', 'modules'), mayaModulesDir)
        # os_wrapper.copyDirContents(os.path.join(os.environ['IC_JOBPUBLISHDIR'], 'ma_shelves'), mayaShelvesDir)
        verbose.message("Successfully deployed %s tools." %
                        os.environ['IC_VENDOR_INITIALS'])
        return True

    except:
        verbose.warning("Failed to deploy %s tools." %
                        os.environ['IC_VENDOR_INITIALS'])
        return False
Exemplo n.º 6
0
def autoDeploy():

    # Deploying commands organizer
    outputMsg = "Deploying GPS tools... "
    try:
        # Deploy commands organizer copying the file to user scenes directory
        # so it's not read directly from master file in pipeline.
        # There's a different commandsOrganizer.dat for osx/win due to file
        # path differences for icons.
        if os.environ['IC_RUNNING_OS'] == 'Windows':
            osdir = 'win'
        else:
            osdir = 'osx'
        src = os.path.join(os.environ['IC_BASEDIR'], 'rsc', 'realflow',
                           'realflow__env__', osdir, 'commandsOrganizer.dat')
        dst = os.path.join(os.environ['IC_REALFLOW_SCENES_DIR'], '.cmdsOrg',
                           'commandsOrganizer.dat')
        os_wrapper.copy(src, dst)
        verbose.message("%s Ok" % outputMsg)
    except:
        verbose.error("%s Failed" % outputMsg)
Exemplo n.º 7
0
	def importJobs(self):
		""" Open a dialog to import an XML jobs data file and merge with the
			current data.
		"""
		datafile = self.fileDialog(
			os.environ['IC_CONFIGDIR'], fileFilter='XML files (*.xml)')
		if datafile:
			j = jobs.Jobs(datafile)

			for jobElement in j.getJobs():
				jobName = j.getValue(jobElement, 'name')
				jobPath = j.getValue(jobElement, 'path')
				jobVersion = j.getValue(jobElement, 'version')
				jobActive = jobElement.get('active')

				# print(jobName, jobPath, jobVersion, jobActive)

				if '$JOBSROOT' in jobPath:
					jobPath = jobPath.replace('$JOBSROOT', '$IC_JOBSROOT')
					verbose.message("Updating job path: %s" % jobPath)

				if self.j.addJob(jobName, jobPath, jobVersion, jobActive):
					self.reloadJobs(reloadDatabase=False)
Exemplo n.º 8
0
def submit_job(**kwargs):
    """ Submit job to Deadline.
	"""
    cmd_output = ""
    result_msg = ""

    # if kwargs is not None:
    # 	for key, value in kwargs.items():
    # 		print("%24s = %s" %(key, value))

    try:
        if kwargs['renderLayers']:  # Batch submission -----------------------
            # Generate submission info files
            num_jobs = 0
            job_info_file_list = []
            plugin_info_file_list = []
            for render_layer in re.split(
                    r',\s*',
                    kwargs['renderLayers']):  # may be better to pass as list
                kwargs['renderLayer'] = render_layer
                # kwargs['isMovie'] = False
                job_info_file = generate_job_info_file(**kwargs)
                job_info_file_list.append(job_info_file)
                plugin_info_file = generate_plugin_info_file(**kwargs)
                plugin_info_file_list.append(plugin_info_file)
                num_jobs += 1

            # Generate batch file
            batch_submission_file = generate_batch_file(
                kwargs['scene'], job_info_file_list, plugin_info_file_list)

            # Execute deadlinecommand
            cmd_result, cmd_output = os_wrapper.execute(
                [os.environ['RQ_DEADLINECOMMAND'], batch_submission_file])
            if cmd_result:
                result_msg = "Successfully submitted %d job(s) to Deadline." % num_jobs

        else:  # Single job submission ---------------------------------------
            # Generate submission info files
            kwargs['renderLayer'] = None
            job_info_file = generate_job_info_file(**kwargs)
            plugin_info_file = generate_plugin_info_file(**kwargs)

            # Execute deadlinecommand
            cmd_result, cmd_output = os_wrapper.execute([
                os.environ['RQ_DEADLINECOMMAND'], job_info_file,
                plugin_info_file
            ])
            if cmd_result:
                result_msg = "Successfully submitted job to Deadline."

        if cmd_result:
            result = True
            verbose.print_(cmd_output)  #.decode())
            verbose.message(result_msg)
        else:
            raise RuntimeError(cmd_output)

    except:  # Submission failed ---------------------------------------------
        result = False
        exc_type, exc_value, exc_traceback = sys.exc_info()
        traceback.print_exception(exc_type, exc_value, exc_traceback)
        result_msg = "Failed to submit job to Deadline."
        verbose.error(result_msg)
        if (exc_type == RuntimeError) and cmd_output:
            result_msg += "\n" + cmd_output
        else:
            result_msg += "\nCheck console output for details."
        #output_str = "Either the Deadline executable could not be found, or the submission info files could not be written."
        #output_str = traceback.format_exception_only(exc_type, exc_value)[0]

    return result, result_msg
    def __init__(self, parent=None):
        super(ShotManagementDialog, self).__init__(parent)
        self.parent = parent

        # Show initialisation message
        verbose.message("%s v%s" % (cfg['window_title'], VERSION))

        self.setupUI(**cfg)
        self.conformFormLayoutLabels(self.ui.sidebar_frame)

        # Set window icon, flags and other Qt attributes
        # self.setWindowIcon(self.iconSet('filmgrain.svg', tintNormal=False))
        self.setWindowFlags(QtCore.Qt.Dialog)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)

        # Restore splitter size state
        try:
            self.ui.splitter.restoreState(
                self.settings.value("splitterSizes"))  #.toByteArray())
            self.ui.shots_tableWidget.horizontalHeader().restoreState(
                self.settings.value("shotsTableView"))  #.toByteArray())
        except:
            pass

        # Set icons
        self.ui.shotCreate_toolButton.setIcon(self.iconSet('filmgrain.svg'))
        self.ui.shotDelete_toolButton.setIcon(self.iconSet('edit-delete.svg'))
        self.ui.shotSettings_toolButton.setIcon(self.iconSet('configure.svg'))
        self.ui.refresh_toolButton.setIcon(self.iconSet('icon_refresh.png'))
        self.ui.import_toolButton.setIcon(self.iconSet('icon_arrow_down.png'))
        self.ui.export_toolButton.setIcon(self.iconSet('icon_arrow_up.png'))

        self.ui.searchFilterClear_toolButton.setIcon(self.iconSet('clear.svg'))

        # Connect signals & slots
        self.ui.job_comboBox.currentIndexChanged.connect(self.reloadJobData)

        self.ui.shotCreate_toolButton.toggled.connect(
            lambda checked: self.toggleSidebar(checked))
        self.ui.shotDelete_toolButton.clicked.connect(self.deleteShots)
        self.ui.shotSettings_toolButton.clicked.connect(self.shotSettings)
        self.ui.refresh_toolButton.clicked.connect(
            lambda: self.populateShots())

        self.ui.searchFilter_lineEdit.textChanged.connect(
            lambda text: self.populateShots(shot_filter=text))
        self.ui.searchFilterClear_toolButton.clicked.connect(self.clearFilter)

        self.ui.shots_tableWidget.itemSelectionChanged.connect(
            self.updateToolbarUI)
        # self.ui.shots_tableWidget.itemDoubleClicked.connect(lambda: self.editCell)
        # self.ui.shots_tableWidget.itemChanged.connect(lambda item: self.itemChecked(item))

        self.ui.seq_comboBox.currentIndexChanged.connect(
            self.updateShotsPreview)
        self.ui.seq_comboBox.editTextChanged.connect(self.updateShotsPreview)
        self.ui.prefix_comboBox.currentIndexChanged.connect(
            self.updateShotsPreview)
        self.ui.prefix_comboBox.editTextChanged.connect(
            self.updateShotsPreview)
        self.ui.shotCount_spinBox.valueChanged.connect(self.updateShotsPreview)
        self.ui.start_spinBox.valueChanged.connect(self.updateShotsPreview)
        self.ui.increment_spinBox.valueChanged.connect(self.updateShotsPreview)

        self.ui.create_pushButton.clicked.connect(self.createShots)

        self.ui.main_buttonBox.button(
            QtWidgets.QDialogButtonBox.Close).clicked.connect(self.accept)

        # Set input validators
        seq_pattern = r'\w*'
        seq_pattern_validator = QtGui.QRegExpValidator(
            QtCore.QRegExp(seq_pattern), self.ui.seq_comboBox.lineEdit())
        self.ui.seq_comboBox.lineEdit().setValidator(seq_pattern_validator)

        shot_pattern = r'^\w+#{0,8}\w*$'
        shot_pattern_validator = QtGui.QRegExpValidator(
            QtCore.QRegExp(shot_pattern), self.ui.prefix_comboBox.lineEdit())
        self.ui.prefix_comboBox.lineEdit().setValidator(shot_pattern_validator)

        # Instantiate jobs and metadata classes
        self.j = jobs.Jobs()
        self.job_data = metadata.Metadata()
        self.shot_data = metadata.Metadata()