当前位置: 首页>>代码示例>>Python>>正文


Python DivWdg.center方法代码示例

本文整理汇总了Python中pyasm.web.DivWdg.center方法的典型用法代码示例。如果您正苦于以下问题:Python DivWdg.center方法的具体用法?Python DivWdg.center怎么用?Python DivWdg.center使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyasm.web.DivWdg的用法示例。


在下文中一共展示了DivWdg.center方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_action_html

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import center [as 别名]
    def get_action_html(my):
        search_key = SearchKey.get_by_sobject(my.sobjects[0])
        behavior_submit = {
            'type': 'click_up',
            'cb_fire_named_event': 'append_pressed',
            'element_names': my.element_names,
            'search_key': search_key,
            'input_prefix': my.input_prefix

        }
        behavior_cancel = {
            'type': 'click_up',
            'cb_fire_named_event': 'preclose_edit_popup',
            'cbjs_postaction': "spt.popup.destroy( spt.popup.get_popup( $('edit_popup') ) );"
        }
        button_list = [{'label':  "%s/Close" % my.mode.capitalize(),
            'bvr': behavior_submit},
            {'label':  "Cancel", 'bvr': behavior_cancel}]        
        edit_close = TextBtnSetWdg( buttons=button_list, spacing =6, size='large', \
                align='center',side_padding=10)
        
       
        div = DivWdg()
        div.add_styles('height: 35px; margin-top: 10px;')
       
        div.center()
        div.add(edit_close)

        return div
开发者ID:funic,项目名称:TACTIC,代码行数:31,代码来源:edit_wdg.py

示例2: init

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import center [as 别名]
    def init(my):
        div_main = DivWdg(css='module')
        if my.width != None:
            widthstr="width: %sem" % (my.width)
            div_main.add_style(widthstr)
            
        # reset my.name,  create the content widget
        if not my.shad_name:
            my.shad_name = "ShadowBox%s" % (my.generate_unique_id())
        div_main.set_id(my.shad_name)

        
        div_main.center()
              
        div_head = DivWdg(css='boxhead')

        # HACK to compensate for IE weird handling of CSS
        if WebContainer.get_web().is_IE() and 'password' in my.shad_name:
            div_head.add_style('left','-242px')

        div_head.add_style('padding-bottom: 2px')
        empty_header = Widget(name=my.HEADER)
        
        div_head.add(empty_header, empty_header.get_name())
        div_head.add(my.title_wdg, my.title_wdg.get_name())
        
        div_control = DivWdg(css='control')
        empty_control = Widget(name=my.CONTROL)
        
        div_control.add(empty_header, empty_control.get_name())
        
        div_container = DivWdg(css='container')
 
        ie_rect = HtmlElement('v:roundrect') 
        ie_rect.set_attr("arcsize", "1966f")
        ie_rect.set_attr("fillcolor", "white")
        ie_rect.set_attr("strokecolor", "#555")
        ie_rect.set_attr("strokeweight", "2pt")
        
        div_body = DivWdg(css='content')
        div_body.set_id("%s_cont" % my.shad_name)  
        div_body.center()
        div_body.add(div_head)
        div_body.add(div_control)
        
        my.content = div_main
        my.head = div_head
        my.control = div_control
        my.body = div_body
        
        div_container.add(ie_rect)
        ie_rect.add(div_body)

        #div_main.add(div_head)
        div_main.add(div_container)
开发者ID:0-T-0,项目名称:TACTIC,代码行数:57,代码来源:shadowbox_wdg.py

