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


Python Table.add_color方法代码示例

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


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

示例1: handle_python_script_test

# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_color [as 别名]
    def handle_python_script_test(self, top):
        top.add(DivWdg('Python Script Test', css='spt_info_title'))
        table = Table(css='script')
        table.add_color("color", "color")
        table.add_style("margin: 10px")
        table.add_style("width: 100%")
        top.add(table)
        table.add_row()
        td = table.add_cell("Script Path: ")
        td.add_style("width: 150px")
        text = TextWdg('script_path')
        td = table.add_cell(text)
        button = ActionButtonWdg(title='Run')
        table.add_cell(button)
        button.add_style("float: right")
        button.add_behavior( {
        'type': 'click_up',
        'cbjs_action': '''
             var s = TacticServerStub.get();
             try {
                var path =  bvr.src_el.getParent('.script').getElement('.spt_input').value;
                if (! path)
                    throw('Please enter a valid script path');
                s.execute_cmd('tactic.command.PythonCmd', {script_path: path});
             } catch(e) {
                spt.alert(spt.exception.handler(e));
             }

        '''
        })
开发者ID:mincau,项目名称:TACTIC,代码行数:32,代码来源:system_info_wdg.py

示例2: get_sobject_info_wdg

# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_color [as 别名]
    def get_sobject_info_wdg(my):
        div = DivWdg()
        return div

        attr_table = Table()
        div.add(attr_table)

        attr_table.add_color("color", "color")

        sobject = my.get_sobject()

        titles, exprs = my.get_sobject_info()
        for title, expr in zip(titles, exprs):
            try:
                value = Search.eval(expr, sobject)
            except Exception, e:
                print "WARNING: ", e.message
                continue


            if value == '':
                value = '<i>none</i>'
            if len(value) > 100:
                value = "%s..." % value[:100]

            attr_table.add_row()
            th = attr_table.add_header("%s: " % title)
            th.add_style("text-align: left")
            td = attr_table.add_cell(value)
开发者ID:davidsouthpaw,项目名称:TACTIC,代码行数:31,代码来源:sobject_wdg.py

示例3: get_header_wdg

# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_color [as 别名]
    def get_header_wdg(my):
        outer = DivWdg()

        div = DivWdg()
        outer.add(div)
        div.add_color("background", "background3")
        div.add_style("padding: 5px")
        div.add_border()

        table = Table()
        table.add_style("margin-left: auto")
        table.add_style("margin-right: auto")
        table.add_color("color", "color")
        table.add_style("font-size: 1.5em")
        table.add_style("font-weight: bold")

        table.add_row()

        # add the month navigators
        date_str = "%s, %s" % (my.MONTHS[my.month - 1], my.year)
        month_wdg = DivWdg()
        month_wdg.add_style("width: 150px")
        month_wdg.add(date_str)

        prev_month_wdg = my.get_prev_month_wdg()
        next_month_wdg = my.get_next_month_wdg()

        table.add_cell(prev_month_wdg)
        td = table.add_cell(month_wdg)
        td.add_style("text-align: center")
        table.add_cell(next_month_wdg)

        div.add(table)

        return outer
开发者ID:pombredanne,项目名称:TACTIC,代码行数:37,代码来源:sobject_calendar_wdg.py

示例4: handle_load_balancing

# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_color [as 别名]
    def handle_load_balancing(self, top):
        # deal with asset directories
        top.add(DivWdg('Load Balancing', css='spt_info_title'))
        table = Table()
        table.add_class("spt_loadbalance")
        table.add_color("color", "color")
        table.add_style("margin: 10px")
        top.add(table)
        table.add_row()
        td = table.add_cell("Load Balancing: ")
        td.add_style("width: 150px")

        button = ActionButtonWdg(title='Test')
        td = table.add_cell(button)
        message_div = DivWdg()
        message_div.add_class("spt_loadbalance_message")
        table.add_cell(message_div)
        button.add_behavior( {
        'type': 'click_up',
        'cbjs_action': '''
        var server = TacticServerStub.get()
        var ports = {};
        var count = 0;
        for (var i = 0; i < 50; i++) {
          var info = server.get_connection_info();
          var port = info.port;
          var num = ports[port];
          if (!num) {
            ports[port] = 1;
            count += 1;
          }
          else {
            ports[port] += 1;
          }
          // if there are 10 requests and still only one, then break
          if (i == 10 && count == 1)
            break;
        }


        // build the ports string
        x = [];
        for (i in ports) {
            x.push(i);
        }
        x.sort();
        x = x.join(", ");

        var loadbalance_el = bvr.src_el.getParent(".spt_loadbalance");
        var message_el = loadbalance_el.getElement(".spt_loadbalance_message");
        if (count > 1) {
            var message = "Yes (found " + count + " ports: "+x+")";
        }
        else {
            var message = "<blink style='background: red; padding: 3px'>Not enabled (found only port " + x + ")</blink>";
        }
        message_el.innerHTML = message
        '''
        } )
