Example #1
0
    def get_advanced_definition_wdg(self):
        # add the advanced entry
        advanced = DivWdg()
        advanced.add_style("margin-top: 10px")
        advanced.add_style("padding: 10px")
        advanced.add_border()
        title = DivWdg()
        title.add_style("color: black")
        title.add("Advanced - XML Column Definition")
        title.add_style("margin-top: -23")
        advanced.add(title)
        advanced.add("<br/>")

        input = TextAreaWdg("config_xml")
        input.set_id("config_xml")
        input.set_option("rows", "10")
        input.set_option("cols", "70")
        input.set_value(self.config_string)
        advanced.add(input)
        advanced.add(HtmlElement.br(2))

        button_div = DivWdg()
        button_div.add_style("text-align: center")
        

        button = ActionButtonWdg(title="Save Definition") 
        #button = ProdIconButtonWdg("Save Definition")
        button.add_event("onclick", "spt.custom_project.save_definition_cbk()")
        button_div.add(button)
        button_div.add_style("margin-left: 130px")
        advanced.add(button_div)

        return advanced
    def get_advanced_definition_wdg(my):
        # add the advanced entry
        advanced = DivWdg()
        advanced.add_style("margin-top: 10px")
        advanced.add_style("padding: 10px")
        advanced.add_border()
        title = DivWdg()
        title.add_style("color: black")
        title.add("Advanced - XML Column Definition")
        title.add_style("margin-top: -23")
        advanced.add(title)
        advanced.add("<br/>")

        input = TextAreaWdg("config_xml")
        input.set_id("config_xml")
        input.set_option("rows", "10")
        input.set_option("cols", "70")
        input.set_value(my.config_string)
        advanced.add(input)
        advanced.add(HtmlElement.br(2))

        button_div = DivWdg()
        button_div.add_style("text-align: center")

        button = ActionButtonWdg(title="Save Definition")
        #button = ProdIconButtonWdg("Save Definition")
        button.add_event("onclick", "spt.custom_project.save_definition_cbk()")
        button_div.add(button)
        button_div.add_style("margin-left: 130px")
        advanced.add(button_div)

        return advanced
Example #3
0
    def handle_xml_mode(my, custom_table, mode):

        tbody = custom_table.add_tbody()
        tbody.add_class("spt_custom_xml")
        if mode != 'xml':
            tbody.add_style('display: none')

        # extra for custom config_xml
        custom_table.add_row()

        td = custom_table.add_cell()
        td.add("Config XML Definition")


        div = DivWdg()
        div.set_id("config_xml_options")
        #div.add_style("display: none")
        div.add_style("margin-top: 10px")


        default = '''
<element name=''>
  <display class=''>
    <option></option>
  </display>
</element>
        '''
        config_xml_wdg = TextAreaWdg("config_xml")
        config_xml_wdg.set_option("rows", "8")
        config_xml_wdg.set_option("cols", "50")
        config_xml_wdg.set_value(default)
        div.add( config_xml_wdg )

        custom_table.add_cell(div)

        # create columns
        custom_table.add_row()
        td = custom_table.add_cell()
        create_columns_wdg = CheckboxWdg("create_columns")
        create_columns_wdg.set_checked()
        td.add("Create required columns? ")

        td = custom_table.add_cell()
        td.add(create_columns_wdg)


        custom_table.close_tbody()
Example #4
0
    def handle_xml_mode(self, custom_table, mode):

        tbody = custom_table.add_tbody()
        tbody.add_class("spt_custom_xml")
        if mode != 'xml':
            tbody.add_style('display: none')

        # extra for custom config_xml
        custom_table.add_row()

        td = custom_table.add_cell()
        td.add("Config XML Definition")

        div = DivWdg()
        div.set_id("config_xml_options")
        #div.add_style("display: none")
        div.add_style("margin-top: 10px")

        default = '''
<element name=''>
  <display class=''>
    <option></option>
  </display>
</element>
        '''
        config_xml_wdg = TextAreaWdg("config_xml")
        config_xml_wdg.set_option("rows", "8")
        config_xml_wdg.set_option("cols", "50")
        config_xml_wdg.set_value(default)
        div.add(config_xml_wdg)

        custom_table.add_cell(div)

        # create columns
        custom_table.add_row()
        td = custom_table.add_cell()
        create_columns_wdg = CheckboxWdg("create_columns")
        create_columns_wdg.set_checked()
        td.add("Create required columns? ")

        td = custom_table.add_cell()
        td.add(create_columns_wdg)

        custom_table.close_tbody()