示例3: get_display

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import center [as 别名]
    def get_display(self):
        top = self.top
        top.add_color("background", "background")
        top.add_color("color", "color")
        top.add_class("spt_schedule_top")


        table = Table()
        #table = ResizableTableWdg()
        top.add(table)
        table.add_color("color", "color")

        table.add_row()
        left = table.add_cell()
        user_wdg = self.get_group_wdg()
        left.add(user_wdg)
        left.add_style("vertical-align: top")
        left.add_border()
        left.add_style("width: 250px")

        right = table.add_cell()
        right.add_class("spt_schedule_content")
        #right.add_border()
        right.add_style("overflow-x: hidden")
        right.add("&nbsp")
        right.add_style("min-width: 500px")
        right.add_style("width: 100%")
        right.add_style("height: 500px")



        div = DivWdg()
        right.add(div)

        div.add_style("height: 100px")
        div.add_style("width: 400px")
        div.add_color("background", "background3")
        div.add_color("color", "color3")
        #div.add_border()
        div.center()
        div.add_style("margin-top: 50px")
        div.add_style("padding-top: 75px")

        div.add_style("text-align: center")
        div.add("<b>Select a user on the left</b>")


        return top
开发者ID:mincau,项目名称:TACTIC,代码行数:50,代码来源:schedule_wdg.py

示例4: get_section_wdg

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import center [as 别名]
    def get_section_wdg(self, title, description, image, behavior):

        section_wdg = DivWdg()
        section_wdg.set_round_corners()
        section_wdg.add_border()
        section_wdg.add_style("width: 120px")
        section_wdg.add_style("height: 100px")
        section_wdg.add_style("overflow: hidden")
        section_wdg.add_style("margin: 5px")
        section_wdg.set_box_shadow("0px 0px 10px")

        title_wdg = DivWdg()
        section_wdg.add(title_wdg)
        title_wdg.add(title)
        title_wdg.add_style("height: 20px")
        title_wdg.add_style("padding: 3px")
        title_wdg.add_style("margin-top: 0px")
        title_wdg.add_style("font-weight: bold")
        title_wdg.add_color("background", "background", -10)

        section_wdg.add_color("background", "background")
        #section_wdg.add_gradient("background", "background", 0, -3)
        section_wdg.add_behavior( {
        'type': 'hover',
        'add_color_modifier': -5,
        'cb_set_prefix': 'spt.mouse.table_layout_hover',
        } )

        """
        desc_div = DivWdg()
        desc_div.add(description)
        desc_div.add_style("padding: 5px 10px 10px 5px")
        """

        div = DivWdg()
        section_wdg.add(div)
        div.add_style("margin-top: 20px")
        div.center()
        div.add_style("width: 32px")
        div.add(image)

        section_wdg.add_behavior( behavior )
        section_wdg.add_class("hand")
        section_wdg.add_attr('title', description)

        return section_wdg
开发者ID:mincau,项目名称:TACTIC,代码行数:48,代码来源:quick_box_wdg.py

示例5: get_page_widget

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import center [as 别名]
    def get_page_widget(self):

        div = DivWdg()

        div.add_style("font-size: 1.5em")
        div.add_style("text-align: left")
        div.add_style("border-width: 1px")
        div.add_style("border-style: solid")
        div.add_style("padding: 10px")
        div.add_style("width: 80%")
        div.center()
    
        div.add( HtmlElement.p("We have detected that you are running Windows Internet Explorer") )
        div.add(HtmlElement.p("At present, we have chosen not to support Windows Internet Explorer") )

        div.add(HtmlElement.p("TACTIC is a complex web application and we comply to W3C standards.  Many browsers suport these standards.  However, Internet Explorer does not.  So in order to provide you with the best user experience, we strongly recommend you use one of the following browsers: Firefox or any Mozilla base browser, Safari, etc."))

        return div
开发者ID:mincau,项目名称:TACTIC,代码行数:20,代码来源:browser.py

