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 update_names(self): """docstring for update_project""" self.cmbName.clear() cur_project = self.cmbProject.currentText() cur_shot = self.cmbShot.currentText() if cur_project == "" or cur_shot == "": return self.COMP_ROOT_DIR = shot_id_path(cur_project, cur_shot, "compositions") if self.COMP_ROOT_DIR == "": self.valid_compname = False return self.valid_compname = True # TODO: More then comp for item in sorted(glob.glob(os.path.join(self.COMP_ROOT_DIR, "*.comp")), cmp=lambda x,y: cmp(os.path.basename(x).lower(), os.path.basename(y).lower())): if os.path.isfile(item): mat = self.PAT_VER.match(os.path.basename(item)) if mat is not None: base, ver, post = mat.groups() else: base = item self.cmbName.addItem(base, item) # Dirty Hack self.cmbName.lineEdit().setText(self.cmbShot.currentText().replace("\\", "_")) self._get_last_version()
def comps(project, shot): """docstring for comps""" comp_dir = shot_id_path(project, shot, "compositions") if os.path.isdir(comp_dir): return glob.glob(os.path.join(comp_dir, "*.comp")) return []
def _validate_path(self, text): """docstring for _validate_path""" cur_project = self.cmbProject.currentText() cur_shot = self.cmbShot.currentText() self.COMPOUTPUT_ROOT_DIR = shot_id_path(cur_project, cur_shot, "compoutput") valid_dir = os.path.isdir(self.COMPOUTPUT_ROOT_DIR) text = self.lneName.text() valid_name = len(text) > 0 file_exists = False self.SAVER_FILEPATH = "" if not self.valid_projectname: self.invalid_message = "<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='#ffaa00'>No project found.</font>" elif not self.valid_shotname: self.invalid_message = "<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='#ffaa00'>No shot found.</font>" # elif not self.valid_compname: # self.invalid_message = "<font color='#ffaa00'>Composition location not found in shot template.</font>" elif not valid_name: self.invalid_message = "<font color='#ffaa00'>Invalid Name</font>" elif not valid_dir: self.invalid_message = "<font color='#ffaa00'>No composition ouput path found in shot template.</font>" else: filename = u"{0}_v{1:03d}_".format(text, self.spnVersion.value()) saver_filedir = os.path.join(self.COMPOUTPUT_ROOT_DIR, filename) self.SAVER_FILEPATH = os.path.join( saver_filedir, filename + str(self.cmbFormat.itemData(self.cmbFormat.currentIndex())) ) if os.path.isdir(saver_filedir): file_exists = True self.invalid_message = "<font color='#ffaa00'>Warning: Output directory already exists.</font>" self.lblPreview.setText(os.path.basename(self.SAVER_FILEPATH)) cur_state = valid_name and self.valid_projectname and self.valid_shotname and valid_dir if not cur_state or file_exists: self.lblStatus.setText(self.invalid_message) self._status_fade.setDirection(QAbstractAnimation.Forward) self.compfilepath = "" else: self._status_fade.setDirection(QAbstractAnimation.Backward) # Does not account for file exists self.butCreate.setEnabled(cur_state) if (cur_state and not file_exists) != self._last_state: self._status_fade.start() self._last_state = cur_state and not file_exists
def _validate_path(self, text): """docstring for _validate_path""" cur_project = self.cmbProject.currentText() cur_shot = self.cmbShot.currentText() self.COMPOUTPUT_ROOT_DIR = shot_id_path(cur_project, cur_shot, "compoutput") valid_dir = os.path.isdir(self.COMPOUTPUT_ROOT_DIR) text = self.lneName.text() valid_name = len(text) > 0 file_exists = False self.SAVER_FILEPATH = "" if not self.valid_projectname: self.invalid_message = "<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='#ffaa00'>No project found.</font>" elif not self.valid_shotname: self.invalid_message = "<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='#ffaa00'>No shot found.</font>" #elif not self.valid_compname: # self.invalid_message = "<font color='#ffaa00'>Composition location not found in shot template.</font>" elif not valid_name: self.invalid_message = "<font color='#ffaa00'>Invalid Name</font>" elif not valid_dir: self.invalid_message = "<font color='#ffaa00'>No composition ouput path found in shot template.</font>" else: filename = u"{0}_v{1:03d}_".format(text, self.spnVersion.value()) saver_filedir = os.path.join(self.COMPOUTPUT_ROOT_DIR, filename) self.SAVER_FILEPATH = os.path.join(saver_filedir, filename + str(self.cmbFormat.itemData(self.cmbFormat.currentIndex()))) if os.path.isdir(saver_filedir): file_exists = True self.invalid_message = "<font color='#ffaa00'>Warning: Output directory already exists.</font>" self.lblPreview.setText(os.path.basename(self.SAVER_FILEPATH)) cur_state = valid_name and self.valid_projectname and self.valid_shotname and valid_dir if not cur_state or file_exists: self.lblStatus.setText(self.invalid_message) self._status_fade.setDirection(QAbstractAnimation.Forward) self.compfilepath = "" else: self._status_fade.setDirection(QAbstractAnimation.Backward) # Does not account for file exists self.butCreate.setEnabled(cur_state) if (cur_state and not file_exists) != self._last_state: self._status_fade.start() self._last_state = (cur_state and not file_exists)
def update_names(self): """docstring for update_project""" self.cmbName.clear() cur_project = self.cmbProject.currentText() cur_shot = self.cmbShot.currentText() if cur_project == "" or cur_shot == "": return self.COMP_ROOT_DIR = shot_id_path(cur_project, cur_shot, "compositions") if self.COMP_ROOT_DIR == "": self.valid_compname = False return self.valid_compname = True # TODO: More then comp for item in sorted(glob.glob(os.path.join(self.COMP_ROOT_DIR, "*.comp")), cmp=lambda x, y: cmp( os.path.basename(x).lower(), os.path.basename(y).lower())): if os.path.isfile(item): mat = self.PAT_VER.match(os.path.basename(item)) if mat is not None: base, ver, post = mat.groups() else: base = item self.cmbName.addItem(base, item) # Dirty Hack self.cmbName.lineEdit().setText(self.cmbShot.currentText().replace( "\\", "_")) self._get_last_version()