本文整理汇总了Python中pyasm.widget.CheckboxWdg类的典型用法代码示例。如果您正苦于以下问题:Python CheckboxWdg类的具体用法?Python CheckboxWdg怎么用?Python CheckboxWdg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CheckboxWdg类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_item_div
def get_item_div(my, sobjects, related_type):
item_div = DivWdg()
item_div.add_style("margin: 15px 10px")
sobject = sobjects[0]
checkbox = CheckboxWdg('related_types')
item_div.add(checkbox)
checkbox.set_attr("value", related_type)
if related_type in ["sthpw/snapshot", "sthpw/file"]:
checkbox.set_checked()
item_div.add(" ")
item_div.add(related_type)
item_div.add(": ")
if related_type.startswith("@SOBJECT"):
related_sobjects = Search.eval(related_type, [sobject], list=True)
else:
try:
related_sobjects = []
for sobject in sobjects:
sobjs = sobject.get_related_sobjects(related_type)
related_sobjects.extend(sobjs)
except Exception, e:
print "WARNING: ", e
related_sobjects = []
示例2: get_files_checkbox_from_file_list
def get_files_checkbox_from_file_list(file_sobjects, selected_file_sobjects):
"""
Given a list of file sobjects, return a table of Checkbox widgets (CheckboxWdg) using the file paths and codes.
If a file is also in the selected_file_sobjects list, check it automatically.
:param file_sobjects: List of file sobjects
:param selected_file_sobjects: List of file sobjects (that are already selected)
:return: Table
"""
files_checkbox_table = Table()
header_row = files_checkbox_table.add_row()
header = files_checkbox_table.add_header(data='Files', row=header_row)
header.add_style('text-align', 'center')
header.add_style('text-decoration', 'underline')
for file_sobject in file_sobjects:
checkbox = CheckboxWdg(name=file_sobject.get_code())
if file_sobject.get_code() in [selected_file.get_code() for selected_file in selected_file_sobjects]:
checkbox.set_checked()
checkbox_row = files_checkbox_table.add_row()
files_checkbox_table.add_cell(data=checkbox, row=checkbox_row)
files_checkbox_table.add_cell(data=file_sobject.get_value('file_path'), row=checkbox_row)
return files_checkbox_table
示例3: get_render_icon_wdg
def get_render_icon_wdg(my):
'''Checkbox determines whether to create icon'''
div = DivWdg()
div.add("Create Icon: ")
checkbox = CheckboxWdg("render")
checkbox.set_persistence()
div.add(checkbox)
return div
示例4: get_display
def get_display(my):
sobject = my.get_current_sobject()
checkbox = CheckboxWdg()
checkbox.set_name(my.name)
checkbox.set_option( "value", sobject.get_search_key() )
return checkbox
示例5: get_display
def get_display(self):
sobject = self.get_current_sobject()
search_key = sobject.get_search_key()
div = DivWdg()
checkbox = CheckboxWdg("search_key")
checkbox.set_option("value", search_key)
div.add(checkbox)
return div
示例6: make_check_table
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
示例7: get_page_four
def get_page_four(my):
last_page = DivWdg()
last_page.add_style("padding-top: 80px")
last_page.add_style("padding-left: 30px")
cb = CheckboxWdg('jump_to_tab', label='Jump to Tab')
cb.set_checked()
last_page.add(cb)
last_page.add(HtmlElement.br(5))
button_div = DivWdg()
create_button = ActionButtonWdg(title="Create >>", tip="Create new project")
my.wizard.add_submit_button(create_button)
create_button.add_style("float: right")
create_button.add_behavior({
'type': "click_up",
'cbjs_action': '''
spt.alert('perform action here');
'''
})
# you can even pass in a custom cacel_script like
# spt.info("You have cancelled")
cancel_script = my.kwargs.get("cancel_script")
if cancel_script:
cancel_button = ActionButtonWdg(title="Cancel")
cancel_button.add_style("float: left")
cancel_button.add_behavior({
'type': "click_up",
'cbjs_action': cancel_script
})
button_div.add(cancel_button)
create_button.add_style("margin-right: 15px")
create_button.add_style("margin-left: 75px")
button_div.add("<br clear='all'/>")
last_page.add(button_div)
return last_page
示例8: get_instantiation_wdg
def get_instantiation_wdg(self):
setting = self.get_default_setting()
default_instantiation = setting.get('instantiation')
div = DivWdg()
is_unchecked = True
default_cb = None
for value in self.get_instantiation_options():
name = self.get_element_name("instantiation")
checkbox = CheckboxWdg( name )
if value == default_instantiation:
default_cb = checkbox
checkbox.set_option("value", value)
checkbox.set_persistence()
if checkbox.is_checked():
is_unchecked = False
checkbox.add_behavior({'type': 'click_up',
'propagate_evt': True,
"cbjs_action": "spt.toggle_checkbox(bvr, '.spt_ui_options', '%s')" %name})
span = SpanWdg(checkbox, css='small')
span.add(value)
div.add(span)
if is_unchecked:
default_cb.set_checked()
return div
示例9: make_intermediate_unit
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
示例10: init
def init(my):
my.is_refresh = my.kwargs.get('is_refresh')
my.file_path = my.kwargs.get('file_path')
my.search_type = my.kwargs.get('search_type')
my.search_type_obj = SearchType.get(my.search_type)
web = WebContainer.get_web()
my.encoder = web.get_form_value('encoder')
title_row_checkbox = CheckboxWdg("has_title")
my.has_title = title_row_checkbox.is_checked()
lowercase_title_checkbox = CheckboxWdg("lowercase_title")
my.lowercase_title = lowercase_title_checkbox.is_checked()
示例11: get_checkboxes_section
def get_checkboxes_section(outer_div):
checkboxes_div = DivWdg()
bigboard_wdg = CheckboxWdg('bigboard', 'Hot Title?')
no_charge_wdg = CheckboxWdg('no_charge', 'No Charge')
redo_wdg = CheckboxWdg('redo', 'Redo')
repurpose_wdg = CheckboxWdg('repurpose', 'Repurpose')
bigboard_wdg.get_value()
checkboxes_div.add(bigboard_wdg)
checkboxes_div.add(no_charge_wdg)
checkboxes_div.add(redo_wdg)
checkboxes_div.add(repurpose_wdg)
outer_div.add(checkboxes_div)
示例12: handle_xml_mode
def handle_xml_mode(my, custom_table, mode):
tbody = custom_table.add_tbody()
tbody.add_class("spt_custom_xml")
if mode != 'xml':
tbody.add_style('display: none')
# extra for custom config_xml
custom_table.add_row()
td = custom_table.add_cell()
td.add("Config XML Definition")
div = DivWdg()
div.set_id("config_xml_options")
#div.add_style("display: none")
div.add_style("margin-top: 10px")
default = '''
<element name=''>
<display class=''>
<option></option>
</display>
</element>
'''
config_xml_wdg = TextAreaWdg("config_xml")
config_xml_wdg.set_option("rows", "8")
config_xml_wdg.set_option("cols", "50")
config_xml_wdg.set_value(default)
div.add( config_xml_wdg )
custom_table.add_cell(div)
# create columns
custom_table.add_row()
td = custom_table.add_cell()
create_columns_wdg = CheckboxWdg("create_columns")
create_columns_wdg.set_checked()
td.add("Create required columns? ")
td = custom_table.add_cell()
td.add(create_columns_wdg)
custom_table.close_tbody()
示例13: get_display
def get_display(self):
outer_div = DivWdg()
outer_div.set_id('link_components_to_packages_div')
table = Table()
table.add_attr('id', 'link_components_to_packages_table')
table.add_style('width', '100%')
table.add_border(style='solid', color='#F2F2F2', size='1px')
order_code = self.order_sobject.get_code()
components = get_component_sobjects_from_order_code(order_code)
packages = get_package_sobjects_from_order_code(order_code)
existing_component_package_links = self.get_existing_entries(components, packages)
package_row = table.add_row()
table.add_cell(row=package_row)
for package in packages:
table.add_cell(package.get('name'), row=package_row)
for component in components:
component_row = table.add_row()
component_row.set_id(component.get_code())
table.add_cell(component.get('name'), row=component_row)
for package in packages:
checkbox = CheckboxWdg(name='{0}_{1}'.format(component.get_code(), package.get_code()))
if self.component_package_link_exists(component, package, existing_component_package_links):
checkbox.set_checked()
checkbox_cell = table.add_cell(checkbox)
checkbox_cell.add_style('text-align', 'center')
outer_div.add(table)
submit_button = SubmitWdg('Submit')
submit_button.add_behavior(self.get_submit_button_behavior())
outer_div.add(submit_button)
return outer_div
示例14: init
def init(self):
self.add("Process: ")
checkbox = CheckboxWdg("process")
checkbox.set_option("value", "on")
checkbox.set_persistence()
checkbox.add_event("onclick", "document.form.submit()")
self.add(checkbox)
示例15: get_item_div
def get_item_div(self, sobjects, related_type):
item_div = DivWdg()
item_div.add_style("margin: 15px 10px")
sobject = sobjects[0]
checkbox = CheckboxWdg('related_types')
item_div.add(checkbox)
checkbox.add_style("vertical-align: bottom")
checkbox.set_attr("value", related_type)
if related_type in ["sthpw/snapshot", "sthpw/file"]:
checkbox.set_checked()
checked_types = self.kwargs.get("checked_types")
if checked_types == "__ALL__":
checkbox.set_checked()
item_div.add(" ")
item_div.add(related_type)
item_div.add(": ")
if related_type.startswith("@SOBJECT"):
related_sobjects = Search.eval(related_type, [sobject], list=True)
else:
try:
related_sobjects = []
for sobject in sobjects:
sobjs = sobject.get_related_sobjects(related_type)
related_sobjects.extend(sobjs)
except Exception as e:
print("WARNING: ", e)
related_sobjects = []
item_div.add("(%s)" % len(related_sobjects))
if len(related_sobjects) == 0:
item_div.add_style("opacity: 0.5")
return None
else:
# leave them unchecked for now to account for user's careless delete behavior
pass
# skip checking login by default to avoid accidental delete
#if related_type != 'sthpw/login':
# checkbox.set_checked()
return item_div