def get_display(my): web = WebContainer.get_web() context_url = web.get_context_url().to_string() js_url = "%s/javascript" % context_url spt_js_url = "%s/spt_js" % context_url # adding new core "spt" javascript library folder version = Environment.get_release_version() # add some third party libraries third_party = js_includes.third_party security = Environment.get_security() for include in js_includes.third_party: Container.append_seq("Page:js", "%s/%s" % (spt_js_url,include)) all_js_path = js_includes.get_compact_js_filepath() if os.path.exists( all_js_path ): Container.append_seq("Page:js", "%s/%s" % (context_url, js_includes.get_compact_js_context_path_suffix())) else: for include in js_includes.legacy_core: Container.append_seq("Page:js", "%s/%s" % (js_url,include)) for include in js_includes.spt_js: Container.append_seq("Page:js", "%s/%s" % (spt_js_url,include)) for include in js_includes.legacy_app: Container.append_seq("Page:js", "%s/%s" % (js_url,include)) # custom js files to include includes = Config.get_value("install", "include_js") includes = includes.split(",") for include in includes: include = include.strip() if include: print "include: ", include Container.append_seq("Page:js", include) widget = Widget() js_files = Container.get("Page:js") for js_file in js_files: widget.add('<script src="%s?ver=%s" ></script>\n' % (js_file,version) ) return widget
def get_display(my): web = WebContainer.get_web() context_url = web.get_context_url().to_string() js_url = "%s/javascript" % context_url spt_js_url = "%s/spt_js" % context_url # adding new core "spt" javascript library folder version = Environment.get_release_version() # add some third party libraries third_party = js_includes.third_party security = Environment.get_security() # FIXME: this logic should not be located here. # no reason to have the edit_area_full.js if not security.check_access("builtin", "view_script_editor", "allow") and security.check_access("builtin", "view_site_admin", "allow"): if "edit_area/edit_area_full.js" in third_party: third_party.remove("edit_area/edit_area_full.js") for include in js_includes.third_party: Container.append_seq("Page:js", "%s/%s" % (spt_js_url,include)) all_js_path = js_includes.get_compact_js_filepath() if os.path.exists( all_js_path ): Container.append_seq("Page:js", "%s/%s" % (context_url, js_includes.get_compact_js_context_path_suffix())) else: for include in js_includes.legacy_core: Container.append_seq("Page:js", "%s/%s" % (js_url,include)) for include in js_includes.spt_js: Container.append_seq("Page:js", "%s/%s" % (spt_js_url,include)) for include in js_includes.legacy_app: Container.append_seq("Page:js", "%s/%s" % (js_url,include)) #Container.append_seq("Page:js", "http://webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject.js") #Container.append_seq("Page:js", "/context/spt_js/UnityObject.js") #widget = DivWdg() #widget.set_id("javascript") #my.set_as_panel(widget) widget = Widget() js_files = Container.get("Page:js") for js_file in js_files: widget.add('<script src="%s?ver=%s" ></script>\n' % (js_file,version) ) return widget
def get_display(my): my.view = my.kwargs.get('view') if not my.view: my.view = 'publish' widget = Widget() sobject = my.get_current_sobject() search_type = sobject.get_search_type() search_id = sobject.get_id() if my.get_option('preview') != 'false': my.thumb.set_current_index(my.get_current_index()) widget.add(my.thumb) publish_link = PublishLinkWdg(search_type,search_id, config_base=my.view) div = DivWdg(publish_link) div.set_style('clear: left; padding-top: 6px') widget.add(div) # build a popup link to show publish browsing browse_link = IconButtonWdg("Publish Browser", IconWdg.CONTENTS) browse_link.add_behavior({'type': 'click_up', 'cbjs_action': 'spt.popup.get_widget(evt, bvr)', 'options': {'popup_id' : 'publish_browser', 'class_name' : 'pyasm.prod.web.PublishBrowserWdg' , 'title': 'Publish Browser'}, 'args' : { 'search_type': search_type, 'search_id' : search_id } }) div.add(browse_link) div.set_style('padding-top: 6px') return widget
def get_display(self): sobject = self.get_current_sobject() sobject = sobject.get_parent() if not sobject: return Widget() # get all of the sobject_logs search = Search("sthpw/sobject_log") search.add_sobject_filter(sobject) logs = search.get_sobjects() search = Search("sthpw/transaction_log") search.add_filters("id", [x.get_value("transaction_log_id") for x in logs]) search.set_limit(200) logs = search.get_sobjects() from layout_wdg import TableWdg widget = Widget() table = TableWdg("sthpw/transaction_log") table.add_class("minimal") table.set_header_flag(False) table.set_show_property(False) table.set_no_results_wdg(" ") table.set_sobjects(logs) widget.add(table) return widget
def get_storyboard_wdg(my): widget = Widget() help = HelpItemWdg( 'Storyboards', 'Storyboards tab lets the user organize storyboards. You are only required to [Insert] once per shot. Subsequent versions of the storyboard should be published via the [Publish] button.' ) my.add(help) div = DivWdg(css="filter_box") sequence_filter = SequenceFilterWdg() epi_code, sequence_code = sequence_filter.get_value() div.add(sequence_filter) columns = ['code', 'shot_code'] search_filter = SearchFilterWdg("storyboard_search", columns=columns,\ has_persistence=False) div.add(search_filter) widget.add(div) # create a search search = Search("prod/storyboard") if sequence_code: search.add_where( "shot_code in (select code from shot where sequence_code = '%s')" % sequence_code) table = TableWdg("prod/storyboard") table.set_class("table") table.set_search_limit(25) table.set_search(search) widget.add(table) return widget
def get_display(my): widget = Widget() app = "Maya" widget.add("<h3>Application Setup Wizard</h3>") block = HtmlElement.blockquote() block.add("<p>Step 1: Launch %s (or start with a new session)</p>" % app) # sphere test block.add("<p>Step 2: Sphere test</p>") sphere_button = ProdIconButtonWdg("Sphere") sphere_button.add_event("onclick", "app.mel('sphere')") block.add( sphere_button) block.add( "If a sphere appears when clicking on this button, then the Maya connector is functiioning") block.add("<p>Step 3: Introspection</p>") introspect_button = ProdIconButtonWdg("Introspect") introspect_button.add_event("onclick", "introspect()") block.add( introspect_button) block.add("<p>Step 4: Create C:/temp/sthpw</p>") block.add("<p>Step 5: Check in Sphere</p>") block.add("<p>Step 6: Load Sphere</p>") widget.add(block) return widget
def get_tool_bar(my): widget = Widget() trash_div = SpanWdg() trash_div.set_id('trash_me') trash_div.add(IconWdg('Trash', IconWdg.TRASH)) trash_div.add("TRASH!") trash_div.add_class("hand") trash_div.add_class("spt_side_bar_trash") trash_div.set_attr("SPT_ACCEPT_DROP", "manageSideBar") bvr = { "type": "click_up",\ 'cbjs_action': "alert('Drag and drop element name here to remove it.')"} trash_div.add_behavior(bvr) widget.add(trash_div) save_div = SpanWdg(css='med hand spt_side_bar_trash') save_div.add(IconWdg('Save', IconWdg.SAVE)) bvr = { "type": "click_up",\ 'cbjs_action': "spt.custom_project.manage_action_cbk({'value':'save'},'%s');" % my.view} save_div.add_behavior(bvr) widget.add(save_div) return widget
def get_display(my): if my.is_refresh: top = Widget() my.add(top) web = WebContainer.get_web() my.checked_processes = web.get_form_values('process_names') left_checked_processes = web.get_form_values('left_process_names') right_checked_processes = web.get_form_values( 'right_process_names') is_split_view = web.get_form_value('split_view') == 'true' else: top = my.get_viewer() if my.is_refresh: if is_split_view: viewer = my.get_split_viewer() top.add(viewer) else: inner_wdg = SingleNoteViewerWdg( processes_names=my.process_names, parent_key=my.kwargs.get('parent_key'), resize='false', append_context=my.append_context, view=my.view) top.add(inner_wdg) return top
def get_tool_bar(my): widget = Widget() trash_div = SpanWdg() # reset some global variables on load trash_div.add_behavior({'type':'load', 'cbjs_action':'spt.side_bar.trashed_items=[]; spt.side_bar.changed_views={}'}) trash_div.set_id('trash_me') trash_div.add(IconWdg('Trash', IconWdg.TRASH)) trash_div.add("TRASH!") trash_div.add_class("hand") trash_div.add_class("spt_side_bar_trash") trash_div.set_attr("SPT_ACCEPT_DROP", "manageSideBar") bvr = { "type": "click_up",\ 'cbjs_action': "alert('Drag and drop link or folder here to remove it.')"} trash_div.add_behavior(bvr) widget.add(trash_div) save_div = SpanWdg(css='med hand spt_side_bar_trash') save_div.add(IconWdg('Save Ordering', IconWdg.SAVE)) # FIXME: is_personal??? is_personal = 'false' bvr = { "type": "click_up",\ 'cbjs_action': "spt.side_bar.manage_section_action_cbk({'value':'save'},'%s',%s);" % (my.view, is_personal)} save_div.add_behavior(bvr) widget.add(save_div) return widget
def get_display(my): search_type = my.search_type related_search_type = my.related_search_type_wdg.get_value() if related_search_type: search_type = related_search_type hier_sel = my.get_hier_sel(search_type) selected_related_search_type = hier_sel.get_value() process_wdg = my.get_process_wdg(search_type) context_wdg = my.get_context_wdg(search_type) widget = my.main_div if my.is_from_ajax(True): widget = Widget() else: my.set_ajax_top(widget) hidden = HiddenWdg("search_type" ,search_type) widget.add(hidden) hier_sel.add_event('onchange', my.get_refresh_script(show_progress=False)) widget.add(hier_sel) #Tooltip doesn't work too well #hint = HintWdg('Related search type you can optionally select to drive the process') widget.add(HtmlElement.br(2)) widget.add(process_wdg) widget.add(context_wdg) return widget
def get_display(self): if self.is_refresh: top = Widget() self.add(top) web = WebContainer.get_web() self.checked_processes = web.get_form_values('process_names') left_checked_processes = web.get_form_values('left_process_names') right_checked_processes = web.get_form_values('right_process_names') is_split_view = web.get_form_value('split_view') == 'true' else: top = self.get_viewer() if self.is_refresh: if is_split_view: viewer = self.get_split_viewer() top.add(viewer) else: inner_wdg = SingleNoteViewerWdg(processes_names=self.process_names, parent_key=self.kwargs.get('parent_key'), resize='false', append_context=self.append_context, view=self.view) top.add(inner_wdg) return top
def get_tool_bar(my): widget = Widget() trash_div = SpanWdg() # reset some global variables on load trash_div.add_behavior({ 'type': 'load', 'cbjs_action': 'spt.side_bar.trashed_items=[]; spt.side_bar.changed_views={}' }) trash_div.set_id('trash_me') trash_div.add(IconWdg('Trash', IconWdg.TRASH)) trash_div.add("TRASH!") trash_div.add_class("hand") trash_div.add_class("spt_side_bar_trash") trash_div.set_attr("SPT_ACCEPT_DROP", "manageSideBar") bvr = { "type": "click_up",\ 'cbjs_action': "alert('Drag and drop link or folder here to remove it.')"} trash_div.add_behavior(bvr) widget.add(trash_div) save_div = SpanWdg(css='med hand spt_side_bar_trash') save_div.add(IconWdg('Save Ordering', IconWdg.SAVE)) # FIXME: is_personal??? is_personal = 'false' bvr = { "type": "click_up",\ 'cbjs_action': "spt.side_bar.manage_section_action_cbk({'value':'save'},'%s',%s);" % (my.view, is_personal)} save_div.add_behavior(bvr) widget.add(save_div) return widget
def get_pipeline_wdg(self): search = Search("sthpw/pipeline") widget = Widget() widget.set_search(search) table = TableWdg("sthpw/pipeline", "manage") widget.add(table) return widget
def get_notes_wdg(my): widget = Widget() div = DivWdg(css="filter_box") columns = ['code', 'description'] search_filter = SearchFilterWdg("note_search", columns=columns,\ has_persistence=False) div.add(search_filter) sequence_filter = SequenceFilterWdg() div.add(sequence_filter) context_select = FilterSelectWdg("discussion_context") context_select.set_option("setting", "notes_preprod_context") context_select.add_empty_option("-- Any Context --") span = SpanWdg(css="med") span.add("Notes Context: ") span.add(context_select) hint = HintWdg('Submission notes for each shot are also included here') span.add(hint) div.add(span) widget.add(div) # create a search search = Search("prod/shot") sequence_filter.alter_search(search) search_filter.alter_search(search) table = TableWdg("prod/shot", "preprod_notes") table.set_search(search) widget.add(table) return widget
def get_display(my): widget = Widget() thumb = super(ThumbPublishWdg, my).get_display() widget.add(thumb) sobject = my.get_current_sobject() search_type = sobject.get_search_type() search_id = sobject.get_id() publish_link = PublishLinkWdg(search_type,search_id) div = DivWdg(publish_link) div.set_style('clear: left; padding-top: 6px') widget.add(div) # build an iframe to show publish browsing browse_link = IconButtonWdg("Publish Browser", IconWdg.CONTENTS) iframe = WebContainer.get_iframe() iframe.set_width(100) url = WebContainer.get_web().get_widget_url() url.set_option("widget", "pyasm.prod.web.PublishBrowserWdg") url.set_option("search_type", search_type) url.set_option("search_id", search_id) script = iframe.get_on_script(url.to_string()) browse_link.add_event("onclick", script) div.add(browse_link) div.set_style('padding-top: 6px') return widget
def get_display(self): if self.is_refresh: top = Widget() self.add(top) web = WebContainer.get_web() self.checked_processes = web.get_form_values('process_names') left_checked_processes = web.get_form_values('left_process_names') right_checked_processes = web.get_form_values('right_process_names') is_split_view = web.get_form_values('split_view') == 'true' else: top = self.get_viewer() self.process_names = [x for x in self.process_names if x ] if self.is_refresh: if self.process_names: table = Table() table.add_row() td = table.add_cell() expression = "@SOBJECT(sthpw/note['context','in','%s'])" %'|'.join(self.process_names) table_id = 'main_table_left' left_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(left_table) td.add(inner_wdg) else: td.add(left_table) top.add(table) return top
def get_camera_wdg(my): widget = Widget() div = DivWdg(css="filter_box") sequence_filter = SequenceFilterWdg() epi_code, sequence_code = sequence_filter.get_value() div.add(sequence_filter) search = Search("prod/camera") columns = ['shot_code', 'description'] search_filter = SearchFilterWdg("camera_search", columns=columns,\ has_persistence=False) search_filter.alter_search(search) div.add(search_filter) widget.add(div) if sequence_code: search.add_where( "shot_code in (select code from shot where sequence_code = '%s')" % sequence_code) table = TableWdg("prod/camera") table.set_search(search) widget.add(table) return widget
def get_art_reference(self): widget = Widget() help = HelpItemWdg('References', 'References tab lets the user organize art references. Each reference can be [related] to one or more assets defined in TACTIC. It can be set up when you [Edit] the reference.') self.add(help) div = DivWdg(css="filter_box") widget.add(div) columns = ['description','keywords'] search_filter = SearchFilterWdg("art_ref_search", columns=columns,\ has_persistence=False) div.add(search_filter) select = FilterSelectWdg("art_ref_category", label='Category: ', css='snall') select.set_option("setting", "art_reference_category") select.add_empty_option('-- Any --') div.add( select ) table = TableWdg("prod/art_reference") search = Search("prod/art_reference") search_filter.alter_search(search) value = select.get_value() if value != "": search.add_filter("category", value) table.set_search(search) widget.add(table) return widget
def get_css_wdg(my): widget = Widget() web = WebContainer.get_web() context_url = web.get_context_url().to_string() skin = web.get_skin() # first load context css Container.append_seq("Page:css", "%s/style/layout.css" % context_url) # add the color wheel css Container.append_seq("Page:css", "%s/spt_js/mooRainbow/Assets/mooRainbow.css" % context_url) Container.append_seq("Page:css", "%s/spt_js/mooDialog/css/MooDialog.css" % context_url) # get all of the registered css file css_files = Container.get_seq("Page:css") for css_file in css_files: widget.add('<link rel="stylesheet" href="%s" type="text/css" />\n' % css_file ) # TEST TEST TEST widget.add('<link rel="stylesheet" href="/assets/_video/video-js.min.css" type="text/css" />\n') return widget
def get_display(self): search_type = self.search_type related_search_type = self.related_search_type_wdg.get_value() if related_search_type: search_type = related_search_type hier_sel = self.get_hier_sel(search_type) selected_related_search_type = hier_sel.get_value() process_wdg = self.get_process_wdg(search_type) context_wdg = self.get_context_wdg(search_type) widget = self.main_div if self.is_from_ajax(True): widget = Widget() else: self.set_ajax_top(widget) hidden = HiddenWdg("search_type" ,search_type) widget.add(hidden) hier_sel.add_event('onchange', self.get_refresh_script(show_progress=False)) widget.add(hier_sel) #Tooltip doesn't work too well #hint = HintWdg('Related search type you can optionally select to drive the process') widget.add(HtmlElement.br(2)) widget.add(process_wdg) widget.add(context_wdg) return widget
def get_display(self): sobject = self.get_current_sobject() sobject = sobject.get_parent() if not sobject: return Widget() # get all of the sobject_logs search = Search("sthpw/sobject_log") search.add_sobject_filter(sobject) logs = search.get_sobjects() search = Search("sthpw/transaction_log") search.add_filters("id", [x.get_value("transaction_log_id") for x in logs] ) search.set_limit(200) logs = search.get_sobjects() from layout_wdg import TableWdg widget = Widget() table = TableWdg("sthpw/transaction_log") table.add_class("minimal") table.set_header_flag(False) table.set_show_property(False) table.set_no_results_wdg( " " ) table.set_sobjects(logs) widget.add(table) return widget
def get_display(my): widget = Widget() thumb = super(ThumbPublishWdg, my).get_display() widget.add(thumb) sobject = my.get_current_sobject() search_type = sobject.get_search_type() search_id = sobject.get_id() publish_link = PublishLinkWdg(search_type, search_id) div = DivWdg(publish_link) div.set_style('clear: left; padding-top: 6px') widget.add(div) # build an iframe to show publish browsing browse_link = IconButtonWdg("Publish Browser", IconWdg.CONTENTS) iframe = WebContainer.get_iframe() iframe.set_width(100) url = WebContainer.get_web().get_widget_url() url.set_option("widget", "pyasm.prod.web.PublishBrowserWdg") url.set_option("search_type", search_type) url.set_option("search_id", search_id) script = iframe.get_on_script(url.to_string()) browse_link.add_event("onclick", script) div.add(browse_link) div.set_style('padding-top: 6px') return widget
def get_tool_bar(self): widget = Widget() trash_div = SpanWdg() trash_div.set_id('trash_me') trash_div.add(IconWdg('Trash', IconWdg.TRASH)) trash_div.add("TRASH!") trash_div.add_class("hand") trash_div.add_class("spt_side_bar_trash") trash_div.set_attr("SPT_ACCEPT_DROP", "manageSideBar") bvr = { "type": "click_up",\ 'cbjs_action': "alert('Drag and drop element name here to remove it.')"} trash_div.add_behavior(bvr) widget.add(trash_div) save_div = SpanWdg(css='med hand spt_side_bar_trash') save_div.add(IconWdg('Save', IconWdg.SAVE)) bvr = { "type": "click_up",\ 'cbjs_action': "spt.custom_project.manage_action_cbk({'value':'save'},'%s');" % self.view} save_div.add_behavior(bvr) widget.add(save_div) return widget
def get_css_wdg(my): widget = Widget() web = WebContainer.get_web() context_url = web.get_context_url().to_string() skin = web.get_skin() # first load context css Container.append_seq("Page:css", "%s/style/layout.css" % context_url) # add the color wheel css Container.append_seq("Page:css", "%s/spt_js/mooRainbow/Assets/mooRainbow.css" % context_url) Container.append_seq("Page:css", "%s/spt_js/mooDialog/css/MooDialog.css" % context_url) Container.append_seq("Page:css", "%s/spt_js/mooScrollable/Scrollable.css" % context_url) # TEST Container.append_seq("Page:css", "%s/spt_js/video/video-js.css" % context_url) # get all of the registered css file css_files = Container.get_seq("Page:css") for css_file in css_files: widget.add('<link rel="stylesheet" href="%s" type="text/css" />\n' % css_file ) return widget
def get_pipeline_wdg(my): search = Search("sthpw/pipeline") widget = Widget() widget.set_search(search) table = TableWdg("sthpw/pipeline", "manage") widget.add(table) return widget
def get_checkin(my): '''the button which initiates the checkin''' # create the button with the javascript function widget = Widget() #button = TextBtnWdg(label=my.PUBLISH_BUTTON, size='large', width='100', side_padding='20', vert_offset='-5') #button.get_top_el().add_class('smaller') button = ActionButtonWdg(title=my.PUBLISH_BUTTON, tip='Publish the selected assets') button.add_style('margin-bottom: 10px') #button.add_color("background", "background") hidden = HiddenWdg(my.PUBLISH_BUTTON, '') button.add( hidden ) ''' status_sel = SelectWdg('checkin_status', label='Status: ') status_sel.set_option('setting', 'checkin_status') status_sel.set_persist_on_submit() status_sel.add_empty_option('-- Checkin Status --') widget.add(status_sel) ''' widget.add(button) # custom defined server_cbk = "pyasm.prod.web.AssetCheckinCbk" #TODO: make other Publish Buttons call their own handle_input function exec( Common.get_import_from_class_path(server_cbk) ) exec( "%s.handle_input(button, my.search_type, my.texture_search_type)" % server_cbk) return widget
def get_display(my): my.view = my.kwargs.get('view') if not my.view: my.view = 'publish' widget = Widget() sobject = my.get_current_sobject() search_type = sobject.get_search_type() search_id = sobject.get_id() if my.get_option('preview') != 'false': my.thumb.set_current_index(my.get_current_index()) widget.add(my.thumb) publish_link = PublishLinkWdg(search_type,search_id, config_base=my.view) div = DivWdg(publish_link) div.set_style('clear: left; padding-top: 6px') widget.add(div) # build a popup link to show publish browsing browse_link = IconButtonWdg("Publish Browser", IconWdg.CONTENTS) browse_link.add_behavior({'type': 'click_up', 'cbjs_action': 'spt.popup.get_widget(evt, bvr)', 'options': {'popup_id' : 'publish_browser', 'class_name' : 'pyasm.prod.web.PublishBrowserWdg' , 'title': 'Publish Browser'}, 'args' : { 'search_type': search_type, 'search_id' : search_id } }) div.add(browse_link) div.set_style('padding-top: 6px') return widget
def get_camera_wdg(self): widget = Widget() div = DivWdg(css="filter_box") sequence_filter = SequenceFilterWdg() epi_code, sequence_code = sequence_filter.get_value() div.add(sequence_filter) search = Search("prod/camera") columns = ['shot_code', 'description'] search_filter = SearchFilterWdg("camera_search", columns=columns,\ has_persistence=False) search_filter.alter_search(search) div.add(search_filter) widget.add(div) if sequence_code: search.add_where("shot_code in (select code from shot where sequence_code = '%s')" % sequence_code) table = TableWdg("prod/camera") table.set_search(search) widget.add(table) return widget
def get_checkin(my): '''the button which initiates the checkin''' # create the button with the javascript function widget = Widget() #button = TextBtnWdg(label=my.PUBLISH_BUTTON, size='large', width='100', side_padding='20', vert_offset='-5') #button.get_top_el().add_class('smaller') button = ActionButtonWdg(title=my.PUBLISH_BUTTON, tip='Publish the selected assets') button.add_style('margin-bottom: 10px') #button.add_color("background", "background") hidden = HiddenWdg(my.PUBLISH_BUTTON, '') button.add(hidden) ''' status_sel = SelectWdg('checkin_status', label='Status: ') status_sel.set_option('setting', 'checkin_status') status_sel.set_persist_on_submit() status_sel.add_empty_option('-- Checkin Status --') widget.add(status_sel) ''' widget.add(button) # custom defined server_cbk = "pyasm.prod.web.AssetCheckinCbk" #TODO: make other Publish Buttons call their own handle_input function exec(Common.get_import_from_class_path(server_cbk)) exec( "%s.handle_input(button, my.search_type, my.texture_search_type)" % server_cbk) return widget
def get_display(my): #parent_class = "TabWdg" my.parent_class = my.parent_wdg.__class__.__name__ if my.parent_class == "TbodyWdg": my.parent_class = "TableWdg" elif my.parent_class == "MayaTabWdgImpl": my.parent_class = "TabWdg" # get the key if my.parent_class == "TabWdg": key = my.parent_wdg.get_tab_path() elif my.parent_class == "TableWdg": key = "%s|%s" % (my.search_type, my.parent_wdg.get_view()) else: key = my.parent_wdg.get_name() # set sobjects from the parent, if there are any my.sobjects = my.parent_wdg.get_sobjects() # search for these from pyasm.search import Search search = Search("sthpw/widget_extend") search.add_project_filter() search.add_filter("type", my.parent_class) search.add_filter("key", key) extends = search.get_sobjects() for extend in extends: xml = extend.get_xml_value("data") index = xml.get_value("widget/@index") if index: index = int(index) else: index = None title = xml.get_value("widget/@name") nodes = xml.get_nodes("widget/widget") if nodes: widget = Widget() for node in nodes: node_string = Xml.get_node_xml(node) child_widget = CustomXmlWdg(node_string) if not child_widget: continue if my.sobjects: child_widget.set_sobjects(my.sobjects) widget.add(child_widget) else: widget = CustomXmlWdg(xml.to_string()) if my.sobjects: widget.set_sobjects(my.sobjects) if my.parent_class == 'TableWdg': table_element = widget.get_display_widget() table_element.set_parent_wdg(my.parent_wdg) my.parent_wdg.add(widget, title, index=index)
def get_title(self): widget = Widget() if not Container.get('GeneralAppletWdg'): widget.add(GeneralAppletWdg()) Container.put('GeneralAppletWdg', True) widget.add(super(LayerTableElementWdg, self).get_title()) return widget
def get_title(self): widget = Widget() if not Container.get('GeneralAppletWdg'): widget.add( GeneralAppletWdg() ) Container.put('GeneralAppletWdg', True) widget.add(super(LayerTableElementWdg, self).get_title()) return widget
def get_display(self): web = WebContainer.get_web() response = web.get_response() # get info from url site_obj = Site.get() path = web.get_request_path() path_info = site_obj.break_up_request_path(path) site = path_info.get("site") project_code = path_info.get("project_code") # find the relative path hash = self.kwargs.get("hash") parts = hash[1:] rel_path = "/".join(parts) #rel_path = "asset/Fantasy/Castle/54d45150c61251f65687d716cc3951f1_v001.jpg" # construct all of the paths asset_dir = web.get_asset_dir() base_dir = "%s/%s" % (asset_dir, project_code) path = "%s/%s" % (base_dir, rel_path) filename = os.path.basename(rel_path) print "path: ", path # determine the mimetype automatically import mimetypes base, ext = os.path.splitext(path) ext = ext.lower() mimetype = mimetypes.types_map[ext] headers = response.headers response.headers['Content-Type'] = mimetype response.headers['Content-Disposition'] = 'inline; filename={0}'.format(filename) use_xsendfile = True if use_xsendfile: response.headers['X-Sendfile'] = path return Widget(path) else: response.headers['Content-Transfer-Encoding'] = 'BINARY' widget = Widget() f = open(path, 'rb') data = f.read() f.close() widget.add(data) return widget
def get_display(my): top = Widget() from tactic.ui.panel import CustomLayoutWdg #widget = CustomLayoutWdg(view="bootstrap.basic.test_mootools", is_top=True) widget = CustomLayoutWdg(view="bootstrap.themes.jumbotron.main2", is_top=True) #widget = CustomLayoutWdg(view="bootstrap.basic.test2", is_top=True) top.add(widget) return top
def get_display(my): sobject = my.get_current_sobject() bins = sobject.get_bins() widget = Widget() bins_str = ", ".join(["%s" % bin.get_label() for bin in bins]) widget.add(bins_str) return widget
def get_display(my): sobject = my.get_current_sobject() bins = sobject.get_bins() widget = Widget() bins_str = ", ".join( ["%s" % bin.get_label() for bin in bins] ) widget.add( bins_str ) return widget
def get_display(my): my.run_init() name = my.get_name() if not name: name = my.kwargs.get("name") if my.is_refresh: widget = Widget() else: widget = DivWdg() my.set_as_panel(widget) widget.add_class("spt_note_top") widget.set_attr("spt_name", name) widget.set_attr("spt_parent_key", my.parent_key) web = WebContainer.get_web() value = web.get_form_value(name) text = TextAreaWdg(name) widget.add(text) if value: text.set_value(value) text.add_style("width: 100%") text.add_style("min-width: 200") text.add_attr("rows", "5") text.add_class('spt_note_text') color = text.get_color("background", -10) text.add_behavior({ 'type': 'blur', 'cbjs_action': ''' //spt.dg_table._toggle_commit_btn($(this), false); var el = bvr.src_el; var td = el.getParent(".spt_table_td"); var tbody = el.getParent(".spt_table_tbody"); td.setStyle('background-color','#909977'); td.addClass('spt_value_changed'); tbody.addClass('spt_value_changed'); td.setAttribute('spt_input_value', el.value); ''' }) #text.add_event("onblur", "spt.dg_table._toggle_commit_btn($(this), false);$(this).getParent('.spt_table_td').setStyle('background-color','#030');$(this).getParent('.spt_table_td').addClass('spt_value_changed');$(this).getParent('.spt_table_tbody').addClass('spt_value_changed');$(this).getParent('.spt_table_td').setAttribute('spt_input_value',this.value)") #text.add_event("onclick", "spt.dg_table.edit_cell_cbk( this, spt.kbd.special_keys_map.ENTER)" ); #behavior = { # 'type': 'keyboard', # 'kbd_handler_name': 'DgTableMultiLineTextEdit' #} #text.add_behavior(behavior) action_wdg = my.get_action_wdg(name) widget.add(action_wdg) return widget
def get_display(my): web = WebContainer.get_web() if not my.view: view = web.get_form_value("filter|view") # create popup create_popup = PopupWdg("create_action") create_popup.set_auto_hide(False) create_popup.add("Enter name of view: ") create_popup.add(TextWdg("create_view_name")) # create_popup.add( HtmlElement.br(2) ) # create_popup.add( "Copy from template: " ) # template_select = SelectWdg("copy_from_template") # template_select.add_empty_option("-- None --") # template_select.set_option("values", "list|summary|task") # create_popup.add( template_select ) create_popup.add(HtmlElement.br(2, clear="all")) from pyasm.prod.web import ProdIconButtonWdg, ProdIconSubmitWdg create_icon = ProdIconButtonWdg("Create") ajax = AjaxCmd() ajax.register_cmd("pyasm.widget.CustomCreateViewCbk") ajax.add_element_name("create_view_name") ajax.add_element_name("auto_create_edit") ajax.set_option("search_type", my.search_type) ajax.set_option("project", Project.get_project_code()) if my.view: ajax.set_option("template_view", my.view) create_icon.add_event( "onclick", "%s;%s" % (ajax.get_on_script(), "toggle_display('create_action');setTimeout('document.form.submit()',1000)"), ) cancel_icon = ProdIconButtonWdg("Cancel") cancel_icon.add_event("onclick", "toggle_display('create_action')") span = SpanWdg() span.add(create_icon) span.add(cancel_icon) create_popup.add(span) create_popup.add(HtmlElement.br()) # add the create button create = IconButtonWdg("Create View", IconWdg.SAVE, True) create.add_event("onclick", "%s" % create_popup.get_on_script()) # lay it all out widget = Widget() widget.add(create_popup) # Browser does not have create # widget.add(create) return widget
def get_project_settings_wdg(my): widget = Widget() search = Search("prod/prod_setting") table = TableWdg("prod/prod_setting") table.set_search(search) widget.add(table) return widget
def get_milestone_wdg(self): widget = Widget() search = Search("sthpw/milestone") table = TableWdg("sthpw/milestone") table.set_search(search) widget.add(table) return widget
def get_display(my): top = Widget() from tactic.ui.panel import CustomLayoutWdg #widget = CustomLayoutWdg(view="bootstrap.basic.test_mootools", is_top=True) widget = CustomLayoutWdg(view="bootstrap.themes.jumbotron.main2", is_top=True) #widget = CustomLayoutWdg(view="bootstrap.basic.test2", is_top=True) top.add(widget) return top
def get_project_settings_wdg(self): widget = Widget() search = Search("prod/prod_setting") table = TableWdg("prod/prod_setting") table.set_search(search) widget.add(table) return widget
def get_milestone_wdg(my): widget = Widget() search = Search("sthpw/milestone") table = TableWdg("sthpw/milestone") table.set_search(search) widget.add(table) return widget
def get_display(self): self.run_init() name = self.get_name() if not name: name = self.kwargs.get("name") if self.is_refresh: widget = Widget() else: widget = DivWdg() self.set_as_panel(widget) widget.add_class("spt_note_top") widget.set_attr("spt_name", name) widget.set_attr("spt_parent_key", self.parent_key) web = WebContainer.get_web() value = web.get_form_value(name) text = TextAreaWdg(name) widget.add(text) if value: text.set_value(value) text.add_style("width: 100%") text.add_style("min-width: 200") text.add_attr("rows", "5") text.add_class('spt_note_text') color = text.get_color("background", -10); text.add_behavior( { 'type': 'blur', 'cbjs_action': ''' //spt.dg_table._toggle_commit_btn($(this), false); var el = bvr.src_el; var td = el.getParent(".spt_table_td"); var tbody = el.getParent(".spt_table_tbody"); td.setStyle('background-color','#909977'); td.addClass('spt_value_changed'); tbody.addClass('spt_value_changed'); td.setAttribute('spt_input_value', el.value); ''' } ) #text.add_event("onblur", "spt.dg_table._toggle_commit_btn($(this), false);$(this).getParent('.spt_table_td').setStyle('background-color','#030');$(this).getParent('.spt_table_td').addClass('spt_value_changed');$(this).getParent('.spt_table_tbody').addClass('spt_value_changed');$(this).getParent('.spt_table_td').setAttribute('spt_input_value',this.value)") #text.add_event("onclick", "spt.dg_table.edit_cell_cbk( this, spt.kbd.special_keys_map.ENTER)" ); #behavior = { # 'type': 'keyboard', # 'kbd_handler_name': 'DgTableMultiLineTextEdit' #} #text.add_behavior(behavior) action_wdg = self.get_action_wdg(name) widget.add(action_wdg) return widget
def get_display(self): web = WebContainer.get_web() response = web.get_response() # get info from url site_obj = Site.get() path = web.get_request_path() path_info = site_obj.break_up_request_path(path) site = path_info.get("site") project_code = path_info.get("project_code") # find the relative path hash = self.kwargs.get("hash") parts = hash[1:] rel_path = "/".join(parts) #rel_path = "asset/Fantasy/Castle/54d45150c61251f65687d716cc3951f1_v001.jpg" # construct all of the paths asset_dir = web.get_asset_dir() base_dir = "%s/%s" % (asset_dir, project_code) path = "%s/%s" % (base_dir, rel_path) filename = os.path.basename(rel_path) print "path: ", path # determine the mimetype automatically import mimetypes base, ext = os.path.splitext(path) ext = ext.lower() mimetype = mimetypes.types_map[ext] headers = response.headers response.headers['Content-Type'] = mimetype response.headers[ 'Content-Disposition'] = 'inline; filename={0}'.format(filename) use_xsendfile = True if use_xsendfile: response.headers['X-Sendfile'] = path return Widget(path) else: response.headers['Content-Transfer-Encoding'] = 'BINARY' widget = Widget() f = open(path, 'rb') data = f.read() f.close() widget.add(data) return widget
def get_display(my): web = WebContainer.get_web() if not my.view: view = web.get_form_value("filter|view") # create popup create_popup = PopupWdg("create_action") create_popup.set_auto_hide(False) create_popup.add("Enter name of view: ") create_popup.add(TextWdg("create_view_name")) #create_popup.add( HtmlElement.br(2) ) #create_popup.add( "Copy from template: " ) #template_select = SelectWdg("copy_from_template") #template_select.add_empty_option("-- None --") #template_select.set_option("values", "list|summary|task") #create_popup.add( template_select ) create_popup.add(HtmlElement.br(2, clear="all")) from pyasm.prod.web import ProdIconButtonWdg, ProdIconSubmitWdg create_icon = ProdIconButtonWdg('Create') ajax = AjaxCmd() ajax.register_cmd("pyasm.widget.CustomCreateViewCbk") ajax.add_element_name("create_view_name") ajax.add_element_name("auto_create_edit") ajax.set_option("search_type", my.search_type) ajax.set_option("project", Project.get_project_code()) if my.view: ajax.set_option("template_view", my.view) create_icon.add_event( "onclick", "%s;%s" % (ajax.get_on_script(), "toggle_display('create_action');setTimeout('document.form.submit()',1000)" )) cancel_icon = ProdIconButtonWdg('Cancel') cancel_icon.add_event("onclick", "toggle_display('create_action')") span = SpanWdg() span.add(create_icon) span.add(cancel_icon) create_popup.add(span) create_popup.add(HtmlElement.br()) # add the create button create = IconButtonWdg("Create View", IconWdg.SAVE, True) create.add_event("onclick", "%s" % create_popup.get_on_script()) # lay it all out widget = Widget() widget.add(create_popup) # Browser does not have create #widget.add(create) return widget
def get_display(self): clipboards = Clipboard.get_all("select") from layout_wdg import TableWdg widget = Widget() widget.add( "<h3>Clipboard</h3>") table = TableWdg("sthpw/clipboard", self.view) table.set_sobjects(clipboards) widget.add(table) return widget
def get_css_wdg(self): widget = Widget() web = WebContainer.get_web() context_url = web.get_context_url().to_string() skin = web.get_skin() version = Environment.get_release_version() # Bootstrap use_bootstrap = True if use_bootstrap: Container.append_seq( "Page:css", "%s/spt_js/bootstrap/css/bootstrap.min.css?ver=%s" % (context_url, version)) # add the color wheel css Container.append_seq( "Page:css", "%s/spt_js/mooRainbow/Assets/mooRainbow.css" % context_url) Container.append_seq( "Page:css", "%s/spt_js/mooDialog/css/MooDialog.css" % context_url) Container.append_seq( "Page:css", "%s/spt_js/mooScrollable/Scrollable.css" % context_url) # first load context css Container.append_seq("Page:css", "%s/style/layout.css" % context_url) # TEST Container.append_seq("Page:css", "%s/spt_js/video/video-js.css" % context_url) # get all of the registered css file css_files = Container.get_seq("Page:css") for css_file in css_files: widget.add( '<link rel="stylesheet" href="%s" type="text/css" />\n' % css_file) # custom js files to include includes = Config.get_value("install", "include_css") includes = includes.split(",") for include in includes: include = include.strip() if include: print("include: ", include) widget.add( '<link rel="stylesheet" href="%s" type="text/css" />\n' % include) return widget
def get_display(self): clipboards = Clipboard.get_all("select") from layout_wdg import TableWdg widget = Widget() widget.add("<h3>Clipboard</h3>") table = TableWdg("sthpw/clipboard", self.view) table.set_sobjects(clipboards) widget.add(table) return widget
def get_naming_wdg(self): widget = Widget() #div = DivWdg(css="filter_box") #widget.add(div) table = TableWdg("prod/naming") search = Search("prod/naming") sobjects = search.get_sobjects() table.set_sobjects(sobjects) widget.add(table) return widget
def get_display(self): widget = Widget() checkbox = CheckboxWdg(self.get_input_name()) widget.add(checkbox) where = self.get_option("where") count = Clipboard.get_count(where=where) widget.add("Copy from clipboard: ( %s items )" % count) return widget
def get_render_policy_wdg(my): widget = Widget() #div = DivWdg(css="filter_box") #widget.add(div) table = TableWdg("prod/render_policy") search = Search("prod/render_policy") sobjects = search.get_sobjects() table.set_sobjects(sobjects) widget.add(table) return widget
def get_naming_wdg(self): widget = Widget() #div = DivWdg(css="filter_box") #widget.add(div) table = TableWdg("prod/naming") search = Search("prod/naming") sobjects = search.get_sobjects() table.set_sobjects(sobjects) widget.add(table) return widget
def get_display(self): widget = Widget() checkbox = CheckboxWdg(self.get_input_name()) widget.add(checkbox) where = self.get_option("where") count = Clipboard.get_count(where=where) widget.add("Copy from clipboard: ( %s items )" % count) return widget
def get_render_policy_wdg(my): widget = Widget() #div = DivWdg(css="filter_box") #widget.add(div) table = TableWdg("prod/render_policy") search = Search("prod/render_policy") sobjects = search.get_sobjects() table.set_sobjects(sobjects) widget.add(table) return widget
def handle_unknown_instance(my, table, instance): '''handle unassigned or non-tactic nodes''' table.add_row() table.add_blank_cell() icon = IconWdg("unknown", icon=IconWdg.UNKNOWN) table.add_cell(icon) info_wdg = Widget() info_wdg.add("<b>%s</b>" % instance) table.add_cell(info_wdg) table.add_blank_cell() table.add_blank_cell()
def handle_unknown_instance(my, table, instance): '''handle unassigned or non-tactic nodes''' table.add_row() table.add_blank_cell() icon = IconWdg("unknown", icon=IconWdg.UNKNOWN) table.add_cell(icon) info_wdg = Widget() info_wdg.add("<b>%s</b>" % instance) table.add_cell(info_wdg) table.add_blank_cell() table.add_blank_cell()
def get_display(my): web = WebContainer.get_web() context_url = web.get_context_url().to_string() js_url = "%s/javascript" % context_url spt_js_url = "%s/spt_js" % context_url # adding new core "spt" javascript library folder version = Environment.get_release_version() # add some third party libraries third_party = js_includes.third_party security = Environment.get_security() for include in js_includes.third_party: Container.append_seq("Page:js", "%s/%s" % (spt_js_url, include)) all_js_path = js_includes.get_compact_js_filepath() if os.path.exists(all_js_path): Container.append_seq( "Page:js", "%s/%s" % (context_url, js_includes.get_compact_js_context_path_suffix())) else: for include in js_includes.legacy_core: Container.append_seq("Page:js", "%s/%s" % (js_url, include)) for include in js_includes.spt_js: Container.append_seq("Page:js", "%s/%s" % (spt_js_url, include)) for include in js_includes.legacy_app: Container.append_seq("Page:js", "%s/%s" % (js_url, include)) # custom js files to include includes = Config.get_value("install", "include_js") includes = includes.split(",") for include in includes: include = include.strip() if include: print "include: ", include Container.append_seq("Page:js", include) widget = Widget() js_files = Container.get("Page:js") for js_file in js_files: widget.add('<script src="%s?ver=%s" ></script>\n' % (js_file, version)) return widget
def get_display(self): web = WebContainer.get_web() widget = Widget() search_type = web.get_form_value("parent_search_type") search_id = web.get_form_value("parent_search_id") if not search_type: widget.add("RenderSubmitInfo: parent type not found") return widget hidden = HiddenWdg("parent_search_type", search_type) widget.add(hidden) hidden = HiddenWdg("parent_search_id", search_id) widget.add(hidden) sobject = Search.get_by_id(search_type, search_id) table = TableWdg(search_type, css="embed") table.set_show_property(False) table.set_sobject(sobject) table.remove_widget("render") table.remove_widget("description") widget.add(table) return widget
def get_display(self): widget = Widget() project = self.get_current_sobject() table = Table() widget.add(table) table.add_style("width: 140px") table.add_row() table.add_cell("Exists: ") table.add_cell(" ") try: exists = project.database_exists() except: #print "Error checking if database exists for project [%s]" % project.get_code() exists = False if exists: table.add_cell( IconWdg("database", IconWdg.DOT_GREEN) ) else: table.add_cell( IconWdg("database", IconWdg.DOT_RED) ) table.add_row() table.add_cell("Version: ") last_version_update = project.get_value("last_version_update") table.add_cell( last_version_update) if last_version_update >= self.version: table.add_cell( IconWdg("database", IconWdg.DOT_GREEN) ) else: table.add_cell( IconWdg("database", IconWdg.DOT_RED) ) widget.add("<br/>") """ widget.add("Schema: ") widget.add("<br/>") widget.add("Context: ") widget.add("<br/>") widget.add("Data: ") widget.add("<br/>") """ return widget