Example #5
0
    def get_display(my):
        sobject = my.get_current_sobject()

        # handle the start and end
        frame_start = sobject.get_value("tc_frame_start")
        frame_end = sobject.get_value("tc_frame_end")

        frame_start_text = TextWdg("tc_frame_start")
        frame_start_text.set_value(frame_start)
        frame_start_text.set_option("size", "2")

        frame_end_text = TextWdg("tc_frame_end")
        frame_end_text.set_value(frame_end)
        frame_end_text.set_option("size", "2")

        # handle the notes
        frame_notes = sobject.get_value("frame_note")
        frame_notes_text = TextAreaWdg("frame_note")
        frame_notes_text.set_value(frame_notes)
        frame_notes_text.set_option("rows", "2")


        # handle the in and out handles
        frame_in = sobject.get_value("frame_in")
        frame_out = sobject.get_value("frame_out")

        frame_in_text = TextWdg("frame_in")
        frame_in_text.set_value(frame_in)
        frame_in_text.set_option("size", "2")

        frame_out_text = TextWdg("frame_out")
        frame_out_text.set_value(frame_out)
        frame_out_text.set_option("size", "2")


        div = DivWdg()


        table = Table()
        div.add(table)
        table.add_row()
        td = table.add_cell("Range:")
        td.add_style("width: 100px")
        td = table.add_cell()
        td.add_style("text-align: right")
        td.add_style("padding: 5px")
        td.add("start: ")
        td.add(frame_start_text)
        td = table.add_cell()
        td.add_style("text-align: right")
        td.add_style("padding: 5px")
        td.add("end: ")
        td.add(frame_end_text)

        table.add_row()
        table.add_cell("Handles:")
        td = table.add_cell()
        td.add_style("text-align: right")
        td.add_style("padding: 5px")
        td.add("in: ")
        td.add(frame_in_text)
        td = table.add_cell()
        td.add_style("text-align: right")
        td.add_style("padding: 5px")
        td.add("out: ")
        td.add(frame_out_text)
        td.add("<br/>")

        table.add_row()
        table.add_cell("Notes:")
        td = table.add_cell(frame_notes_text)
        td.add_style("padding: 5px")
        td.add_attr("colspan", "2")

        return div
Example #6
0
    def get_display(self):
        sobject = self.get_current_sobject()

        # handle the start and end
        frame_start = sobject.get_value("tc_frame_start")
        frame_end = sobject.get_value("tc_frame_end")

        frame_start_text = TextWdg("tc_frame_start")
        frame_start_text.set_value(frame_start)
        frame_start_text.set_option("size", "2")

        frame_end_text = TextWdg("tc_frame_end")
        frame_end_text.set_value(frame_end)
        frame_end_text.set_option("size", "2")

        # handle the notes
        frame_notes = sobject.get_value("frame_note")
        frame_notes_text = TextAreaWdg("frame_note")
        frame_notes_text.set_value(frame_notes)
        frame_notes_text.set_option("rows", "2")

        # handle the in and out handles
        frame_in = sobject.get_value("frame_in")
        frame_out = sobject.get_value("frame_out")

        frame_in_text = TextWdg("frame_in")
        frame_in_text.set_value(frame_in)
        frame_in_text.set_option("size", "2")

        frame_out_text = TextWdg("frame_out")
        frame_out_text.set_value(frame_out)
        frame_out_text.set_option("size", "2")

        div = DivWdg()

        table = Table()
        div.add(table)
        table.add_row()
        td = table.add_cell("Range:")
        td.add_style("width: 100px")
        td = table.add_cell()
        td.add_style("text-align: right")
        td.add_style("padding: 5px")
        td.add("start: ")
        td.add(frame_start_text)
        td = table.add_cell()
        td.add_style("text-align: right")
        td.add_style("padding: 5px")
        td.add("end: ")
        td.add(frame_end_text)

        table.add_row()
        table.add_cell("Handles:")
        td = table.add_cell()
        td.add_style("text-align: right")
        td.add_style("padding: 5px")
        td.add("in: ")
        td.add(frame_in_text)
        td = table.add_cell()
        td.add_style("text-align: right")
        td.add_style("padding: 5px")
        td.add("out: ")
        td.add(frame_out_text)
        td.add("<br/>")

        table.add_row()
        table.add_cell("Notes:")
        td = table.add_cell(frame_notes_text)
        td.add_style("padding: 5px")
        td.add_attr("colspan", "2")

        return div