开发者ID:mincau,项目名称:TACTIC,代码行数:61,代码来源:system_info_wdg.py

示例5: get_display

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

        top = my.top
        top.add_class("spt_share_top")
        my.set_as_panel(top)

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

        title = DivWdg()
        top.add(title)
        title.add_style("font-size: 18px")
        title.add_style("font-weight: bold")
        title.add_style("text-align: center")
        title.add_style("padding: 10px")
        #title.add_style("margin: -10px -10px 10px -10px")

        title.add_gradient("background", "background3", 5, -10)

        title.add("Share Project")



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

        table.add_row()
        left = table.add_cell()
        left.add_border()
        left.add_style("vertical-align: top")
        left.add_style("min-width: 250px")
        left.add_style("height: 400px")
        left.add_color("background", "background3")

        left.add(my.get_share_wdg() )

        right = table.add_cell()
        right.add_border()
        right.add_style("vertical-align: top")
        right.add_style("min-width: 400px")
        right.add_style("width: 100%")
        right.add_style("height: 400px")
        right.add_style("padding: 5px")

        right.add_class("spt_share_content")


        share_item_wdg = ShareItemWdg()
        right.add(share_item_wdg)


        return top
开发者ID:blezek,项目名称:TACTIC,代码行数:56,代码来源:share_wdg.py

示例6: get_display

# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_color [as 别名]
    def get_display(my):
        notification_logins = my.get_logins()

        table = Table()
        table.add_color("color", "color")

        for notification_login in notification_logins:
            type = notification_login.get_value("type")
            user = notification_login.get_value("login")
            table.add_row()
            table.add_cell(type)
            table.add_cell(user)

        return table
开发者ID:funic,项目名称:TACTIC,代码行数:16,代码来源:table_element_wdg.py

示例7: get_otherdb_wdg

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

        div = DivWdg()
        div.add_class("spt_db_options")
        div.add_attr("spt_vendor", "Other")
        div.add_style("margin: 20px")

        table = Table()
        div.add(table)
        table.add_color("color", "color")


        table.add_row()
        table.add_cell("Server: ")
        text = TextInputWdg(name="server")
        text.set_value("localhost")
        table.add_cell(text)
        server = Config.get_value("database", "server")
        if server:
            text.set_value(server)

        table.add_row()
        table.add_cell("Port: ")
        text = TextInputWdg(name="port")
        table.add_cell(text)
        port = Config.get_value("database", "port")
        if port:
            text.set_value(port)

        table.add_row()
        table.add_cell("Login: ")
        text = TextInputWdg(name="user")
        table.add_cell(text)
        user = Config.get_value("database", "user")
        if user:
            text.set_value(user)

        table.add_row()
        text = PasswordInputWdg(name="password")
        table.add_cell("Password: ")
        table.add_cell(text)
        password = Config.get_value("database", "password")
        if password:
            text.set_value(password)

        #from pyasm.search import Sql
        #sql.connect()

        return div
开发者ID:blezek,项目名称:TACTIC,代码行数:51,代码来源:db_config_wdg.py

示例8: get_display

# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_color [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