示例6: get_display

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import center [as 别名]
    def get_display(my):

        search_key = my.kwargs.get("search_key")
        snapshot = my.kwargs.get("snapshot")

        if snapshot:
            my.snapshot = snapshot
        else:
            my.snapshot = SearchKey.get_by_search_key(search_key)


        assert my.snapshot

        metadata = my.snapshot.get_metadata()

        top = my.top
        top.add_color("background", "background")


        table = Table()
        table.set_max_width()
        top.add(table)
        table.set_unique_id()
        table.add_border()

        table.add_smart_styles("spt_cell", {
            'padding': '3px'
        } )



        tr = table.add_row()
        tr.add_gradient("background", "background3")
        th = table.add_header("Property")
        th.add_style("min-width: 200px")
        th.add_style("padding: 5px")
        th = table.add_header("Value")
        th.add_style("min-width: 400px")
        th.add_style("padding: 5px")

        keys = metadata.get("__keys__")
        if not keys:
            keys = metadata.keys()

        empty = False
        if not keys:
            empty = True
            keys = ['','','','','','','']
            table.add_smart_styles("spt_cell", {
                'height': '20px'
            } )


        for i, key in enumerate(keys):
            value = metadata.get(key)

            title = Common.get_display_title(key)

            tr = table.add_row()

            if i % 2:
                tr.add_color("background", "background")
                tr.add_color("color", "color")
            else:
                tr.add_color("background", "background", -8)
                tr.add_color("color", "color")

            td = table.add_cell()
            td.add_class("spt_cell")
            td.add(title)

            td = table.add_cell()
            td.add_class("spt_cell")
            td.add(value)


        if empty:
            div = DivWdg()
            top.add(div)
            div.add_style("height: 30px")
            div.add_style("width: 150px")
            div.add_style("margin-top: -110px")
            div.center()
            div.add("<b>No Metadata</b>")
            div.add_border()
            div.add_color("background", "background3")
            div.add_color("color", "color3")
            div.add_style("padding: 20px")
            div.add_style("text-align: center")

            top.add_style("min-height: 200px")

        return top
开发者ID:asmboom,项目名称:TACTIC,代码行数:95,代码来源:snapshot_files_wdg.py

示例7: get_display

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import center [as 别名]
    def get_display(my):

        my.search_type = my.kwargs.get("search_type")
        if not my.search_type:
            my.search_type = 'sthpw/task'

        my.column = my.kwargs.get("column")
        if not my.column:
            my.column = 'status'


        my.project_code = my.kwargs.get("project_code")
        if not my.project_code:
            my.project_code = Project.get_project_code()

        my.bar_width = my.kwargs.get("bar_width")
        if not my.bar_width:
            my.bar_width = 200


        values = my.kwargs.get("values")
        if values:
            values = values.split("|")

        else:
            pipeline_code = my.kwargs.get("pipeline_code")
            if pipeline_code:
                pipeline = Pipeline.get_by_code(pipeline_code)
                values = pipeline.get_process_names()
            else:    
                search = Search(my.search_type)
                search.add_filter("project_code", my.project_code)
                search.add_column(my.column, distinct=True)
                xx = search.get_sobjects()
                values = [x.get_value(my.column) for x in xx]


        search = Search(my.search_type)
        search.add_filter("project_code", my.project_code)
        search.add_filters(my.column, values)
        total = search.get_count()




        colors = ['#900', '#090', '#009', '#990', '#099', '#909', '#900', '#090', '#009', '#990']
        while len(values) > len(colors):
            colors.extend(colors)

        top = DivWdg()
        top.add_color("background", "background")

        date = "@FORMAT(@STRING($TODAY),'Dec 31, 1999')"
        date = Search.eval(date, single=True)
        title = "Tasks Status Chart"

        title_wdg = DivWdg()
        top.add(title_wdg)
        title_wdg.add(title)
        title_wdg.add(" [%s]" % date)
        title_wdg.add_style("font-size: 14")
        title_wdg.add_color("background", "background3")
        title_wdg.add_color("color", "color3")
        title_wdg.add_style("padding: 10px")
        title_wdg.add_style("font-weight: bold")
        title_wdg.add_style("text-align: center")


        inner = DivWdg()
        top.add(inner)
        inner.center()
        inner.add_style("width: 500px")
        inner.add_style("padding: 30px")


        for i,status in enumerate(values):

            if not status:
                continue

            count = my.get_count(status)
            div = my.get_div(status, count, total, colors[i])
            inner.add( div.get_buffer_display() )
            inner.add( "<br clear='all'/>")

        inner.add("<hr/>")

        div = my.get_div("Total", total, total, "gray")
        inner.add( div.get_buffer_display() )
        inner.add("<br clear='all'/>")


        return top