Example #7
0
    def get_display(self):
        top = DivWdg()

        search_type = self.kwargs.get("search_type")
        view = self.kwargs.get("view")
        element_name = self.kwargs.get("element_name")

        config_view = WidgetConfigView.get_by_search_type(search_type, view)

        #inner_div = RoundedCornerDivWdg(hex_color_code="949494",corner_size="10")
        inner_div = RoundedCornerDivWdg(hex_color_code="272727",
                                        corner_size="10")
        inner_div.set_dimensions(width_str='400px', content_height_str='600px')
        top.add(inner_div)

        # add the save button
        buttons_list = []
        buttons_list.append({
            'label': 'Save as View',
            'tip': 'Save as View',
            'bvr': {
                'cbjs_action': "alert('Not Implemented')"
            }
        })
        buttons_list.append({
            'label': 'Save as Def',
            'tip': 'Save as Definition',
            'bvr': {
                'cbjs_action': "alert('Not Implemented')"
            }
        })

        buttons = TextBtnSetWdg(float="right",
                                buttons=buttons_list,
                                spacing=6,
                                size='small',
                                side_padding=4)

        inner_div.add(buttons)

        title_div = DivWdg()
        title_div.add_style("margin-bottom: 10px")
        title_div.add_class("maq_search_bar")
        title_div.add("Element Definition")
        inner_div.add(title_div)

        test = SimpleElementDefinitionWdg(config_view=config_view,
                                          element_name=element_name)
        inner_div.add(test)

        config_title_wdg = DivWdg()
        inner_div.add(config_title_wdg)
        config_title_wdg.add("<b>Definitions in config</b>")
        config_title_wdg.add_style("margin: 15px 0px 5px 0px")

        for config in config_view.get_configs():
            view = config.get_view()
            xml = config.get_element_xml(element_name)

            config_div = DivWdg()
            inner_div.add(config_div)

            # add the title
            from pyasm.widget import SwapDisplayWdg, IconWdg

            view_div = DivWdg()
            view_div.add_class("spt_view")
            config_div.add(view_div)

            if not xml:
                icon_wdg = IconWdg("Nothing defined", IconWdg.DOT_RED)
                icon_wdg.add_style("float: right")
                view_div.add(icon_wdg)
            else:
                icon_wdg = IconWdg("Is defined", IconWdg.DOT_GREEN)
                icon_wdg.add_style("float: right")
                view_div.add(icon_wdg)

            swap = SwapDisplayWdg()
            view_div.add(swap)
            swap.add_action_script('''
                var info_wdg = bvr.src_el.getParent('.spt_view').getElement('.spt_info');
                spt.toggle_show_hide(info_wdg);
            ''')

            mode = "predefined"
            file_path = config.get_file_path()
            if not file_path:
                mode = "database"
            elif file_path == 'generated':
                mode = 'generated'

            # display the title
            view_div.add("%s" % view)
            view_div.add(" - [%s]" % mode)

            info_div = DivWdg()
            info_div.add_class("spt_info")
            info_div.add_style("margin-left: 20px")
            info_div.add_style("display: none")
            #if not xml:
            #    info_div.add_style("display: none")
            #else:
            #    swap.set_off()
            view_div.add(info_div)

            path_div = DivWdg()
            if not file_path:
                file_path = mode
            path_div.add("Defined in: %s" % file_path)
            info_div.add(path_div)

            text_wdg = TextAreaWdg()
            text_wdg.set_option("rows", 15)
            text_wdg.set_option("cols", 80)
            text_wdg.set_value(xml)
            info_div.add(text_wdg)

            #view_div.add("<hr/>")

        return top
