本文整理汇总了Python中pyasm.web.HtmlElement.href方法的典型用法代码示例。如果您正苦于以下问题:Python HtmlElement.href方法的具体用法?Python HtmlElement.href怎么用?Python HtmlElement.href使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.HtmlElement
的用法示例。
在下文中一共展示了HtmlElement.href方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import href [as 别名]
def init(my):
my.layer = LayerWdg(my.xpos, my.ypos, my.display)
if not my.width:
my.shadowbox = ShadowBoxWdg(my.shad_name)
else:
my.shadowbox = ShadowBoxWdg(my.shad_name, my.width)
# do not enable it for the Login page
web = WebContainer.get_web()
if my.shad_name and not web.is_IE():
BaseAppServer.add_onload_script("Move.drag('%s','%s')" \
%(my.shadowbox.get_name(), my.iframe_name))
div = DivWdg()
from pyasm.widget import IconButtonWdg
move_button = IconWdg(name='move me', icon=IconWdg.NAV)
move_button.set_id("%s_handle" % (my.shad_name))
move_button.add_class('move')
move_button.add_style('float: left')
move_button.add_style('padding: 2px 0 0 6px')
if not web.is_IE():
div.add(move_button)
mbutton = IconButtonWdg(name='close window', icon=IconWdg.KILL)
mbutton.set_class("moduleKillBtn")
mbutton.add_event("onclick", my.layer.get_off_script() )
div.add(mbutton)
if my.nav_links:
back_link = HtmlElement.href("<<", "javascript:history.back()")
back_link.add_style("font-size", "1.4em")
for_link = HtmlElement.href(">>", "javascript:history.forward()")
for_link.add_style("font-size", "1.4em")
div.add(SpanWdg(back_link, css='med'))
div.add(SpanWdg(for_link, css='med'))
my.shadowbox.set_header(div)
# add button and title_wdg to shadow box
if my.title_wdg:
title_wdg = DivWdg()
title_wdg.set_class("moduleTitle")
title_wdg.add(my.title_wdg)
my.shadowbox.set_title_wdg(title_wdg)
my.layer.add(my.shadowbox)
my._add_widget(my.layer)
示例2: set_type_link
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import href [as 别名]
def set_type_link(my, widget, link_path_list):
''' set the format of the file type links '''
type_div = DivWdg()
for type, link_path in link_path_list:
href = HtmlElement.href(type, link_path)
href.add_color('color','color')
href.set_attr("target", "_blank")
href.add_tip('Right-click and choose [Save Link As..] to save to disk')
type_div.add(SpanWdg(href, 'small'))
widget.add(type_div)
示例3: get_display
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import href [as 别名]
def get_display(my):
sobject = my.get_current_sobject()
if sobject:
path = sobject.get_web_path_by_type()
filename = os.path.basename(path)
widget = HtmlElement.href(filename, ref=path, target="_blank")
else:
widget = ""
return widget
示例4: _add_title
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import href [as 别名]
def _add_title(my):
if my.long:
# This would be better on the whole span
my.add(HtmlElement.href(my.text, "#"))
# this is Mootools specific
my.add_event('onclick', 'new Event(event).stop()')
my.add_class("button")
if WebContainer.get_web().is_IE():
my.add_style("border-width: 0px 2px 2px 0px")
my.add_style("border-style: solid")
my.add_style("border-color: #303030")
my.add_event("onmousedown", "button_down(this)")
my.add_event("onmouseup", "button_up(this)")
my.add_event("onmouseout", "button_up(this)")
示例5: set_text_link
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import href [as 别名]
def set_text_link(my, widget, div, link_path):
''' set the format of the text link. Overridable for different formats '''
filename = os.path.basename(link_path)
if len(filename) > 30:
filename = "%s..." % (filename[0:30])
href = HtmlElement.href(filename, link_path)
href.add_style('font-size: 0.8em')
href.add_color('color','color')
href.set_attr("target", "_blank")
href.add_tip('%s::<i>Right-click and choose [Save Link As..]'\
'to save to disk</i>' % filename)
# avoid double link break
if not my.show_orig_icon:
div.add(HtmlElement.br(2))
widget.add(href)
示例6: get_display
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import href [as 别名]
def get_display(self):
sobject = self.get_current_sobject()
if sobject.is_insert():
return ""
if sobject:
path = sobject.get_web_path_by_type()
filename = os.path.basename(path)
if sobject.get_value("snapshot_type") == "sequence":
file_range = sobject.get_file_range()
filename = "%s (%s)" % (filename, file_range.get_display() )
widget = DivWdg()
widget.add_style("display: inline-block")
link = HtmlElement.href(filename, ref=path)
link.add_attr("download", filename)
# do this in javascript because the link doesn't
# work for some reason
widget.add_behavior( {
'type': 'click',
'filename': filename,
'href': path,
'cbjs_action': '''
var a = document.createElement('a');
a.href = bvr.href;
a.download = bvr.filename;
a.click();
'''
} )
widget.add(link)
else:
widget = ""
return widget
示例7: get_display
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import href [as 别名]
def get_display(my):
web = WebContainer.get_web()
search_key = web.get_form_value("search_key")
widget = Widget()
sobject = Search.get_by_search_key(search_key)
table = TableWdg( sobject.get_search_type(), "render" )
table.set_sobject(sobject)
widget.add(table)
# get all of the snapshots with a context render
sobject_snapshot = Snapshot.get_latest_by_sobject(sobject,"render")
if sobject_snapshot:
search_type = sobject.get_search_type()
search_id = sobject.get_value('search_id')
render_snapshots = Snapshot.get_by_search_type(search_type,search_id,"render")
table = TableWdg("sthpw/snapshot")
table.set_sobjects(render_snapshots)
widget.add(table)
widget.add(HtmlElement.h3("Rendered Frames"))
if sobject_snapshot:
widget.add("Render version: v%0.3d" % sobject_snapshot.get_value("version") )
# get latest snapshot of the render
renders = Render.get_all_by_sobject(sobject)
if not renders:
widget.add("<h4>No renders found</h4>")
return widget
render = renders[0]
snapshot = Snapshot.get_latest_by_sobject(render,"render")
if snapshot == None:
widget.add("<h4>No snapshots found</h4>")
return widget
# get the images
web_dir = snapshot.get_web_dir()
lib_dir = snapshot.get_lib_dir()
xml = snapshot.get_xml_value("snapshot")
file_nodes = xml.get_nodes("snapshot/file")
file_name = icon_file_name = ''
frame_range = icon_frame_range = None
for file_node in file_nodes:
if Xml.get_attribute(file_node, 'type') == 'main':
file_name, frame_range = my._get_frame_info(file_node, sobject)
if Xml.get_attribute(file_node, 'type') == 'icon':
icon_file_name, icon_frame_range = my._get_frame_info(file_node, sobject)
file_names = [file_name]
icon_file_names = [icon_file_name]
if "##" in file_name:
file_names = FileGroup.expand_paths(file_name, frame_range)
if "##" in icon_file_name:
icon_file_names = FileGroup.expand_paths(icon_file_name, \
icon_frame_range)
div = DivWdg()
for k in range(len(file_names)):
file_name = file_names[k]
# ignore frames that don't exist
lib_path = "%s/%s" % (lib_dir, file_name)
if not os.path.exists(lib_path):
continue
try:
icon_file_name = icon_file_names[k]
except IndexError:
icon_file_name = file_names[k]
file_path = "%s/%s" % (web_dir, file_name)
icon_file_path = "%s/%s" % (web_dir, icon_file_name)
img = HtmlElement.img(icon_file_path)
img.set_attr("width", "60")
img.add_event("onmouseover","hint_bubble.show(event,'Ctrl + Click to open in new window')")
href = HtmlElement.href(img, file_path)
div.add(href)
widget.add(div)
widget.add( "<h3>Render History</h3>" )
widget.add( my.get_render_history(renders) )
return widget
示例8:
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import href [as 别名]
'type': 'click_up',
'repo_path': repo_path,
'cbjs_action': '''
var base_dir = bvr.repo_path;
var class_name = 'tactic.ui.tools.SnapshotDirListWdg';
var kwargs = {
'base_dir': base_dir,
'location': 'server'
}
spt.panel.load_popup("Folder", class_name, kwargs);
'''
} )
href = img
else:
href = HtmlElement.href(img, link_path)
#href.set_attr("target", "_blank" )
href.add_class("spt_thumb_href")
href.add_attr("spt_href", link_path)
div.add(href)
else:
div.add(img)
else:
div.add(img)
div.add_class("hand")
示例9: get_display
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import href [as 别名]
def get_display(my):
top = DivWdg()
title = DivWdg()
top.add(title)
top.add_color("background", "background")
top.add_style("margin: 0px 10px 15px 10px")
top.set_box_shadow()
title.add("More Information")
title.add_style("font-size: 16px")
title.add_style("padding: 5px")
title.add_gradient("background", "background")
title.add_border()
title.set_round_corners(corners=['TL','TR'])
content_wdg = DivWdg()
top.add(content_wdg)
content_wdg.add_border()
content_wdg.add_style("padding: 20px")
content_wdg.add("<div style='font-size: 12px'>The following links will help you find out more information on how to set-up or use TACTIC.</div>")
content_wdg.add("<hr/>")
hover = title.get_color("background", -10)
links_div = DivWdg()
links_div.add_style("padding: 10px")
content_wdg.add(links_div)
# documentation linke
link_div = DivWdg()
link_div.add_style("padding-left: 10px")
links_div.add(link_div)
icon = IconWdg("Documentation", IconWdg.DOCUMENTATION)
icon.set_box_shadow("2px 2px 5px")
icon.add_border()
icon.add_style("padding: 5px 3px 5px 7px")
icon.set_round_corners()
icon.add_color("background", "background3")
link_div.add(icon)
link_div.add(" "*2)
link = HtmlElement.href("Documentation", "/doc/", target="_blank")
link_div.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
spt.help.set_top();
spt.help.load_alias("main");
'''
} )
link_div.add_behavior( {
'type': 'hover',
'color': hover,
'cbjs_action_over': '''
bvr.src_el.setStyle("background", bvr.color);
''',
'cbjs_action_out': '''
bvr.src_el.setStyle("background", "");
'''
} )
link_div.add(link)
link.add_color("color", "color")
links_div.add("<br/>")
link_div = DivWdg()
link_div.add_style("padding-left: 10px")
links_div.add(link_div)
icon = IconWdg("Community", IconWdg.COMMUNITY)
icon.set_box_shadow("2px 2px 5px")
icon.add_border()
icon.add_style("padding: 5px 3px 5px 7px")
icon.set_round_corners()
icon.set_round_corners()
icon.add_color("background", "background3")
link_div.add(icon)
link_div.add(" "*2)
link = HtmlElement.href("Community", "http://community.southpawtech.com", target="_blank")
link_div.add(link)
link.add_color("color", "color")
link_div.add_behavior( {
'type': 'hover',
'color': hover,
'cbjs_action_over': '''
bvr.src_el.setStyle("background", bvr.color);
#.........这里部分代码省略.........
示例10: get_display
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import href [as 别名]
def get_display(my):
sobject = my.get_current_sobject()
use_parent = my.get_option("use_parent")
use_parent = use_parent in ['true', True]
#if use_parent in ['true', True]:
# sobject = sobject.get_parent()
# if not sobject:
# return DivWdg()
my.search_key = SearchKey.get_by_sobject(sobject)
div = DivWdg()
div.add_class("hand")
target_id = "main_body"
mode = my.get_option("mode")
#mode = "link"
title = "Show Item Details"
if my.widget:
widget = my.widget
elif mode == "link":
widget = HtmlElement.href()
column = my.get_option("link_column")
if not column:
column = "code"
widget.add( sobject.get_value(column) )
widget.add_style('text-decoration: underline')
else:
#widget = IconButtonWdg(title=title, icon=IconWdg.ZOOM)
widget = IconButtonWdg(title=title, icon="BS_SEARCH")
div.add_style("width: 26px")
div.add_style("margin-left: auto")
div.add_style("margin-right: auto")
code = sobject.get_code()
name = sobject.get_value("name", no_exception=True)
if not name:
name = code
search_type_obj = sobject.get_search_type_obj()
title = search_type_obj.get_title()
if not title:
title = "Detail"
title = _(title)
tab_element_names = my.kwargs.get("tab_element_names") or ""
detail_view = my.kwargs.get("detail_view") or ""
widget.add_behavior( {
'type': 'click_up',
'search_key': my.search_key,
'use_parent': use_parent,
'tab_element_names': tab_element_names,
'detail_view': detail_view,
'show_task_process': my.show_task_process,
'code': code,
'name': name,
'label': title,
'cbjs_action': '''
spt.tab.set_main_body_tab();
var class_name = 'tactic.ui.tools.SObjectDetailWdg';
var kwargs = {
search_key: bvr.search_key,
use_parent: bvr.use_parent,
tab_element_names: bvr.tab_element_names,
show_task_process: bvr.show_task_process,
detail_view: bvr.detail_view
};
var mode = '';
var layout = bvr.src_el.getParent(".spt_tool_top");
if (layout != null) {
mode = 'tool'
}
if (mode == 'tool') {
spt.app_busy.show("Loading ...");
var layout = bvr.src_el.getParent(".spt_tool_top");
var element = layout.getElement(".spt_tool_content");
spt.panel.load(element, class_name, kwargs);
spt.app_busy.hide();
}
else {
var element_name = "detail_"+bvr.code;
var title = bvr.label + " ["+bvr.name+"]";
spt.tab.add_new(element_name, title, class_name, kwargs);
}
'''
} )
#link_wdg = my.get_link_wdg(target_id, title, widget)
#div.add( link_wdg )
#.........这里部分代码省略.........
示例11: get_display
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import href [as 别名]
#.........这里部分代码省略.........
category_div.add(category)
category_div.add_style("padding: 8px")
category_div.add_style("font-size: 16px")
category_div.add_style("font-weight: bold")
category_div.add_color("color", "color")
category_div.add_gradient("background", "background3",0, -10)
category_div.add_color("color", "color3")
#category_div.set_round_corners()
if last_category == None:
category_div.add_style("margin: -6 -6 6 -6")
else:
category_div.add_style("margin: 15 -6 0 -6")
table.add_row()
has_category = True
index = 0
index += 1
last_category = category
thumb = ThumbWdg()
thumb.set_name("snapshot")
thumb.set_sobject(project)
thumb.set_show_clipboard(False)
thumb.set_has_img_link(False)
thumb.set_icon_size(icon_size)
code = project.get_code()
title = project.get_value("title")
# Restrict the length of project name
if len(title) >= 36:
title = title[:36] + "..."
if app_name != 'Browser':
href = HtmlElement.href(HtmlElement.h2(title), ref='/tactic/%s/%s'\
%(code, app_name))
img_href = HtmlElement.href(thumb, ref='/tactic/%s/%s'\
%(code, app_name))
link = '/tactic/%s/%s' % (code, app_name)
else:
href = HtmlElement.href(HtmlElement.h2(title), ref="/tactic/%s/" % code)
img_href = DivWdg(thumb)
img_href.add_behavior( {
'type': 'click_up',
'code': code,
'cbjs_action': '''
document.location = '/tactic/'+bvr.code+'/';
'''
} )
link = '/tactic/%s/' % code
href = href.get_buffer_display()
if (index-1) % columns == 0:
table.add_row()
td = table.add_cell()
img_div = DivWdg()
img_div.add(img_href)
img_div.add_style("margin-right: 20px")
img_div.add_style("float: left")
img_div.add_border()
#img_div.set_round_corners()
img_div.set_box_shadow("0px 1px 5px")
project_div = DivWdg()
示例12: get_display
# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import href [as 别名]
#.........这里部分代码省略.........
tr, td = table.add_row_cell()
td.add_style("font-size: 14px")
td.add("<br/>")
div = DivWdg()
title = DivWdg()
div.add(title)
div.add_color("background", "background")
div.add_style("margin: 0px 10px 15px 10px")
title.add("Quick Links")
title.add_style("font-size: 16px")
title.add_style("padding: 5px")
title.add_gradient("background", "background")
title.add_border()
title.set_round_corners(corners=['TL','TR'])
content_wdg = DivWdg()
div.add(content_wdg)
content_wdg.add_border()
content_wdg.add_style("padding: 20px")
content_wdg.add("<div style='font-size: 12px'>The following links will help you find out more information on how to set up or use TACTIC.</div>")
content_wdg.add("<hr/>")
hover = title.get_color("background", -10)
link_div = DivWdg()
link_div.add_style("padding: 10px")
content_wdg.add(link_div)
icon = IconWdg("TACTIC Documentation", IconWdg.JUMP)
link_div.add(icon)
link = HtmlElement.href("TACTIC Documentation", "/doc/", target="_blank")
link.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
spt.help.set_top();
spt.help.load_alias("main");
'''
} )
link.add_behavior( {
'type': 'hover',
'color': hover,
'cbjs_action_over': '''
bvr.src_el.setStyle("background", bvr.color);
''',
'cbjs_action_out': '''
bvr.src_el.setStyle("background", "");
'''
} )
link_div.add(link)
link.add_color("color", "color")
link_div.add("<br/>"*2)
icon = IconWdg("Southpaw Web Site", IconWdg.JUMP)
link_div.add(icon)
link = HtmlElement.href("Southpaw Web Site", "http://www.southpawtech.com", target="_blank")
link_div.add(link)
link.add_color("color", "color")
link.add_behavior( {
'type': 'hover',
'color': hover,
'cbjs_action_over': '''
bvr.src_el.setStyle("background", bvr.color);
''',
'cbjs_action_out': '''
bvr.src_el.setStyle("background", "");
'''
} )
link_div.add("<br/>"*2)
icon = IconWdg("TACTIC Community", IconWdg.JUMP)
link_div.add(icon)
link = HtmlElement.href("TACTIC Community", "http://community.southpawtech.com", target="_blank")
link_div.add(link)
link.add_color("color", "color")
link.add_behavior( {
'type': 'hover',
'color': hover,
'cbjs_action_over': '''
bvr.src_el.setStyle("background", bvr.color);
''',
'cbjs_action_out': '''
bvr.src_el.setStyle("background", "");
'''
} )
td.add(div)
return top