コード例 #1
0
ファイル: help_wdg.py プロジェクト: 2gDigitalPost/tactic_src
        # dummy div to get color
        div = DivWdg()

        # convert pre-elements to have < and >
        pre_nodes = xml.get_nodes("//pre")
        for node in pre_nodes:
            html = xml.to_string(node)
            html = html.replace('''<pre class="screen">''','')
            html = html.replace('''</pre>''','')
            if not html:
                continue
                
            styles = []
            styles.append("padding: 10px")
            styles.append("margin: 10px")
            styles.append("border: solid 1px %s" % div.get_color("border"))
            styles.append("background: %s" % div.get_color("background", -3))
            style = ";".join(styles)
            xml.set_attribute(node, "style", style)
            node.text = html


        # style the table nodes
        table_nodes = xml.get_nodes("//table")
        for node in table_nodes:
            styles = []
            #styles.append("border: solid 1px %s" % div.get_color("border"))
            styles.append("background: %s" % div.get_color("background", -1))
            style = ";".join(styles)
            xml.set_attribute(node, "style", style)
            xml.set_attribute(node, "cellpadding", "10")
コード例 #2
0
        # dummy div to get color
        div = DivWdg()

        # convert pre-elements to have &lt; and &gt;
        pre_nodes = xml.get_nodes("//pre")
        for node in pre_nodes:
            html = xml.to_string(node)
            html = html.replace('''<pre class="screen">''', '')
            html = html.replace('''</pre>''', '')
            if not html:
                continue

            styles = []
            styles.append("padding: 10px")
            styles.append("margin: 10px")
            styles.append("border: solid 1px %s" % div.get_color("border"))
            styles.append("background: %s" % div.get_color("background", -3))
            style = ";".join(styles)
            xml.set_attribute(node, "style", style)
            node.text = html

        # style the table nodes
        table_nodes = xml.get_nodes("//table")
        for node in table_nodes:
            styles = []
            #styles.append("border: solid 1px %s" % div.get_color("border"))
            styles.append("background: %s" % div.get_color("background", -1))
            style = ";".join(styles)
            xml.set_attribute(node, "style", style)
            xml.set_attribute(node, "cellpadding", "10")
            xml.set_attribute(node, "cellspacing", "0")
コード例 #3
0
ファイル: base_section_wdg.py プロジェクト: zieglerm/TACTIC
    def get_display(self):
        self.config_search_type = self.kwargs.get("config_search_type")
        if not self.config_search_type:
            self.config_search_type = "SideBarWdg"

        title = self.kwargs.get('title')
        config = self.kwargs.get('config')
        view = self.kwargs.get('view')
        width = self.kwargs.get('width')
        #sortable = self.kwargs.get('sortable')
        if not width:
            width = "175"

        self.prefix = self.kwargs.get("prefix")
        if not self.prefix:
            self.prefix = "side_bar"

        self.mode = self.kwargs.get("mode")
        if not self.mode:
            self.mode = 'view'

        self.default = self.kwargs.get('default') == 'True'

        div = DivWdg()
        div.add_class("spt_section_top")
        div.set_attr("SPT_ACCEPT_DROP", "manageSideBar")

        # create the top widgets
        label = SpanWdg()
        label.add(title)
        label.add_style("font-size: 1.1em")
        section_div = LabeledHidableWdg(label=label)
        div.add(section_div)

        section_div.set_attr('spt_class_name',
                             Common.get_full_class_name(self))
        for name, value in self.kwargs.items():
            if name == "config":
                continue
            section_div.set_attr("spt_%s" % name, value)

        bgcolor = label.get_color("background3")
        project_div = RoundedCornerDivWdg(hex_color_code=bgcolor,
                                          corner_size="10")
        project_div.set_dimensions(width_str='%spx' % width,
                                   content_height_str='100px')
        content_div = project_div.get_content_wdg()

        #project_div = DivWdg()
        #content_div = project_div

        section_div.add(project_div)

        content_div.add_class("spt_side_bar_content")
        content_div.add_attr("spt_view", view)

        if type(view) in types.StringTypes:
            view = [view]

        view_margin_top = '4px'

        web = WebContainer.get_web()
        for viewx in view:
            config = self.get_config(self.config_search_type,
                                     viewx,
                                     default=self.default)
            if not config:
                continue

            # make up a title
            title = DivWdg()
            title.add_gradient("background",
                               "side_bar_title",
                               0,
                               -15,
                               default="background")
            title.add_color("color", "side_bar_title_color", default="color")
            title.add_styles(
                "margin-top: %s; margin-bottom: 3px; vertical-align: middle" %
                view_margin_top)
            if not web.is_IE():
                title.add_styles("margin-left: -5px; margin-right: -5px;")
            title.add_looks("navmenu_header")
            title.add_style("height: 18px")
            title.add_style("padding-top: 2px")
            """
            title = DivWdg()
            title.add_styles( "margin-top: %s; margin-bottom: 3px; vertical-align: middle" % view_margin_top )
            if not web.is_IE():
                title.add_styles( "margin-left: -10px; margin-right: -10px;")
            title.add_looks( "navmenu_header" )
            """

            # FIXME: not sure if this logic should be here. It basically
            # makes special titles for certain view names
            view_attrs = config.get_view_attributes()
            title_str = view_attrs.get("title")
            if not title_str:
                if viewx.startswith("self_view_"):
                    title_str = "My Views"
                else:
                    title_str = viewx

            title_str = Common.get_display_title(title_str)

            title_label = SpanWdg()
            title_label.add_styles("margin-left: 6px; padding-bottom: 2px;")
            title_label.add_looks("fnt_title_5 fnt_bold")
            title_label.add(title_str)
            title.add(title_label)

            content_div.add(title)

            info = {'counter': 10, 'view': viewx}
            self.generate_section(config, content_div, info)
            error_list = Container.get_seq(self.ERR_MSG)
            if error_list:
                span = SpanWdg()
                span.add_style('background', 'red')
                span.add('<br/>'.join(error_list))
                content_div.add(span)
                Container.clear_seq(self.ERR_MSG)
            self.add_dummy(config, content_div)

        return div