Example #8
0
    def get_display(my):
        sobject = my.get_current_sobject()

        # handle the start and end
        frame_start = sobject.get_value("tc_frame_start")
        frame_end = sobject.get_value("tc_frame_end")

        frame_start_text = TextWdg("tc_frame_start")
        frame_start_text.set_value(frame_start)
        frame_start_text.set_option("size", "2")

        frame_end_text = TextWdg("tc_frame_end")
        frame_end_text.set_value(frame_end)
        frame_end_text.set_option("size", "2")

        # handle the notes
        frame_notes = sobject.get_value("frame_note")
        frame_notes_text = TextAreaWdg("frame_note")
        frame_notes_text.set_value(frame_notes)
        frame_notes_text.set_option("rows", "1")


        # handle the in and out handles
        frame_in = sobject.get_value("frame_in")
        frame_out = sobject.get_value("frame_out")

        frame_in_text = TextWdg("frame_in")
        frame_in_text.set_value(frame_in)
        frame_in_text.set_option("size", "2")

        frame_out_text = TextWdg("frame_out")
        frame_out_text.set_value(frame_out)
        frame_out_text.set_option("size", "2")


        div = DivWdg()


        table = Table()
        div.add(table)
        table.add_row()
        td = table.add_cell("Range:")
        td.add_style("width: 100px")
        td = table.add_cell()
        td.add("start: ")
        td.add(frame_start_text)
        td.add(" - end: ")
        td.add(frame_end_text)

        table.add_row()
        table.add_cell("Handles:")
        td = table.add_cell()
        td.add("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;in: ")
        td.add(frame_in_text)
        td.add(" - out: ")
        td.add(frame_out_text)
        td.add("<br/>")

        table.add_row()
        table.add_cell("Notes:")
        td = table.add_cell(frame_notes_text)

        """
        div.add("Range - start: ")
        div.add(frame_start_text)
        div.add(" - end: ")
        div.add(frame_end_text)
        div.add("<br/>")
        div.add("Handles - in: ")
        div.add(frame_in_text)
        div.add(" - out: ")
        div.add(frame_out_text)
        div.add("<br/>")
        div.add("Notes:")
        div.add(frame_notes_text)
        """

        return div
