def copy_sobject(my, sobject, dst_search_type, context=None, checkin_mode='inplace'): new_sobject = SearchType.create(dst_search_type) search_type = SearchType.get(dst_search_type) columns = SearchType.get_columns(dst_search_type) data = sobject.get_data() for name, value in data.items(): if name in ['id', 'code', 'pipeline_code']: continue if name not in columns: continue if not value: continue new_sobject.set_value(name, value) new_sobject.commit() # get all of the current snapshots and file paths associated if not context: snapshots = Snapshot.get_all_current_by_sobject(sobject) else: snapshots = [Snapshot.get_current_by_sobject(sobject, context)] if not snapshots: return msgs = [] for snapshot in snapshots: #file_paths = snapshot.get_all_lib_paths() file_paths_dict = snapshot.get_all_paths_dict() file_types = file_paths_dict.keys() if not file_types: continue # make sure the paths match the file_types file_paths = [file_paths_dict.get(x)[0] for x in file_types] mode = checkin_mode # checkin the files (inplace) try: context = snapshot.get_value('context') checkin = FileCheckin(new_sobject, context=context, file_paths=file_paths, file_types=file_types, mode=mode) checkin.execute() #print "done: ", context, new_sobject.get_related_sobjects("sthpw/snapshot") except CheckinException, e: msgs.append('Post-process Check-in Error for %s: %s ' % (context, e.__str__()))
def get_display(self): sobject = self.get_current_sobject() snapshots = [] if isinstance(sobject, Layer): # for layer renders, we try to get all render sobjects renders = Render.get_all_by_sobject(sobject) if renders: snapshots = Snapshot.get_by_sobjects(renders, is_current=True) else: # for object that has direct snapshots like plates snapshot = Snapshot.get_current_by_sobject(sobject) if snapshot: snapshots.append(snapshot) if not snapshots: return "<i>- no files -</i>" div = DivWdg() for snapshot in snapshots: file_types = snapshot.get_all_file_types() table = Table(css='embed') for file_type in file_types: table.add_row() table.add_cell( self.get_open_wdg(snapshot, file_type) ) dir = snapshot.get_client_lib_dir(file_type=file_type) table.add_cell( "%s: <i>%s</i>" % (file_type, dir) ) div.add(table) return div
def get_display(self): sobject = self.get_current_sobject() snapshots = [] if isinstance(sobject, Layer): # for layer renders, we try to get all render sobjects renders = Render.get_all_by_sobject(sobject) if renders: snapshots = Snapshot.get_by_sobjects(renders, is_current=True) else: # for object that has direct snapshots like plates snapshot = Snapshot.get_current_by_sobject(sobject) if snapshot: snapshots.append(snapshot) if not snapshots: return "<i>- no files -</i>" div = DivWdg() for snapshot in snapshots: file_types = snapshot.get_all_file_types() table = Table(css='embed') for file_type in file_types: table.add_row() table.add_cell(self.get_open_wdg(snapshot, file_type)) dir = snapshot.get_client_lib_dir(file_type=file_type) table.add_cell("%s: <i>%s</i>" % (file_type, dir)) div.add(table) return div
def copy_sobject(my, sobject, dst_search_type, context=None, checkin_mode='inplace'): new_sobject = SearchType.create(dst_search_type) search_type = SearchType.get(dst_search_type) columns = SearchType.get_columns(dst_search_type) data = sobject.get_data() for name, value in data.items(): if name in ['id','pipeline_code']: continue if name not in columns: continue if not value: continue if name == "code": value = Common.get_next_sobject_code(sobject, 'code') if not value: continue new_sobject.set_value(name, value) if SearchType.column_exists(dst_search_type, "project_code"): project_code = Project.get_project_code() new_sobject.set_value("project_code", project_code) new_sobject.commit() # get all of the current snapshots and file paths associated if not context: snapshots = Snapshot.get_all_current_by_sobject(sobject) else: snapshots = [Snapshot.get_current_by_sobject(sobject, context)] if not snapshots: return msgs = [] for snapshot in snapshots: #file_paths = snapshot.get_all_lib_paths() file_paths_dict = snapshot.get_all_paths_dict() file_types = file_paths_dict.keys() if not file_types: continue # make sure the paths match the file_types file_paths = [file_paths_dict.get(x)[0] for x in file_types] mode = checkin_mode # checkin the files (inplace) try: context = snapshot.get_value('context') checkin = FileCheckin(new_sobject, context=context, file_paths=file_paths, file_types=file_types, mode=mode) checkin.execute() #print "done: ", context, new_sobject.get_related_sobjects("sthpw/snapshot") except CheckinException, e: msgs.append('Post-process Check-in Error for %s: %s ' %(context, e.__str__()))
def get_display(self): sobject = self.get_current_sobject() # this is a comp object ... need to find the shot if not isinstance(sobject, Shot) : shot = sobject.get_parent("prod/shot") else: shot = sobject # now get all of the layers layers = shot.get_all_children("prod/layer") div = DivWdg() #div.set_style('width: 100px; overflow": auto') table = Table(css='embed') table.add_row() table.add_cell( shot.get_code() ) render = Render.get_last(shot) if not render: table.add_cell("<i>No renders</i>") else: render = Snapshot.get_current_by_sobject(render) table.add_cell( self.get_open_wdg(render) ) dir = render.get_web_dir() table.add_cell( "<i>%s</i>" % dir ) for layer in layers: table.add_row() table.add_cell( layer.get_value("name") ) render = Render.get_last(layer) if render: render = Snapshot.get_current_by_sobject(render) if not render: table.add_cell("<i>No renders</i>") else: table.add_cell( self.get_open_wdg(render) ) dir = render.get_client_lib_dir() table.add_cell( "<i>%s</i>" % dir ) div.add(table) return div
def get_display(self): sobject = self.get_current_sobject() # this is a comp object ... need to find the shot if not isinstance(sobject, Shot): shot = sobject.get_parent("prod/shot") else: shot = sobject # now get all of the layers layers = shot.get_all_children("prod/layer") div = DivWdg() #div.set_style('width: 100px; overflow": auto') table = Table(css='embed') table.add_row() table.add_cell(shot.get_code()) render = Render.get_last(shot) if not render: table.add_cell("<i>No renders</i>") else: render = Snapshot.get_current_by_sobject(render) table.add_cell(self.get_open_wdg(render)) dir = render.get_web_dir() table.add_cell("<i>%s</i>" % dir) for layer in layers: table.add_row() table.add_cell(layer.get_value("name")) render = Render.get_last(layer) if render: render = Snapshot.get_current_by_sobject(render) if not render: table.add_cell("<i>No renders</i>") else: table.add_cell(self.get_open_wdg(render)) dir = render.get_client_lib_dir() table.add_cell("<i>%s</i>" % dir) div.add(table) return div
def init(self): search_type = "prod/shot" widget = Widget() search = Search(search_type) div = DivWdg(css="filter_box") filter = SequenceFilterWdg() div.add(filter) #context_filter = ContextFilterWdg(label="Context: ", search_type=) #context_filter.set_search_type(search_type) #div.add(context_filter) context_wdg = TextWdg("context") context_wdg.set_persistence() span = SpanWdg(css="med") span.add("Context: ") span.add(context_wdg) div.add(span) self.context = context_wdg.get_value() if not self.context: self.context = None mode = "latest" filter.alter_search(search) sobjects = search.get_sobjects() widget.add(div) table = Table(css="table") table.add_style("width: 100%") for sobject in sobjects: table.add_row() thumb = ThumbWdg() thumb.set_sobject(sobject) table.add_cell(thumb) table.add_cell(sobject.get_code()) td = table.add_cell(WikiUtil().convert( sobject.get_value("description"))) td.add_style("width: 300px") if mode == "latest": snapshot = Snapshot.get_latest_by_sobject( sobject, self.context) else: snapshot = Snapshot.get_current_by_sobject( sobject, self.context) if not snapshot: table.add_cell("<i>No snapshot found</i>") continue dependency = DependencyWdg() dependency.set_show_title(False) dependency.set_sobject(snapshot) table.add_cell(dependency) widget.add(table) self.add(widget)
def init(my): search_type = "prod/shot" widget = Widget() search = Search(search_type) div = DivWdg(css="filter_box") filter = SequenceFilterWdg() div.add(filter) #context_filter = ContextFilterWdg(label="Context: ", search_type=) #context_filter.set_search_type(search_type) #div.add(context_filter) context_wdg = TextWdg("context") context_wdg.set_persistence() span = SpanWdg(css="med") span.add("Context: ") span.add(context_wdg) div.add(span) my.context = context_wdg.get_value() if not my.context: my.context = None mode = "latest" filter.alter_search(search) sobjects = search.get_sobjects() widget.add(div) table = Table(css="table") table.add_style("width: 100%") for sobject in sobjects: table.add_row() thumb = ThumbWdg() thumb.set_sobject(sobject) table.add_cell(thumb) table.add_cell( sobject.get_code() ) td = table.add_cell( WikiUtil().convert(sobject.get_value("description") )) td.add_style("width: 300px") if mode == "latest": snapshot = Snapshot.get_latest_by_sobject(sobject, my.context) else: snapshot = Snapshot.get_current_by_sobject(sobject, my.context) if not snapshot: table.add_cell("<i>No snapshot found</i>") continue dependency = DependencyWdg() dependency.set_show_title(False) dependency.set_sobject(snapshot) table.add_cell(dependency) widget.add(table) my.add(widget)