本文整理汇总了Python中pyasm.web.Table.add_smart_styles方法的典型用法代码示例。如果您正苦于以下问题:Python Table.add_smart_styles方法的具体用法?Python Table.add_smart_styles怎么用?Python Table.add_smart_styles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.Table
的用法示例。
在下文中一共展示了Table.add_smart_styles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_smart_styles [as 别名]
def get_display(my):
search_key = my.kwargs.get("search_key")
path = my.kwargs.get("path")
parser_str = my.kwargs.get("parser")
use_tactic_tags = my.kwargs.get("use_tactic_tags")
from pyasm.checkin import PILMetadataParser, ImageMagickMetadataParser, ExifMetadataParser, BaseMetadataParser
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 = {}
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")
if len(str(value)) > 500:
inside = DivWdg()
td.add(inside)
value = value[:500]
inside.add(value)
inside.add_style("max-width: 600px")
else:
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>")
#.........这里部分代码省略.........
示例2: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_smart_styles [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")
#.........这里部分代码省略.........