示例9: get_info_wdg

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

        div = DivWdg()
        div.set_name("Info")
        div.add_style("padding: 20px")

        
        table = Table()
        div.add(table)
        table.add_color("color", "color")
        #table.add_style("height: 280px")
        table.set_unique_id()

        table.add_smart_style("spt_table_header", "width", "200px")
        table.add_smart_style("spt_table_header", "text-align", "right")
        table.add_smart_style("spt_table_header", "padding-right", "20px")
        table.add_smart_style("spt_table_header", "margin-bottom", "10px")
        table.add_smart_style("spt_table_element", "vertical-align", "top")

        table.add_row()

        #if my.mode == 'insert':
        #    read_only = False
        #else:
        #    read_only = True
        read_only = False

        code = Config.get_value("install", "server") or ""

        td = table.add_cell()
        td.add_class("spt_table_header")
        td.add("Code: ")
        td.add_style("vertical-align: top")
        text = TextInputWdg(name="code", read_only=read_only)
        td = table.add_cell()
        td.add_class("spt_table_element")
        td.add(text)
        text.set_value(code)

        return div
开发者ID:blezek,项目名称:TACTIC,代码行数:42,代码来源:share_wdg.py

示例10: handle_sidebar_clear

# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_color [as 别名]
 def handle_sidebar_clear(self, top):
     top.add(DivWdg('Clear Side Bar Cache ', css='spt_info_title'))
     table = Table()
     table.add_color("color", "color")
     table.add_style("margin: 10px")
     top.add(table)
     table.add_row()
     td = table.add_cell("Clear the Side Bar Cache for all users")
     td.add_style("width: 250px")
     button = ActionButtonWdg(title='Run')
     table.add_cell(button)
     button.add_behavior( {
     'type': 'click_up',
     'cbjs_action': '''
         try {
         var s = TacticServerStub.get();
         s.execute_cmd('tactic.ui.app.ClearSideBarCache');
         
         } catch(e) {
             spt.alert(spt.exception.handler(e));
         }
         spt.info('Side Bar cache cleared.')
     '''
     })
开发者ID:mincau,项目名称:TACTIC,代码行数:26,代码来源:system_info_wdg.py

示例11: get_category_wdg2

# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_color [as 别名]
    def get_category_wdg2(self, paths, title=None, tags={}):

        if not paths:
            paths = []

        div = DivWdg()

        if not title:
            title = "Paths"
        div.add("%s (%s)<hr/>" % (title, len(paths)) )
        #if not paths:
        #    div.add("-- None --<br/>")

        table = Table()
        div.add(table)
        table.add_color("color", "color")

        base_dir = self.kwargs.get("base_dir")

        sobjects = []
        tags_keys = set()
        for path in paths:
            sobject = SearchType.create("sthpw/virtual")

            basename = os.path.basename(path)
            dirname = os.path.dirname(path)

            # FIXME: need session base
            reldir = dirname.replace("%s" % base_dir, "")
            reldir = dirname


            if not reldir:
                reldir = '&nbsp;'
            else:
                reldir.lstrip("/")
            if not basename:
                basename = '&nbsp;'

            sobject.set_value("folder", reldir)
            sobject.set_value("file_name", basename)
            sobjects.append(sobject)

            if tags:
                path_tags = tags.get(path)
                if path_tags:
                    for key, value in path_tags.get("sobject").items():
                        sobject.set_value(key, value)
                        tags_keys.add(key)

        from tactic.ui.panel import TableLayoutWdg
        element_names = ['path']
        element_names.extend( list(tags_keys) )
        #show_metadata = False
        #if not show_metadata:
        #    element_names.remove('metadata')


        config_xml = self.get_config_xml(list(tags_keys))

        layout = TableLayoutWdg(search_type='sthpw/virtual', view='report', config_xml=config_xml, element_names=element_names, mode='simple')
        # FIXME: just show first 200 results
        layout.set_sobjects(sobjects[:200])

        div.add(layout)

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