开发者ID:0-T-0,项目名称:TACTIC,代码行数:95,代码来源:task_status_report_wdg.py

示例8: get_display

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import center [as 别名]
    def get_display(my):

        top = my.top
        #top.add_color("background", "background" )
        top.add_gradient("background", "background", 0, -10 )

        search_type = my.kwargs.get("search_type")
        assert(search_type)

        search_type_obj = SearchType.get(search_type)


        title = my.kwargs.get("title")
        if not title:
            title = search_type_obj.get_title()

        if title:
            date = "@FORMAT(@STRING($TODAY),'Dec 31, 1999')"
            date = Search.eval(date, single=True)

            title_wdg = DivWdg()
            top.add(title_wdg)
            title_wdg.add(title)
            title_wdg.add(" [%s]" % date)
            title_wdg.add_style("font-size: 14")
            title_wdg.add_color("background", "background3")
            title_wdg.add_color("color", "color3")
            title_wdg.add_style("padding: 10px")
            title_wdg.add_style("font-weight: bold")
            title_wdg.add_style("text-align: center")


        search = Search("sthpw/task")
        full_search_type = Project.get_full_search_type(search_type)
        search.add_filter("search_type", full_search_type)
        tasks = search.get_sobjects()

        # organize by search_key
        tasks_dict = {}
        for task in tasks:
            parent_search_type = task.get_value("search_type")
            parent_search_id = task.get_value("search_id")
            key = "%s|%s" % (parent_search_type, parent_search_id)

            task_list = tasks_dict.get(key)
            if task_list == None:
                task_list = []
                tasks_dict[key] = task_list

            task_list.append(task)



        # go through each sobject and find out where it is "at"
        search = Search(search_type)
        sobjects = search.get_sobjects()
        sobject_statuses = {}
        for sobject in sobjects:
            # get all the tasks for this sobject

            sobject_search_type = sobject.get_search_type()
            sobject_search_id = sobject.get_id()
            key = "%s|%s" % (sobject_search_type, sobject_search_id)

            tasks = tasks_dict.get(key)
            if not tasks:
                tasks = []

            # figure out where in the pipeline this sobject is based
            # on the statuses
            process_statuses = {}
            for task in tasks:
                actual_end_date = task.get_value("actual_end_date")
                if actual_end_date:
                    is_complete = True
                else:
                    is_complete = False

                process = task.get_value("process")
                process_statuses[process] = is_complete


            pipeline_code = sobject.get_value("pipeline_code")
            pipeline = Pipeline.get_by_code(pipeline_code)
            if not pipeline:
                process_names = []
            else:
                process_names = pipeline.get_process_names()
            sobject_status = None
            none_complete = True
            for process_name in process_names:
                is_complete = process_statuses.get(process_name)
                if is_complete == None:
                    continue
                if is_complete == False:
                    sobject_status = process_name
                    break

                none_complete = False

#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:stype_report_wdg.py

