def add_unassigned_instances(my, widget, shot_inst_names): ''' add the unassigned instances into a SwapDisplayWdg ''' info = [] session = SessionContents.get() if not session: return "" tactic_nodes = session.get_instance_names(is_tactic_node=True) non_tactic_nodes = session.get_node_names(is_tactic_node=False) """ title = HtmlElement.b('Unassigned instances') widget.add(title) # this is just a filler for now, can be any sobjects snapshots = [] for tactic_node in tactic_nodes: if tactic_node not in shot_inst_names: session_version = session.get_version(tactic_node) session_snap = session.get_snapshot(tactic_node) if session_snap: snapshots.append(session_snap) info.append({'session_version': session_version, 'instance':\ tactic_node}) div = DivWdg(id="unassigned_table") SwapDisplayWdg.create_swap_title( title, swap, div) table = TableWdg('sthpw/snapshot', 'session_items') table.set_show_property(False) table.set_aux_data(info) table.set_sobjects(snapshots) div.add(table) widget.add(div) widget.add(HtmlElement.br()) """ # Add other non-tactic nodes swap2 = SwapDisplayWdg.get_triangle_wdg() title2 = HtmlElement.b('Other Nodes') div2 = DivWdg(id="other_node_div") widget.add(swap2) widget.add(title2) SwapDisplayWdg.create_swap_title( title2, swap2, div2) hidden_table = Table(css='table') div2.add(hidden_table) hidden_table.set_max_width() for node in non_tactic_nodes: hidden_table.add_row() hidden_table.add_cell(node) hidden_table.add_blank_cell() widget.add(div2)
def add_unassigned_instances(self, widget, shot_inst_names): ''' add the unassigned instances into a SwapDisplayWdg ''' info = [] session = SessionContents.get() if not session: return "" tactic_nodes = session.get_instance_names(is_tactic_node=True) non_tactic_nodes = session.get_node_names(is_tactic_node=False) """ title = HtmlElement.b('Unassigned instances') widget.add(title) # this is just a filler for now, can be any sobjects snapshots = [] for tactic_node in tactic_nodes: if tactic_node not in shot_inst_names: session_version = session.get_version(tactic_node) session_snap = session.get_snapshot(tactic_node) if session_snap: snapshots.append(session_snap) info.append({'session_version': session_version, 'instance':\ tactic_node}) div = DivWdg(id="unassigned_table") SwapDisplayWdg.create_swap_title( title, swap, div) table = TableWdg('sthpw/snapshot', 'session_items') table.set_show_property(False) table.set_aux_data(info) table.set_sobjects(snapshots) div.add(table) widget.add(div) widget.add(HtmlElement.br()) """ # Add other non-tactic nodes swap2 = SwapDisplayWdg.get_triangle_wdg() title2 = HtmlElement.b('Other Nodes') div2 = DivWdg(id="other_node_div") widget.add(swap2) widget.add(title2) SwapDisplayWdg.create_swap_title(title2, swap2, div2) hidden_table = Table(css='table') div2.add(hidden_table) hidden_table.set_max_width() for node in non_tactic_nodes: hidden_table.add_row() hidden_table.add_cell(node) hidden_table.add_blank_cell() widget.add(div2)
def get_new_tab_wdg(my): widget = Widget() span = SpanWdg() swap = SwapDisplayWdg.get_triangle_wdg() title = SpanWdg("Tab Creation") span.add(swap) span.add(title) span.add_style("float: left") widget.add(span) widget.add(HtmlElement.br()) # add the tab selector div = DivWdg() SwapDisplayWdg.create_swap_title(title, swap, div) tab_text = TextWdg("tab") tab_text.set_persistence() span = SpanWdg(css="med") span.add("Tab: ") span.add(tab_text) div.add(span) # parent index_text = TextWdg("parent_tab") index_text.set_persistence() span = SpanWdg(css="med") span.add("Parent Tab: ") span.add(index_text) span.add( HintWdg( "Enter the name of the tab that this will fall under. Leave empty to put on the main tab" )) div.add(span) # index index_text = TextWdg("index") index_text.set_attr("size", "4") index_text.set_persistence() span = SpanWdg(css="med") span.add("Index: ") span.add(index_text) span.add( HintWdg("Enter the numeric location for this tab to be placed")) div.add(span) WebContainer.register_cmd("CreateTabCmd") button = IconSubmitWdg("Create Tab", IconWdg.CREATE, True) div.add(button) widget.add(div) return widget
def get_new_tab_wdg(self): widget = Widget() span = SpanWdg() swap = SwapDisplayWdg.get_triangle_wdg() title = SpanWdg("Tab Creation") span.add(swap) span.add(title) span.add_style("float: left") widget.add(span) widget.add(HtmlElement.br() ) # add the tab selector div = DivWdg() SwapDisplayWdg.create_swap_title( title, swap, div) tab_text = TextWdg("tab") tab_text.set_persistence() span = SpanWdg(css="med") span.add("Tab: ") span.add(tab_text) div.add(span) # parent index_text = TextWdg("parent_tab") index_text.set_persistence() span = SpanWdg(css="med") span.add("Parent Tab: ") span.add(index_text) span.add(HintWdg("Enter the name of the tab that this will fall under. Leave empty to put on the main tab") ) div.add(span) # index index_text = TextWdg("index") index_text.set_attr("size", "4") index_text.set_persistence() span = SpanWdg(css="med") span.add("Index: ") span.add(index_text) span.add(HintWdg("Enter the numeric location for this tab to be placed") ) div.add(span) WebContainer.register_cmd("CreateTabCmd") button = IconSubmitWdg("Create Tab", IconWdg.CREATE, True) div.add(button) widget.add(div) return widget
def get_group_wdg(self): div = DivWdg() title_wdg = DivWdg() div.add(title_wdg) title_wdg.add_style("padding: 5px") title_wdg.add_style("font-weight: bold") title_wdg.add_style("font-size: 14px") title_wdg.add_gradient("background", "background") title_wdg.add("Users") title_wdg.add_style("min-width: 200px") filtered_groups = self.kwargs.get("groups") if isinstance(filtered_groups, basestring): filtered_groups = filtered_groups.split("|") search = Search("sthpw/login_group") if filtered_groups: search.add_filters("login_group", filtered_groups) security = Environment.get_security() if not security.check_access("builtin", "view_site_admin", "allow"): search.add_filter("login_group", "admin", op="!=") search.add_project_filter() groups = search.get_sobjects() groups_div = DivWdg() div.add(groups_div) for group in groups: group_div = DivWdg() groups_div.add(group_div) title_div = DivWdg() group_div.add(title_div) title_div.add_color("background", "background3") title_div.add_color("color", "color3") title_div.add_style("margin-top: 5px") title_div.add_style("padding: 2px") swap = SwapDisplayWdg() title_div.add(swap) swap.add_style("float: left") title = DivWdg(group.get_value("login_group")) title_div.add(title) #title.add_style("float: left") title.add_style("font-weight: bold") title.add_style("padding-top: 2px") content_div = DivWdg() group_div.add(content_div) SwapDisplayWdg.create_swap_title(title, swap, div=content_div, is_open=True, action_script=None) logins = group.get_logins() logins_div = self.get_logins_wdg(logins) content_div.add(logins_div) content_div.add_style("padding-left: 15px") return div
def get_viewer(my): top = DivWdg(css='spt_note_viewer_top') # draw checkbox options swap = SwapDisplayWdg() title = SpanWdg('main context') split_div = FloatDivWdg(css='spt_split_cb') div = DivWdg(css='spt_main_context_cb') content_div = DivWdg() content_div.add_color('color', 'color') content_div.add_style('padding: 10px') SwapDisplayWdg.create_swap_title(title, swap, content_div, is_open=False) div.add(swap) div.add(title) checkbox_name = 'split_screen' split_cb = CheckboxWdg(checkbox_name, label='Split View') split_cb.persistence = True split_cb.persistence_obj = split_cb key = split_cb.get_key() #cb.add_style('float: left') split_cb.add_behavior({ 'type': 'click_up', 'propagate_evt': True, 'cbjs_action': ''' var top = bvr.src_el.getParent(".spt_note_viewer_top"); var table_top = top.getElement(".spt_note_viewer_table"); var cbs = top.getElement('.spt_main_context_cb'); var values = spt.api.Utility.get_input_values(cbs); var processes = values.note_context_cb; var kwargs = { process_names: processes}; if (bvr.src_el.checked) { kwargs.split_view = 'true'; kwargs.show_context = 'true'; kwargs.left_process_names = processes; kwargs.right_process_names = processes; } spt.input.save_selected(bvr, '%s','%s'); spt.app_busy.show("Note Viewer", 'Loading') ; setTimeout(function(){ spt.panel.refresh(table_top, kwargs, false); if (bvr.src_el.checked) spt.hide(cbs); else spt.show(cbs); spt.app_busy.hide(); }, 50 ); ''' % (checkbox_name, key) }) split_div.add(split_cb) top.add(split_div) top.add(div) div.add(content_div) top.add(HtmlElement.br()) checkbox_name = 'note_main_context_cb' cb = CheckboxWdg(checkbox_name) cb.persistence = True cb.persistence_obj = cb my.checked_process_names = cb.get_values() for value in my.process_names: #my.checked_process_names = web.get_form_values('process_names') cb = CheckboxWdg(checkbox_name, label=value) if value in my.checked_process_names: my.checked_processes.append(value) # FIXME: this is very tenous. Accessing private members to # override behavior cb.persistence = True cb.persistence_obj = cb key = cb.get_key() cb.set_option('value', value) cb.add_behavior({ 'type': 'click_up', 'propagate_evt': True, 'cbjs_action': ''' var top = bvr.src_el.getParent(".spt_note_viewer_top") var table_top = top.getElement('.spt_note_viewer_table'); var cbs = top.getElement('.spt_main_context_cb'); var values = spt.api.Utility.get_input_values(cbs); var processes = values.note_main_context_cb; var kwargs = { process_names: processes}; spt.input.save_selected(bvr, '%s','%s'); spt.panel.refresh(table_top, kwargs, false); ''' % (checkbox_name, key) }) content_div.add(cb) table_top = DivWdg(css='spt_note_viewer_table') expression = "@SOBJECT(sthpw/note['context','in','%s'])" % '|'.join( my.checked_processes) if split_cb.is_checked(): table = my.get_split_viewer() else: table_id = 'main_table1' table = TableLayoutWdg(table_id=table_id, search_type='sthpw/note', view=my.view,\ show_row_select=True, show_insert=False, state={'parent_key': my.parent_key}, inline_search=False, show_refresh=True, expression=expression ) my.set_as_panel(table_top) table_top.add_style('float: left') top.add(table_top) table_top.add(table) return top
def get_viewer(my): top = DivWdg(css='spt_single_note_viewer_top') # draw checkbox options swap = SwapDisplayWdg() title = SpanWdg('context') title.add_color('color', 'color') div = DivWdg(css='spt_context_cb') div.add_color('color', 'color') SwapDisplayWdg.create_swap_title(title, swap, div, is_open=False) checkbox_name = 'split_screen' checked_process_names = [] if my.show_context: top.add(swap) top.add(title) top.add(div) #checkbox_name = 'note_context_cb' checkbox_name = my.checkbox_name cb = CheckboxWdg(checkbox_name) cb.persistence = True cb.persistence_obj = cb checked_process_names = cb.get_values() for value in my.process_names: #my.checked_process_names = web.get_form_values('process_names') cb = CheckboxWdg(checkbox_name, label=value) if value in checked_process_names: my.checked_processes.append(value) # FIXME: this is very tenous. Accessing private members to # override behavior cb.persistence = True cb.persistence_obj = cb key = cb.get_key() cb.set_option('value', value) cb.add_behavior({ 'type': 'click_up', 'propagate_evt': True, 'cbjs_action': ''' var top = bvr.src_el.getParent(".spt_single_note_viewer_top") var table_top = top.getElement('.spt_note_viewer_table'); var cbs = top.getElement('.spt_context_cb'); var values = spt.api.Utility.get_input_values(cbs); var processes = values.%s; var kwargs = { process_names: processes}; spt.input.save_selected(bvr, '%s','%s'); spt.panel.refresh(table_top, kwargs, false); ''' % (checkbox_name, checkbox_name, key) }) div.add(cb) else: web = WebContainer.get_web() checked_process_names = web.get_form_values('process_names') table_top = DivWdg(css='spt_note_viewer_table') expression = "@SOBJECT(sthpw/note['context','in','%s'])" % '|'.join( checked_process_names) table_id = 'main_table1' table = TableLayoutWdg(table_id=table_id, search_type='sthpw/note', view=my.view,\ show_row_select=True, show_insert=False, state={'parent_key': my.parent_key}, inline_search=False, show_refresh=True, expression=expression ) if my.resize: from tactic.ui.container import ResizeScrollWdg inner_wdg = ResizeScrollWdg(width='500px', height='500px', scroll_bar_size_str='thick', scroll_expansion='inside') inner_wdg.add(table) table_top.add(inner_wdg) else: table_top.add(table) my.set_as_panel(table_top) top.add(table_top) return top
def get_display(my): my.search_type = my.kwargs.get('search_type') my.texture_search_type = my.kwargs.get('texture_search_type') assert my.search_type app_name = WebContainer.get_web().get_selected_app() # add an outside box top = DivWdg(css='spt_view_panel') #div = DivWdg(css="maq_search_bar") div = DivWdg() div.add_color("background", "background2", -15) my.set_as_panel(top) top.add(div) div.add_style("margin: 5px") div.add_style("padding: 10px") div.add_style("font-style: bold") process_div = DivWdg() process_div.add_style("padding-left: 10px") div.add(process_div) process_div.add(my.get_process_wdg(my.search_type)) process_div.add(my.get_context_filter_wdg()) process_div.add(HtmlElement.br(clear="all")) div.add(HtmlElement.br()) checkin_options = DivWdg(css='spt_ui_options') checkin_options.add_style("padding: 10px") swap = SwapDisplayWdg() #swap.set_off() title = SpanWdg("Check in Options") SwapDisplayWdg.create_swap_title(title, swap, checkin_options, is_open=False) div.add(swap) div.add(title) checkin_options.add(my.get_file_type_wdg()) checkin_options.add(my.get_snapshot_type_wdg()) checkin_options.add(HtmlElement.br(1)) checkin_options.add(my.get_export_method_wdg()) checkin_options.add(my.get_checkin_as_wdg()) #my.add( my.get_render_icon_wdg() ) # For different export methods checkin_options.add(my.get_currency_wdg()) checkin_options.add(my.get_reference_option()) checkin_options.add(my.get_auto_version_wdg()) checkin_options.add(my.get_texture_option(app=app_name)) checkin_options.add(my.get_handoff_wdg()) if not my.context_select.get_value(for_display=True): my.add(DivWdg('A context must be selected.', css='warning')) return div.add(checkin_options) top.add(my.get_introspect_wdg()) top.add(HtmlElement.br(2)) # create the interface table = Table() table.set_max_width() #table.set_class("table") table.add_color('background', 'background2') #table.add_style('line-height','3.0em') #table.add_row(css='smaller') tr = table.add_row(css='smaller') tr.add_style('height', '3.5em') table.add_header(" ") table.add_header(" ") th = table.add_header("Instance") th.add_style('text-align: left') table.add_header(my.get_checkin()) table.add_header("Sandbox") tr.add_color('background', 'background2', -15) # get session and handle case where there is no session my.session = SessionContents.get() if my.session == None: instance_names = [] asset_codes = [] node_names = [] else: instance_names = my.session.get_instance_names() asset_codes = my.session.get_asset_codes() node_names = my.session.get_node_names() # get all of the possible assets based on the asset codes search = Search(my.search_type) search.add_filters("code", asset_codes) assets = search.get_sobjects() assets_dict = SObject.get_dict(assets, ["code"]) if my.session: my.add("Current Project: <b>%s</b>" % my.session.get_project_dir()) else: my.add("Current Project: Please press 'Introspect'") count = 0 for i in range(0, len(node_names)): node_name = node_names[i] if not my.session.is_tactic_node(node_name) and \ not my.session.get_node_type(node_name) in ['transform','objectSet']: continue instance_name = instance_names[i] # backwards compatible: try: asset_code = asset_codes[i] except IndexError, e: asset_code = instance_name # skip if this is a reference if my.list_references == False and \ my.session.is_reference(node_name): continue table.add_row() # check that this asset exists asset = assets_dict.get(asset_code) if not asset: continue # list items if it is a set if asset.get_value('asset_type', no_exception=True) in ["set", "section"]: my.current_sobject = asset my.handle_set(table, instance_name, asset, instance_names) count += 1 # if this asset is in the database, then allow it to checked in if asset: if my.session.get_snapshot_code(instance_name, snapshot_type='set'): continue # hack remember this my.current_sobject = asset my.handle_instance(table, instance_name, asset, node_name) else: table.add_blank_cell() table.add_cell(instance_name) count += 1
class AppSObjectCheckinWdg(CheckinWdg): PUBLISH_BUTTON = 'Publish' ARGS_KEYS = { "search_type": { 'description': "search type that this panel works with", 'type': 'TextWdg', 'order': 0, 'category': '1. Required' }, "texture_search_type": { 'description': "texture search type that this panel works with", 'type': 'TextWdg', 'order': 1, 'category': '1. Required' }, "process": { 'description': "The process this panel is looking at e.g. {@GET(state.process)}", 'type': 'TextWdg', 'order': 1, 'category': '2. Options' } } def list_references(my): '''lists whether references can be checked in with this widget''' return False def get_context_data(my): process = my.process_select.get_value() labels, values = super(AppSObjectCheckinWdg,my).get_context_data(\ my.search_type, process) return labels, values def get_display(my): my.search_type = my.kwargs.get('search_type') my.texture_search_type = my.kwargs.get('texture_search_type') assert my.search_type app_name = WebContainer.get_web().get_selected_app() # add an outside box top = DivWdg(css='spt_view_panel') #div = DivWdg(css="maq_search_bar") div = DivWdg() div.add_color("background", "background2", -15) my.set_as_panel(top) top.add(div) div.add_style("margin: 5px") div.add_style("padding: 10px") div.add_style("font-style: bold") process_div = DivWdg() process_div.add_style("padding-left: 10px") div.add(process_div) process_div.add(my.get_process_wdg(my.search_type)) process_div.add(my.get_context_filter_wdg()) process_div.add(HtmlElement.br(clear="all")) div.add(HtmlElement.br()) checkin_options = DivWdg(css='spt_ui_options') checkin_options.add_style("padding: 10px") swap = SwapDisplayWdg() #swap.set_off() title = SpanWdg("Check in Options") SwapDisplayWdg.create_swap_title(title, swap, checkin_options, is_open=False) div.add(swap) div.add(title) checkin_options.add(my.get_file_type_wdg()) checkin_options.add(my.get_snapshot_type_wdg()) checkin_options.add(HtmlElement.br(1)) checkin_options.add(my.get_export_method_wdg()) checkin_options.add(my.get_checkin_as_wdg()) #my.add( my.get_render_icon_wdg() ) # For different export methods checkin_options.add(my.get_currency_wdg()) checkin_options.add(my.get_reference_option()) checkin_options.add(my.get_auto_version_wdg()) checkin_options.add(my.get_texture_option(app=app_name)) checkin_options.add(my.get_handoff_wdg()) if not my.context_select.get_value(for_display=True): my.add(DivWdg('A context must be selected.', css='warning')) return div.add(checkin_options) top.add(my.get_introspect_wdg()) top.add(HtmlElement.br(2)) # create the interface table = Table() table.set_max_width() #table.set_class("table") table.add_color('background', 'background2') #table.add_style('line-height','3.0em') #table.add_row(css='smaller') tr = table.add_row(css='smaller') tr.add_style('height', '3.5em') table.add_header(" ") table.add_header(" ") th = table.add_header("Instance") th.add_style('text-align: left') table.add_header(my.get_checkin()) table.add_header("Sandbox") tr.add_color('background', 'background2', -15) # get session and handle case where there is no session my.session = SessionContents.get() if my.session == None: instance_names = [] asset_codes = [] node_names = [] else: instance_names = my.session.get_instance_names() asset_codes = my.session.get_asset_codes() node_names = my.session.get_node_names() # get all of the possible assets based on the asset codes search = Search(my.search_type) search.add_filters("code", asset_codes) assets = search.get_sobjects() assets_dict = SObject.get_dict(assets, ["code"]) if my.session: my.add("Current Project: <b>%s</b>" % my.session.get_project_dir()) else: my.add("Current Project: Please press 'Introspect'") count = 0 for i in range(0, len(node_names)): node_name = node_names[i] if not my.session.is_tactic_node(node_name) and \ not my.session.get_node_type(node_name) in ['transform','objectSet']: continue instance_name = instance_names[i] # backwards compatible: try: asset_code = asset_codes[i] except IndexError, e: asset_code = instance_name # skip if this is a reference if my.list_references == False and \ my.session.is_reference(node_name): continue table.add_row() # check that this asset exists asset = assets_dict.get(asset_code) if not asset: continue # list items if it is a set if asset.get_value('asset_type', no_exception=True) in ["set", "section"]: my.current_sobject = asset my.handle_set(table, instance_name, asset, instance_names) count += 1 # if this asset is in the database, then allow it to checked in if asset: if my.session.get_snapshot_code(instance_name, snapshot_type='set'): continue # hack remember this my.current_sobject = asset my.handle_instance(table, instance_name, asset, node_name) else: table.add_blank_cell() table.add_cell(instance_name) count += 1 if count == 0: table.add_row_cell( "<center><h2>No assets in session to checkin</h2></center>") top.add(table) if not my.session: return non_tactic_nodes = my.session.get_instance_names(is_tactic_node=False) title = HtmlElement.b("Unknown List") swap = SwapDisplayWdg.get_triangle_wdg() div = DivWdg(id="unknown list") top.add(swap) top.add(title) SwapDisplayWdg.create_swap_title(title, swap, div) unknown_table = Table() unknown_table.add_color('background', 'background2') unknown_table.set_max_width() div.add(unknown_table) for instance in non_tactic_nodes: my.handle_unknown_instance(unknown_table, instance) top.add(div) return top
def get_display(my): my.search_type = my.kwargs.get('search_type') my.texture_search_type = my.kwargs.get('texture_search_type') assert my.search_type app_name = WebContainer.get_web().get_selected_app() # add an outside box top = DivWdg(css='spt_view_panel') #div = DivWdg(css="maq_search_bar") div = DivWdg() div.add_color("background", "background2", -15) my.set_as_panel(top) top.add(div) div.add_style("margin: 5px") div.add_style("padding: 10px") div.add_style("font-style: bold") process_div = DivWdg() process_div.add_style("padding-left: 10px") div.add(process_div) process_div.add( my.get_process_wdg(my.search_type)) process_div.add( my.get_context_filter_wdg() ) process_div.add(HtmlElement.br(clear="all")) div.add( HtmlElement.br() ) checkin_options = DivWdg(css='spt_ui_options') checkin_options.add_style("padding: 10px") swap = SwapDisplayWdg() #swap.set_off() title = SpanWdg("Check in Options") SwapDisplayWdg.create_swap_title(title, swap, checkin_options, is_open=False) div.add(swap) div.add(title) checkin_options.add( my.get_file_type_wdg() ) checkin_options.add( my.get_snapshot_type_wdg() ) checkin_options.add(HtmlElement.br(1)) checkin_options.add( my.get_export_method_wdg() ) checkin_options.add( my.get_checkin_as_wdg() ) #my.add( my.get_render_icon_wdg() ) # For different export methods checkin_options.add( my.get_currency_wdg() ) checkin_options.add( my.get_reference_option()) checkin_options.add( my.get_auto_version_wdg()) checkin_options.add( my.get_texture_option(app=app_name)) checkin_options.add( my.get_handoff_wdg()) if not my.context_select.get_value(for_display=True): my.add(DivWdg('A context must be selected.', css='warning')) return div.add(checkin_options) top.add( my.get_introspect_wdg() ) top.add(HtmlElement.br(2)) # create the interface table = Table() table.set_max_width() #table.set_class("table") table.add_color('background','background2') #table.add_style('line-height','3.0em') #table.add_row(css='smaller') tr = table.add_row(css='smaller') tr.add_style('height', '3.5em') table.add_header(" ") table.add_header(" ") th = table.add_header("Instance") th.add_style('text-align: left') table.add_header(my.get_checkin()) table.add_header("Sandbox") tr.add_color('background','background2', -15) # get session and handle case where there is no session my.session = SessionContents.get() if my.session == None: instance_names = [] asset_codes = [] node_names = [] else: instance_names = my.session.get_instance_names() asset_codes = my.session.get_asset_codes() node_names = my.session.get_node_names() # get all of the possible assets based on the asset codes search = Search(my.search_type) search.add_filters("code", asset_codes) assets = search.get_sobjects() assets_dict = SObject.get_dict(assets, ["code"]) if my.session: my.add("Current Project: <b>%s</b>" % my.session.get_project_dir() ) else: my.add("Current Project: Please press 'Introspect'") count = 0 for i in range(0, len(node_names) ): node_name = node_names[i] if not my.session.is_tactic_node(node_name) and \ not my.session.get_node_type(node_name) in ['transform','objectSet']: continue instance_name = instance_names[i] # backwards compatible: try: asset_code = asset_codes[i] except IndexError, e: asset_code = instance_name # skip if this is a reference if my.list_references == False and \ my.session.is_reference(node_name): continue table.add_row() # check that this asset exists asset = assets_dict.get(asset_code) if not asset: continue # list items if it is a set if asset.get_value('asset_type', no_exception=True) in ["set", "section"]: my.current_sobject = asset my.handle_set( table, instance_name, asset, instance_names) count +=1 # if this asset is in the database, then allow it to checked in if asset: if my.session.get_snapshot_code(instance_name, snapshot_type='set'): continue # hack remember this my.current_sobject = asset my.handle_instance(table, instance_name, asset, node_name) else: table.add_blank_cell() table.add_cell(instance_name) count += 1
def get_display(my): widget = Widget() div = DivWdg(css='spt_ui_options') div.set_unique_id() table = Table() div.add(table) table.add_style("margin: 5px 15px") table.add_color('color', 'color') swap = SwapDisplayWdg() #swap.set_off() app = WebContainer.get_web().get_selected_app() outer_span = SpanWdg() outer_span.add_style('float: right') span = SpanWdg(app, css='small') icon = IconWdg(icon=eval("IconWdg.%s" % app.upper()), width='13px') outer_span.add(span) outer_span.add(icon) title = SpanWdg("Loading Options") title.add(outer_span) SwapDisplayWdg.create_swap_title(title, swap, div, is_open=False) widget.add(swap) widget.add(title) widget.add(div) if not my.hide_instantiation: table.add_row() table.add_blank_cell() div = DivWdg(HtmlElement.b("Instantiation: ")) table.add_cell(div) div = my.get_instantiation_wdg() table.add_cell(div) setting = my.get_default_setting() default_instantiation = setting.get('instantiation') default_connection = setting.get('connection') default_dependency = setting.get('texture_dependency') if not my.hide_connection: table.add_row() table.add_blank_cell() con_div = DivWdg(HtmlElement.b("Connection: ")) table.add_cell(con_div) td = table.add_cell() is_unchecked = True default_cb = None for value in ['http', 'file system']: name = my.get_element_name("connection") checkbox = CheckboxWdg(name) checkbox.set_option("value", value) checkbox.set_persistence() if value == default_connection: default_cb = checkbox if checkbox.is_checked(): is_unchecked = False checkbox.add_behavior({ 'type': 'click_up', 'propagate_evt': True, "cbjs_action": "spt.toggle_checkbox(bvr, '.spt_ui_options', '%s')" % name }) span = SpanWdg(checkbox, css='small') span.add(value) td.add(span) if is_unchecked: default_cb.set_checked() if not my.hide_dependencies: table.add_row() table.add_blank_cell() div = DivWdg(HtmlElement.b("Texture Dependencies: ")) table.add_cell(div) td = table.add_cell() is_unchecked = True default_cb = None for value in ['as checked in', 'latest', 'current']: name = my.get_element_name("dependency") checkbox = CheckboxWdg(name) checkbox.set_option("value", value) checkbox.set_persistence() checkbox.add_behavior({ 'type': 'click_up', 'propagate_evt': True, "cbjs_action": "spt.toggle_checkbox(bvr, '.spt_ui_options', '%s')" % name }) if value == default_dependency: default_cb = checkbox if checkbox.is_checked(): is_unchecked = False span = SpanWdg(checkbox, css='small') span.add(value) td.add(span) if is_unchecked: default_cb.set_checked() from connection_select_wdg import ConnectionSelectWdg table.add_row() table.add_blank_cell() div = DivWdg(HtmlElement.b("Connection Type: ")) table.add_cell(div) table.add_cell(ConnectionSelectWdg()) table.add_row() table.add_blank_cell() div = DivWdg(HtmlElement.b("Connection Port: ")) table.add_cell(div) port_div = DivWdg() port_text = TextWdg("port") port_text.set_option('size', '6') port_div.add(port_text) port_div.add_style("padding-left: 7px") port_div.add_style("width: 40px") table.add_cell(port_div) from pyasm.prod.web import WidgetSettings value = WidgetSettings.get_value_by_key("CGApp:connection_port") if value: port_text.set_value(value) elif WebContainer.get_web().get_selected_app() == 'Houdini': port_text.set_value("13000") else: port_text.set_value("4444") port_text.add_behavior({ 'type': 'change', 'cbjs_action': ''' var value = bvr.src_el.value; value = parseInt(value); var kwargs = { 'data': value, 'key': 'CGApp:connection_port' } var cmd = "pyasm.web.WidgetSettingSaveCbk" var server = TacticServerStub.get(); server.execute_cmd(cmd, kwargs); // FIXME: this is dangerous use of a global var app.port = value; ''' }) return widget
def get_group_wdg(my): div = DivWdg() title_wdg = DivWdg() div.add(title_wdg) title_wdg.add_style("padding: 5px") title_wdg.add_style("font-weight: bold") title_wdg.add_style("font-size: 14px") title_wdg.add_gradient("background", "background") title_wdg.add("Users") title_wdg.add_style("min-width: 200px") filtered_groups = my.kwargs.get("groups") if isinstance(filtered_groups, basestring): filtered_groups = filtered_groups.split("|") search = Search("sthpw/login_group") if filtered_groups: search.add_filters("login_group", filtered_groups) security = Environment.get_security() if not security.check_access("builtin", "view_site_admin", "allow"): search.add_filter("login_group", "admin", op="!=") search.add_project_filter() groups = search.get_sobjects() groups_div = DivWdg() div.add(groups_div) for group in groups: group_div = DivWdg() groups_div.add(group_div) title_div = DivWdg() group_div.add(title_div) title_div.add_color("background", "background3") title_div.add_color("color", "color3") title_div.add_style("margin-top: 5px") title_div.add_style("padding: 2px") swap = SwapDisplayWdg() title_div.add(swap) swap.add_style("float: left") title = DivWdg(group.get_value("login_group")) title_div.add(title) # title.add_style("float: left") title.add_style("font-weight: bold") title.add_style("padding-top: 2px") content_div = DivWdg() group_div.add(content_div) SwapDisplayWdg.create_swap_title(title, swap, div=content_div, is_open=True, action_script=None) logins = group.get_logins() logins_div = my.get_logins_wdg(logins) content_div.add(logins_div) content_div.add_style("padding-left: 15px") return div
def get_display(self): widget = Widget() div = DivWdg(css='spt_ui_options') div.set_unique_id() table = Table() div.add(table) table.add_style("margin: 5px 15px") table.add_color('color','color') swap = SwapDisplayWdg() #swap.set_off() app = WebContainer.get_web().get_selected_app() outer_span = SpanWdg() outer_span.add_style('float: right') span = SpanWdg(app, css='small') icon = IconWdg(icon=eval("IconWdg.%s"%app.upper()), width='13px') outer_span.add(span) outer_span.add(icon) title = SpanWdg("Loading Options") title.add(outer_span) SwapDisplayWdg.create_swap_title(title, swap, div, is_open=False) widget.add(swap) widget.add(title) widget.add(div) if not self.hide_instantiation: table.add_row() table.add_blank_cell() div = DivWdg(HtmlElement.b("Instantiation: ")) table.add_cell(div) div = self.get_instantiation_wdg() table.add_cell(div) setting = self.get_default_setting() default_instantiation = setting.get('instantiation') default_connection = setting.get('connection') default_dependency = setting.get('texture_dependency') if not self.hide_connection: table.add_row() table.add_blank_cell() con_div = DivWdg(HtmlElement.b("Connection: ")) table.add_cell(con_div) td = table.add_cell() is_unchecked = True default_cb = None for value in ['http', 'file system']: name = self.get_element_name("connection") checkbox = CheckboxWdg( name ) checkbox.set_option("value", value) checkbox.set_persistence() if value == default_connection: default_cb = checkbox if checkbox.is_checked(): is_unchecked = False checkbox.add_behavior({'type': 'click_up', 'propagate_evt': True, "cbjs_action": "spt.toggle_checkbox(bvr, '.spt_ui_options', '%s')" %name}) span = SpanWdg(checkbox, css='small') span.add(value) td.add(span) if is_unchecked: default_cb.set_checked() if not self.hide_dependencies: table.add_row() table.add_blank_cell() div = DivWdg(HtmlElement.b("Texture Dependencies: ")) table.add_cell(div) td = table.add_cell() is_unchecked = True default_cb = None for value in ['as checked in', 'latest', 'current']: name = self.get_element_name("dependency") checkbox = CheckboxWdg( name ) checkbox.set_option("value", value) checkbox.set_persistence() checkbox.add_behavior({'type': 'click_up', 'propagate_evt': True, "cbjs_action": "spt.toggle_checkbox(bvr, '.spt_ui_options', '%s')" %name}) if value == default_dependency: default_cb = checkbox if checkbox.is_checked(): is_unchecked = False span = SpanWdg(checkbox, css='small') span.add(value) td.add(span) if is_unchecked: default_cb.set_checked() from connection_select_wdg import ConnectionSelectWdg table.add_row() table.add_blank_cell() div = DivWdg(HtmlElement.b("Connection Type: ")) table.add_cell(div) table.add_cell( ConnectionSelectWdg() ) table.add_row() table.add_blank_cell() div = DivWdg(HtmlElement.b("Connection Port: ")) table.add_cell(div) port_div = DivWdg() port_text = TextWdg("port") port_text.set_option('size','6') port_div.add(port_text) port_div.add_style("padding-left: 7px") port_div.add_style("width: 40px") table.add_cell( port_div ) from pyasm.prod.web import WidgetSettings value = WidgetSettings.get_value_by_key("CGApp:connection_port") if value: port_text.set_value(value) elif WebContainer.get_web().get_selected_app() == 'Houdini': port_text.set_value("13000") else: port_text.set_value("4444") port_text.add_behavior( { 'type': 'change', 'cbjs_action': ''' var value = bvr.src_el.value; value = parseInt(value); var kwargs = { 'data': value, 'key': 'CGApp:connection_port' } var cmd = "pyasm.web.WidgetSettingSaveCbk" var server = TacticServerStub.get(); server.execute_cmd(cmd, kwargs); // FIXME: this is dangerous use of a global var app.port = value; ''' } ) return widget
def get_viewer(self): top = DivWdg(css='spt_note_viewer_top') # draw checkbox options swap = SwapDisplayWdg() title = SpanWdg('main context') split_div = FloatDivWdg(css='spt_split_cb') div = DivWdg(css='spt_main_context_cb') content_div = DivWdg() content_div.add_color('color','color') content_div.add_style('padding: 10px') SwapDisplayWdg.create_swap_title(title, swap, content_div, is_open=False) div.add(swap) div.add(title) checkbox_name = 'split_screen' split_cb = CheckboxWdg(checkbox_name, label='Split View') split_cb.persistence = True split_cb.persistence_obj = split_cb key = split_cb.get_key() #cb.add_style('float: left') split_cb.add_behavior({'type': 'click_up', 'propagate_evt': True, 'cbjs_action': ''' var top = bvr.src_el.getParent(".spt_note_viewer_top"); var table_top = top.getElement(".spt_note_viewer_table"); var cbs = top.getElement('.spt_main_context_cb'); var values = spt.api.Utility.get_input_values(cbs); var processes = values.note_context_cb; var kwargs = { process_names: processes}; if (bvr.src_el.checked) { kwargs.split_view = 'true'; kwargs.show_context = 'true'; kwargs.left_process_names = processes; kwargs.right_process_names = processes; } spt.input.save_selected(bvr, '%s','%s'); spt.app_busy.show("Note Viewer", 'Loading') ; setTimeout(function(){ spt.panel.refresh(table_top, kwargs, false); if (bvr.src_el.checked) spt.hide(cbs); else spt.show(cbs); spt.app_busy.hide(); }, 50 ); ''' % ( checkbox_name, key) }) split_div.add(split_cb) top.add(split_div) top.add(div) div.add(content_div) top.add(HtmlElement.br()) checkbox_name = 'note_main_context_cb' cb = CheckboxWdg(checkbox_name) cb.persistence = True cb.persistence_obj = cb self.checked_process_names = cb.get_values() for value in self.process_names: #self.checked_process_names = web.get_form_values('process_names') cb = CheckboxWdg(checkbox_name, label=value) if value in self.checked_process_names: self.checked_processes.append(value) # FIXME: this is very tenous. Accessing private members to # override behavior cb.persistence = True cb.persistence_obj = cb key = cb.get_key() cb.set_option('value', value) cb.add_behavior({ 'type': 'click_up', 'propagate_evt': True, 'cbjs_action': ''' var top = bvr.src_el.getParent(".spt_note_viewer_top") var table_top = top.getElement('.spt_note_viewer_table'); var cbs = top.getElement('.spt_main_context_cb'); var values = spt.api.Utility.get_input_values(cbs); var processes = values.note_main_context_cb; var kwargs = { process_names: processes}; spt.input.save_selected(bvr, '%s','%s'); spt.panel.refresh(table_top, kwargs, false); ''' % (checkbox_name, key) }) content_div.add(cb) table_top = DivWdg(css='spt_note_viewer_table') expression = "@SOBJECT(sthpw/note['context','in','%s'])" %'|'.join(self.checked_processes) if split_cb.is_checked(): table = self.get_split_viewer() else: table_id = 'main_table1' table = TableLayoutWdg(table_id=table_id, search_type='sthpw/note', view=self.view,\ show_row_select=True, show_insert=False, state={'parent_key': self.parent_key}, inline_search=False, show_refresh=True, expression=expression ) self.set_as_panel(table_top) table_top.add_style('float: left') top.add(table_top) table_top.add(table) return top
def get_viewer(self): top = DivWdg(css='spt_single_note_viewer_top') # draw checkbox options swap = SwapDisplayWdg() title = SpanWdg('context') title.add_color('color','color') div = DivWdg(css='spt_context_cb') div.add_color('color','color') SwapDisplayWdg.create_swap_title(title, swap, div, is_open=False) checkbox_name = 'split_screen' checked_process_names = [] if self.show_context: top.add(swap) top.add(title) top.add(div) #checkbox_name = 'note_context_cb' checkbox_name = self.checkbox_name cb = CheckboxWdg(checkbox_name) cb.persistence = True cb.persistence_obj = cb checked_process_names = cb.get_values() for value in self.process_names: #self.checked_process_names = web.get_form_values('process_names') cb = CheckboxWdg(checkbox_name, label=value) if value in checked_process_names: self.checked_processes.append(value) # FIXME: this is very tenous. Accessing private members to # override behavior cb.persistence = True cb.persistence_obj = cb key = cb.get_key() cb.set_option('value', value) cb.add_behavior({ 'type': 'click_up', 'propagate_evt': True, 'cbjs_action': ''' var top = bvr.src_el.getParent(".spt_single_note_viewer_top") var table_top = top.getElement('.spt_note_viewer_table'); var cbs = top.getElement('.spt_context_cb'); var values = spt.api.Utility.get_input_values(cbs); var processes = values.%s; var kwargs = { process_names: processes}; spt.input.save_selected(bvr, '%s','%s'); spt.panel.refresh(table_top, kwargs, false); ''' % (checkbox_name, checkbox_name, key) }) div.add(cb) else: web = WebContainer.get_web() checked_process_names = web.get_form_values('process_names') table_top = DivWdg(css='spt_note_viewer_table') expression = "@SOBJECT(sthpw/note['context','in','%s'])" %'|'.join(checked_process_names) table_id = 'main_table1' table = TableLayoutWdg(table_id=table_id, search_type='sthpw/note', view=self.view,\ show_row_select=True, show_insert=False, state={'parent_key': self.parent_key}, inline_search=False, show_refresh=True, expression=expression ) if self.resize: from tactic.ui.container import ResizeScrollWdg inner_wdg = ResizeScrollWdg( width='500px', height='500px', scroll_bar_size_str='thick', scroll_expansion='inside' ) inner_wdg.add(table) table_top.add(inner_wdg) else: table_top.add(table) self.set_as_panel(table_top) top.add(table_top) return top