コード例 #4
0
ファイル: base_section_wdg.py プロジェクト: 0-T-0/TACTIC
    def get_display(my):
        my.config_search_type = my.kwargs.get("config_search_type")
        if not my.config_search_type:
            my.config_search_type = "SideBarWdg"

        title = my.kwargs.get('title')
        config = my.kwargs.get('config')
        view = my.kwargs.get('view')
        width = my.kwargs.get('width')
        #sortable = my.kwargs.get('sortable')
        if not width:
            width = "175"

        my.prefix = my.kwargs.get("prefix")
        if not my.prefix:
            my.prefix = "side_bar"

        my.mode = my.kwargs.get("mode")
        if not my.mode:
            my.mode = 'view'


        my.default = my.kwargs.get('default') == 'True'

        div = DivWdg()
        div.add_class("spt_section_top")
        div.set_attr("SPT_ACCEPT_DROP", "manageSideBar")


        # create the top widgets
        label = SpanWdg()
        label.add(title)
        label.add_style("font-size: 1.1em")
        section_div = LabeledHidableWdg(label=label)
        div.add(section_div)

        section_div.set_attr('spt_class_name', Common.get_full_class_name(my))
        for name, value in my.kwargs.items():
            if name == "config":
                continue
            section_div.set_attr("spt_%s" % name, value)

        bgcolor = label.get_color("background3")
        project_div = RoundedCornerDivWdg(hex_color_code=bgcolor,corner_size="10")
        project_div.set_dimensions( width_str='%spx' % width, content_height_str='100px' )
        content_div = project_div.get_content_wdg()

        #project_div = DivWdg()
        #content_div = project_div


        section_div.add( project_div )

        content_div.add_class("spt_side_bar_content")
        content_div.add_attr("spt_view", view)

        if type(view) in types.StringTypes:
            view = [view]

        view_margin_top = '4px'

        web = WebContainer.get_web()
        for viewx in view:
            config = my.get_config(my.config_search_type, viewx, default=my.default)
            if not config:
                continue

            # make up a title
            title = DivWdg()
            title.add_gradient( "background", "side_bar_title", 0, -15, default="background" )
            title.add_color( "color", "side_bar_title_color", default="color" )
            title.add_styles( "margin-top: %s; margin-bottom: 3px; vertical-align: middle" % view_margin_top )
            if not web.is_IE():
                title.add_styles( "margin-left: -5px; margin-right: -5px;")
            title.add_looks( "navmenu_header" )
            title.add_style( "height: 18px" )
            title.add_style( "padding-top: 2px" )
            """
            title = DivWdg()
            title.add_styles( "margin-top: %s; margin-bottom: 3px; vertical-align: middle" % view_margin_top )
            if not web.is_IE():
                title.add_styles( "margin-left: -10px; margin-right: -10px;")
            title.add_looks( "navmenu_header" )
            """

            # FIXME: not sure if this logic should be here. It basically
            # makes special titles for certain view names
            view_attrs = config.get_view_attributes()
            title_str = view_attrs.get("title")
            if not title_str:
                if viewx.startswith("my_view_"):
                    title_str = "My Views"
                else:
                    title_str = viewx

            title_str = Common.get_display_title(title_str)

            title_label = SpanWdg()
            title_label.add_styles( "margin-left: 6px; padding-bottom: 2px;" )
            title_label.add_looks( "fnt_title_5 fnt_bold" )
            title_label.add( title_str )
            title.add( title_label )

            content_div.add( title )

            info = { 'counter' : 10, 'view': viewx }
            my.generate_section( config, content_div, info )
            error_list = Container.get_seq(my.ERR_MSG)
            if error_list: 
                span = SpanWdg()
                span.add_style('background', 'red')
                span.add('<br/>'.join(error_list))
                content_div.add(span)
                Container.clear_seq(my.ERR_MSG)
            my.add_dummy(config, content_div) 

        return div