示例9: get_display

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import center [as 别名]
    def get_display(self):
        self.preprocess()

        if not self.x_axis:
            chart_labels = [x.get_code() for x in self.sobjects]
        else:
            try:
                chart_labels = [x.get_value(self.x_axis) for x in self.sobjects]
            except:
                # FIXME ... put in some special logic for users since it
                # is used so often in charting
                if self.search_type == 'sthpw/login':
                    chart_labels = [x.get_value("login") for x in self.sobjects]
                else:
                    chart_labels = [x.get_code() for x in self.sobjects]


        top = DivWdg()
        top.add_class("spt_chart")
        self.set_as_panel(top)
        top.add_style("position: relative")

        title = self.kwargs.get("title")
        if title:
            title_wdg = self.get_title_wdg(title)
            top.add(title_wdg)


        if not self.sobjects:
            top.add("No results found")
            return top



        element_data = {}

        chart_labels = []
        element_values = []

        # get the labels and values for each sobject
        for sobject in self.sobjects:

            chart_labels.append( sobject.get_code() )

            values, labels = self.get_data(sobject)
            for value, label in zip(values, labels):

                data = element_data.get(label)
                if data == None:
                    data = []
                    element_data[label] = data
                data.append(value)



        width = self.kwargs.get("width")
        if not width:
            width = '800px'
        height = self.kwargs.get("height")
        if not height:
            height = '500px'


        chart_div = DivWdg()
        chart_div.add_style("width", width)
        chart_div.add_style("height", height)
        chart_div.center()

        if not self.sobjects:
            msg_div = DivWdg()
            msg_div.add_style("position: absolute")
            chart_div.add(msg_div)
            msg_div.add_style("width: 200px")
            msg_div.add_style("height: 15px")
            msg_div.add_style("padding: 50px")
            msg_div.add_style("margin-top: 200px")
            msg_div.add("<b>No results found</b>")
            msg_div.add_border()
            msg_div.add_color("color", "color3")
            msg_div.add_color("background", "background3")
            msg_div.add_style("top: 0px")
            msg_div.add_style("left: 350")
            msg_div.add_style("z-index: 100")
            msg_div.add_style("text-align: center")


        chart = ChartWdg(
            width=width,
            height=height,
            chart_type='bar',
            #legend=self.elements,
            labels=chart_labels,
            label_values=[i+0.5 for i,x in enumerate(chart_labels)]
        )
        chart_div.add(chart)

        top.add(chart_div)
        top.add_color("background", "background")
        top.add_color("color", "color")

#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:sobject_chart_wdg.py

示例10: get_display

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import center [as 别名]
    def get_display(self):


        web = WebContainer.get_web()
        palette = web.get_palette()

        widget = DivWdg()
        widget.add_style("width: 100%")
        widget.add_style("text-align: center")

        from tactic.ui.app import PageHeaderWdg
        header = PageHeaderWdg(show_project=False)
        widget.add( header )

        security = Environment.get_security()


        search = Search("sthpw/project")
        search.add_where("\"code\" not in ('sthpw', 'admin', 'unittest')")
        search.add_where("\"type\" not in ('resource')")
        # hide template projects
        if security.check_access("builtin", "view_site_admin", "allow") or security.check_access("builtin", "view_template_projects", "allow"):
            pass
        else:
            search.add_op("begin")
            search.add_filter("is_template", True, op='!=')
            search.add_filter("is_template", 'NULL', quoted=False, op='is')
            search.add_op("or")

        search.add_order_by("category")

        projects = search.get_sobjects()
        
        num = len(projects)
        # sort by project
        if num < 5:
            columns = 1
            icon_size = 90
            width = 500
        elif num < 15:
            columns = 2
            icon_size = 60
            width = 700
        else:
            columns = 3
            icon_size = 45
            width = 800

        div = DivWdg()

        div.add_style("margin-left: auto")
        div.add_style("margin-right: auto")
        #div.add_style("width: 520px")
        div.center()
        widget.add(div)

        #logo = TacticLogoWdg()
        #div.add(logo)
        div.add("<br/>"*3)

        bg_color = palette.color("background")
        #div.add_color("color", "color")

        from tactic.ui.container import RoundedCornerDivWdg
        div = RoundedCornerDivWdg(hex_color_code=bg_color,corner_size="10")
        div.set_dimensions( width_str='%spx' % width, content_height_str='50px' )
        div.add_border()
        div.add_style("overflow: hidden")
        div.set_box_shadow()

        div.add_style("margin-left: auto")
        div.add_style("margin-right: auto")
        div.add_style("width: %spx" % width)
        table = Table()
        table.set_max_width()
        table.add_style("margin-left: auto")
        table.add_style("margin-right: auto")
        table.add_style("background-color: %s" % bg_color)
        table.add_color("color", "color")

        tr, td = table.add_row_cell()
        logo_div = DivWdg()
        logo_div.add_gradient("background", "background3", -5, -10)
        td.add(logo_div)
        logo = TacticLogoWdg()
        logo_div.add(logo)
        logo_div.add_style("margin: -6 -6 6 -6")


        app_name = WebContainer.get_web().get_app_name()
        security = Environment.get_security() 

        last_category = None
        has_category = False
        index = 0 

        # if TACTIC has not been set up, show the configuration page
        # FIXME: what is the requirement for is_installed?
        config_path = Config.get_config_path()
        if not os.path.exists(config_path):
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:index_wdg.py

