def callback_show_sequence(self): import subprocess hafarm_parms = self.context.GUI.get_job_parms_from_detail_view() picture_parm = hafarm_parms[u'parms'][u'output_picture'] picture_info = utilities.padding(picture_parm, format="shell") picture_path = picture_info[0] config = self.context.config viewer = config.select_optional_executable('image_viewer') if viewer: # Hard coded fix for rv :( if viewer.endswith("rv"): picture_path = picture_path.replace("*", "#") command = [viewer, picture_path] subprocess.Popen(command, shell=False) return else: self.context.GUI.message( "Can't find viewer app in PATH. Trying RV in rez subshell...") package = ['rv'] command = "export HOME=%s; export DISPLAY=:0; rv %s" % ( os.getenv("HOME"), picture_path.replace("*", "#")) pid = utilities.run_rez_shell(command, package) if pid: return
def tasks_view_doubleClicked(self, index): """ Double clicking on an item in task view starts viewer for now. """ import subprocess s_index = self.tasks_view.proxy_model.mapToSource(index) job_id_index = self.tasks_view.model.get_key_index(backend.TASK_ID_KEY) job_id = self.tasks_view.model._data[s_index.row()][job_id_index] task_id_index = self.tasks_view.model.get_key_index(backend.TASK_NUMBER) task_id = self.tasks_view.model._data[s_index.row()][task_id_index] hafarm_parms = self.get_job_parms_from_detail_view() picture_parm = hafarm_parms[u'parms'][u'output_picture'] picture_info = utilities.padding(picture_parm, _frame=task_id) picture_path = picture_info[0] if not os.path.isfile(picture_path): self.context.GUI.message("Can't find %s" % picture_path) return viewer = self.config.select_optional_executable("image_viewer") if viewer: command = [viewer, picture_path] subprocess.Popen(command, shell=False) return else: self.context.GUI.message("Can't find viewer app in PATH. Trying RV in rez subshell...") package = ['rv'] command = "export HOME=%s; export DISPLAY=:0; rv %s" % (os.getenv("HOME"), picture_path) pid = utilities.run_rez_shell(command, package) if pid: return
def tasks_view_doubleClicked(self, index): """ Double clicking on an item in task view starts viewer for now. """ import subprocess s_index = self.tasks_view.proxy_model.mapToSource(index) job_id_index = self.tasks_view.model.get_key_index(backend.TASK_ID_KEY) job_id = self.tasks_view.model._data[s_index.row()][job_id_index] task_id_index = self.tasks_view.model.get_key_index( backend.TASK_NUMBER) task_id = self.tasks_view.model._data[s_index.row()][task_id_index] hafarm_parms = self.get_job_parms_from_detail_view() picture_parm = hafarm_parms[u'parms'][u'output_picture'] picture_info = utilities.padding(picture_parm, _frame=task_id) picture_path = picture_info[0] if not os.path.isfile(picture_path): self.context.GUI.message("Can't find %s" % picture_path) return viewer = self.config.select_optional_executable("image_viewer") if viewer: command = [viewer, picture_path] subprocess.Popen(command, shell=False) return else: self.context.GUI.message( "Can't find viewer app in PATH. Trying RV in rez subshell...") package = ['rv'] command = "export HOME=%s; export DISPLAY=:0; rv %s" % ( os.getenv("HOME"), picture_path) pid = utilities.run_rez_shell(command, package) if pid: return
def tasks_view_doubleClicked(self, index): """ Double clicking on an item in task view starts viewer for now. """ s_index = self.tasks_view.proxy_model.mapToSource(index) job_id_index = self.tasks_view.model.get_key_index(backend.TASK_ID_KEY) job_id = self.tasks_view.model._data[s_index.row()][job_id_index] task_id_index = self.tasks_view.model.get_key_index(backend.TASK_NUMBER) task_id = self.tasks_view.model._data[s_index.row()][task_id_index] hafarm_parms = self.get_job_parms_from_detail_view() picture_parm = hafarm_parms[u'parms'][u'output_picture'] picture_info = utilities.padding(picture_parm, _frame=task_id) print picture_info if not os.path.isfile(picture_info[0]): return viewer = self.config.select_optional_executable("image_viewer") if not viewer: return import subprocess command = [viewer, picture_info[0]] subprocess.Popen(command, shell=False)
def callback_copy_to_nuke(self): """Creates a Nuke's paste string to create ReadNodes from selected render jobs. """ indices = self.view.selectedIndexes() indices = [ self.view.proxy_model.mapToSource(index) for index in indices ] job_ids = list(set([index.row() for index in indices])) job_id_index = self.model.get_key_index('JB_job_number') clipboard = self.app.clipboard() read = [] nuke_paste_in = "" model = self.context.views['job_detail_view'].model for index in indices: job_id = self.model._data[index.row()][job_id_index] if job_id not in read: model.update(constants.SGE_JOB_DETAILS % job_id) picture = model.get_value('OUTPUT_PICTURE') rn_min = model.get_value("RN_min")[0] rn_max = model.get_value('RN_max')[0] read.append(job_id) if picture: p0 = utilities.padding(picture[0], 'nuke')[0] nuke_paste_in += constants.NUKE_READ_NODE_STRING % ( p0, rn_min, rn_max) nuke_paste_in += "\n" clipboard.setText(nuke_paste_in)
def preprocess_map(self, path): original_image = cv2.imread(path, 0) padded_image = utilities.padding(original_image, self.gt_shape[0], self.gt_shape[1], 1) im = padded_image.astype('float32') im /= 255.0 return im
def image_view_update(self, job_id, task_id): """ """ hafarm_parms = self.get_job_parms_from_detail_view() picture_parm = hafarm_parms[u'parms'][u'output_picture'] picture_info = utilities.padding(picture_parm, _frame=task_id) if not os.path.isfile(picture_info[0]): return self.load_render_preview(picture_info[0]) self.image_detail_view.update_model(picture_info[0])
def preprocess_image(self, path): original_image = cv2.imread(path) padded_image = utilities.padding(original_image, self.im_shape[0], self.im_shape[1], 3) im = padded_image.astype('float32') im[:, :, 0] -= 103.939 im[:, :, 1] -= 116.779 im[:, :, 2] -= 123.68 im = im.transpose((2, 0, 1)) return im
def callback_show_in_folder(self): import subprocess task_id = self.get_selected_items(key=backend.TASK_NUMBER)[-1] hafarm_parms = self.context.GUI.get_job_parms_from_detail_view() picture_parm = hafarm_parms[u'parms'][u'output_picture'] picture_info = utilities.padding(picture_parm, _frame=task_id) picture_path = picture_info[0] config = self.context.config manager = config.select_optional_executable('file_manager') if not manager: self.context.GUI.message("Can't find file manager.") return command = [manager, picture_path] subprocess.Popen(command, shell=False)
def callback_show_sequence(self): import subprocess hafarm_parms = self.context.GUI.get_job_parms_from_detail_view() picture_parm = hafarm_parms[u'parms'][u'output_picture'] picture_info = utilities.padding(picture_parm, format="shell") picture_path = picture_info[0] config = self.context.config viewer = config.select_optional_executable('image_viewer') if not viewer: self.context.GUI.message("Can't find viewer app. Rez-env rv, djv, houdini, maya or Nuke.") return # Hard coded fix for rv :( if viewer.endswith("rv"): picture_path = picture_path.replace("*", "#") command = [viewer, picture_path] subprocess.Popen(command, shell=False)
def callback_copy_to_nuke(self): """Creates a Nuke's paste string to create ReadNodes from selected render jobs. """ indices = self.view.selectedIndexes() indices = [self.view.proxy_model.mapToSource(index) for index in indices] job_ids = list(set([index.row() for index in indices])) job_id_index = self.model.get_key_index('JB_job_number') clipboard = self.app.clipboard() read = []; nuke_paste_in = "" model = self.context.views['job_detail_view'].model for index in indices: job_id = self.model._data[index.row()][job_id_index] if job_id not in read: model.update(constants.SGE_JOB_DETAILS % job_id) picture = model.get_value('OUTPUT_PICTURE') rn_min = model.get_value("RN_min")[0] rn_max = model.get_value('RN_max')[0] read.append(job_id) if picture: p0 = utilities.padding(picture[0], 'nuke')[0] nuke_paste_in += constants.NUKE_READ_NODE_STRING % (p0, rn_min, rn_max) nuke_paste_in += "\n" clipboard.setText(nuke_paste_in)