def on_main_asset_selected(self, data): print 'selecting' if data: print data[0][2] path_object = PathObject(data[0][2]) if not path_object.task: path_object.set_attr(task='*') else: path_object.set_attr(user=None) self.update_location(path_object)
def make_source_file(self, to_path, row): source_path = PathObject(to_path) source_path.set_attr(context='source') source_path.set_attr(filename='system_report.csv') dir = os.path.dirname(source_path.path_root) data = [] data.append((row["Filepath"], row["Filename"], row["Filetype"], row["Frame_Range"], row["Tags"], row["Keep_Client_Naming"], row["Scope"], row["Seq"], row["Shot"], row["Task"], row["Publish_Filepath"], row["Publish_Date"], row["Status"])) df = pd.DataFrame(data, columns=self.shared_data['ingest_browser_header']) if not self.test: df.to_csv(source_path.path_root, index=False)
def make_source_file(to_path, row): source_path = PathObject(to_path) source_path.set_attr(context='source') source_path.set_attr(filename='system_report.csv') dir_ = os.path.dirname(source_path.path_root) if not os.path.exists(dir_): os.makedirs(dir_) data = [] data.append( (row["Filepath"], row["Filename"], row["Filetype"], row["Frame_Range"], row["Tags"], row["Keep_Client_Naming"], row["Scope"], row["Seq"], row["Shot"], row["Task"], row["Publish_Filepath"], row["Publish_Date"], row["Status"])) df = pd.DataFrame( data, columns=CONFIG['definitions']['ingest_browser_header']) df.to_csv(source_path.path_root, index=False)
def run(self): path_object = self.shared_data['path_object'] user = path_object.user if path_object.context != 'render': path_object = PathObject.copy(path_object, context='render') from_dir = os.path.dirname(path_object.path_root) pub_obj = PathObject(from_dir) pub_obj = pub_obj.copy(latest=True) pub_obj.set_attr(user='******') pub_obj = pub_obj.next_major_version() major_version_obj = pub_obj.copy(user=user) for each in os.listdir(from_dir): print(os.path.join(from_dir, each), os.path.join(major_version_obj.path_root, each)) print(os.path.join(from_dir, each), os.path.join(pub_obj.path_root, each)) cgl_copy(os.path.join(from_dir, each), os.path.join(major_version_obj.path_root, each)) cgl_copy(os.path.join(from_dir, each), os.path.join(pub_obj.path_root, each)) self.pass_check('Done Copying Render Files to %s' % pub_obj.path_root)
def reload_task_widget(self, widget, path_object=None, populate_versions=True): if path_object: path_obj = PathObject(path_object) else: path_obj = PathObject(self.current_location) path_obj.set_attr(user=widget.users.currentText()) if populate_versions: path_obj.set_attr(version=self.populate_versions_combo( widget, path_obj, widget.label)) else: path_obj.set_attr(version=widget.versions.currentText()) path_obj.set_attr(resolution=widget.resolutions.currentText()) path_obj.set_attr(task=widget.task) self.update_task_location(path_obj) list_ = [] files_ = glob.glob('%s/*' % path_obj.path_root) for each in files_: list_.append(os.path.basename(each)) # this is what's doing the loading of the files. widget.files_area.clear()
def create_proxy_sequence(input_sequence, output_sequence, width='1920', height='1080', do_height=False, processing_method='local', dependent_job=None, copy_input_padding=True, command_name='create_proxy_sequence()', new_window=False, ext=None): """ Create a proxy jpeg sequence in sRGB color space from the given input sequence. :param input_sequence: input sequence string, formatted with (#, %04d, *) :param output_sequence: output sequence string, formatted with (####, %04d, *) :param width: width in pixels :param height: height in pixels :param do_height: this is when you want to specifically use both parts of the width/height. y default we only use width and scale from there. :param processing_method: how will this be processed? (local, smedge, deadline) :param dependent_job: job_id of any dependencies :param copy_input_padding: if True use the same padding as the input file, if False, use studio wide padding setting :param command_name: this is the command name that will be sent to the render farm :param new_window: Puts the processing of the job into a new shell :param ext: if none i'll use what's in the output. :return: """ from cgl.core.path import Sequence, PathObject if ' ' in input_sequence: input_sequence, frange = input_sequence.split(' ') input_sequence.replace('/', '\\') input_ = Sequence(input_sequence) if not input_.is_valid_sequence(): logging.error('%s is not a valid sequence' % input_sequence) filein = input_.star_sequence if copy_input_padding: padding = input_.padding else: padding = PADDING output_sequence = output_sequence.replace('/', '\\') output_ = Sequence(output_sequence, padding=padding) if not output_.is_valid_sequence(): logging.error('%s is not a valid sequence' % output_sequence) fileout = output_.num_sequence out_dir = os.path.dirname(fileout) out_obj = PathObject(out_dir) if out_obj.context == 'source': out_obj.set_attr(context='render') else: out_obj.set_attr(context='source') if not os.path.exists(out_dir): os.makedirs(out_dir) if not os.path.exists(out_obj.path_root): os.makedirs(out_obj.path_root) process_info = None if do_height: res = 'x%s' % height else: res = width start_frame = input_.start_frame if processing_method == 'smedge': pyfile = '%s.py' % os.path.splitext(__file__)[0] command = r'python %s -i %s -o %s -w %s -h %s -ft sequence -t proxy' % ( pyfile, filein, fileout, width, height) # probably good to write a custom imagemagick command for smedge for this. process_info = cgl_execute(command, command_name=command_name, methodology='smedge', WaitForJobID=dependent_job) elif processing_method == 'local': dirname, filename = os.path.split(filein) match = filename.split('*')[0] for each in os.listdir(os.path.dirname(filein)): if match in each: file_ = os.path.join(os.path.dirname(filein), each) SEQ_SPLIT = "\d{3,}\.\w{2,4}$" frange = re.search(SEQ_SPLIT, each) if frange: num = os.path.splitext(frange.group(0))[0] filename, ext_ = fileout.split('%') if not ext: ext = os.path.splitext(ext_)[-1].replace('.', '') file_out = '%s%s.%s' % (filename, num, ext) command = '%s %s -resize %s %s' % (PATHS['magick'], file_, res, file_out) process_info = cgl_execute(command, methodology='local', command_name=command_name, verbose=True, new_window=new_window) if process_info: process_info['file_out'] = fileout print(fileout) print('-----------') print(process_info) try: write_to_cgl_data(process_info) except ValueError: print('Skipping write to cgl_data: %s' % process_info) return process_info else: print('----------------------------') print('process_info not defined')
class AssetCreator(LJDialog): def __init__(self, parent=None, path_dict=None, task_mode=False): LJDialog.__init__(self, parent) self.task_mode = task_mode self.resize(300, 60) self.red_palette, self.green_palette, self.black_palette = define_palettes( ) if not path_dict: return self.path_object = PathObject(path_dict) self.scope = self.path_object.scope if task_mode: self.setWindowTitle('Create %s' % 'Task(s)') else: self.setWindowTitle('Create %s' % self.scope.title()) self.asset = None self.asset_message_string = '' self.asset_list = [] self.full_root = None self.regex = '' self.valid_categories_string = '' self.seq = None self.valid_categories = [] self.get_valid_categories() # Environment Stuff self.root = CONFIG['paths']['root'] self.project_management = CONFIG['account_info']['project_management'] self.schema = CONFIG['project_management'][ self.project_management]['api']['default_schema'] if self.scope == 'assets': self.asset_string_example = CONFIG['rules']['path_variables'][ 'asset']['example'] elif self.scope == 'shots': self.asset_string_example = CONFIG['rules']['path_variables'][ 'shotname']['example'] schema = CONFIG['project_management'][ self.project_management]['tasks'][self.schema] self.proj_man_tasks = schema['long_to_short'][self.scope.lower()] self.proj_man_tasks_short_to_long = schema['short_to_long'][ self.scope.lower()] self.v_layout = QtWidgets.QVBoxLayout(self) self.scope_row = QtWidgets.QHBoxLayout() self.asset_row = QtWidgets.QHBoxLayout(self) self.tasks = [] self.task_row = QtWidgets.QHBoxLayout(self) self.task_combo = AdvComboBox() self.clear_selection_button = QtWidgets.QPushButton('Clear Selection') self.defaults_radio = QtWidgets.QRadioButton('Select Defaults') self.none_radio = QtWidgets.QRadioButton('Select None') self.radio_layout = QtWidgets.QHBoxLayout() self.radio_layout.addItem( QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)) self.radio_layout.addWidget(self.defaults_radio) self.radio_layout.addWidget(self.none_radio) self.defaults_radio.setChecked(True) self.defaults_radio.hide() self.none_radio.hide() if self.task_mode: self.create_button = QtWidgets.QPushButton('Create %s' % 'Task(s)') else: self.create_button = QtWidgets.QPushButton('Create %s' % self.scope.title()) self.create_button.setEnabled(False) # asset & shot stuff self.asset_widget = AssetWidget(self, scope=self.scope, title=str(self.path_object.project)) self.asset_widget.name_row.combo.setEnabled(False) self.asset_row.addWidget(self.asset_widget) # task stuff self.task_layout = QtWidgets.QVBoxLayout(self) for each in self.proj_man_tasks: checkbox = QtWidgets.QCheckBox('%s (%s)' % (each, self.proj_man_tasks[each])) checkbox.stateChanged.connect(self.on_checkbox_clicked) self.task_layout.addWidget(checkbox) self.v_layout.addLayout(self.asset_row) self.v_layout.addLayout(self.radio_layout) self.v_layout.addLayout(self.task_layout) self.v_layout.addWidget(self.create_button) self.v_layout.addItem( QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) self.asset_widget.message.hide() # self.asset_widget.message.setPalette(self.red_palette) self.load_categories() self.asset_widget.category_row.combo.currentIndexChanged.connect( self.on_category_selected) self.asset_widget.name_row.combo.editTextChanged.connect( self.process_asset_string) self.create_button.clicked.connect(self.on_create_clicked) if self.scope == 'shots': self.asset_widget.category_row.combo.editTextChanged.connect( self.on_seq_text_changed) self.hide_layout_items(self.task_layout) if self.task_mode: self.on_set_vars() def on_set_vars(self): if self.path_object.seq: if self.path_object.seq != '*': index = self.asset_widget.category_row.combo.findText( self.path_object.seq) if index != -1: self.asset_widget.category_row.combo.setCurrentIndex(index) else: self.asset_widget.category_row.combo.addItem( self.path_object.seq) index = self.asset_widget.category_row.combo.findText( self.path_object.seq) self.asset_widget.category_row.combo.setCurrentIndex(index) if self.path_object.shot: if self.path_object.shot != '*': index = self.asset_widget.name_row.combo.findText( self.path_object.shot) if index != -1: self.asset_widget.name_row.combo.setCurrentIndex(index) else: self.asset_widget.name_row.combo.addItem( self.path_object.shot) index = self.asset_widget.name_row.combo.findText( self.path_object.shot) self.asset_widget.name_row.combo.setCurrentIndex(index) def on_checkbox_clicked(self): self.find_all_checked_boxes() def find_all_checked_boxes(self): self.tasks = [] for i in range(self.task_layout.count()): child = self.task_layout.itemAt(i) if child.widget().checkState() == QtCore.Qt.Checked: self.tasks.append(child.widget().text().split('(')[-1].replace( ')', '')) @staticmethod def hide_layout_items(layout): for i in range(layout.count()): child = layout.itemAt(i).widget() child.hide() @staticmethod def show_layout_items(layout): for i in range(layout.count()): child = layout.itemAt(i).widget() child.show() def on_category_selected(self): self.path_object.set_attr( seq=self.asset_widget.category_row.combo.currentText()) self.asset_widget.name_row.combo.setEnabled(True) self.load_assets() def on_seq_text_changed(self): self.seq = self.asset_widget.category_row.combo.currentText() seq_rules = CONFIG['rules']['path_variables']['seq']['regex'] example = CONFIG['rules']['path_variables']['seq']['example'] self.regex = re.compile(r'%s' % seq_rules) if re.match(self.regex, self.seq): self.asset_widget.name_row.combo.setEnabled(True) self.asset_widget.message.hide() else: self.asset_message_string = '%s is not a valid sequence name\n%s' % ( self.seq, example) self.asset_widget.message.setText(self.asset_message_string) # self.asset_widget.message.setPalette(self.red_palette) self.asset_widget.message.show() def load_categories(self): if self.path_object.scope == 'assets': categories = CONFIG['asset_categories'] cats = [''] for c in categories: if CONFIG['account_info']['project_management'] == 'shotgun': cats.append(c) else: cats.append(categories[c]) self.asset_widget.category_row.combo.addItems(cats) elif self.path_object.scope == 'shots': seqs = self.path_object.glob_project_element('seq') self.asset_widget.category_row.combo.addItems(seqs) self.on_seq_text_changed() def process_asset_string(self): asset_rules = '' self.seq = self.asset_widget.category_row.combo.currentText() asset_string = self.asset_widget.name_row.combo.currentText() if self.scope == 'assets': asset_rules = r'^([a-zA-Z]{3,},\s*)*([a-zA-Z]{3,}$)|^([a-zA-Z]{3,},\s*)*([a-zA-Z]{3,}$)' # example = CONFIG['rules']['path_variables']['shot']['regex'] if self.scope == 'shots': asset_rules = CONFIG['rules']['path_variables']['shot']['regex'] self.regex = re.compile(r'%s' % asset_rules) if re.match(self.regex, asset_string): self.asset_message_string = '%s is a valid %s name' % ( asset_string, self.scope) # self.asset_widget.message.setPalette(self.black_palette) self.asset_widget.message.setText(self.asset_message_string) self.asset_widget.message.hide() self.show_layout_items(self.task_layout) self.create_button.setEnabled(True) if asset_string in self.asset_list: self.asset_message_string = '%s already Exists!' % asset_string self.asset_widget.message.setText(self.asset_message_string) # self.asset_widget.message.setPalette(self.red_palette) self.asset_widget.message.show() self.hide_layout_items(self.task_layout) self.create_button.setEnabled(False) else: self.asset_message_string = '%s is not a valid %s name\n%s' % ( asset_string, self.scope, self.asset_string_example) self.asset_widget.message.setText(self.asset_message_string) # self.asset_widget.message.setPalette(self.red_palette) if asset_string == '': self.asset_widget.message.hide() else: self.asset_widget.message.show() self.hide_layout_items(self.task_layout) self.create_button.setEnabled(False) def get_valid_categories(self): categories = CONFIG['asset_categories'] for each in categories: self.valid_categories.append(each) self.valid_categories_string = '%s, %s' % ( self.valid_categories_string, each) @staticmethod def remove_spaces_on_list(list_): new_list = [] for each in list_: new_list.append(each.replace(' ', '')) return new_list def load_assets(self): self.asset_widget.name_row.combo.clear() glob_path = self.path_object.path_root glob_path = re.sub('/+$', '', glob_path) list_ = glob.glob(glob_path) assets = [''] for each in list_: assets.append(os.path.split(each)[-1]) self.asset_list = assets self.asset_widget.name_row.combo.addItems(assets) def load_tasks(self): task_list = self.proj_man_tasks tasks = [''] for each in task_list: tasks.append(each) @staticmethod def is_valid_asset(): pass @staticmethod def is_valid_shot(): pass def on_create_clicked(self): for each in self.tasks: if self.scope == 'assets': self.path_object.set_attr( asset=self.asset_widget.name_row.combo.currentText()) self.path_object.set_attr(type=self.seq) elif self.scope == 'shots': self.path_object.set_attr( shot=self.asset_widget.name_row.combo.currentText()) self.path_object.set_attr(seq=self.seq) self.path_object.set_attr(task=each) CreateProductionData(self.path_object.data, project_management=self.project_management) self.accept() self.close()
def on_task_selected(self, data): try: if isinstance(data, PathObject): current = data.copy() elif isinstance(data, dict): 'its a dict, this sucks' current = PathObject(data) except IndexError: print 'Nothing Selected' return if data: self.clear_layout(self.panel) # reset the GUI if not current.task: current.set_attr(task='*') current.set_attr(root=self.path_object.root) # current.set_attr(user_email=self.user_email) self.panel.seq = current.seq self.panel.shot = current.shot self.update_task_location(path_object=current) self.panel.tasks = [] try: if 'elem' in self.task: title = self.task else: title = self.proj_man_tasks_short_to_long[self.task] except KeyError: return task_widget = TaskWidget(parent=self, title=title, path_object=current, show_import=self.show_import) task_widget.task = self.task self.render_files_widget = task_widget.files_area.export_files_table task_widget.files_area.export_files_table.hide() self.task_widgets_dict[self.task] = task_widget # find the version information for the task: user = self.populate_users_combo(task_widget, current, self.task) self.current_location['user'] = user version = self.populate_versions_combo(task_widget, current, self.task) self.current_location['version'] = version resolution = self.populate_resolutions_combo( task_widget, current, self.task) self.current_location['resolution'] = resolution self.update_task_location(self.current_location) self.panel.addWidget(task_widget) self.panel.tasks.append(self.task) self.version_obj = current.copy(task=self.task, user=user, version=version, resolution=resolution, context='source', filename='*') task_widget.files_area.work_files_table.task = self.version_obj.task task_widget.files_area.work_files_table.user = self.version_obj.user task_widget.files_area.work_files_table.version = self.version_obj.version task_widget.files_area.work_files_table.resolution = self.version_obj.resolution try: self.work_files = self.version_obj.glob_project_element( 'filename', full_path=True) self.high_files = self.version_obj.copy( resolution='high').glob_project_element('filename', full_path=True) except ValueError: self.work_files = [] self.high_files = [] # check to see if there are work files for the 'high' version self.render_files = [] if user != 'publish': my_files_label = 'My Work Files' if not self.work_files: my_files_label = 'Drag/Drop Work Files' task_widget.files_area.work_files_table.hide() else: my_files_label = 'Published Work Files' logging.debug('Work Files: %s' % self.work_files) task_widget.setup( task_widget.files_area.work_files_table, FileTableModel( self.prep_list_for_table(self.work_files, basename=True), [my_files_label])) self.load_render_files(task_widget) task_widget.create_empty_version.connect( self.new_empty_version_clicked) task_widget.files_area.review_button_clicked.connect( self.on_review_clicked) task_widget.files_area.publish_button_clicked.connect( self.on_publish_clicked) task_widget.copy_latest_version.connect( self.new_version_from_latest) task_widget.copy_selected_version.connect( self.version_up_selected_clicked) task_widget.files_area.work_files_table.selected.connect( self.on_source_selected) task_widget.files_area.export_files_table.selected.connect( self.on_render_selected) task_widget.files_area.export_files_table.double_clicked.connect( self.on_render_double_clicked) task_widget.files_area.export_files_table.show_in_folder.connect( self.show_selected_in_folder) task_widget.files_area.work_files_table.doubleClicked.connect( self.on_open_clicked) task_widget.files_area.open_button.clicked.connect( self.on_open_clicked) task_widget.files_area.import_button.clicked.connect( self.on_import_clicked) task_widget.versions.currentIndexChanged.connect( self.on_task_info_changed) task_widget.users.currentIndexChanged.connect( self.on_task_info_changed) task_widget.resolutions.currentIndexChanged.connect( self.on_task_info_changed) task_widget.start_task_clicked.connect( self.on_assign_button_clicked) task_widget.files_area.work_files_table.dropped.connect( self.on_file_dragged_to_source) task_widget.files_area.export_files_table.dropped.connect( self.on_file_dragged_to_render) task_widget.files_area.work_files_table.show_in_folder.connect( self.show_selected_in_folder) task_widget.files_area.work_files_table.copy_folder_path.connect( self.copy_folder_path) task_widget.files_area.work_files_table.copy_file_path.connect( self.copy_file_path) task_widget.files_area.work_files_table.import_version_from.connect( self.import_versions_from) task_widget.empty_state.files_added.connect( self.on_file_dragged_to_source) if not user: task_widget.users_label.hide() task_widget.users.hide() task_widget.files_area.hide() task_widget.versions_label.hide() task_widget.versions.hide() task_widget.resolutions_label.hide() task_widget.resolutions.hide() task_widget.empty_state.hide() task_widget.status_button.hide() else: if task_widget.users.currentText() == current_user(): task_widget.refresh_task_info() else: task_widget.status_button.hide()
def on_render_selected(self, data): if data: new_data = [] if self.current_location['context'] == 'source': self.current_location['filename'] = '' self.current_location['ext'] = '' self.current_location['context'] = 'render' object_ = PathObject(self.current_location) if not self.in_current_folder: current_variable = self.get_next_path_object_variable(object_) self.in_current_folder = True else: current_variable = self.get_next_path_object_variable( object_, current=True) print current_variable, object_.path_root if current_variable != 'filename': if object_.filename: object_.set_attr(filename='') object_.set_attr(ext='') new_path_object = PathObject(object_).copy() new_path_object.set_attr(attr=current_variable, value=data[0][0]) object_.set_attr(attr=current_variable, value=data[0][0]) # object_.set_attr(task=self.sender().task) if current_variable == 'filename': if os.path.splitext(data[0][0]): print 'this is a file' object_.set_attr(filename=data[0][0]) filename_base, ext = os.path.splitext(data[0][0]) object_.set_attr(filename_base=filename_base) object_.set_attr(ext=ext.replace('.', '')) else: print 'this is a folder i thought was a file' self.update_task_location(new_path_object) for each in data: dir_ = os.path.dirname(object_.path_root) new_data.append(os.path.join(dir_, each[0])) self.source_selection_changed.emit(new_data) # self.clear_task_selection_except(self.sender().task) self.sender().parent().show_tool_buttons(user=self.user) self.sender().parent().review_button.setEnabled(True) self.sender().parent().publish_button.setEnabled(True) self.add_context_menu() else: logging.debug( 'No render Files, Drag/Drop them to interface, or create them through software.' )
def on_source_selected(self, data): reload_render = False new_data = [] temp_ = PathObject(self.current_location) if temp_.resolution: if temp_.render_pass: reload_render = True object_ = PathObject(temp_.split_after('resolution')) else: object_ = temp_ parent = self.sender().parent() object_.set_attr(root=self.path_object.root) object_.set_attr(version=parent.parent().versions.currentText()) object_.set_attr(context='source') object_.set_attr(resolution=parent.parent().resolutions.currentText()) object_.set_attr(user=parent.parent().users.currentText()) object_.set_attr(task=self.sender().task) try: object_.set_attr(filename=data[0][0]) filename_base, ext = os.path.splitext(data[0][0]) object_.set_attr(filename_base=filename_base) object_.set_attr(ext=ext.replace('.', '')) except IndexError: # this indicates a selection within the module, but not a specific selected files pass self.update_task_location(object_) for each in data: dir_ = os.path.dirname(object_.path_root) new_data.append(os.path.join(dir_, each[0])) self.source_selection_changed.emit(new_data) self.clear_task_selection_except(self.sender().task) self.sender().parent().show_tool_buttons(user=object_.user) if reload_render: self.load_render_files(self.task_widgets_dict[object_.task])
def do_review(progress_bar=None, path_object=None): import shutil import logging from cgl.core.utils.general import cgl_copy from cgl.ui.widgets.dialog import InputDialog job_id = None if not path_object: print 'No Valid PathObject() found for review' return None else: selection = path_object selection.set_preview_path() selection.set_hd_proxy_path() # selection.set_path() if os.path.isdir(selection.path_root): print 'Choose a sequence or file' return if not os.path.exists(selection.preview_path): print('No Web Preview Found, creating one') job_info = selection.make_preview() job_id = job_info['job_id'] if selection.context == 'render': # lin_images = ['exr', 'dpx'] # LUMBERMILL REVIEWS if PROJ_MANAGEMENT == 'lumbermill': # do this for movies print 'Lumbermill Not connected to review features' # FTRACK REVIEWS elif PROJ_MANAGEMENT == 'ftrack': if selection.filename: if selection.file_type == 'folder' or not selection.file_type: dialog = InputDialog( title='Error: unsupported folder or file_type', message= "%s is a folder or undefined file_type\nunsure how to proceed" % selection.filename) dialog.exec_() if dialog.button == 'Ok' or dialog.button == 'Cancel': dialog.accept() return else: selection.upload_review(job_id=job_id) # CreateProductionData(selection) else: print('Select file for Review') elif PROJ_MANAGEMENT == 'shotgun': if selection.filename: if selection.file_type == 'folder' or not selection.file_type: dialog = InputDialog( title='Error: unsupported folder or file_type', message= "%s is a folder or undefined file_type\nunsure how to proceed" % selection.filename) dialog.exec_() if dialog.button == 'Ok' or dialog.button == 'Cancel': dialog.accept() return else: if os.path.exists(selection.preview_path): print 1 CreateProductionData(path_object=selection) else: selection.upload_review(job_id=job_id) else: print('Select file for Review') else: print('%s is an unknown project management type' % PROJ_MANAGEMENT) selection.set_attr(filename='') selection.set_attr(ext='') else: dialog = InputDialog(title="Prep for Review", message="Move or copy files to review area?", buttons=['Move', 'Copy']) dialog.exec_() move = False if dialog.button == 'Move': move = True if selection.file_type == 'sequence': # sequence_name = selection.filename from_path = os.path.dirname(selection.path_root) to_object = PathObject(from_path) to_object.set_attr(context='render') for each in os.listdir(from_path): from_file = os.path.join(from_path, each) to_file = os.path.join(to_object.path_root, each) if move: shutil.move(from_file, to_file) else: cgl_copy(from_file, to_file) selection.set_attr(filename='') selection.set_attr(ext='') else: to_object = PathObject.copy(selection, context='render') logging.info('Copying %s to %s' % (selection.path_root, to_object.path_root)) if move: shutil.move(selection.path_root, to_object.path_root) else: cgl_copy(selection.path_root, to_object.path_root) selection.set_attr(filename='') selection.set_attr(ext='') if progress_bar: progress_bar.hide() return True