def back_button_pressed(self): path_object = cglpath.PathObject( self.current_location_line_edit.text()) path_object.set_attr(context='source') # if i'm a task, show me all the assets or shots last = path_object.get_last_attr() if last == 'filename': last = 'task' if last == 'resolution': last = 'task' if last == 'version': if path_object.scope == 'IO': last = 'scope' else: last = 'task' if last == 'user': last = 'task' if last == 'task': if path_object.task == '*': new_path = self.format_new_path(path_object, 'scope') else: # send them to the tasks page new_path = self.format_new_path(path_object, 'shot') elif last == 'seq' or last == 'type': if path_object.seq == '*' or path_object.type == '*': # send them to the projects page new_path = self.format_new_path(path_object, split_after='project') else: new_path = self.format_new_path(path_object, split_after='scope') elif last == 'shot' or last == 'asset': new_path = self.format_new_path(path_object, split_after='scope') elif last == 'scope': if path_object.scope == '*': # send them to the scope page new_path = self.format_new_path(path_object, split_after='context') else: # send them to the projects page new_path = self.format_new_path(path_object, split_after='project') elif last == 'project' or last == 'company': # send them to the "Companies" page new_path = path_object.root elif last == 'ingest_source': # send them to projects page new_path = self.format_new_path(path_object, split_after='project') else: logging.debug(path_object.path_root) logging.debug('Nothing built for %s' % last) return self.path_object = cglpath.PathObject(new_path) self.update_buttons() self.location_changed.emit(self.path_object)
def review_clicked(self): selection = cglpath.PathObject(self.path_widget.path_line_edit.text()) selection.set_file_type() process_method(self.progress_bar, self.do_review, args=(self.progress_bar, selection), text='Submitting Review') print 'updating_location %s %s' % (selection.path_root, selection.data) self.update_location(data=selection.data)
def show_my_tasks(self): self.path_object = cglpath.PathObject( self.path_widget.path_line_edit.text()) self.path_object.set_attr(user=current_user(), resolution='', filename='', ext='') self.path_object.set_attr(scope='shots', seq='*', shot=None, task=None) self.path_object.data['my_tasks'] = True self.path_widget.update_path(path_object=self.path_object) self.update_location(self.path_object)
def buttons_pressed(self): path = None if self.sender() == self.projects_button: path = '%s/%s/source/*' % (self.path_object.root, self.path_object.company) elif self.sender() == self.companies_button: path = '%s/%s' % (self.path_object.root, '*') elif self.sender() == self.shots_button: path = '%s/%s/source/%s/%s/*' % ( self.path_object.root, self.path_object.company, self.path_object.project, self.path_object.scope) new_obj = cglpath.PathObject(path) self.location_changed.emit(new_obj)
def manage_sharing_action_clicked(self): from ui.widgets.sync_master import SyncMaster scope = None path_object = cglpath.PathObject( self.centralWidget().path_widget.path_line_edit.text()) if path_object.scope: if path_object.scope != '*': scope = path_object.scope dialog = SyncMaster(company=path_object.company, project=path_object.project, scope=scope) dialog.exec_() print "This produces a gui for managing the sharing of folders and external devices." pass
def publish_clicked(self): from plugins.preflight.launch import launch_ from cgl.ui.widgets.publish_dialog import PublishDialog selection = cglpath.PathObject(self.path_widget.path_line_edit.text()) if not selection.filename or selection.context == 'source': dialog = InputDialog( title='Invalid Selection', message='Please select a valid file or sequence\nfrom ' 'the "Ready to Review/Publish" Section') dialog.exec_() else: task = selection.task dialog = PublishDialog(path_object=selection) dialog.do_publish.connect(lambda: launch_( self, task, selection, do_review=dialog.do_review)) dialog.exec_()
def __init__(self, parent=None, path_object=None): QtWidgets.QFrame.__init__(self, parent) if path_object: self.path_object = cglpath.PathObject(path_object) self.path_root = self.path_object.path_root else: return layout = QtWidgets.QHBoxLayout(self) self.path_line_edit = QtWidgets.QLineEdit() self.path_line_edit.setMinimumHeight(ICON_WIDTH) self.text = self.path_object.path_root layout.addWidget(self.path_line_edit) # add css self.setProperty('class', 'light_grey') self.path_line_edit.setProperty('class', 'medium_grey')
def update_path(self, path_object): if isinstance(path_object, dict): path_object = cglpath.PathObject(path_object) if path_object: self.text = path_object.path_root self.path_line_edit.setText(path_object.path_root)
def update_location(self, data): self.nav_widget.search_box.setText('') # TODO - if we're in the project set the search box to the default project # TODO - if we're in the companies set the search box to the default company try: if self.sender().force_clear: if self.panel: self.panel.clear_layout() self.panel = None except AttributeError: pass path_object = None if type(data) == dict: path_object = cglpath.PathObject(data) elif type(data) == cglpath.PathObject: path_object = cglpath.PathObject(data) if path_object.frame_range: self.frame_range = path_object.frame_range self.nav_widget.set_text(path_object.path_root) self.nav_widget.update_buttons(path_object=path_object) last = path_object.get_last_attr() seq_attrs = ['seq', 'type'] shot_attrs = ['shot', 'asset'] version_template = path_object.version_template del version_template[0:2] if DO_IOP: if path_object.scope == 'IO': if path_object.version: if not self.panel: self.panel = IoP.IOPanel(parent=self, path_object=path_object) self.setMinimumWidth(1100) self.setMinimumHeight(700) self.panel.location_changed.connect( self.update_location) self.panel.location_changed.connect( self.path_widget.update_path) self.panel.render_location_changed.connect( self.render_location) self.layout.addWidget(self.panel) self.layout.addWidget(self.path_widget) return if 'my_tasks' in path_object.data or last == 'scope': go_ahead = False if last == 'scope': go_ahead = True if path_object.scope == 'IO': go_ahead = False else: if path_object.data['my_tasks']: go_ahead = True if go_ahead: self.panel = ProductionPanel( parent=self, path_object=path_object, search_box=self.nav_widget.search_box, my_tasks=True) if self.panel: if self.panel.load_tasks(): self.update_panel(set_tasks_radio=True) self.layout.addWidget(self.progress_bar) self.layout.addWidget(self.path_widget) self.path_object.data['my_tasks'] = False return else: self.panel = None if last in version_template: if self.panel: # if we already have a panel, and we're getting a filename it means it's a currently selected file # and we don't want to reload the panel or it gets into a loop and won't select the file return else: new_path_object = path_object.copy(user=None, resolution='high', filename=None) self.load_files_panel(path_object=new_path_object) else: if self.panel: self.panel.clear_layout() if last == 'resolution': self.load_files_panel(path_object) if last == 'project': if path_object.project == '*': self.panel = ProjectPanel( path_object=path_object, search_box=self.nav_widget.search_box) else: self.panel = ProductionPanel( parent=self, path_object=path_object, search_box=self.nav_widget.search_box) if last == 'scope': if path_object.scope == '*': self.panel = ScopePanel(path_object=path_object) elif path_object.scope == 'IO': if DO_IOP: self.panel = IoP.IOPanel(path_object=path_object) else: self.panel = ProductionPanel( parent=self, path_object=path_object, search_box=self.nav_widget.search_box) elif last in shot_attrs: if path_object.shot == '*' or path_object.asset == '*' or path_object.seq == '*' or path_object.type == '*': self.panel = ProductionPanel( parent=self, path_object=path_object, search_box=self.nav_widget.search_box) else: self.panel = TaskPanel(path_object=path_object, element='task') self.panel.add_button.connect(self.add_task) elif last in seq_attrs: if path_object.shot == '*' or path_object.asset == '*' or path_object.seq == '*' or path_object.type == '*': self.panel = ProductionPanel( parent=self, path_object=path_object, search_box=self.nav_widget.search_box) elif last == 'ingest_source': if DO_IOP: self.panel = IoP.IOPanel(path_object=path_object) elif last == 'task': if path_object.task == '*': self.panel = TaskPanel(path_object=path_object, element='task') self.panel.add_button.connect(self.add_task) else: self.load_files_panel(path_object) elif last == 'company': self.panel = ProjectPanel(path_object=path_object, search_box=self.nav_widget.search_box, title='Companies') if self.panel: self.update_panel() self.layout.addWidget(self.progress_bar) self.layout.addWidget(self.path_widget)
def __init__(self, parent=None, project_management=None, user_email=None, company=None, path=None, radio_filter=None, show_import=False): QtWidgets.QWidget.__init__(self, parent) try: font_db = QtGui.QFontDatabase() font_db.addApplicationFont( os.path.join(cglpath.font_path(), 'ARCADECLASSIC.TTF')) font_db.addApplicationFont( os.path.join(cglpath.font_path(), 'ka1.ttf')) except AttributeError: logging.error('Skipping Loading Fonts - possible Pyside2 issue') # Environment Stuff self.show_import = show_import self.user_email = user_email self.company = company self.project_management = project_management self.root = CONFIG['paths']['root'] # Company Specific self.user_root = CONFIG['cg_lumberjack_dir'] self.context = 'source' self.path_object = None self.panel = None self.radio_filter = radio_filter self.source_selection = [] self.setMinimumWidth(840) self.setMinimumHeight(800) self.frame_range = None self.layout = QtWidgets.QVBoxLayout(self) self.setContentsMargins(0, 0, 0, 0) self.layout.setContentsMargins(0, 0, 0, 0) if path: try: self.path_object = cglpath.PathObject(path) if self.path_object.context == 'render': self.path_object.set_attr(context='source') self.path_object.set_attr(resolution=None) self.path_object.set_attr(version=None) self.path_object.set_attr(user='') if not self.path_object.task: self.path_object.set_attr(task='*') self.path_object.set_attr(filename='') self.path_object.set_attr(ext='') except IndexError: logging.error('Path is not set') pass else: self.path_object = cglpath.PathObject(self.root) # self.project = '*' self.scope = 'assets' self.shot = '*' self.seq = '*' self.ingest_source = '*' if self.path_object: if self.path_object.project: self.project = self.path_object.project if self.path_object.scope: self.scope = self.path_object.scope if self.path_object.shot: self.shot = self.path_object.shot if self.path_object.seq: self.seq = self.path_object.seq self.user_favorites = '' self.task = '' self.resolution = '' self.in_file_tree = None self.nav_widget = NavigationWidget(path_object=self.path_object) self.path_widget = PathWidget(path_object=self.path_object) self.progress_bar = ProgressGif() self.progress_bar.hide() # self.nav_widget.update_buttons() self.path_widget.update_path(path_object=self.path_object) self.nav_widget.location_changed.connect(self.update_location) self.nav_widget.refresh_button_clicked.connect( self.update_location_to_latest) self.nav_widget.my_tasks_clicked.connect(self.show_my_tasks) self.nav_widget.location_changed.connect(self.path_widget.update_path) self.layout.addWidget(self.nav_widget) self.update_location(self.path_object)
def set_text(self, text): self.current_location_line_edit.setText(text.replace('\\', '/')) if self.current_location_line_edit.text(): self.path_object = cglpath.PathObject( self.current_location_line_edit.text())