def accept(self): """ Check the connection. """ cur_project = self.cmbProject.currentText() cur_shot = self.cmbShot.currentText() log.info("Setting project to " + cur_project) log.info("Setting shot to " + cur_shot) osplus.set_env("EPP_CURPROJECT", cur_project) osplus.set_env("EPP_CURSHOT", cur_shot) _fu = fu_controller() if not _fu.status(True): # No need for a dialog log.error("Fusion not running.", False) else: COMP_ROOT_DIR = shot_id_path(cur_project, cur_shot, "compositions") if os.path.isdir(COMP_ROOT_DIR): res = _fu.set_pathmap("Comps:", COMP_ROOT_DIR) log.info("Setting Comps: PathMap to {0} ({1})".format( COMP_ROOT_DIR, res[1])) super(SetShotDialog, self).accept()
def accept(self): """ Check the connection. """ if not self._gen.status(True): log.error("Could not establish connection with Generation. Make sure it is running.", True) return # Need edit rights for this one! if not self._gen.allow_changes(True): return ret, msg = control.add_shot(self.PROJECTNAME, self.plugName.text(), self.cmbDirStructure.currentText()+".xml", self._gen, self.cmbInsertPosition.currentIndex()) if not ret: log.error(msg, True) return # Keep the dialog. if not self.chkAnother.isChecked(): super(AddShotDialog, self).accept() else: shot_dir = os.path.join(self.SHOTDIR, self.plugName.text()) self.plugName.setText("") self.lblStatus.setText("<html><head><style type=text/css>a {{ color: white; }}\n a:link {{color:white; text-decoration:none; }}\n a:hover {{ color:#ffcc00; text-decoration:underline; }}</style></head><body><font color='#00ee00'>Shot successfully created:</font> <a href='file:///{0}'>{0}</a></body></html>".format(shot_dir, shot_dir.replace("\\", "/"))) self._status_fade.setDirection(QAbstractAnimation.Forward) self._status_fade.start() self.plugName.setFocus()
def main(): """docstring for main""" fu_con = fu_controller() gen_con = gen_controller() apps = {} apps["add_project"] = add_project.main apps["add_shot"] = add_shot.main apps["add_shot_from_media"] = add_shot_from_media.main apps["create_saver"] = create_saver.main apps["save_as"] = save_as.main apps["set_shot"] = set_shot.main apps["update_shot"] = update_shot.main apps["save_new_version"] = fu_con.save_new_version apps["meta_from_standins"] = gen_con.meta_from_standins parser = argparse.ArgumentParser(description='Process some integers.') parser.add_argument('module', metavar='module', type=str, nargs='+', help='Which module to launch.') args = parser.parse_args() for module in args.module: if not module in apps: log.error("Module not found: " + module) else: log.info("Launching " + module) apps[module]()
def accept(self): """ Check the connection. """ projectname = self.PROJECTNAME shotname = self.cmbShot.currentText() shot_data = self.cmbShot.itemData(self.cmbShot.currentIndex()) if not self._gen.status(): log.error("Generation not running", True) return log.info("Importing Comps from {0} - {1}".format( projectname, shotname)) if shot_data == "*": shots = filesystem.shots(self.PROJECTROOT, projectname) else: shots = {shotname: ""} for cur_shotname, cur_shotdir in shots.items(): comps = filesystem.comps(projectname, cur_shotname) for comp in comps: log.debug("Inserting {0}".format(comp)) comp = str(comp) self._gen.insert_media(cur_shotname, comp, self.chkShotLike.isChecked()) super(UpdateShotDialog, self).accept()
def accept(self): """ Check the connection. """ projectname = self.PROJECTNAME shotname = self.cmbShot.currentText() shot_data = self.cmbShot.itemData(self.cmbShot.currentIndex()) if not self._gen.status(): log.error("Generation not running", True) return log.info("Importing Comps from {0} - {1}".format(projectname, shotname)) if shot_data == "*": shots = filesystem.shots(self.PROJECTROOT, projectname) else: shots = {shotname:""} for cur_shotname, cur_shotdir in shots.items(): comps = filesystem.comps(projectname, cur_shotname) for comp in comps: log.debug("Inserting {0}".format(comp)) comp = str(comp) self._gen.insert_media(cur_shotname, comp, self.chkShotLike.isChecked()) super(UpdateShotDialog, self).accept()
def accept(self): """ Check the connection. """ _fu = fu_controller() if not _fu.status(True): log.error("Fusion not running.", True) return if os.path.isfile(self.COMP_FILEPATH): ret = QMessageBox.information( self, "Question", "Composition does already exist.\nOverwrite '{0}'".format( os.path.basename(self.COMP_FILEPATH)), QMessageBox.Yes | QMessageBox.No) if ret == QMessageBox.No: return cur_project = self.cmbProject.currentText() cur_shot = self.cmbShot.currentText() ret = _fu.save_comp(self.COMP_FILEPATH, { "project": str(cur_project), "shot": str(cur_shot) }) if not ret[0]: log.error(ret[1], True) return log.info("Saved Comp to {0}".format(self.COMP_FILEPATH)) self.hide() if self.chkUpdateSavers.isChecked(): ret = _fu.update_savers(self.spnVersion.value()) if self.chkFormat.isChecked(): _fu.set_format(project_format_object(cur_project)) osplus.set_env("EPP_CURPROJECT", self.cmbProject.currentText()) osplus.set_env("EPP_CURSHOT", self.cmbShot.currentText()) COMP_ROOT_DIR = os.path.dirname(self.COMP_FILEPATH) if os.path.isdir(COMP_ROOT_DIR): res = _fu.set_pathmap("Comps:", COMP_ROOT_DIR) log.info("Setting Comps: PathMap to {0} ({1})".format( COMP_ROOT_DIR, res[1])) super(SaveAsDialog, self).accept()
def accept(self): """ Check the connection. """ _fu = fu_controller() if not _fu.status(True): log.error("Fusion not running.", True) return if os.path.isfile(self.COMP_FILEPATH): ret = QMessageBox.information(self, "Question", "Composition does already exist.\nOverwrite '{0}'".format(os.path.basename(self.COMP_FILEPATH)), QMessageBox.Yes | QMessageBox.No) if ret == QMessageBox.No: return cur_project = self.cmbProject.currentText() cur_shot = self.cmbShot.currentText() ret = _fu.save_comp(self.COMP_FILEPATH, {"project": str(cur_project), "shot": str(cur_shot)}) if not ret[0]: log.error(ret[1], True) return log.info("Saved Comp to {0}".format(self.COMP_FILEPATH)) self.hide() if self.chkUpdateSavers.isChecked(): ret = _fu.update_savers(self.spnVersion.value()) if self.chkFormat.isChecked(): _fu.set_format(project_format_object(cur_project)) osplus.set_env("EPP_CURPROJECT", self.cmbProject.currentText()) osplus.set_env("EPP_CURSHOT", self.cmbShot.currentText()) COMP_ROOT_DIR = os.path.dirname(self.COMP_FILEPATH) if os.path.isdir(COMP_ROOT_DIR): res = _fu.set_pathmap("Comps:", COMP_ROOT_DIR) log.info("Setting Comps: PathMap to {0} ({1})".format(COMP_ROOT_DIR, res[1])) super(SaveAsDialog, self).accept()
def _setup(self): """ Setup the widgets """ _fu = fu_controller() if not _fu.status(True): log.error("Fusion not running.", True) return False epp_root = osplus.get_env("EPP_ROOT") if not os.path.isdir(epp_root): log.error( "Could not find EPP ROOT directory.\n{0}".format(epp_root), True) return False self.settings = settings.XMLSettings( os.path.join(epp_root, "config.xml")) self.PROJECTROOT = self.settings.get("paths", "projectdir") if self.PROJECTROOT is None: log.error("No Project Directory configured in config.xml.", True) return False self._setup_header(epp_root) self._setup_status() self.cmbProject.currentIndexChanged.connect(self.update_shots) self.update_project() # Make sure enter does not add to combo box self.cmbName.installEventFilter(self) self.cmbProject.currentIndexChanged.connect(self._validate_path) self.cmbShot.currentIndexChanged.connect(self.update_names) self.cmbShot.currentIndexChanged.connect(self._validate_path) self.cmbName.currentIndexChanged.connect(self._validate_path) self.cmbName.lineEdit().textChanged.connect(self._validate_path) self.cmbName.lineEdit().textChanged.connect(self._get_last_version) self.spnVersion.valueChanged.connect(self._validate_path) self.butNext.clicked.connect(self._get_last_version) self._setup_defaults() self.update_names() return True
def _setup(self): """ Setup the widgets """ epp_root = osplus.get_env("EPP_ROOT") if not os.path.isdir(epp_root): QMessageBox.critical( self, "Error", "Could not find EPP ROOT directory.\n{0}".format(epp_root)) return False self.settings = settings.XMLSettings( os.path.join(epp_root, "config.xml")) self.PROJECTROOT = self.settings.get("paths", "projectdir") if self.PROJECTROOT is None: QMessageBox.critical( self, "Error", "No Project Directory configured in config.xml.") return False self._setup_header(epp_root) self._setup_status() # Require Generation if not self._setup_generation(): msg = "Could not establish connection with Generation. Make sure it is running." log.error(msg, True) return False # Need edit rights for this one! if not self._gen.allow_changes(True): log.warning("Project locked.") return False if not self._setup_project(): msg = "Project directory from Generation Project invalid: {0}".format( self.PROJECTDIR) log.error(msg, True) return False if not self._setup_shot(): msg = "Project directory from Generation Project invald: {0}".format( self.PROJECTDIR) log.error(msg, True) return False return True
def _setup(self): """ Setup the widgets """ _fu = fu_controller() if not _fu.status(True): log.error("Fusion not running.", True) return False epp_root = osplus.get_env("EPP_ROOT") if not os.path.isdir(epp_root): log.error("Could not find EPP ROOT directory.\n{0}".format(epp_root), True) return False self.settings = settings.XMLSettings(os.path.join(epp_root, "config.xml") ) self.PROJECTROOT = self.settings.get("paths", "projectdir") if self.PROJECTROOT is None: log.error("No Project Directory configured in config.xml.", True) return False self._setup_header(epp_root) self._setup_status() self.cmbProject.currentIndexChanged.connect(self.update_shots) self.update_project() # Make sure enter does not add to combo box self.cmbName.installEventFilter(self) self.cmbProject.currentIndexChanged.connect(self._validate_path) self.cmbShot.currentIndexChanged.connect(self.update_names) self.cmbShot.currentIndexChanged.connect(self._validate_path) self.cmbName.currentIndexChanged.connect(self._validate_path) self.cmbName.lineEdit().textChanged.connect(self._validate_path) self.cmbName.lineEdit().textChanged.connect(self._get_last_version) self.spnVersion.valueChanged.connect(self._validate_path) self.butNext.clicked.connect(self._get_last_version) self._setup_defaults() self.update_names() return True
def accept(self): """ Check the connection. """ if not self._gen.status(True): log.error( "Could not establish connection with Generation. Make sure it is running.", True) return # Need edit rights for this one! if not self._gen.allow_changes(True): return selected_versions = self._gen.selected_versions() if len(selected_versions) < 1: msg = "No versions selected." log.error(msg, True) return ignore = False for version in selected_versions: meta = version.Metadata(version.InPoint) path = meta['Data']['File']['Path'] shotname = self.get_shotname(path) ret, msg = control.add_shot_from_media( self.PROJECTNAME, shotname, self.cmbDirStructure.currentText() + ".xml", self._gen, self.cmbInsertPosition.currentIndex() + 3, version.GetSlotClip()) if not ret: log.error(msg) if not ignore: ret = QMessageBox.critical( self, "Error", msg + "\nIgnore?", QMessageBox.Yes | QMessageBox.YesToAll | QMessageBox.Cancel) if ret == QMessageBox.Cancel: return elif ret == QMessageBox.YesToAll: ignore = True else: log.info(msg) super(AddShotFromMediaDialog, self).accept()
def _setup(self): """ Setup the widgets """ epp_root = osplus.get_env("EPP_ROOT") if not os.path.isdir(epp_root): QMessageBox.critical(self, "Error", "Could not find EPP ROOT directory.\n{0}".format(epp_root)) return False self.settings = settings.XMLSettings(os.path.join(epp_root, "config.xml") ) self.PROJECTROOT = self.settings.get("paths", "projectdir") if self.PROJECTROOT is None: QMessageBox.critical(self, "Error", "No Project Directory configured in config.xml.") return False self._setup_header(epp_root) self._setup_status() # Require Generation if not self._setup_generation(): msg = "Could not establish connection with Generation. Make sure it is running." log.error(msg, True) return False # Need edit rights for this one! if not self._gen.allow_changes(True): log.warning("Project locked.") return False if not self._setup_project(): msg = "Project directory from Generation Project invalid: {0}".format(self.PROJECTDIR) log.error(msg, True) return False if not self._setup_shot(): msg = "Project directory from Generation Project invald: {0}".format(self.PROJECTDIR) log.error(msg, True) return False return True
def accept(self): """ Check the connection. """ if not self._gen.status(True): log.error("Could not establish connection with Generation. Make sure it is running.", True) return # Need edit rights for this one! if not self._gen.allow_changes(True): return selected_versions = self._gen.selected_versions() if len(selected_versions) < 1: msg = "No versions selected." log.error(msg, True) return ignore = False for version in selected_versions: meta = version.Metadata(version.InPoint) path = meta['Data']['File']['Path'] shotname = self.get_shotname(path) ret, msg = control.add_shot_from_media(self.PROJECTNAME, shotname, self.cmbDirStructure.currentText()+".xml", self._gen, self.cmbInsertPosition.currentIndex()+3, version.GetSlotClip()) if not ret: log.error(msg) if not ignore: ret = QMessageBox.critical(self, "Error", msg+"\nIgnore?", QMessageBox.Yes | QMessageBox.YesToAll | QMessageBox.Cancel) if ret == QMessageBox.Cancel: return elif ret == QMessageBox.YesToAll: ignore = True else: log.info(msg) super(AddShotFromMediaDialog, self).accept()
def _setup(self): """ Setup the widgets """ epp_root = osplus.get_env("EPP_ROOT") if not os.path.isdir(epp_root): log.error( "Could not find EPP ROOT directory.\n{0}".format(epp_root), True) return False self.settings = settings.XMLSettings( os.path.join(epp_root, "config.xml")) self.PROJECTROOT = self.settings.get("paths", "projectdir") if not self.PROJECTROOT.endswith(os.path.sep): self.PROJECTROOT = self.PROJECTROOT + os.path.sep if self.PROJECTROOT is None: log.error("No Project Directory configured in config.xml.", True) return False self._setup_header(epp_root) #self._setup_name_widget(epp_root) self._setup_status() # Require Generation if not self._setup_generation(): msg = "Could not establish connection with Generation. Make sure it is running." log.error(msg, True) return False # Need edit rights for this one! if not self._gen.allow_changes(True): return False if not self._setup_project(): msg = "Project directory from Generation Project invalid: {0}".format( self.PROJECTDIR) log.error(msg, True) return False if not self._setup_shot(): msg = "Project directory from Generation Project invald: {0}".format( self.PROJECTDIR) log.error(msg, True) return False selected_versions = self._gen.selected_versions() if len(selected_versions) < 1: msg = "No versions selected." log.error(msg, True) return False meta = selected_versions[0].Metadata(selected_versions[0].InPoint) self.preview_path = meta['Data']['File']['Path'] if not self._setup_patterns(epp_root): msg = "No parsing patterns found." log.warning(msg) return False # We can't work without structs if not self._setup_structs(epp_root): msg = "Could not find directory structure files in templates.\n{0}".format( os.path.join(epp_root, "templates", "shot_dirs")) log.error(msg, True) return False return True
if len(selected_versions) < 1: return (False, "No versions selected.") for version in selected_versions: meta = version.Metadata(gen.frame()) path = meta['Data']['File']['Path'] mat = PAT_FILEBASENAME.findall(path) if len(mat): shotname = mat[0] gen.add_meta(version, shotname) log.info("Setting metadata of {0} to {1}".format( version.Name, shotname)) else: log.warning("Skipping " + os.path.basename(path)) return (True, "") if __name__ == '__main__': from epp.gen.controller import gen_controller epp_root = osplus.get_env("EPP_ROOT") cur_settings = settings.XMLSettings(os.path.join(epp_root, "config.xml")) patterns = cur_settings.findall("shotpattern", "pattern") gen = gen_controller() ret, msg = generate_meta(gen, patterns.values()[1]) if not ret: log.error(msg)
if len(selected_versions) < 1: return (False, "No versions selected.") for version in selected_versions: meta = version.Metadata(gen.frame()) path = meta['Data']['File']['Path'] mat = PAT_FILEBASENAME.findall(path) if len(mat): shotname = mat[0] gen.add_meta(version, shotname) log.info("Setting metadata of {0} to {1}".format(version.Name, shotname)) else: log.warning("Skipping " + os.path.basename(path)) return (True, "") if __name__ == '__main__': from epp.gen.controller import gen_controller epp_root = osplus.get_env("EPP_ROOT") cur_settings = settings.XMLSettings(os.path.join(epp_root, "config.xml") ) patterns = cur_settings.findall("shotpattern", "pattern") gen = gen_controller() ret, msg = generate_meta(gen, patterns.values()[1]) if not ret: log.error(msg)
def _setup(self): """ Setup the widgets """ epp_root = osplus.get_env("EPP_ROOT") if not os.path.isdir(epp_root): log.error("Could not find EPP ROOT directory.\n{0}".format(epp_root), True) return False self.settings = settings.XMLSettings(os.path.join(epp_root, "config.xml") ) self.PROJECTROOT = self.settings.get("paths", "projectdir") if not self.PROJECTROOT.endswith(os.path.sep): self.PROJECTROOT = self.PROJECTROOT + os.path.sep if self.PROJECTROOT is None: log.error("No Project Directory configured in config.xml.", True) return False self._setup_header(epp_root) #self._setup_name_widget(epp_root) self._setup_status() # Require Generation if not self._setup_generation(): msg = "Could not establish connection with Generation. Make sure it is running." log.error(msg, True) return False # Need edit rights for this one! if not self._gen.allow_changes(True): return False if not self._setup_project(): msg = "Project directory from Generation Project invalid: {0}".format(self.PROJECTDIR) log.error(msg, True) return False if not self._setup_shot(): msg = "Project directory from Generation Project invald: {0}".format(self.PROJECTDIR) log.error(msg, True) return False selected_versions = self._gen.selected_versions() if len(selected_versions) < 1: msg = "No versions selected." log.error(msg, True) return False meta = selected_versions[0].Metadata(selected_versions[0].InPoint) self.preview_path = meta['Data']['File']['Path'] if not self._setup_patterns(epp_root): msg = "No parsing patterns found." log.warning(msg) return False # We can't work without structs if not self._setup_structs(epp_root): msg = "Could not find directory structure files in templates.\n{0}".format(os.path.join(epp_root, "templates", "shot_dirs")) log.error(msg, True) return False return True