示例12: get_display

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

        my.sobject = my.get_sobject()

        top = DivWdg()
        top.add_class("spt_detail_top")
        top.add_color("background", "background")
        top.add_color("color", "color")

        if not my.sobject:
            top.add("No SObject defined for this widget")
            return top

        if my.parent:
            my.search_type = my.parent.get_base_search_type()
            my.search_key = SearchKey.get_by_sobject(my.parent)
            top.add_attr("spt_parent_key", my.search_key) 
            my.pipeline_code = my.parent.get_value("pipeline_code", no_exception=True)
            my.full_search_type = my.parent.get_search_type()
        else:
            my.pipeline_code = my.sobject.get_value("pipeline_code", no_exception=True)
            my.search_type = my.sobject.get_base_search_type()
            my.search_key = SearchKey.get_by_sobject(my.sobject)
            my.full_search_type = my.sobject.get_search_type()

        if not my.pipeline_code:
            my.pipeline_code = 'default'


        top.add_style("text-align: left")
        my.set_as_panel(top)

        table = Table()
        #from tactic.ui.container import ResizableTableWdg
        #table = ResizableTableWdg()
        table.add_color("background", "background")
        table.add_color("color", "color")
        top.add(table)
        table.set_max_width()

        table.add_row()

        # left
        #td = table.add_cell(resize=False)
        td = table.add_cell()
        #td.add_style("padding: 10px")
        td.add_style("width: 200px")
        td.add_style("min-width: 200px")
        td.add_style("vertical-align: top")
        #td.add_border()
        #td.add_style("border-style: solid")
        #td.add_style("border-width: 1px 0 1px 1px")
        #td.add_color("border-color", "border")
        #td.add_color("background", "background", -10)


        if my.parent:
            code = my.parent.get_code()
        else:
            code = my.sobject.get_code()

        # add the tile
        title = DivWdg()
        td.add(title)
        title.add_gradient("background", "background3", 0, -10)
        title.add_style("height: 20px")
        title.add_style("padding: 4px")
        title.add_style("font-weight: bold")
        title.add_style("font-size: 1.4em")
        title.add("%s" % code)
        title.add_border()


        div = DivWdg()
        td.add(div)
        div.add_class("spt_sobject_detail_top")

        thumb_table = Table()
        div.add(thumb_table)
        thumb_table.add_row()

        thumb = ThumbWdg()

        # use a larger version for clearer display
        thumb.set_icon_type('web')
        # prefer to see the original image, then web
        thumb.set_option('image_link_order', 'main|web|.swf')
        thumb.set_option("detail", "false")
        thumb.set_option("icon_size", "100%")

        td = thumb_table.add_cell(thumb)
        td.add_style("vertical-align: top")
        td.add_style("width: 200px")
        td.add_style("padding: 20px")

        if my.parent:
            thumb.set_sobject(my.parent)
        else:
            thumb.set_sobject(my.sobject)

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

