本文整理汇总了Python中pyasm.web.Table.add_row_cell方法的典型用法代码示例。如果您正苦于以下问题:Python Table.add_row_cell方法的具体用法?Python Table.add_row_cell怎么用?Python Table.add_row_cell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.Table
的用法示例。
在下文中一共展示了Table.add_row_cell方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_target_span
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_row_cell [as 别名]
def _get_target_span(my):
# get the target span
search = Search(my.container_cls)
my._order_search(search)
groups = search.get_sobjects()
if groups:
my.container_sobj = groups[0]
target_span = SpanWdg(css='med')
group_table = Table(my.GROUP_TABLE_NAME, css='table')
group_table.add_style('width','30em')
group_table.add_col(css='small')
group_table.add_col(css='small')
group_table.add_col()
target_span.add(group_table)
group_table.add_row_cell(search.get_search_type_obj()\
.get_description(), "heading")
checkbox = CheckboxWdg()
checkbox.set_option("onclick", \
"a=new Elements('container_ids');a.toggle_all(this);")
group_table.add_row()
group_table.add_cell(checkbox)
col_name = group_table.get_next_col_name()
toggle_control = HiddenRowToggleWdg(col_name=col_name, is_control=True, auto_index=True)
group_table.add_cell(toggle_control)
group_table.add_cell('MASTER CONTROL')
remove_cmd = HiddenWdg(SObjectGroupCmd.REMOVE_CMD)
my.add(remove_cmd)
for group in groups:
group_table.add_row()
checkbox = CheckboxWdg("container_ids")
checkbox.set_option("value", group.get_primary_key_value() )
toggle = HiddenRowToggleWdg(col_name, auto_index=True)
toggle.store_event()
group_details = ItemInContainerWdg( group, my.item_sobj, my.item_cls, my.grouping_cls )
# set the target content of the toggle
toggle.set_static_content(group_details)
group_table.add_cell( checkbox )
group_table.add_cell( toggle, add_hidden_wdg=True )
group_table.add_cell( group.get_description())
num_items = group_details.get_num_items()
if num_items:
td = group_table.add_cell( "( %s )" % num_items, 'no_wrap')
td.add_color(color)
else:
group_table.add_blank_cell()
return target_span
示例2: get_sobject_info_wdg
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_row_cell [as 别名]
def get_sobject_info_wdg(my):
attr_table = Table()
attr_table.add_color("color", "color")
attr_table.add_color("background", "background", -5)
attr_table.add_border()
attr_table.set_box_shadow("0px 0px 5px")
sobject = my.get_sobject()
tr, td = attr_table.add_row_cell()
td.add("<b>Task Info<hr/></b>")
td.add_style("padding-top: 5px")
td.add_style("padding-left: 5px")
titles, exprs = my.get_task_info()
for title, expr in zip(titles, exprs):
try:
value = Search.eval(expr, sobject, single=True)
except Exception, e:
print "WARNING: ", e.message
continue
if value == '':
value = '<i>none</i>'
attr_table.add_row()
th = attr_table.add_cell("%s: " % title)
th.add_style("text-align: left")
th.add_style("padding-right: 15px")
th.add_style("padding-left: 5px")
th.add_style("padding-bottom: 2px")
td = attr_table.add_cell(value)
示例3: get_bottom
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_row_cell [as 别名]
def get_bottom(my):
if my.get_option("report") == "false":
return Widget()
table = Table()
table.add_row_cell("Report")
table.add_row()
table.add_blank_cell()
table.add_cell("# Tasks")
table.add_cell("Completion")
for process in my.processes_order:
my._draw_stat_row(table, process)
return table
示例4: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_row_cell [as 别名]
def get_display(self):
sobject = self.get_current_sobject()
context = self.kwargs.get('context')
if not context:
context = "publish"
snapshot = Snapshot.get_latest_by_sobject(sobject, context)
if not snapshot:
return "Nothing checked in"
xml = snapshot.get_xml_value("snapshot")
print xml.to_string()
# this is a comp object ... need to find the shot
shot = sobject.get_parent("prod/shot")
# now get all of the layers
layers = shot.get_all_children("prod/layer")
div = DivWdg()
table = Table(css='embed')
# get the renders for each of the references in the snapshot
#ref_nodes = xml.get_nodes("snapshot/file/ref")
ref_nodes = xml.get_nodes("snapshot/input_ref")
unknown_ref_nodes = xml.get_nodes("snapshot/unknown_ref")
if ref_nodes:
table.add_row_cell('Ref:')
self.draw_node(ref_nodes, table)
if unknown_ref_nodes:
table.add_row_cell('Unknown Ref:')
for node in unknown_ref_nodes:
table.add_row()
table.add_cell(xml.get_attribute(node, 'path'))
div.add(table)
return div
示例5: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_row_cell [as 别名]
def get_display(my):
my.sobject = my.get_sobject()
top = DivWdg()
top.add_class("spt_detail_top")
top.add_color("background", "background")
top.add_color("color", "color")
if not my.sobject:
top.add("No SObject defined for this widget")
return top
if my.parent:
my.search_type = my.parent.get_base_search_type()
my.search_key = SearchKey.get_by_sobject(my.parent)
top.add_attr("spt_parent_key", my.search_key)
my.pipeline_code = my.parent.get_value("pipeline_code", no_exception=True)
my.full_search_type = my.parent.get_search_type()
else:
my.pipeline_code = my.sobject.get_value("pipeline_code", no_exception=True)
my.search_type = my.sobject.get_base_search_type()
my.search_key = SearchKey.get_by_sobject(my.sobject)
my.full_search_type = my.sobject.get_search_type()
if not my.pipeline_code:
my.pipeline_code = 'default'
top.add_style("text-align: left")
my.set_as_panel(top)
table = Table()
#from tactic.ui.container import ResizableTableWdg
#table = ResizableTableWdg()
table.add_color("background", "background")
table.add_color("color", "color")
top.add(table)
table.set_max_width()
# add the title
tr, td = table.add_row_cell()
title_wdg = my.get_title_wdg()
td.add(title_wdg)
table.add_row()
# left
td = table.add_cell()
td.add_style("width: 300px")
td.add_style("min-width: 300px")
td.add_style("vertical-align: top")
div = DivWdg()
td.add(div)
div.add_class("spt_sobject_detail_top")
thumb_table = Table()
div.add(thumb_table)
thumb_table.add_row()
from tactic.ui.panel import ThumbWdg2
thumb = ThumbWdg2()
# use a larger version for clearer display
#thumb.set_icon_type('web')
if my.parent:
thumb.set_sobject(my.parent)
search_key = my.parent.get_search_key()
else:
thumb.set_sobject(my.sobject)
search_key = my.sobject.get_search_key()
gallery_div = DivWdg()
div.add( gallery_div )
gallery_div.add_class("spt_tile_gallery")
thumb_table.add_behavior( {
'type': 'click_up',
'search_key': search_key,
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_sobject_detail_top");
var gallery_el = top.getElement(".spt_tile_gallery");
var class_name = 'tactic.ui.widget.gallery_wdg.GalleryWdg';
var kwargs = {
search_key: bvr.search_key,
search_keys: [bvr.search_key],
};
spt.panel.load(gallery_el, class_name, kwargs);
''' } )
# prefer to see the original image, then web
#thumb.set_option('image_link_order', 'main|web|icon')
#thumb.set_option("detail", "false")
#thumb.set_option("icon_size", "100%")
#.........这里部分代码省略.........
示例6: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_row_cell [as 别名]
#.........这里部分代码省略.........
from pyasm.widget import WidgetConfig
tmp_path = __file__
dir_name = os.path.dirname(tmp_path)
file_path="%s/../config/dashboard-conf.xml" % (dir_name)
config = WidgetConfig.get(file_path=file_path, view="definition")
#element_name = "my_dashboard"
element_name = "my_dashboard"
attrs = config.get_element_attributes(element_name)
dashboard_data = {}
kwargs = config.get_display_options(element_name)
class_name = kwargs.get('class_name')
dashboard_data['class_name'] = class_name
dashboard_data['kwargs'] = kwargs
dashboard_data['title'] = attrs.get("title")
dashboard_data['description'] = attrs.get("description")
dashboard_data['image'] = attrs.get("image")
behavior = {
'type': 'click_up',
'dashboard': dashboard_data,
'cbjs_action': '''
var class_name = 'tactic.ui.startup.dashboards_wdg.DashboardsWdg';
var kwargs = {};
spt.tab.set_main_body_tab();
spt.tab.add_new("my_dashboard", "My Dashboard", bvr.dashboard.class_name, bvr.dashboard.kwargs);
'''
}
pipeline_wdg = my.get_section_wdg(title, description, image, behavior)
td.add(pipeline_wdg)
td = table.add_cell()
td.add_style("padding: 3px")
td.add_style("vertical-align: top")
title = "My Reports"
image = "<img src='/context/icons/64x64/report_64.png'/>"
description = '''TACTIC provides a number of predefined reports that project managers can access instantly to get real-time analytics.'''
behavior = {
'type': 'click_up',
'cbjs_action': '''
var class_name = 'tactic.ui.startup.reports_wdg.ReportsWdg';
var kwargs = {};
spt.tab.set_main_body_tab();
spt.tab.add_new("reports", "Reports", class_name, kwargs);
//spt.panel.load_popup("Reports", class_name, kwargs);
'''
}
side_bar_wdg = my.get_section_wdg(title, description, image, behavior)
td.add(side_bar_wdg)
"""
td = table.add_cell()
td.add_style("vertical-align: top")
td.add_style("padding: 3px")
title = "Documentation"
description = '''TACTIC Documentation.
<br/><br/>
* Project Setup Documentation<br/>
<br/>
* End User Documentation<br/>
<br/>
* Developer Documentation<br/>
<br/>
* System Administrator Documentation<br/>
<br/>
'''
image = "<img src='/context/images/getting_started_pipeline.png'/>"
behavior = {
'type': 'click_up',
'cbjs_action': '''
spt.help.load_alias("main")
'''
}
doc_wdg = my.get_section_wdg(title, description, image, behavior)
td.add(doc_wdg)
"""
tr, td = table.add_row_cell()
td.add_style("font-size: 14px")
td.add("<br/>"*2)
quick_links_wdg = QuickLinksWdg()
td.add(quick_links_wdg)
return top
示例7: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_row_cell [as 别名]
def get_display(my):
element_data_dict = {}
config = my.get_config()
element_names = config.get_element_names()
content_wdg = DivWdg()
if not element_names:
element_names = ['keywords']
my.set_content(content_wdg)
# this is somewhat duplicated logic from alter_search, but since this is called
# in ViewPanelWdg, it's a diff instance and needs to retrieve again
filter_data = FilterData.get()
data_list = filter_data.get_values_by_prefix(my.prefix)
for data in data_list:
handler = data.get("handler")
element_name = data.get("element_name")
if not element_name:
continue
element_data_dict[element_name] = data
elements_wdg = DivWdg()
content_wdg.add(elements_wdg)
elements_wdg.add_color("color", "color")
elements_wdg.add_style("padding-top: 10px")
elements_wdg.add_style("padding-bottom: 15px")
elements_wdg.add_color("background", "background3", 0)
elements_wdg.add_border()
if len(element_names) == 1:
elements_wdg.add_style("border-width: 0px 0px 0px 0px" )
elements_wdg.add_style("padding-right: 50px" )
else:
elements_wdg.add_style("border-width: 0px 1px 0px 0px" )
table = Table()
table.add_color("color", "color")
elements_wdg.add(table)
table.add_class("spt_simple_search_table")
num_rows = int(len(element_names)/2)+1
tot_rows = int(len(element_names)/2)+1
project_code = Project.get_project_code()
# my.search_type could be the same as my.base_search_type
full_search_type = SearchType.build_search_type(my.search_type, project_code)
visible_rows = my.kwargs.get("visible_rows")
if visible_rows:
visible_rows = int(visible_rows)
num_rows = visible_rows
else:
visible_rows = 0
titles = config.get_element_titles()
row_count = 0
for i, element_name in enumerate(element_names):
attrs = config.get_element_attributes(element_name)
if i % 2 == 0:
if visible_rows and row_count == visible_rows:
tr, td = table.add_row_cell("+ more ...")
td.add_class("hand")
td.add_class("SPT_DTS")
td.add_class("spt_toggle")
td.add_style("padding-left: 10px")
td.add_behavior( {
'type': 'click_up',
'visible_rows': visible_rows,
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_simple_search_table");
var expand = true;
var rows = top.getElements(".spt_simple_search_row");
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
if (row.getStyle("display") == "none") {
row.setStyle("display", "");
}
else {
row.setStyle("display", "none");
expand = false;
}
}
var spacer = top.getElements(".spt_spacer");
var cell = top.getElement(".spt_toggle");
if (expand) {
spacer.setStyle("height", (rows.length+bvr.visible_rows)*20);
cell.innerHTML = "- less ...";
}
else {
spacer.setStyle("height", bvr.visible_rows*20);
#.........这里部分代码省略.........
示例8: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_row_cell [as 别名]
#.........这里部分代码省略.........
width = my.kwargs.get("width")
if not width:
width = 500
table.add_style("width: %s" % width)
height = attrs.get('height')
if height:
table.add_style("height: %s" % height)
tr = table.add_row()
show_header = my.kwargs.get("show_header")
if show_header not in ['false', False]:
my.add_header(table, sobj_title)
single = my.kwargs.get("single")
if single in ['false', False] and my.mode == 'insert':
multi_div = DivWdg()
multi_div.add_style("text-align: left")
multi_div.add("Specify the number of items that will be added with this form:<br/><br/>")
multi_div.add("<b># of new items to add: </b>")
multi_div.add(" "*4)
multi_text = TextWdg("multiplier")
multi_text.add_style("width: 30px")
multi_div.add(multi_text)
tr, td = table.add_row_cell( multi_div )
if my.color_mode == "default":
td.add_color("border-color", "table_border", default="border")
td.add_style("border-width: 1px")
td.add_style("border-style: solid")
td.add_style("padding: 8 3 8 3")
td.add_color("background", "background3")
td.add_color("color", "color3")
security = Environment.get_security()
# break the widgets up in columns
num_columns = attrs.get('num_columns')
if not num_columns:
num_columns = my.kwargs.get('num_columns')
if not num_columns:
num_columns = 1
else:
num_columns = int(num_columns)
# go through each widget and draw it
for i, widget in enumerate(my.widgets):
# since a widget name called code doesn't necessariy write to code column, it is commented out for now
"""
key = { 'search_type' : search_type_obj.get_base_key(),
'column' : widget.get_name(),
'project': project_code}
# check security on widget
if not security.check_access( "sobject_column",\
示例9: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_row_cell [as 别名]
#.........这里部分代码省略.........
image = "<img src='/context/icons/64x64/dashboard_64.png'/>"
description = '''Dashboards display key project data in single views. Drill down further to work on tasks, make status changes or add notes.'''
# read the config file
#from pyasm.widget import WidgetConfig
#tmp_path = __file__
#dir_name = os.path.dirname(tmp_path)
#file_path="%s/../config/dashboard-conf.xml" % (dir_name)
#config = WidgetConfig.get(file_path=file_path, view="definition")
# FIXME: this bypasses the link security
#element_name = "dashboards"
#attrs = config.get_element_attributes(element_name)
#dashboard_data = {}
#kwargs = config.get_display_options(element_name)
#class_name = kwargs.get('class_name')
behavior = {
'type': 'click_up',
'cbjs_action': '''
var class_name = 'tactic.ui.startup.dashboards_wdg.DashboardsWdg';
var kwargs = {
help_alias: 'project-startup-dashboards'
};
spt.tab.set_main_body_tab();
spt.tab.add_new("dashboards", "Dashboards", class_name, kwargs);
'''
}
dashboard_wdg = self.get_section_wdg(title, description, image, behavior)
td.add(dashboard_wdg)
td = table.add_cell()
td.add_style("padding: 3px")
td.add_style("vertical-align: top")
title = "Reports"
image = "<img src='/context/icons/64x64/report_64.png'/>"
description = '''TACTIC provides a number of predefined reports that project managers can access instantly to get real-time analytics.'''
behavior = {
'type': 'click_up',
'cbjs_action': '''
var class_name = 'tactic.ui.startup.reports_wdg.ReportsWdg';
var kwargs = {};
spt.tab.set_main_body_tab();
spt.tab.add_new("reports", "Reports", class_name, kwargs);
//spt.panel.load_popup("Reports", class_name, kwargs);
'''
}
side_bar_wdg = self.get_section_wdg(title, description, image, behavior)
td.add(side_bar_wdg)
td = table.add_cell()
td.add_style("padding: 3px")
td.add_style("vertical-align: top")
title = "Lists of Items"
description = '''View all of the lists items for this project<br/><br/>
'''
image = "<img src='/context/icons/48x48/search_type_48.png'/>"
#image = "<img src='/context/images/getting_started_pipeline.png'/>"
behavior = {
'type': 'click_up',
'cbjs_action': '''
spt.tab.set_main_body_tab();
var class_name = 'tactic.ui.startup.HomeWdg';
var kwargs = {};
spt.tab.add_new("lists", "Lists", class_name, kwargs);
'''
}
config_wdg = self.get_section_wdg(title, description, image, behavior)
td.add(config_wdg)
tr, td = table.add_row_cell()
td.add_style("font-size: 14px")
td.add("<br/>"*2)
quick_links_wdg = QuickLinksWdg()
td.add(quick_links_wdg)
return top
示例10: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_row_cell [as 别名]
#.........这里部分代码省略.........
table = Table()
table.add_color("color", "color")
elements_wdg.add(table)
table.add_class("spt_simple_search_table")
columns = self.kwargs.get("columns")
if not columns:
columns = 2
else:
columns = int(columns)
num_rows = int(len(element_names)/columns)+1
tot_rows = int(len(element_names)/columns)+1
project_code = Project.get_project_code()
# self.search_type could be the same as self.base_search_type
full_search_type = SearchType.build_search_type(self.search_type, project_code)
visible_rows = self.kwargs.get("visible_rows")
if visible_rows:
visible_rows = int(visible_rows)
num_rows = visible_rows
else:
visible_rows = 0
titles = config.get_element_titles()
row_count = 0
for i, element_name in enumerate(element_names):
attrs = config.get_element_attributes(element_name)
if i % columns == 0:
if visible_rows and row_count == visible_rows:
tr, td = table.add_row_cell("+ more ...")
td.add_class("hand")
td.add_class("SPT_DTS")
td.add_class("spt_toggle")
td.add_style("padding-left: 10px")
td.add_behavior( {
'type': 'click_up',
'visible_rows': visible_rows,
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_simple_search_table");
var expand = true;
var rows = top.getElements(".spt_simple_search_row");
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
if (row.getStyle("display") == "none") {
row.setStyle("display", "");
}
else {
row.setStyle("display", "none");
expand = false;
}
}
var spacer = top.getElements(".spt_spacer");
var cell = top.getElement(".spt_toggle");
if (expand) {
spacer.setStyle("height", (rows.length+bvr.visible_rows)*20);
cell.innerHTML = "- less ...";
}
else {
spacer.setStyle("height", bvr.visible_rows*20);
cell.innerHTML = "+ more ...";
}
示例11: get_top
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_row_cell [as 别名]
def get_top(self):
top = self.top
top.add_color("background", "background", -5)
top.add_style("margin-bottom: -2px")
top.add_class("spt_filter_top")
table = Table()
top.add(table)
tr, td = table.add_row_cell()
td.add_class("spt_simple_search_title")
# add the load wdg
show_saved_search = True
if show_saved_search:
saved_button = ActionButtonWdg(title='Saved', tip='Load Saved Searches')
saved_button.add_class("spt_simple_search_save_button")
saved_button.add_behavior( {
#'type': 'load',
'search_type': self.search_type,
'cbjs_action': '''
var popup = bvr.src_el.getParent(".spt_popup");
spt.popup.close(popup);
var class_name = 'tactic.ui.app.LoadSearchWdg';
var kwargs = {
search_type: bvr.search_type
}
var layout = spt.table.get_layout();
var panel = layout.getParent(".spt_view_panel_top");
var popup = spt.panel.load_popup("Saved Searches", class_name, kwargs);
popup.activator = panel;
'''
} )
td.add(saved_button)
saved_button.add_style("float: right")
saved_button.add_style("margin: 10px")
clear_button = ActionButtonWdg(title='Clear', tip='Clear all of the filters' )
td.add(clear_button)
clear_button.add_class("spt_simple_search_clear_button")
clear_button.add_style("float: right")
clear_button.add_style("margin: 10px")
clear_button.add_behavior( {
'type': 'click',
'cbjs_action': '''
spt.api.Utility.clear_inputs(bvr.src_el.getParent(".spt_filter_top"));
'''
} )
title_div = DivWdg()
td.add(title_div)
title_div.add("<div style='font-size: 16px'>Search Criteria</div>")
title_div.add("<div>Select filters to refine your search</div>")
title_div.add_style("padding: 20px 0px 0px 20px")
table.add_style("margin-left: auto")
table.add_style("margin-right: auto")
table.add_style("margin-bottom: 15px")
table.add_style("width: 100%")
tr = table.add_row()
if not self.content:
self.content = DivWdg()
self.content.add("No Content")
td = table.add_cell()
td.add(self.content)
#self.content.add_style("margin: -2 -1 0 -1")
show_search = self.kwargs.get("show_search")
if show_search in [False, 'false']:
show_search = False
else:
show_search = True
show_search = True
if show_search:
search_wdg = self.get_search_wdg()
table.add_row()
search_wdg.add_style("float: right")
search_wdg.add_class("spt_simple_search_button")
search_wdg.add_style("padding-top: 6px")
search_wdg.add_style("padding-left: 10px")
search_wdg.add_style("height: 33px")
td = table.add_cell()
td.add(search_wdg)
td.add_style("padding: 5px 10px")
#.........这里部分代码省略.........
示例12: get_top
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_row_cell [as 别名]
def get_top(my):
top = my.top
top.add_color("background", "background", -5)
top.add_style("margin-bottom: -2px")
top.add_class("spt_filter_top")
table = Table()
top.add(table)
title_div = DivWdg()
tr, td = table.add_row_cell()
td.add(title_div)
title_div.add("<div style='font-size: 16px'>Search Criteria</div>")
title_div.add("<div>Select filters to refine your search</div>")
title_div.add_style("padding: 20px 0px 0px 20px")
table.add_style("margin-left: auto")
table.add_style("margin-right: auto")
table.add_style("margin-bottom: 15px")
table.add_style("width: 100%")
tr = table.add_row()
if not my.content:
my.content = DivWdg()
my.content.add("No Content")
td = table.add_cell()
td.add(my.content)
#my.content.add_style("margin: -2 -1 0 -1")
show_search = my.kwargs.get("show_search")
if show_search in [False, 'false']:
show_search = False
else:
show_search = True
show_search = False
if show_search:
search_wdg = my.get_search_wdg()
table.add_row()
search_wdg.add_style("float: left")
search_wdg.add_style("padding-top: 6px")
search_wdg.add_style("padding-left: 10px")
search_wdg.add_style("height: 33px")
td = table.add_cell()
td.add(search_wdg)
td.add_style("padding: 5px 20px")
#td.add_border()
#td.add_color("background", "background", -10)
hidden = HiddenWdg("prefix", my.prefix)
top.add(hidden)
# this cannot be spt_search as it will confuse spt.dg_table.search_cbk()
top.add_class("spt_simple_search")
return top
示例13: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_row_cell [as 别名]
def get_display(my):
top = DivWdg()
element_name = my.kwargs.get('element_name')
config_view = my.kwargs.get("config_view")
display_class = config_view.get_display_handler(element_name)
display_options = config_view.get_display_options(element_name)
element_attr = config_view.get_element_attributes(element_name)
name = element_attr.get('name')
edit = element_attr.get('edit')
title = element_attr.get('title')
width = element_attr.get('width')
# add the name
from pyasm.web import Table
table = Table()
top.add(table)
table.add_row()
td = table.add_cell("Name: ")
td.add_style("padding: 5px")
name_text = SpanWdg(name)
name_text.add_style('font-weight: bold')
name_text.add_attr("size", "50")
table.add_cell(name_text)
table.add_row_cell("<br/>Element Attributes:<br/>")
# add the title
table.add_row()
td = table.add_cell("Title: ")
td.add_style("padding: 5px")
title_text = TextWdg("title")
title_text.add_attr("size", "50")
if title:
title_text.set_value(title)
table.add_cell(title_text)
# add the width
table.add_row()
td = table.add_cell("Width: ")
td.add_style("padding: 5px")
width_text = TextWdg("width")
if width:
width_text.set_value(width)
width_text.add_attr("size", "50")
table.add_cell(width_text)
# add the editable
table.add_row()
td = table.add_cell("Editable: ")
td.add_style("padding: 5px")
editable_text = CheckboxWdg("editable")
editable_text.add_attr("size", "50")
table.add_cell(editable_text)
table.add_row_cell("<br/>Display:<br/>")
# add the widget
table.add_row()
td = table.add_cell("Widget: ")
td.add_style("padding: 5px")
widget_select = SelectWdg("widget")
options = ['Expression']
widget_select.set_option("values", options)
widget_select.add_empty_option("-- Select --")
#widget_select.set_value(display_class)
table.add_cell(widget_select)
table.add_row_cell(" - or -")
# add the class
table.add_row()
td = table.add_cell("Class Name: ")
td.add_style("padding: 5px")
class_text = TextWdg("class_name")
class_text.set_value(display_class)
class_text.add_attr("size", "50")
table.add_cell(class_text)
# introspect the widget
if not display_class:
display_class = "pyasm.widget.SimpleTableElementWdg"
#display_class = "tactic.ui.panel.ViewPanelWdg"
from pyasm.common import Common
import_stmt = Common.get_import_from_class_path(display_class)
if import_stmt:
exec(import_stmt)
else:
#.........这里部分代码省略.........
示例14: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_row_cell [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")
#.........这里部分代码省略.........
示例15: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_row_cell [as 别名]
#.........这里部分代码省略.........
# Widget Config
td = table.add_cell()
td.add_style("padding: 3px")
td.add_style("vertical-align: top")
title = "Widget Config"
image = IconWdg("Widget Config", IconWdg.WIDGET_CONFIG_01)
div = DivWdg(image)
image = div
description = "Modify the base widget configurations for the project."
behavior = {
'type': 'click_up',
'cbjs_action': '''
spt.tab.set_main_body_tab();
var class_name = 'tactic.ui.panel.ViewPanelWdg';
var kwargs = {
'view': 'table',
'search_type': 'config/widget_config',
help_alias: 'tactic-widgets'
};
spt.tab.add_new("widget_config", "Widget Config", class_name, kwargs);
'''
}
config_wdg = my.get_small_section_wdg(title, description, image, behavior)
td.add(config_wdg)
# Quicklinks
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)