本文整理汇总了Python中pyasm.web.SpanWdg.get_color方法的典型用法代码示例。如果您正苦于以下问题:Python SpanWdg.get_color方法的具体用法?Python SpanWdg.get_color怎么用?Python SpanWdg.get_color使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.SpanWdg
的用法示例。
在下文中一共展示了SpanWdg.get_color方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DivWdg
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import get_color [as 别名]
# 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: get_display
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import get_color [as 别名]
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" )
#.........这里部分代码省略.........