Example #9
0
    def get_display(my):
        top = DivWdg()


        search_type = my.kwargs.get("search_type")
        view = my.kwargs.get("view")
        element_name = my.kwargs.get("element_name")

        config_view = WidgetConfigView.get_by_search_type(search_type, view)


        #inner_div = RoundedCornerDivWdg(hex_color_code="949494",corner_size="10")
        inner_div = RoundedCornerDivWdg(hex_color_code="272727",corner_size="10")
        inner_div.set_dimensions( width_str='400px', content_height_str='600px' )
        top.add(inner_div)


        # add the save button
        buttons_list = []
        buttons_list.append( {'label': 'Save as View', 'tip': 'Save as View',
                'bvr': { 'cbjs_action': "alert('Not Implemented')" }
        })
        buttons_list.append( {'label': 'Save as Def', 'tip': 'Save as Definition',
                'bvr': { 'cbjs_action': "alert('Not Implemented')" }
        })

        buttons = TextBtnSetWdg( float="right", buttons=buttons_list,
                                 spacing=6, size='small', side_padding=4 )


        inner_div.add(buttons)


        title_div = DivWdg()
        title_div.add_style("margin-bottom: 10px")
        title_div.add_class("maq_search_bar")
        title_div.add("Element Definition")
        inner_div.add(title_div)



        test = SimpleElementDefinitionWdg(config_view=config_view, element_name=element_name)
        inner_div.add(test)



        config_title_wdg = DivWdg()
        inner_div.add(config_title_wdg)
        config_title_wdg.add("<b>Definitions in config</b>")
        config_title_wdg.add_style("margin: 15px 0px 5px 0px")

        for config in config_view.get_configs():
            view = config.get_view()
            xml = config.get_element_xml(element_name)

            config_div = DivWdg()
            inner_div.add(config_div)



            # add the title
            from pyasm.widget import SwapDisplayWdg, IconWdg

            view_div = DivWdg()
            view_div.add_class("spt_view")
            config_div.add(view_div)

            if not xml:
                icon_wdg = IconWdg( "Nothing defined", IconWdg.DOT_RED )
                icon_wdg.add_style("float: right")
                view_div.add(icon_wdg)
            else:
                icon_wdg = IconWdg( "Is defined", IconWdg.DOT_GREEN )
                icon_wdg.add_style("float: right")
                view_div.add(icon_wdg)

            swap = SwapDisplayWdg()
            view_div.add(swap)
            swap.add_action_script('''
                var info_wdg = bvr.src_el.getParent('.spt_view').getElement('.spt_info');
                spt.toggle_show_hide(info_wdg);
            ''')


            mode = "predefined"
            file_path = config.get_file_path()
            if not file_path:
                mode = "database"
            elif file_path == 'generated':
                mode = 'generated'
                

            # display the title
            view_div.add("%s" % view)
            view_div.add(" - [%s]" % mode)

            info_div = DivWdg()
            info_div.add_class("spt_info")
            info_div.add_style("margin-left: 20px")
            info_div.add_style("display: none")
            #if not xml:
            #    info_div.add_style("display: none")
            #else:
            #    swap.set_off()
            view_div.add(info_div)

            path_div = DivWdg()
            if not file_path:
                file_path = mode
            path_div.add("Defined in: %s" % file_path)
            info_div.add(path_div)

            text_wdg = TextAreaWdg()
            text_wdg.set_option("rows", 15)
            text_wdg.set_option("cols", 80)
            text_wdg.set_value(xml)
            info_div.add(text_wdg)

            #view_div.add("<hr/>")

        return top
Example #10
0
    def get_display(my):
        sobject = my.get_current_sobject()

        # handle the start and end
        frame_start = sobject.get_value("tc_frame_start")
        frame_end = sobject.get_value("tc_frame_end")

        frame_start_text = TextWdg("tc_frame_start")
        frame_start_text.set_value(frame_start)
        frame_start_text.set_option("size", "2")

        frame_end_text = TextWdg("tc_frame_end")
        frame_end_text.set_value(frame_end)
        frame_end_text.set_option("size", "2")

        # handle the notes
        frame_notes = sobject.get_value("frame_note")
        frame_notes_text = TextAreaWdg("frame_note")
        frame_notes_text.set_value(frame_notes)
        frame_notes_text.set_option("rows", "1")

        # handle the in and out handles
        frame_in = sobject.get_value("frame_in")
        frame_out = sobject.get_value("frame_out")

        frame_in_text = TextWdg("frame_in")
        frame_in_text.set_value(frame_in)
        frame_in_text.set_option("size", "2")

        frame_out_text = TextWdg("frame_out")
        frame_out_text.set_value(frame_out)
        frame_out_text.set_option("size", "2")

        div = DivWdg()

        table = Table()
        div.add(table)
        table.add_row()
        td = table.add_cell("Range:")
        td.add_style("width: 100px")
        td = table.add_cell()
        td.add("start: ")
        td.add(frame_start_text)
        td.add(" - end: ")
        td.add(frame_end_text)

        table.add_row()
        table.add_cell("Handles:")
        td = table.add_cell()
        td.add("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;in: ")
        td.add(frame_in_text)
        td.add(" - out: ")
        td.add(frame_out_text)
        td.add("<br/>")

        table.add_row()
        table.add_cell("Notes:")
        td = table.add_cell(frame_notes_text)
        """
        div.add("Range - start: ")
        div.add(frame_start_text)
        div.add(" - end: ")
        div.add(frame_end_text)
        div.add("<br/>")
        div.add("Handles - in: ")
        div.add(frame_in_text)
        div.add(" - out: ")
        div.add(frame_out_text)
        div.add("<br/>")
        div.add("Notes:")
        div.add(frame_notes_text)
        """

        return div