本文整理汇总了Python中pyasm.widget.CheckboxWdg.add_attr方法的典型用法代码示例。如果您正苦于以下问题:Python CheckboxWdg.add_attr方法的具体用法?Python CheckboxWdg.add_attr怎么用?Python CheckboxWdg.add_attr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.CheckboxWdg
的用法示例。
在下文中一共展示了CheckboxWdg.add_attr方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_login_table
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import add_attr [as 别名]
def make_login_table(my, sob):
table = Table()
table.add_style('background-color: #fffff1;')
max_width = 4
table.add_row()
top_cell = table.add_cell('<b><u>Responsible</u></b>')
top_cell.add_attr('colspan',max_width)
top_cell.add_attr('align','center')
count = 0
users = my.server.eval("@SOBJECT(sthpw/login['location','internal']['license_type','user']['@ORDER_BY','login'])")
for u in users:
if count % max_width == 0:
table.add_row()
checker = CheckboxWdg('responsible_%s' % u.get('login'))
checker.add_attr('login',u.get('login'))
checker.add_attr('code',sob.get('code'))
checker.add_attr('current_list', sob.get('responsible_users'))
#checker.set_persistence()
if sob.get('responsible_users') not in [None,'']:
if u.get('login') in sob.get('responsible_users'):
checker.set_value(True)
else:
checker.set_value(False)
else:
checker.set_value(False)
checker.add_behavior(my.get_make_responsible_behavior())
table.add_cell(checker)
label = table.add_cell(u.get('login'))
label.add_attr('nowrap','nowrap')
label.add_attr('width','137px')
count = count + 1
return table
示例2: make_check_table
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import add_attr [as 别名]
def make_check_table(my, dictoid, arr, sob, my_name, color, is_external_rejection=False):
table = Table()
table.add_style('background-color: %s;' % color)
max_width = 3
table.add_row()
top_cell = table.add_cell('<b><u>%s</u></b>' % my_name)
top_cell.add_attr('colspan',max_width)
top_cell.add_attr('align','center')
count = 0
for entry in arr:
if count % max_width == 0:
table.add_row()
checker = CheckboxWdg('check_%s' % dictoid[entry])
checker.add_attr('code', sob.get('code'))
checker.add_attr('field', dictoid[entry])
#checker.set_persistence()
if sob.get(dictoid[entry]):
checker.set_value(True)
else:
checker.set_value(False)
if not is_external_rejection:
checker.add_behavior(my.get_reason_check_behavior(dictoid[entry]))
check_hold = table.add_cell(checker)
check_hold.add_attr('code', sob.get('code'))
check_hold.add_attr('field', dictoid[entry])
label = table.add_cell(entry)
label.add_attr('nowrap','nowrap')
label.add_attr('width','190px')
count = count + 1
return table
示例3: make_intermediate_unit
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import add_attr [as 别名]
def make_intermediate_unit(my, in_link, work_order_code, in_or_out, type_str):
inlink_st = in_link.get('__search_key__').split('?')[0]
if inlink_st == 'twog/work_order_intermediate':
lookmeup = in_link.get('intermediate_file_code')
elif inlink_st == 'twog/work_order_passin':
lookmeup = in_link.get('intermediate_file_code')
sob = my.server.eval("@SOBJECT(twog/intermediate_file['code','%s'])" % lookmeup)[0]
table = Table()
name = sob.get('name')
description = sob.get('description')
table.add_attr('width','100%s' % '%')
table.add_attr('border','1')
table.add_style('background-color: %s;' % my.color_lookup[in_or_out])
table.add_row()
table_src = Table()
type_cell = table_src.add_cell(type_str)
type_cell.add_attr('width', '25%s' % '%')
table_src.add_row()
checkbox = CheckboxWdg('src_disp_chk_%s' % sob.get('code'))
checkbox.add_attr('code',sob.get('code'))
checkbox.add_attr('special_name',name)
checkbox.add_attr('location',sob.get('location'))
checkbox.set_value(False)
#checkbox.set_persistence()
table_src.add_cell(checkbox)
table.add_cell(table_src)
info_tbl = Table()
info_tbl.add_attr('width','100%s' % '%')
info_tbl.add_row()
cell1 = info_tbl.add_cell('<u>Title:</u> %s' % name)
cell1.add_style('cursor: pointer;')
cell1.add_behavior(my.inspect_intermediate_popup(sob.get('code')))
if in_or_out == 'IN':
killer = info_tbl.add_cell(my.x_butt)
killer.add_style('cursor: pointer;')
killer.add_behavior(my.get_intermediate_passin_killer_behavior(in_link.get('code'), work_order_code, name))
info_tbl.add_row()
desc = info_tbl.add_cell(description)
desc.add_attr('colspan','2')
else:
info_tbl.add_row()
desc = info_tbl.add_cell(description)
long_cell = table.add_cell(info_tbl)
long_cell.add_attr('width','75%s' % '%')
table.add_row()
loc_cell1 = table.add_cell(' <u>Location:</u>')
loc_cell1.add_style('cursor: pointer;')
loc_cell1.add_behavior(my.location_changer(sob.get('__search_key__')))
loc_cell2 = table.add_cell(sob.get('location'))
loc_cell2.add_attr('class', 'sd_location_%s' % sob.get('code'))
loc_cell2.add_attr('colspan','2')
return table
示例4: make_source_unit
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import add_attr [as 别名]
def make_source_unit(my, in_link, work_order_code, in_or_out, type_str):
inlink_st = in_link.get('__search_key__').split('?')[0]
linker = ''
if inlink_st == 'twog/work_order_passin':
linker = in_link.get('deliverable_source_code')
elif inlink_st == 'twog/work_order_deliverables':
linker = in_link.get('deliverable_source_code')
elif inlink_st == 'twog/work_order_sources':
linker = in_link.get('source_code')
sob = my.server.eval("@SOBJECT(twog/source['code','%s'])" % linker)[0]
st = sob.get('__search_key__').split('?')[0]
title = sob.get('title')
if sob.get('episode') not in [None,'']:
title = "%s: %s" % (title, sob.get('episode'))
part = ''
if sob.get('part') not in [None,'']:
part = sob.get('part')
table = Table()
table.add_attr('width','100%s' % '%')
table.add_attr('border','1')
table.add_style('background-color: %s;' % my.color_lookup[in_or_out])
table.add_row()
table_src = Table()
type_cell = table_src.add_cell(type_str)
type_cell.add_attr('width', '25%s' % '%')
table_src.add_row()
checkbox = CheckboxWdg('src_disp_chk_%s' % sob.get('code'))
checkbox.add_attr('code',sob.get('code'))
checkbox.add_attr('special_name',sob.get('barcode'))
checkbox.add_attr('location',sob.get('location'))
checkbox.set_value(False)
#checkbox.set_persistence()
table_src.add_cell(checkbox)
table.add_cell(table_src)
top_tbl = Table()
top_tbl.add_attr('width','100%s' % '%')
top_tbl.add_row()
top_tbl.add_cell('<u>Title:</u> %s' % title)
if type_str == 'SRC':
killer = top_tbl.add_cell(my.x_butt)
killer.add_style('cursor: pointer;')
killer.add_behavior(my.get_source_killer_behavior(in_link.get('code'), work_order_code, title))
elif type_str == 'SRC-PASSIN':
killer = top_tbl.add_cell(my.x_butt)
killer.add_style('cursor: pointer;')
killer.add_behavior(my.get_deliverable_passin_killer_behavior(in_link.get('code'), work_order_code, title))
info_tbl = Table()
info_tbl.add_attr('width','100%s' % '%')
info_tbl.add_row()
info_tbl.add_cell(top_tbl)
info_tbl.add_row()
info_tbl.add_cell('<u>Part:</u> %s' % part)
info_tbl.add_row()
cell1 = info_tbl.add_cell('<u>Barcode: <b>%s</u></b>' % (sob.get('barcode')))
cell1.add_style('cursor: pointer;')
cell1.add_behavior(my.inspect_source_popup(sob.get('code'), sob.get('high_security')))
info_tbl.add_row()
info_tbl.add_cell('%s, %s, %s' % (sob.get('standard'), sob.get('aspect_ratio'), sob.get('total_run_time')))
long_cell = table.add_cell(info_tbl)
long_cell.add_attr('width','75%s' % '%')
table.add_row()
loc_cell1 = table.add_cell(' <u>Location:</u>')
loc_cell1.add_style('cursor: pointer;')
loc_cell1.add_behavior(my.location_changer(sob.get('__search_key__')))
loc_cell2 = table.add_cell(sob.get('location'))
loc_cell2.add_attr('class', 'sd_location_%s' % sob.get('code'))
loc_cell2.add_attr('colspan','2')
return table
示例5: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import add_attr [as 别名]
#.........这里部分代码省略.........
collection_div.add_style("margin: 3px 5px 0px 5px")
go_wdg = DivWdg()
collection_div.add(go_wdg)
go_wdg.add_style("float: right")
icon = IconWdg(name="View Collection", icon="BS_CHEVRON_RIGHT")
go_wdg.add(icon)
#go_wdg.add_behavior( {
# 'type': 'click_upX',
# 'cbjs_action': '''
# alert("Not Implemented");
# '''
#} )
name = collection.get_value("name")
# Adding Collection title (without the number count) as an attribute
collection_div.set_attr("collection_name", name)
if not name:
name = collection.get_value("code")
check_div = DivWdg()
collection_div.add(check_div)
check = CheckboxWdg("collection_key")
check.add_class("spt_collection_checkbox")
check_div.add(check)
check_div.add_style("float: left")
check_div.add_style("margin-right: 5px")
check_div.add_style("margin-top: -3px")
check.add_attr("collection_key", collection.get_search_key() )
info_div = DivWdg()
collection_div.add(info_div)
info_div.add(name)
if num_items:
info_div.add(" (%s)" % num_items)
collection_div.add("<hr/>")
add_button = DivWdg()
add_button.add("Add")
add_button.add_style("margin: 0px 10px 10px 10px")
add_button.add_style("width: 50px")
add_button.add_class("btn btn-primary")
dialog.add(add_button)
add_button.add_behavior( {
'type': 'click',
'cbjs_action': '''
var search_keys = spt.table.get_selected_search_keys(false);
if (search_keys.length == 0) {
spt.notify.show_message("No assets selected.");
return;
}
var top = bvr.src_el.getParent(".spt_dialog");
var checkboxes = top.getElements(".spt_collection_checkbox");
var cmd = "tactic.ui.panel.CollectionAddCmd";
var server = TacticServerStub.get();
示例6: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import add_attr [as 别名]
#.........这里部分代码省略.........
go_wdg = DivWdg()
collection_div.add(go_wdg)
go_wdg.add_style("float: right")
#TODO: add some interaction with this arrow
# icon = IconWdg(name="View Collection", icon="BS_CHEVRON_RIGHT")
# go_wdg.add(icon)
#go_wdg.add_behavior( {
# 'type': 'click_upX',
# 'cbjs_action': '''
# alert("Not Implemented");
# '''
#} )
name = collection.get_value("name")
# Adding Collection title (without the number count) as an attribute
#collection_div.set_attr("collection_name", name)
if not name:
name = collection.get_value("code")
check_div = DivWdg()
collection_div.add(check_div)
check = CheckboxWdg("collection_key")
check.add_class("spt_collection_checkbox")
check_div.add(check)
check_div.add_style("float: left")
check_div.add_style("margin-right: 5px")
check_div.add_style("margin-top: -3px")
check.add_attr("collection_key", collection.get_search_key() )
check.add_attr("collection_name", collection.get_name() )
info_div = DivWdg()
collection_div.add(info_div)
info_div.add(name)
if num_items:
info_div.add(" (%s)" % num_items)
collection_div.add("<hr/>")
add_button = DivWdg()
add_button.add("Add")
add_button.add_style("margin: 0px 10px 10px 10px")
add_button.add_style("width: 50px")
add_button.add_class("btn btn-primary")
dialog.add(add_button)
add_button.add_behavior( {
'type': 'click',
'cbjs_action': '''
var search_keys = spt.table.get_selected_search_keys(false);
if (search_keys.length == 0) {
spt.notify.show_message("No items selected.");
return;
}
var top = bvr.src_el.getParent(".spt_dialog");
var checkboxes = top.getElements(".spt_collection_checkbox");
示例7: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import add_attr [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:
#.........这里部分代码省略.........
示例8: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import add_attr [as 别名]
#.........这里部分代码省略.........
keys = ['','','','','','','']
table.add_smart_styles("spt_cell", {
'height': '20px'
} )
keys.sort()
for i, key in enumerate(keys):
value = metadata.get(key)
value = Common.process_unicode_string(value)
if not isinstance(key, basestring):
key = str(key)
#title = Common.get_display_title(key)
title = key
tr = table.add_row()
tr.add_class("tactic_hover")
if i % 2:
tr.add_color("background", "background", -2)
tr.add_color("color", "color")
else:
tr.add_color("background", "background")
tr.add_color("color", "color")
td = table.add_cell()
td.add_class("spt_cell")
td.add(title)
td.add_style("width: 300px")
td.add_style("min-width: 200px")
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)
td.add_style("max-width: 600px")
td.add_style("overflow: hidden")
td.add_style("text-overflow: ellipsis")
td.add_style("white-space: nowrap")
td = table.add_cell()
td.add_class("spt_cell")
try:
is_ascii = True
for c in str(value):
if ord(c) > 128:
is_ascii = False
break
if not is_ascii:
continue
except Exception as e:
print("WARNING: ", e)
continue
from pyasm.widget import CheckboxWdg
checkbox = CheckboxWdg("searchable")
checkbox.add_attr("spt_is_multiple", "true")
td.add(checkbox)
td.add_style("width: 40px")
td.add_style("max-width: 30px")
checkbox.set_option("value", "%s|%s|%s" % (parser_title,key,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