本文整理汇总了Python中pyasm.widget.ThumbWdg.find_icon_link方法的典型用法代码示例。如果您正苦于以下问题:Python ThumbWdg.find_icon_link方法的具体用法?Python ThumbWdg.find_icon_link怎么用?Python ThumbWdg.find_icon_link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.ThumbWdg
的用法示例。
在下文中一共展示了ThumbWdg.find_icon_link方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_category_preview_wdg
# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import find_icon_link [as 别名]
def get_category_preview_wdg(self, paths, title=None, tags={}):
div = DivWdg()
if not title:
title = "Paths"
div.add("%s (%s)<hr/>" % (title, len(paths)) )
if not paths:
div.add("-- None --<br/>")
paths_div = DivWdg()
div.add(paths_div)
from pyasm.widget import ThumbWdg
for path in paths:
path_div = DivWdg()
paths_div.add(path_div)
path_div.add_style("float: left")
path_div.add_style("min-height: 60px")
path_div.add_style("margin: 15px")
path_div.add_style("width: 60px")
icon_link = ThumbWdg.find_icon_link(path)
path_div.add("<div><img width='60px' src='%s'/></div>" % icon_link)
filename = os.path.basename(path)
#path_div.add(path)
path_div.add(filename)
if tags:
path_tags = tags.get(path)
path_div.add( " "*10)
path_div.add(path_tags['sobject'])
div.add("<br clear='all'/>")
return div
示例2: get_display
# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import find_icon_link [as 别名]
def get_display(my):
my.search_key = my.kwargs.get("search_key")
sobject = Search.get_by_search_key(my.search_key)
if sobject.get_base_search_type() == "sthpw/snapshot":
snapshot = sobject
elif sobject.get_base_search_type() == "sthpw/file":
# if it is a file object
snapshot = sobject.get_parent()
else:
snapshots = Snapshot.get_by_sobject(sobject)
snapshot = snapshots[0]
#parent = snapshot.get_parent()
top = my.top
from tactic.ui.container import ResizableTableWdg
table = ResizableTableWdg()
top.add(table)
table.add_row()
table.add_style("width: 100%")
from tactic.ui.widget import EmbedWdg
td = table.add_cell()
td.add_color("background", "background",)
td.add_style("vertical-align: middle")
td.add_style("height: 200px")
td.add_style("overflow-x: auto")
file_type = "icon"
thumb_path = snapshot.get_web_path_by_type(file_type)
file_type = "main"
src = snapshot.get_web_path_by_type(file_type)
parts = os.path.splitext(src)
ext = parts[1]
ext = ext.lower()
if ext in ['.doc','.xls']:
from pyasm.widget import ThumbWdg
link = ThumbWdg.find_icon_link(src)
img = HtmlElement.img(src=link)
href = DivWdg()
href.add_style("text-align: center")
href.add(img)
td.add(href)
href.add_behavior( {
'type': 'click_up',
'src': src,
'cbjs_action': '''
window.open(bvr.src);
'''
} )
href.add_class("hand")
else:
embed_wdg = EmbedWdg(src=src, thumb_path=thumb_path)
td.add(embed_wdg)
embed_wdg.add_style("margin: auto auto")
embed_wdg.add_class("spt_resizable")
embed_wdg.add_style("width: 100%")
embed_wdg.add_style("height: 240px")
embed_wdg.add_behavior( {
'type': 'load',
'cbjs_action': '''
var last_height = spt.container.get_value("last_img_height");
if (last_height) {
bvr.src_el.setStyle("height", last_height);
}
'''
} )
embed_wdg.add_behavior( {
'type': 'unload',
'cbjs_action': '''
var last_height = bvr.src_el.getStyle("height");
spt.container.set_value("last_img_height", last_height);
'''
} )
table.add_row()
td = table.add_cell()
from tactic.ui.checkin import PathMetadataWdg
from tactic.ui.checkin import SnapshotMetadataWdg
metadata_div = DivWdg()
td.add(metadata_div)
#.........这里部分代码省略.........
示例3: get_display
# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import find_icon_link [as 别名]
def get_display(my):
top = my.top
src = my.kwargs.get("src")
file = my.kwargs.get("file")
if file:
src = file.get_web_path()
opacity = 1.0
if not src:
src = "/context/icons/logo/tactic_silver.png"
opacity = 0.6
height = my.kwargs.get("height")
width = my.kwargs.get("width")
index = my.kwargs.get("index")
if not height:
height = "auto"
if not width:
width = "100%"
width = "100%"
height = "auto"
#div = DivWdg()
#top.add(div)
div = top
div.add_class("unselectable")
div.add_style("opacity", opacity)
div.add_style("overflow-x: hidden")
div.add_style("overflow-y: hidden")
div.add_style("margin-left: auto")
div.add_style("margin-right: auto")
div.add_style("text-align: center")
if height:
div.add_style("height", height)
if width:
div.add_style("width", width)
parts = os.path.splitext(src)
ext = parts[1]
ext = ext.lower()
click = my.kwargs.get("click")
if click in [False, 'false']:
click = False
else:
click = True
thumb_path = my.kwargs.get("thumb_path")
preload = my.kwargs.get("preload")
if not preload:
preload = "none"
ext = ext.lstrip(".")
if ext in File.IMAGE_EXT:
embed = HtmlElement.img(src)
embed.add_style("width: 100%")
embed.add_style("height: auto")
elif ext in File.VIDEO_EXT:
from tactic.ui.widget import VideoWdg
embed = DivWdg()
if not thumb_path:
thumb_path = "/context/icons/logo/tactic_sml.png"
controls = my.kwargs.get("controls")
if not controls:
controls = "true"
video_id = None
sources = [src]
source_types = ["video/mp4"]
poster = thumb_path
width = '100%'
height = '100%'
#width = "640"
#height = "480"
video = VideoWdg(video_id=video_id, sources=sources, source_types=source_types, poster=poster, preload=preload, controls=controls, width=width, height=height, index=index)
embed.add(video)
video.get_video().add_class("spt_resizable")
click = False
else:
#embed = HtmlElement.embed(src)
if thumb_path:
img = HtmlElement.img(thumb_path)
else:
from pyasm.widget import ThumbWdg
link = ThumbWdg.find_icon_link(src)
img = HtmlElement.img(link)
img.add_style("width: 50%")
img.add_style("margin: 20px 20px")
embed = DivWdg(img)
#.........这里部分代码省略.........
示例4: get_display
# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import find_icon_link [as 别名]
def get_display(my):
my.search_key = my.kwargs.get("search_key")
sobject = Search.get_by_search_key(my.search_key)
if sobject.get_base_search_type() == "sthpw/snapshot":
snapshot = sobject
elif sobject.get_base_search_type() == "sthpw/file":
# if it is a file object
snapshot = sobject.get_parent()
else:
snapshots = Snapshot.get_by_sobject(sobject)
snapshot = snapshots[0]
#parent = snapshot.get_parent()
top = my.top
from tactic.ui.container import ResizableTableWdg
table = ResizableTableWdg()
top.add(table)
table.add_row()
table.add_style("width: 100%")
from tactic.ui.widget import EmbedWdg
td = table.add_cell()
td.add_color("background", "background",)
td.add_style("vertical-align: middle")
td.add_style("height: 200px")
td.add_style("overflow-x: auto")
file_type = "icon"
thumb_path = snapshot.get_web_path_by_type(file_type)
file_type = "main"
src = snapshot.get_web_path_by_type(file_type)
lib_path = snapshot.get_lib_path_by_type(file_type)
parts = os.path.splitext(src)
ext = parts[1]
ext = ext.lower()
content_div = DivWdg()
if ext in ['.doc','.xls']:
from pyasm.widget import ThumbWdg
link = ThumbWdg.find_icon_link(src)
img = HtmlElement.img(src=link)
href = DivWdg()
href.add_style("text-align: center")
href.add(img)
td.add(href)
href.add_behavior( {
'type': 'click_up',
'src': src,
'cbjs_action': '''
window.open(bvr.src);
'''
} )
href.add_class("hand")
elif ext in ['.txt','.html', '.ini']:
f = open(lib_path, 'r')
content = f.read(10000)
f.close()
if not content:
text = "No Content"
else:
size = os.path.getsize(lib_path)
from pyasm.common import FormatValue
value = FormatValue().get_format_value(size, "KB")
content_div.add("Showing first 10K of %s<hr/>" % value)
text = TextAreaWdg()
text.add(content)
text.add_style("width: 100%")
text.add_style("height: 300px")
text.add_style("padding: 10px")
text.add_style("border: none")
text.add_attr("readonly", "true")
content_div.add(text)
td.add(content_div)
content_div.add_style("color", "#000")
content_div.add_style("width", "auto")
content_div.add_style("margin", "20px")
elif thumb_path == "__DYNAMIC__":
td.add("No Preview")
else:
embed_wdg = EmbedWdg(src=src, thumb_path=thumb_path)
td.add(embed_wdg)
#.........这里部分代码省略.........
示例5: find_icon_link
# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import find_icon_link [as 别名]
def find_icon_link(my, file_path, repo_path=None):
from pyasm.widget import ThumbWdg
return ThumbWdg.find_icon_link(file_path, repo_path)
示例6: get_display
# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import find_icon_link [as 别名]
def get_display(my):
my.init_kwargs()
sobject = my.get_current_sobject()
table = Table(css='minimal')
table.add_color("color", "color")
table.add_style("font-size: 0.9em")
snapshots = my.get_snapshot(my.mode)
for snapshot in snapshots:
table.add_row()
value = my.get_input_value(sobject, snapshot)
current_version = snapshot.get_value("version")
current_context = snapshot.get_value("context")
current_revision = snapshot.get_value("revision", no_exception=True)
current_snapshot_type = snapshot.get_value("snapshot_type")
# hack hard coded type translation
if current_snapshot_type == "anim_export":
current_snapshot_type = "anim"
# ignore icon context completely
if current_context == "icon":
table.add_blank_cell()
table.add_cell("(---)")
return table
checkbox = CheckboxWdg('%s_%s' %(my.search_type, my.CB_NAME))
# this is added back in for now to work with 3.7 Fast table
checkbox.add_behavior({'type': 'click_up',
'propagate_evt': True})
checkbox.add_class('spt_latest_%s' %my.mode)
checkbox.set_option("value", value )
table.add_cell( checkbox )
load_all = False
if load_all:
checkbox.set_checked()
# add the file type icon
xml = snapshot.get_snapshot_xml()
file_name = xml.get_value("snapshot/file/@name")
icon_link = ThumbWdg.find_icon_link(file_name)
image = HtmlElement.img(icon_link)
image.add_style("width: 15px")
table.add_cell(image)
namespace = my.get_namespace(sobject, snapshot)
asset_code = my.get_asset_code()
# force asset mode = True
my.session.set_asset_mode(asset_mode=my.get_session_asset_mode())
node_name = my.get_node_name(snapshot, asset_code, namespace)
# get session info
session_context = session_version = session_revision = None
if my.session:
session_context = my.session.get_context(node_name, asset_code, current_snapshot_type)
session_version = my.session.get_version(node_name, asset_code, current_snapshot_type)
session_revision = my.session.get_revision(node_name, asset_code,current_snapshot_type)
# Maya Specific: try with namespace in front of it for referencing
referenced_name = '%s:%s' %(namespace, node_name)
if not session_context or not session_version:
session_context = my.session.get_context(referenced_name, asset_code, current_snapshot_type)
session_version = my.session.get_version(referenced_name, asset_code, current_snapshot_type)
session_revision = my.session.get_revision(referenced_name, asset_code, current_snapshot_type)
from version_wdg import CurrentVersionContextWdg, SubRefWdg
version_wdg = CurrentVersionContextWdg()
data = {'session_version': session_version, \
'session_context': session_context, \
'session_revision': session_revision, \
'current_context': current_context, \
'current_version': current_version, \
'current_revision': current_revision }
version_wdg.set_options(data)
table.add_cell(version_wdg, "no_wrap")
td = table.add_cell(HtmlElement.b("(%s)" %current_context))
td.add_tip("Snapshot code: %s" % snapshot.get_code())
#table.add_cell(snapshot.get_code() )
#if snapshot.is_current():
# current = IconWdg("current", IconWdg.CURRENT)
# table.add_cell(current)
#else:
# table.add_blank_cell()
# handle subreferences
#.........这里部分代码省略.........
示例7: get_display
# 需要导入模块: from pyasm.widget import ThumbWdg [as 别名]
# 或者: from pyasm.widget.ThumbWdg import find_icon_link [as 别名]
def get_display(my):
my.search_key = my.kwargs.get("search_key")
my.sobject = Search.get_by_search_key(my.search_key)
snapshot = my.sobject.get_parent()
parent = snapshot.get_parent()
top = my.top
from tactic.ui.container import ResizableTableWdg
table = ResizableTableWdg()
top.add(table)
table.add_row()
table.add_style("width: 100%")
#td = table.add_cell()
#thumb_div = DivWdg()
#td.add(thumb_div)
#thumb = ThumbWdg()
#thumb_div.add(thumb)
#thumb_div.add_class("spt_resizable")
#thumb.set_sobject(parent)
#thumb.set_icon_size(120)
from tactic.ui.widget import EmbedWdg
td = table.add_cell()
td.add_color("background", "background",)
td.add_style("vertical-align: middle")
td.add_style("height: 200px")
td.add_style("overflow-x: auto")
src = my.sobject.get_web_path()
parts = os.path.splitext(src)
ext = parts[1]
ext = ext.lower()
if ext in ['.doc','.xls']:
from pyasm.widget import ThumbWdg
link = ThumbWdg.find_icon_link(src)
img = HtmlElement.img(src=link)
href = DivWdg()
href.add_style("text-align: center")
href.add(img)
td.add(href)
href.add_behavior( {
'type': 'click_up',
'src': src,
'cbjs_action': '''
window.open(bvr.src);
'''
} )
href.add_class("hand")
else:
embed_wdg = EmbedWdg(src=src)
td.add(embed_wdg)
embed_wdg.add_style("margin: auto auto")
embed_wdg.add_class("spt_resizable")
embed_wdg.add_style("width: 100%")
embed_wdg.add_style("height: 240px")
embed_wdg.add_behavior( {
'type': 'load',
'cbjs_action': '''
var last_height = spt.container.get_value("last_img_height");
if (last_height) {
bvr.src_el.setStyle("height", last_height);
}
'''
} )
embed_wdg.add_behavior( {
'type': 'unload',
'cbjs_action': '''
var last_height = bvr.src_el.getStyle("height");
spt.container.set_value("last_img_height", last_height);
'''
} )
table.add_row()
from tactic.ui.checkin import SnapshotMetadataWdg
metadata_wdg = SnapshotMetadataWdg(snapshot=snapshot)
td = table.add_cell()
metadata_div = DivWdg()
td.add(metadata_div)
metadata_div.add_style("max-height: 400px")
metadata_div.add_style("overflow-y: auto")
metadata_div.add_style("overflow-x: hidden")
metadata_div.add(metadata_wdg)
top.add("<br/>")
return top