示例13: get_display

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

        top = my.top
        top.add_class("spt_changelist_content")
        my.set_as_panel(top)
        top.add_color("color", "color")
        top.add_color("background", "background")
        #top.add_border()
        #top.add_style("padding", "10px")
        top.add_style("min-width: 600px")
        top.add_style("min-height: 400px")

        top.add_behavior( {
            'type': 'load',
            'cbjs_action': scm_get_onload_js()
        } )



        sync_dir = Environment.get_sandbox_dir()
        # HARD CODED
        project = Project.get()
        depot = project.get_value("location", no_exception=True)
        if not depot:
            depot = project.get_code()
        location = '//%s' % depot


        changelist = my.kwargs.get("changelist")
        if not changelist:
            changelist = WidgetSettings.get_value_by_key("current_changelist")
        else:
            WidgetSettings.set_value_by_key("current_changelist", changelist)

        if not changelist:
            changelist = 'default'


        changelists = my.kwargs.get("changelists")
        if not changelists:
            changelists = []
        elif isinstance(changelists, basestring):
            changelists = changelists.replace("'", '"')
            changelists = jsonloads(changelists)

        top.add_behavior( {
            'type': 'load',
            'sync_dir': sync_dir,
            'depot': depot,
            'cbjs_action': '''
            spt.scm.sync_dir = bvr.sync_dir;
            spt.scm.depot = bvr.depot;
            '''
        } )



        inner = DivWdg()
        top.add(inner)

        table = Table()
        inner.add(table)
        table.add_style("width: 100%")
        table.add_color("background", "background", -3)

        table.add_row()
        th = table.add_header("")

        th = table.add_header("Changelist")
        th.add_style("text-align: left")
        th = table.add_header("Description")
        th.add_style("text-align: left")
        th = table.add_header("# Items")
        th.add_style("text-align: left")
        th = table.add_header("Status")
        th.add_style("text-align: left")
        th = table.add_header("View")
        th.add_style("text-align: left")
        th = table.add_header("Delete")
        th.add_style("text-align: left")
        #table.set_unique_id()
        #table.add_smart_styles("spt_changelist_item", {
        #    'text-align: right'
        #    } ))

        bgcolor = table.get_color("background", -8)
        table.add_relay_behavior( {
            'type': 'mouseover',
            'bvr_match_class': 'spt_changelist_item',
            'bgcolor': bgcolor,
            'cbjs_action': '''
            bvr.src_el.setStyle("background-color", bvr.bgcolor);
            '''
        } )
        table.add_relay_behavior( {
            'type': 'mouseout',
            'bvr_match_class': 'spt_changelist_item',
            'cbjs_action': '''
            bvr.src_el.setStyle("background-color", '');
            '''
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:changelist_wdg.py

示例14: get_display

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

        smenu_div = DivWdg()
        smenu_div.add_class( "SPT_SMENU" )
        smenu_div.add_class( "SPT_SMENU_%s" % my.menu_tag_suffix )
        smenu_div.set_box_shadow()
        smenu_div.add_border()
        smenu_div.add_color("background", "background")
        smenu_div.add_color("color", "color")

        smenu_div.add_behavior( {
            'type': 'load',
            'cbjs_action': '''
            spt.dom.load_js( ["ctx_menu.js"], function() {
                    spt.dom.load_js( ["smart_menu.js"], function() {
                } )
            } );
            '''
        } )

        if my.setup_cbfn:
            smenu_div.set_attr( "SPT_SMENU_SETUP_CBFN", my.setup_cbfn )

        smenu_div.set_z_start( 300 )
        #smenu_div.add_looks( "smenu border curs_default" )
        # smenu_div.add_styles( "padding-top: 3px; padding-bottom: 5px;" )

        m_width = my.width - 2
        smenu_div.add_style( ("width: %spx" % m_width) )

        smenu_div.add_style("overflow-x: hidden")

        icon_width = 16
        icon_col_width = 0
        if my.allow_icons:
            icon_col_width = icon_width + 2
        label_width = m_width - icon_col_width - icon_width

        menu_table = Table()
        menu_table.add_styles( "text-align: left; text-indent: 3px; border-collapse: collapse;" )
        #menu_table.add_color("background", "background")
        menu_table.add_color("color", "color")

        options = my.opt_spec_list
        opt_count = 0

        if options[0].get('type') != 'title':
            my._add_spacer_row(menu_table, 3, icon_width, icon_col_width, label_width)


        """
        menu_table.add_relay_behavior( {
            'type': 'mouseenter',
            'bvr_match_class': 'SPT_SMENU_ENTRY',
            'bgcolor': menu_table.get_color("side_bar_title", -15, default="background3"),
            'cbjs_action': '''
            bvr.src_el.setStyle("background-color", bvr.bgcolor);
            bvr.src_el.setStyle("color", bvr.bgcolor);
            spt.smenu.entry_over( evt, bvr );
            '''
        } )

        menu_table.add_relay_behavior( {
            'type': 'mouseleave',
            'bvr_match_class': 'SPT_SMENU_ENTRY',
            'cbjs_action': '''
            bvr.src_el.setStyle("background-color", "");
            spt.smenu.entry_out( evt, bvr );
            '''
        } )
        """


        for opt in options:

            # if entry is a title, then add a spacer before
            if opt.get('type') == 'title' and opt_count:
                my._add_spacer_row(menu_table, 6, icon_width, icon_col_width, label_width)

            tbody = menu_table.add_tbody()
            tbody.add_style("display","table-row-group")

            tr = menu_table.add_row()
            #tr.add_looks( "smenu" )

            tr.add_class( "SPT_SMENU_ENTRY" )
            tr.add_class( "SPT_SMENU_ENTRY_%s" % opt['type'].upper() )

            if opt.has_key('enabled_check_setup_key'):
                tr.set_attr( "SPT_ENABLED_CHECK_SETUP_KEY", opt.get('enabled_check_setup_key') )

            if opt.has_key('hide_when_disabled') and opt.get('hide_when_disabled'):
                tr.set_attr( "SPT_HIDE_WHEN_DISABLED", "true" )

            if opt['type'] in [ 'action', 'toggle' ]:

                hover_bvr = {'type':'hover', 'add_looks': 'smenu_hilite',
                             'cbjs_action_over': 'spt.smenu.entry_over( evt, bvr );',
                             'cbjs_action_out': 'spt.smenu.entry_out( evt, bvr );' }
                if opt.has_key('hover_bvr_cb'):
#.........这里部分代码省略.........
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:103,代码来源:smart_menu_wdg.py

示例15: get_display

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

        element_data_dict = {}

        config = my.get_config()
        element_names = config.get_element_names()
        content_wdg = DivWdg()


        if not element_names:
            element_names = ['keywords']

        my.set_content(content_wdg)

        
        # this is somewhat duplicated logic from alter_search, but since this is called 
        # in ViewPanelWdg, it's a diff instance and needs to retrieve again
        filter_data = FilterData.get()
        data_list = filter_data.get_values_by_prefix(my.prefix)
        for data in data_list:
            handler = data.get("handler")
            element_name = data.get("element_name")
            if not element_name:
                continue

            element_data_dict[element_name] = data

        elements_wdg = DivWdg()
        content_wdg.add(elements_wdg)
        elements_wdg.add_color("color", "color")
        elements_wdg.add_style("padding-top: 10px")
        elements_wdg.add_style("padding-bottom: 15px")

        elements_wdg.add_color("background", "background3", 0)
        elements_wdg.add_border()



        if len(element_names) == 1:
            elements_wdg.add_style("border-width: 0px 0px 0px 0px" )
            elements_wdg.add_style("padding-right: 50px" )
        else:
            elements_wdg.add_style("border-width: 0px 1px 0px 0px" )

        table = Table()
        table.add_color("color", "color")
        elements_wdg.add(table)
        table.add_class("spt_simple_search_table")
       
        num_rows = int(len(element_names)/2)+1
        tot_rows = int(len(element_names)/2)+1
        project_code = Project.get_project_code()
        # my.search_type could be the same as my.base_search_type
        full_search_type = SearchType.build_search_type(my.search_type, project_code)

        visible_rows = my.kwargs.get("visible_rows")
        if visible_rows:
            visible_rows = int(visible_rows)
            num_rows = visible_rows
        else:
            visible_rows = 0

        titles = config.get_element_titles() 
        row_count = 0
        for i, element_name in enumerate(element_names):
            attrs = config.get_element_attributes(element_name)
            if i % 2 == 0:

                if visible_rows and row_count == visible_rows:
                    tr, td = table.add_row_cell("+ more ...")
                    td.add_class("hand")
                    td.add_class("SPT_DTS")
                    td.add_class("spt_toggle")
                    td.add_style("padding-left: 10px")

                    td.add_behavior( {
                        'type': 'click_up',
                        'visible_rows': visible_rows,
                        'cbjs_action': '''
                        var top = bvr.src_el.getParent(".spt_simple_search_table");
                        var expand = true;
                        var rows = top.getElements(".spt_simple_search_row");
                        for (var i = 0; i < rows.length; i++) {
                            var row = rows[i];
                            if (row.getStyle("display") == "none") {
                                row.setStyle("display", "");
                            }
                            else {
                                row.setStyle("display", "none");
                                expand = false;
                            }
                        }
                        var spacer = top.getElements(".spt_spacer");
                        var cell = top.getElement(".spt_toggle");
                        if (expand) {
                            spacer.setStyle("height", (rows.length+bvr.visible_rows)*20);
                            cell.innerHTML = "- less ...";
                        }
                        else {
                            spacer.setStyle("height", bvr.visible_rows*20);
#.........这里部分代码省略.........
开发者ID:funic,项目名称:TACTIC,代码行数:103,代码来源:simple_search_wdg.py


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