本文整理汇总了Python中pyasm.web.DivWdg.add_attr方法的典型用法代码示例。如果您正苦于以下问题:Python DivWdg.add_attr方法的具体用法?Python DivWdg.add_attr怎么用?Python DivWdg.add_attr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.DivWdg
的用法示例。
在下文中一共展示了DivWdg.add_attr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_attr [as 别名]
def get_display(my):
sobject = my.get_current_sobject()
first_name = sobject.get_value("first_name")
last_name = sobject.get_value("last_name")
div = DivWdg()
div.add("%s %s" % (first_name, last_name) )
div.add("<a target='_blank' href='/tactic/ziryab/link/reports_homepage'>Graph</a> ")
info_div = DivWdg()
#info_div.add( sobject.get_name() )
#info_div.add( " <i style='font-size: 0.8em; opacity: 0.5'>(%s)</i>" % sobject.get_code() )
#info_div.add("<hr/>")
info_div.add_attr("spt_search_key", '/tactic/ziryab/link/reports_homepage')
info_div.add("<a href='%s' target='_blank'>" % '/tactic/ziryab/link/reports_homepage')
info_div.add("%s %s" % (first_name, last_name))
info_div.add(" <i style='opacity: 0.5; font-size: 0.8em'> - ")
info_div.add("Foo Bar")
info_div.add(" (v%0.3d)" % 7)
info_div.add("</i></a><br/>")
return info_div
示例2: add_dummy
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_attr [as 别名]
def add_dummy(my, config, subsection_div):
div = DivWdg()
div.add_attr("spt_view", config.get_view() )
div.add_class("spt_side_bar_element")
div.add_class("spt_side_bar_dummy")
div.add( my.get_drop_wdg() )
subsection_div.add(div)
示例3: get_menu_item
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_attr [as 别名]
def get_menu_item(my, element_name, display_handler):
content = DivWdg()
content.add_attr("spt_element_name", element_name)
content.add_class("hand")
# add the drag/drop behavior
behavior = {
"type": "drag",
"mouse_btn": "LMB",
"modkeys": "",
"src_el": "@",
"cbfn_setup": "spt.side_bar.pp_setup",
"cbfn_motion": "spt.side_bar.pp_motion",
"cbfn_action": "spt.side_bar.pp_action",
}
content.add_behavior(behavior)
content.set_id("manage_%s" % element_name)
content.add_style("position: relative")
content.add_style("margin: 3px")
content.add_style("left: 0")
content.add_style("top: 0")
content.add_style("z-index: 100")
if display_handler == "SeparatorWdg":
content.add(HtmlElement.hr())
else:
content.add(element_name)
return content
示例4: get_title
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_attr [as 别名]
def get_title(self):
if self.title:
title = self.title
title = title.replace(r'\n','<br/>')
if self.title.find("->") != -1:
parts = self.title.split("->")
title = parts[-1]
else:
title = self.name
if self.name.find("->") != -1:
parts = self.name.split("->")
title = parts[-1]
if not title:
title = ""
else:
title = Common.get_display_title(title)
title = _(title)
from pyasm.web import DivWdg
div = DivWdg()
div.add_attr("title", title)
div.add_style("margin-top", "6px")
div.add(title)
return div
示例5: get_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_attr [as 别名]
def get_display(my):
width = my.kwargs.get("width")
if not width:
width = "100%"
height = my.kwargs.get("height")
sobject = my.get_current_sobject()
div = DivWdg()
div.add_class("spt_thumb_top")
path = my.path
if path:
img = HtmlElement.img(src=path)
else:
search_type = sobject.get_search_type_obj()
path = my.get_path_from_sobject(search_type)
if path:
img = DivWdg()
img.add_style("opacity: 0.2")
img_inner = HtmlElement.img(src=path)
img.add(img_inner)
img_inner.add_style("width: %s" % width)
if path and path.startswith("/context"):
img.add_style("padding: 10px 15%")
img.add_style("width: 70%")
elif path:
img.add_style("width: %s" % width)
if height:
img.add_style("height: %s" % height)
img.add_style('margin-left','auto')
img.add_style('margin-right','auto')
if not path:
img = DivWdg()
img.add_class("spt_image")
div.add(img)
if height or my.show_name_hover in ["True","true",True]:
div.add_style("height: 100%")
if my.show_name_hover in ["True","true",True]:
name_hover = DivWdg()
name_hover.add_class("spt_name_hover")
name_hover.add(sobject.get('name'))
name_hover.add_attr('onmouseenter',"this.setStyle('opacity',1)")
name_hover.add_attr('onmouseleave',"this.setStyle('opacity',0)")
name_hover.add_styles('opacity: 0; font-size: 16px; color: rgb(217, 217, 217); top: 0px; \
transition: opacity 0s ease-out; -webkit-transition: opacity 0s ease-out; \
height: 100%; width: 100%; position: absolute; padding-top: 20px; \
text-align: center; background-color: rgba(0, 0, 0, 0.6);')
div.add(name_hover)
return div
示例6: get_item_div
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_attr [as 别名]
def get_item_div(self, sobject):
''' get the item div the sobject'''
top = DivWdg()
top.add_style("padding: 3px 2px")
top.add_class("spt_drop_item")
top.add_class("SPT_DROP_ITEM")
item_div = DivWdg()
top.add(item_div, "item_div")
item_div.add_style("text-overflow: ellipsis")
item_div.add_style("white-space: nowrap")
item_div.add_style("width: 80%")
item_div.add_attr('title','Click to remove')
item_div.add_style("display", "inline-block")
item_div.add_style("vertical-align", "top")
item_div.add_style("overflow", "hidden")
icon_div = DivWdg()
top.add(icon_div)
icon = IconWdg(icon="BS_REMOVE")
icon_div.add(icon)
icon_div.add_behavior( {
'type': 'click_up',
#'cbjs_action': '''spt.dg_table_action.sobject_drop_remove(evt,bvr)'''
'cbjs_action': '''spt.drop.sobject_drop_remove(evt,bvr)'''
} )
icon.add_style("opacity: 0.3")
icon_div.add_class("hand")
icon_div.add_style("display", "inline-block")
icon_div.add_style("vertical-align", "top")
#icon_div.add_border()
#self.menu.set_over(item_div, event="mousein")
#self.menu.set_out(top, event="mouseleave")
# set this as the place for the display value to go
item_div.add_class("spt_drop_display_value")
add_icon = True
ExpressionParser.clear_cache()
if sobject:
if add_icon:
self._add_icon(sobject, item_div)
if self.display_expr:
display_value = Search.eval(self.display_expr, sobjects = sobject, single=True)
else:
display_value = sobject.get_display_value()
if isinstance(display_value, list):
display_value = display_value[0]
item_div.add( display_value )
self.values.append( SearchKey.get_by_sobject(sobject) )
return top
示例7: get_filter_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_attr [as 别名]
def get_filter_wdg(self, filter_name):
if not filter_name:
filter_name = self.get_name()
from pyasm.web import DivWdg
from tactic.ui.widget import IconButtonWdg
filter_wdg = DivWdg()
button = IconButtonWdg(title="Show Filter", icon="BS_SEARCH")
filter_wdg.add_class("spt_filter_button")
filter_wdg.add(button)
filter_wdg.add_style("display: inline-block")
filter_wdg.add_style("vertical-align: middle")
filter_wdg.add_style("opacity: 0.5")
filter_wdg.add_attr("spt_filter_name", filter_name)
filter_wdg.add_behavior( {
'type': 'click',
'cbjs_action': '''
var panel = bvr.src_el.getParent(".spt_view_panel_top");
var th = bvr.src_el.getParent("th");
var pos = th.getPosition(panel);
var name = bvr.src_el.getAttribute("spt_filter_name");
if (! spt.simple_search.has_element(name) ) {
return;
}
pos.y += 35;
spt.simple_search.show_elements([name]);
spt.simple_search.set_position(pos);
spt.simple_search.hide_title();
spt.simple_search.show();
var top = spt.simple_search.get_top();
var size = top.getSize();
var cur_pos = top.getPosition( $(document.body) );
var window_size = $(document.body).getSize();
if (cur_pos.x + size.x > window_size.x) {
var panel_size = panel.getSize();
pos.x = panel_size.x - size.x;
spt.simple_search.set_position(pos);
}
'''
} )
return filter_wdg
示例8: get_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_attr [as 别名]
def get_display(my):
widget = DivWdg()
pipeline_code = my.get_option('pipeline')
pipeline = Pipeline.get_by_code(pipeline_code)
if not pipeline:
widget.add("No pipeline defined")
return widget
processes = pipeline.get_process_names()
widget.add_style("border: solid 1px blue")
widget.add_style("position: absolute")
widget.add_style("top: 300")
widget.add_style("left: -500")
for process in processes:
#inputs = pipeline.get_input_processes(process)
outputs = pipeline.get_output_processes(process)
div = DivWdg()
widget.add(div)
div.add_class("spt_input_option")
div.add_attr("spt_input_key", process)
#if not outputs:
# # then we can't go anywhere, so just add a message
# text = ""
# div.add(text)
# continue
values = []
#values.extend( [str(x) for x in inputs] )
values.append(process)
values.extend( [str(x) for x in outputs] )
select = SelectWdg(my.get_input_name())
select.set_value(process)
select.add_empty_option('-- Select --')
select.set_option("values", values)
div.add(select)
from tactic.ui.panel import CellEditWdg
CellEditWdg.add_edit_behavior(select)
return widget
示例9: get_otherdb_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_attr [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
示例10: get_logins_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_attr [as 别名]
def get_logins_wdg(my, logins):
logins_div = DivWdg()
for login in logins:
login_div = DivWdg()
logins_div.add(login_div)
login_div.add_style("padding: 5px")
# login_div.add_style("height: 30px")
login_div.add_style("margin: 0 5px 5px 0")
login_div.add_attr("spt_login", login.get_value("login"))
thumb_div = DivWdg()
login_div.add(thumb_div)
thumb_div.add_style("float: left")
thumb_div.add_style("margin-right: 5px")
thumb_div.add_style("padding-top: 1px")
thumb = ThumbWdg()
thumb.set_sobject(login)
thumb_div.add(thumb)
thumb.set_icon_size(15)
login_div.add(login.get_full_name())
login_div.add_behavior(
{
"type": "click_up",
"sobject_display_expr": my.sobject_display_expr,
"tab_view": my.tab_view,
"cbjs_action": """
var top = bvr.src_el.getParent(".spt_schedule_top");
var class_name = 'tactic.ui.tools.schedule_wdg.ScheduleUserToolWdg';
var login = bvr.src_el.getAttribute("spt_login")
var kwargs = {
login: login
};
if (bvr.sobject_display_expr)
kwargs['sobject_display_expr'] = bvr.sobject_display_expr;
if (bvr.tab_view)
kwargs['tab_view'] = bvr.tab_view;
var content = top.getElement(".spt_schedule_content");
spt.panel.load(content, class_name, kwargs);
""",
}
)
login_div.add_hover()
return logins_div
示例11: get_section_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_attr [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
示例12: get_item_div
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_attr [as 别名]
def get_item_div(my, sobject):
''' get the item div the sobject'''
top = DivWdg()
top.add_style("padding: 3px 2px")
top.add_attr('title','Click to remove')
# FIXME: put this here for now
top.add_behavior( {
'type': 'click_up',
#'cbjs_action': '''spt.dg_table_action.sobject_drop_remove(evt,bvr)'''
'cbjs_action': '''spt.drop.sobject_drop_remove(evt,bvr)'''
} )
top.add_class("spt_drop_item")
top.add_class("SPT_DROP_ITEM")
item_div = DivWdg()
item_div.add_class("hand")
item_div.add_style("float: clear")
top.add(item_div, "item_div")
#my.menu.set_over(item_div, event="mousein")
#my.menu.set_out(top, event="mouseleave")
# set this as the place for the display value to go
item_div.add_class("spt_drop_display_value")
add_icon = True
ExpressionParser.clear_cache()
if sobject:
if add_icon:
my._add_icon(sobject, item_div)
if my.display_expr:
display_value = Search.eval(my.display_expr, sobjects = sobject, single=True)
else:
display_value = sobject.get_display_value()
if isinstance(display_value, list):
display_value = display_value[0]
item_div.add( display_value )
my.values.append( SearchKey.get_by_sobject(sobject) )
return top
示例13: get_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_attr [as 别名]
def get_display(my):
top = DivWdg()
top.add_color("color", "color")
#top.add_color("background", "background")
top.add_class("spt_simple_upload_top")
top.add(my.browse)
hidden = HiddenWdg( "%s|path" % my.get_input_name() )
hidden.add_class("spt_upload_hidden")
top.add(hidden)
# this can be used for some other transaction that picks up this file to checkin
hidden = HiddenWdg( "%s|ticket" % my.get_input_name() )
hidden.add_class("spt_upload_ticket")
top.add(hidden)
# if not specified, get the sobject's icon context
my.context = my.kwargs.get("context")
if not my.context:
current = my.get_current_sobject()
if current:
my.context = current.get_icon_context()
else:
from pyasm.biz import Snapshot
my.context = Snapshot.get_default_context()
top.add_attr("spt_context", my.context)
top.add( my.get_info_wdg() )
files_div = DivWdg()
top.add(files_div)
files_div.add_class("spt_upload_files")
files_div.add_style("font-size: 11px")
files_div.add_style("margin-top: 10px")
my.add_action()
return top
示例14: get_sqlite_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_attr [as 别名]
def get_sqlite_wdg(my):
div = DivWdg()
div.add_class("spt_db_options")
div.add_attr("spt_vendor", "Sqlite")
div.add_style("padding: 20px")
div.add("Database Folder: ")
text = TextInputWdg(name="database/sqlite_db_dir")
div.add(text)
db_dir = Config.get_value("database", "sqlite_db_dir")
if not db_dir:
data_dir = Environment.get_data_dir()
db_dir = "%s/db" % data_dir
text.set_value(db_dir)
return div
示例15: get_title
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_attr [as 别名]
def get_title(my):
if my.title:
title = my.title
title = title.replace(r'\n','<br/>')
else:
title = my.name
if not title:
title = ""
else:
title = Common.get_display_title(title)
from pyasm.web import DivWdg
div = DivWdg()
div.add_attr("title", title)
div.add(title)
return div
# FIXME: not sure about autofit here? This should be a mode
"""