本文整理汇总了Python中pyasm.widget.IconButtonWdg.add_class方法的典型用法代码示例。如果您正苦于以下问题:Python IconButtonWdg.add_class方法的具体用法?Python IconButtonWdg.add_class怎么用?Python IconButtonWdg.add_class使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.IconButtonWdg
的用法示例。
在下文中一共展示了IconButtonWdg.add_class方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_open_wdg
# 需要导入模块: from pyasm.widget import IconButtonWdg [as 别名]
# 或者: from pyasm.widget.IconButtonWdg import add_class [as 别名]
def get_open_wdg( sobject, file_type=None):
''' given a snapshot. open the sandbox in explorer '''
span = SpanWdg()
# explore button
dir = sobject.get_client_lib_dir(file_type=file_type)
open_button = IconButtonWdg( "Explore: %s" % dir, IconWdg.LOAD, False)
open_button.add_event("onclick", "Applet.open_explorer('%s')" % dir)
open_button.add_class('small')
span.add(open_button)
#dir = sobject.get_sandbox_dir()
#copy_button = IconButtonWdg( "Copy to sandbox: %s" % dir, IconWdg.DOWNLOAD, False)
#span.add(copy_button)
return span
示例2: get_display
# 需要导入模块: from pyasm.widget import IconButtonWdg [as 别名]
# 或者: from pyasm.widget.IconButtonWdg import add_class [as 别名]
def get_display(self):
sobject = self.get_current_sobject()
search_key = SearchKey.build_by_sobject(sobject)
display = DivWdg()
display.add_style("position: relative")
display.add_class("spt_button_top")
display.add_style("width: 26px")
display.add_style("margin-left: auto")
display.add_style("margin-right: auto")
BASE = '/context/themes2/default/'
over_div = DivWdg()
display.add(over_div)
over_div.add_class("spt_button_over")
over_img = "<img src='%s/MainButton_over.png'/>" % BASE
over_div.add(over_img)
over_div.add_style("position: absolute")
over_div.add_style("top: -9px")
over_div.add_style("left: 0px")
over_div.add_style("display: none")
click_div = DivWdg()
display.add(click_div)
click_div.add_class("spt_button_click")
click_img = "<img src='%s/MainButton_click.png'/>" % BASE
click_div.add(click_img)
click_div.add_style("position: absolute")
click_div.add_style("top: -9px")
click_div.add_style("left: 0px")
click_div.add_style("display: none")
if self.get_option('align') =='left':
display.add_style("text-align: left")
else:
display.add_style("text-align: center")
icon = self.get_option("icon")
if not icon:
icon = "create"
icon_tip = self.get_option("icon_tip")
if not icon_tip:
icon_tip = self.get_option("hint")
if not icon_tip:
icon_tip = ""
enable = self.get_option("enable")
if enable:
result = ExpressionParser().eval(enable, sobject)
if not result:
return " "
if not self.script_obj and not self.script:
icon_wdg = IconButtonWdg("No Script Found", IconWdg.ERROR)
else:
icon_link = icon.upper()
icon_wdg = IconButtonWdg(icon_tip, icon=icon_link)
if not sobject.is_insert():
icon_wdg.add_class("hand")
#icon_wdg.add_behavior(self.behavior)
icon_wdg.add_class("spt_button_%s" % self.name)
icon_div = DivWdg()
icon_div.add(icon_wdg)
icon_div.add_style("position: absolute")
icon_div.add_style("top: 2px")
icon_div.add_style("left: 5px")
display.add(icon_div)
hit_wdg = icon_div
hit_wdg.add_class("spt_button_hit")
if sobject.is_insert():
hit_wdg.add_style("opacity: 0.4")
else:
hit_wdg.add_class("spt_button_hit_wdg")
display.add_style("height: 18px")
display.add_style("min-width: 21px")
#display.add_style("overflow: hidden")
display.add_style("margin-top: 0px")
expression = self.kwargs.get('expression')
if expression:
value = Search.eval(expression, sobject, single=True)
if value:
#.........这里部分代码省略.........
示例3: get_display
# 需要导入模块: from pyasm.widget import IconButtonWdg [as 别名]
# 或者: from pyasm.widget.IconButtonWdg import add_class [as 别名]
def get_display(my):
sobject = my.get_current_sobject()
search_key = SearchKey.build_by_sobject(sobject)
display = DivWdg()
display.add_style("position: relative")
display.add_class("spt_button_top")
BASE = "/context/themes2/default/"
over_div = DivWdg()
display.add(over_div)
over_div.add_class("spt_button_over")
over_img = "<img src='%s/MainButton_over.png'/>" % BASE
over_div.add(over_img)
over_div.add_style("position: absolute")
over_div.add_style("top: -9px")
over_div.add_style("left: 0px")
over_div.add_style("display: none")
click_div = DivWdg()
display.add(click_div)
click_div.add_class("spt_button_click")
click_img = "<img src='%s/MainButton_click.png'/>" % BASE
click_div.add(click_img)
click_div.add_style("position: absolute")
click_div.add_style("top: -9px")
click_div.add_style("left: 0px")
click_div.add_style("display: none")
if my.get_option("align") == "left":
display.add_style("text-align: left")
else:
display.add_style("text-align: center")
icon = my.get_option("icon")
if not icon:
icon = "create"
icon_tip = my.get_option("icon_tip")
if not icon_tip:
icon_tip = my.get_option("hint")
if not icon_tip:
icon_tip = ""
enable = my.get_option("enable")
if enable:
result = ExpressionParser().eval(enable, sobject)
if not result:
return " "
if not my.script_obj and not my.script:
icon_wdg = IconButtonWdg("No Script Found", IconWdg.ERROR)
else:
try:
icon_link = eval("IconWdg.%s" % icon.upper())
except Exception, e:
print "WARNING: ", str(e)
icon_link = IconWdg.ERROR
icon_wdg = IconButtonWdg(icon_tip, icon_link)
if not sobject.is_insert():
icon_wdg.add_class("hand")
# icon_wdg.add_behavior(my.behavior)
icon_wdg.add_class("spt_button_%s" % my.name)