def get_sequence_button(my): # add button widget = Widget() from pyasm.prod.web import ProdIconButtonWdg add = ProdIconButtonWdg('Add') script = ["append_item('%s','%s')" % (my.SELECT_NAME, my.NEW_ITEM )] script.append( my.get_refresh_script() ) add.add_event('onclick', ';'.join(script)) widget.add(add) hint = HintWdg('Add one or more items to the list.', title='Tip') widget.add(hint) return widget
def get_sequence_button(self): # add button widget = Widget() from pyasm.prod.web import ProdIconButtonWdg add = ProdIconButtonWdg('Add') script = ["append_item('%s','%s')" % (self.SELECT_NAME, self.NEW_ITEM )] script.append( self.get_refresh_script() ) add.add_event('onclick', ';'.join(script)) widget.add(add) hint = HintWdg('Add one or more items to the list.', title='Tip') widget.add(hint) return widget
def get_sequence_button(my): # add button widget = Widget() from pyasm.prod.web import ProdIconButtonWdg add = ProdIconButtonWdg('Add') script = ["append_item('%s','%s')" % (my.SELECT_NAME, my.NEW_ITEM)] script.append(my.get_refresh_script()) add.add_event('onclick', ';'.join(script)) widget.add(add) hint = HintWdg('New item will be inserted before the currently selected item. '\ 'Click on [Edit/Close] to confirm the final change.', title='Tip') widget.add(hint) return widget
def get_sequence_button(my): # add button widget = Widget() from pyasm.prod.web import ProdIconButtonWdg add = ProdIconButtonWdg('Add') script = ["append_item('%s','%s')" % (my.SELECT_NAME, my.NEW_ITEM )] script.append( my.get_refresh_script() ) add.add_event('onclick', ';'.join(script)) widget.add(add) hint = HintWdg('New item will be inserted before the currently selected item. '\ 'Click on [Edit/Close] to confirm the final change.', title='Tip') widget.add(hint) return widget
def get_map_button(my): widget = Widget() # add button from pyasm.prod.web import ProdIconButtonWdg add = ProdIconButtonWdg('Add') script = ["append_item('%s','%s','%s')" \ % (my.SELECT_NAME, my.NEW_ITEM, my.NEW_ITEM_LABEL)] script.append( my.get_refresh_script() ) add.add_event('onclick', ';'.join(script)) widget.add(add) hint = HintWdg('New value:label pair will be inserted after the currently selected item.\ Click on [Edit/Close] to confirm the final change.') widget.add(hint) return widget
def get_map_button(self): widget = Widget() # add button from pyasm.prod.web import ProdIconButtonWdg add = ProdIconButtonWdg('Add') script = ["append_item('%s','%s','%s')" \ % (self.SELECT_NAME, self.NEW_ITEM, self.NEW_ITEM_LABEL)] script.append( self.get_refresh_script() ) add.add_event('onclick', ';'.join(script)) widget.add(add) hint = HintWdg('New value:label pair will be inserted after the currently selected item.\ Click on [Edit/Close] to confirm the final change.') widget.add(hint) 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_create_view_wdg(my, search_type): # 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)) create_popup.add( CheckboxWdg('auto_create_edit', label='Auto Create Edit View')) 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", search_type) ajax.set_option("project", Project.get_project_code()) div = ajax.generate_div() div.set_post_ajax_script('document.form.submit()') create_icon.add_event( "onclick", "%s;%s" % (ajax.get_on_script(), "toggle_display('create_action')")) 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) widget.add(create) widget.add(div) 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_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_create_view_wdg(my, search_type): # 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)) create_popup.add(CheckboxWdg("auto_create_edit", label="Auto Create Edit View")) 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", search_type) ajax.set_option("project", Project.get_project_code()) div = ajax.generate_div() div.set_post_ajax_script("document.form.submit()") create_icon.add_event("onclick", "%s;%s" % (ajax.get_on_script(), "toggle_display('create_action')")) 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) widget.add(create) widget.add(div) return widget
def get_display(self): 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_new_custom_widget(my, view): custom_table = Table(css="table") name_text = TextWdg("new_custom_name") custom_table.add_row() custom_table.add_cell("Name: ") custom_table.add_cell(name_text) type_select = SelectWdg("new_custom_type") #type_select.add_empty_option("-- Select --") type_select.set_option("values", "Name/Code|Foreign Key|List|Checkbox|Text|Number|Date|Date Range") custom_table.add_row() custom_table.add_cell("Predefined Type: ") td = custom_table.add_cell(type_select) td.add( HtmlElement.script(''' function property_type_select(el) { if (el.value == "Foreign Key") { set_display_on('foreign_key_options') } else if (el.value == "List") { set_display_on('list_options') } else { set_display_off('foreign_key_options') set_display_off('list_options') } } ''') ) type_select.add_event("onchange", "property_type_select(this)") # extra info for foreign key custom_table.add_row() div = DivWdg() div.set_id("foreign_key_options") div.add_style("display: none") div.add_style("margin-top: 10px") div.add("Options") div.add(HtmlElement.br()) # TODO: this class should not be in prod!! from pyasm.prod.web import SearchTypeSelectWdg div.add("Relate to: ") search_type_select = SearchTypeSelectWdg("foreign_key_search_select", mode=SearchTypeSelectWdg.CURRENT_PROJECT) div.add(search_type_select) td.add(div) # extra info for foreign key custom_table.add_row() div = DivWdg() div.set_id("list_options") div.add_style("display: none") div.add_style("margin-top: 10px") div.add("Options") div.add(HtmlElement.br()) # TODO: this class should not be in prod!! from pyasm.prod.web import SearchTypeSelectWdg div.add("Values: ") search_type_text = TextWdg("list_values") div.add(search_type_text) td.add(div) custom_table.add_row() description_wdg = TextAreaWdg("new_description") custom_table.add_cell( "Description: " ) custom_table.add_cell( description_wdg ) # add to current view if view not in ['edit', 'insert']: custom_table.add_row() current_view_wdg = CheckboxWdg("add_to_current_view") current_view_wdg.set_checked() custom_table.add_cell("Add To Current View: ") td = custom_table.add_cell(current_view_wdg) custom_table.add_row() edit_view_wdg = CheckboxWdg("add_to_edit_view") edit_view_wdg.set_checked() custom_table.add_cell("Add To Edit View: ") custom_table.add_cell(edit_view_wdg) # add to edit view custom_table.add_row() custom_table.add_blank_cell() custom_table.add_cell(SpanWdg('If you check this for a search type already in the system, it will create an edit view that overrides the built-in edit view. This may affect its editability. You can always delete the edit view in the Configure Widgets tab afterwards.', css='warning smaller')) custom_table.add_row() from pyasm.prod.web import ProdIconSubmitWdg, ProdIconButtonWdg submit = ProdIconSubmitWdg("Insert/Next") tr, td = custom_table.add_row_cell(submit) td.add_style("text-align: center") submit = ProdIconSubmitWdg("Insert/Exit") td.add(submit) iframe = WebContainer.get_iframe() cancel = ProdIconButtonWdg("Cancel") iframe_close_script = "window.parent.%s" % iframe.get_off_script() cancel.add_event("onclick", iframe_close_script) td.add(cancel) return custom_table