本文整理汇总了Python中pyasm.web.Table.set_unique_id方法的典型用法代码示例。如果您正苦于以下问题:Python Table.set_unique_id方法的具体用法?Python Table.set_unique_id怎么用?Python Table.set_unique_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.Table
的用法示例。
在下文中一共展示了Table.set_unique_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_info_wdg
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import set_unique_id [as 别名]
def get_info_wdg(my):
div = DivWdg()
div.set_name("Info")
div.add_style("padding: 20px")
table = Table()
div.add(table)
table.add_color("color", "color")
#table.add_style("height: 280px")
table.set_unique_id()
table.add_smart_style("spt_table_header", "width", "200px")
table.add_smart_style("spt_table_header", "text-align", "right")
table.add_smart_style("spt_table_header", "padding-right", "20px")
table.add_smart_style("spt_table_header", "margin-bottom", "10px")
table.add_smart_style("spt_table_element", "vertical-align", "top")
table.add_row()
#if my.mode == 'insert':
# read_only = False
#else:
# read_only = True
read_only = False
code = Config.get_value("install", "server") or ""
td = table.add_cell()
td.add_class("spt_table_header")
td.add("Code: ")
td.add_style("vertical-align: top")
text = TextInputWdg(name="code", read_only=read_only)
td = table.add_cell()
td.add_class("spt_table_element")
td.add(text)
text.set_value(code)
return div
示例2: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import set_unique_id [as 别名]
def get_display(my):
search_key = my.kwargs.get("search_key")
snapshot = my.kwargs.get("snapshot")
if snapshot:
my.snapshot = snapshot
else:
my.snapshot = SearchKey.get_by_search_key(search_key)
assert my.snapshot
metadata = my.snapshot.get_metadata()
top = my.top
top.add_color("background", "background")
table = Table()
table.set_max_width()
top.add(table)
table.set_unique_id()
table.add_border()
table.add_smart_styles("spt_cell", {
'padding': '3px'
} )
tr = table.add_row()
tr.add_gradient("background", "background3")
th = table.add_header("Property")
th.add_style("min-width: 200px")
th.add_style("padding: 5px")
th = table.add_header("Value")
th.add_style("min-width: 400px")
th.add_style("padding: 5px")
keys = metadata.get("__keys__")
if not keys:
keys = metadata.keys()
empty = False
if not keys:
empty = True
keys = ['','','','','','','']
table.add_smart_styles("spt_cell", {
'height': '20px'
} )
for i, key in enumerate(keys):
value = metadata.get(key)
title = Common.get_display_title(key)
tr = table.add_row()
if i % 2:
tr.add_color("background", "background")
tr.add_color("color", "color")
else:
tr.add_color("background", "background", -8)
tr.add_color("color", "color")
td = table.add_cell()
td.add_class("spt_cell")
td.add(title)
td = table.add_cell()
td.add_class("spt_cell")
td.add(value)
if empty:
div = DivWdg()
top.add(div)
div.add_style("height: 30px")
div.add_style("width: 150px")
div.add_style("margin-top: -110px")
div.center()
div.add("<b>No Metadata</b>")
div.add_border()
div.add_color("background", "background3")
div.add_color("color", "color3")
div.add_style("padding: 20px")
div.add_style("text-align: center")
top.add_style("min-height: 200px")
return top
示例3: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import set_unique_id [as 别名]
def get_display(self):
search_key = self.kwargs.get("search_key")
path = self.kwargs.get("path")
parser_str = self.kwargs.get("parser")
use_tactic_tags = self.kwargs.get("use_tactic_tags")
from pyasm.checkin import BaseMetadataParser
#parser_str = "EXIF"
if parser_str:
parser = BaseMetadataParser.get_parser(parser_str, path)
else:
parser = BaseMetadataParser.get_parser_by_path(path)
if parser:
if use_tactic_tags in ['true', True]:
metadata = parser.get_tactic_metadata()
else:
metadata = parser.get_metadata()
else:
metadata = {}
parser_title = parser.get_title()
top = self.top
top.add_color("background", "background")
top.add_class("spt_metadata_top")
shelf = DivWdg()
top.add(shelf)
from tactic.ui.widget import ActionButtonWdg
button = ActionButtonWdg(title="Add Selected to Keywords", width="200")
shelf.add(button)
shelf.add_style("margin: 10px 0px")
button.add_behavior( {
'search_key': search_key,
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_metadata_top");
var values = spt.api.get_input_values(top, null, true);
var searchables = values.searchable;
var items = [];
for (var i = 0; i < searchables.length; i++) {
if (searchables[i] == "") {
continue;
}
items.push(searchables[i]);
}
var server = TacticServerStub.get();
var class_name = 'spt.modules.workflow.AssetAddMetadataToKeywordsCmd';
var kwargs = {
search_key: bvr.search_key,
items: items,
};
server.p_execute_cmd(class_name, kwargs)
.then( function() {
spt.api.clear_inputs(top);
spt.notify.show_message("Added Keywords");
} )
'''
} )
table = Table()
table.add_style("width: 100%")
#table.add_style("table-layout: fixed")
top.add(table)
table.set_unique_id()
table.add_smart_styles("spt_cell", {
'padding': '3px'
} )
tr, td = table.add_row_cell()
td.add(parser_title)
td.add_style("height: 20px")
td.add_style("font-weight: bold")
td.add_style("padding: 5px 3px")
td.add_color("background", "background", -5)
border_color = td.get_color("border")
td.add_color("border-bottom", "solid 1px %s" % border_color)
tr.add_class("tactic_hover")
"""
tr = table.add_row()
tr.add_color("background", "background", -5)
th = table.add_header("Property")
th.add_style("min-width: 200px")
th.add_style("padding: 5px")
#.........这里部分代码省略.........