示例11: get_display

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import center [as 别名]

#.........这里部分代码省略.........
            keys = ['','','','','','','']
            table.add_smart_styles("spt_cell", {
                'height': '20px'
            } )

        keys.sort()


        for i, key in enumerate(keys):
            value = metadata.get(key)

            value = Common.process_unicode_string(value)


            if not isinstance(key, basestring):
                key = str(key)
            #title = Common.get_display_title(key)
            title = key

            tr = table.add_row()
            tr.add_class("tactic_hover")

            if i % 2:
                tr.add_color("background", "background", -2)
                tr.add_color("color", "color")
            else:
                tr.add_color("background", "background")
                tr.add_color("color", "color")

            td = table.add_cell()
            td.add_class("spt_cell")
            td.add(title)
            td.add_style("width: 300px")
            td.add_style("min-width: 200px")

            td = table.add_cell()
            td.add_class("spt_cell")

            if len(str(value)) > 500:
                inside = DivWdg()
                td.add(inside)
                value = value[:500]
                inside.add(value)
                inside.add_style("max-width: 600px")
            else:
                td.add(value)
            td.add_style("max-width: 600px")

            td.add_style("overflow: hidden")
            td.add_style("text-overflow: ellipsis")
            td.add_style("white-space: nowrap")





            td = table.add_cell()
            td.add_class("spt_cell")

            try:
                is_ascii = True
                for c in str(value):
                    if ord(c) > 128:
                        is_ascii = False
                        break
                if not is_ascii:
                    continue
            except Exception as e:
                print("WARNING: ", e)
                continue



            from pyasm.widget import CheckboxWdg
            checkbox = CheckboxWdg("searchable")
            checkbox.add_attr("spt_is_multiple", "true")
            td.add(checkbox)
            td.add_style("width: 40px")
            td.add_style("max-width: 30px")
            checkbox.set_option("value", "%s|%s|%s" % (parser_title,key,value))



        if empty:
            div = DivWdg()
            top.add(div)
            div.add_style("height: 30px")
            div.add_style("width: 150px")
            div.add_style("margin-top: -110px")
            div.center()
            div.add("<b>No Metadata</b>")
            div.add_border()
            div.add_color("background", "background3")
            div.add_color("color", "color3")
            div.add_style("padding: 20px")
            div.add_style("text-align: center")

            top.add_style("min-height: 200px")

        return top
开发者ID:mincau,项目名称:TACTIC,代码行数:104,代码来源:snapshot_files_wdg.py

示例12: get_example_display

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import center [as 别名]
    def get_example_display(self):

        div = DivWdg()
        div.add_styles("background: grey; padding: 10px; width: 450px;")
        div.add( "<br/><br/>" )

        from tactic.ui.container import RoundedCornerDivWdg
        rc_wdg = RoundedCornerDivWdg(corner_size=10)
        # rc_wdg.set_dimensions(width_str="100%", content_height_str='100%', height_str="100%")
        rs0_wdg = ResizeScrollWdg( width=300, height=200, scroll_bar_size_str='thin', scroll_expansion='inside',
                                   # max_content_w=500, max_content_h=400,
                                   set_max_to_content_size=True,
                                   min_content_w=100, min_content_h=50 )
        rs0_wdg.add( self.get_popwin_oversize_content() )

        rc_wdg.add( rs0_wdg )
        div.add( rc_wdg )

        div.add( "<br/><br/>" )

        div.add( "<p style='color: black;'>Resize/Scroll Widget example ...</p>" )
        rs_wdg = ResizeScrollWdg( width=300, height=200, scroll_bar_size_str='thin', scroll_expansion='inside' )
        rs_wdg.add( self.get_popwin_oversize_content() )
        div.add( rs_wdg )

        div.add( "<br/><br/>" )

        div.add( "<p style='color: black;'>Resize/Scroll Widget example WITH NO RESIZE CAPABILITY" \
                 " (just scroll bars) ...</p>" )
        rs2_wdg = ResizeScrollWdg( width=300, height=200, scroll_bar_size_str='thin', scroll_expansion='inside',
                                  no_resize=True )
        rs2_wdg.add( self.get_popwin_oversize_content() )
        div.add( rs2_wdg )

        div.add( "<br/><br/>" )

        popwin_id = "NewPopupWindowTest"
        popwin_title = "New Popup Window Widget Test"
        popwin = PopWindowWdg(top_id=popwin_id, title=popwin_title, width=150, height=150)
        popwin.add( self.get_popwin_oversize_content() )
        div.add( popwin )
        pwin_launch = DivWdg()

        pwin_launch.add_styles("cursor: pointer; background-color: red; color: black; border: 1px solid black; width: 100px; height: 50px;")
        pwin_launch.add_behavior( {'type': 'click_up', 'cbjs_action': 'spt.popup.open("' + popwin_id + '");'} )
        pwin_launch.add("Click to launch New Popup Window")
        div.add( pwin_launch )



        div.add( "<br/><br/>" )

        test_div = DivWdg()
        test_div.add_styles("background: black; padding: 10px; width: 350px; text-align: center;")

        test_div.add( SpanWdg("This black DIV has<br/>text-align set to center") )

        my_table = Table()
        my_table.add_row()
        my_table.add_cell("This").add_styles("border: 1px solid white; padding: 4px;")
        my_table.add_cell("that").add_styles("border: 1px solid white; padding: 4px;")
        my_table.add_cell("and").add_styles("border: 1px solid white; padding: 4px;")
        my_table.add_cell("The").add_styles("border: 1px solid white; padding: 4px;")
        my_table.add_cell("other").add_styles("border: 1px solid white; padding: 4px;")

        test_div.add( "<br/><br/>" )
        test_div.add( my_table )

        test_div.add( "<br/><br/>" )
        tmp_div = DivWdg()
        tmp_div.add_styles("width: 200px; background-color: green; color: black; padding: 10px;")
        tmp_div.add("I am a DIV without self margins set")
        test_div.add(tmp_div)

        test_div.add( "<br/><br/>" )
        tmp_div = DivWdg()
        tmp_div.add_styles("width: 200px; background-color: green; color: black; padding: 10px;")
        tmp_div.center()
        tmp_div.add("I am a DIV with self margins<br/>set using HtmlElement.center()")
        test_div.add(tmp_div)

        test_div.add( "<br/><br/>" )
        buttons_list = [
            {
                'label': "Insert",
                'tip': "This is an insert",
                'bvr': {'cbjs_action': 'alert("Insert!");'}
            },
            {
                'label': 'Cancel',
                'tip': 'Cancel',
                'bvr': {'cbjs_action': 'alert("Cancel!");'}
            }
        ]
        buttons = TextBtnSetWdg( float="", align="center", buttons=buttons_list, spacing=6,
                                 size='medium', side_padding=4 )
        test_div.add( buttons )

        div.add(test_div)

#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:dev_sandbox_03_wdg.py


注:本文中的pyasm.web.DivWdg.center方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。