本文整理汇总了Python中pyasm.widget.CheckboxWdg.set_checked方法的典型用法代码示例。如果您正苦于以下问题:Python CheckboxWdg.set_checked方法的具体用法?Python CheckboxWdg.set_checked怎么用?Python CheckboxWdg.set_checked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.CheckboxWdg
的用法示例。
在下文中一共展示了CheckboxWdg.set_checked方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_item_div
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_checked [as 别名]
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
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_checked [as 别名]
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_item_wdg
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_checked [as 别名]
def get_item_wdg(self, item, is_template=False):
item_div = DivWdg()
item_div.add_style("margin-top: 3px")
if is_template == True:
item_div.add_style("display: none")
#item_div.add_style("border: solid 1px blue")
item_div.add_class("spt_list_template_item")
else:
item_div.add_class("spt_list_item")
outer = DivWdg()
outer.add_style("float: left")
outer.add_style("text-align: left")
outer.add(item)
if self.show_enabled:
checkbox = CheckboxWdg("enabled")
checkbox.add_style("float: left")
checkbox.set_checked()
else:
checkbox = HiddenWdg("enabled")
item_div.add(checkbox)
#item_div.add(item)
item_div.add(outer)
from tactic.ui.widget import IconButtonWdg
add_wdg = DivWdg()
add_wdg.add_class("hand")
add_wdg.add_class("SPT_DTS")
#add_wdg.add("(+)")
add_wdg.add_class("spt_add")
button = IconButtonWdg(title="Add Entry", icon="BS_PLUS")
add_wdg.add(button)
add_wdg.add_style("float: left")
add_wdg.add_style("opacity: 0.5")
#add_wdg.add_style("margin: 3px")
item_div.add(add_wdg)
remove_wdg = DivWdg()
remove_wdg.add_class("hand")
remove_wdg.add_class("SPT_DTS")
#remove_wdg.add("(-)")
remove_wdg.add_class("spt_remove")
button = IconButtonWdg(title="Remove Entry", icon="BS_REMOVE")
remove_wdg.add(button)
remove_wdg.add_style("float: left")
remove_wdg.add_style("opacity: 0.5")
#remove_wdg.add_style("margin: 3px")
item_div.add(remove_wdg)
item_div.add("<br clear='all'/>")
return item_div
示例4: get_page_four
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_checked [as 别名]
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
示例5: get_item_div
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_checked [as 别名]
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
示例6: handle_xml_mode
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_checked [as 别名]
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()
示例7: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_checked [as 别名]
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
示例8: get_format_wdg
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_checked [as 别名]
def get_format_wdg(self, value, format, display_value):
div = DivWdg()
if format not in ['Checkbox'] and value == '':
return div
if format == 'Checkbox':
div.add_style("width: 100%")
div.add_class("spt_boolean_top")
from pyasm.widget import CheckboxWdg
checkbox = CheckboxWdg(self.get_name())
checkbox.set_option("value", "true")
if value:
checkbox.set_checked()
div.add(checkbox)
checkbox.add_behavior( {
'type': 'click_up',
'propagate_evt': True,
'cbjs_action': '''
var cached_data = {};
var value_wdg = bvr.src_el;
var top_el = bvr.src_el.getParent(".spt_boolean_top");
spt.dg_table.edit.widget = top_el;
var key_code = spt.kbd.special_keys_map.ENTER;
spt.dg_table.inline_edit_cell_cbk( value_wdg, cached_data );
'''
} )
elif format == '-$1,234.00':
if value < 0:
div.add_style("color: red")
div.add("(%s)" % display_value.replace("-", ""))
else:
div.add_style("color: black")
div.add(display_value)
else:
div.add(display_value)
return div
示例9: get_format_value
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_checked [as 别名]
#.........这里部分代码省略.........
value = value.strftime(setting)
elif format == 'DATE':
if not value:
value = ''
else:
value = parser.parse(value)
setting = ProdSetting.get_value_by_key('DATE')
if not setting:
setting = "%Y-%m-%d"
value = value.strftime(setting)
# ------------------------------------------------
# Scientific
elif format == '-1.23E+03':
if not value:
value = ''
else:
try:
value = "%.2e" % my.convert_to_float(value)
except:
value = "0.00"
elif format == '-1.234E+03':
if not value:
value = ''
else:
try:
value = "%.2e" % my.convert_to_float(value)
except:
value = "0.00"
# ------------------------------------------------
# Boolean
# false = 0, true = 1
elif format in ['True|False']:
if value:
value = 'True'
else:
value = 'False'
elif format in ['true|false']:
if value:
value = 'true'
else:
value = 'false'
elif format == 'Checkbox':
div = DivWdg()
div.add_class("spt_boolean_top")
from pyasm.widget import CheckboxWdg
checkbox = CheckboxWdg(my.get_name())
checkbox.set_option("value", "true")
if value:
checkbox.set_checked()
div.add(checkbox)
div.add_class('spt_format_checkbox_%s' % my.get_name())
version = my.parent_wdg.get_layout_version()
if version == "2":
pass
else:
checkbox.add_behavior( {
'type': 'click_up',
'propagate_evt': True,
'cbjs_action': '''
var cached_data = {};
var value_wdg = bvr.src_el;
var top_el = bvr.src_el.getParent(".spt_boolean_top");
spt.dg_table.edit.widget = top_el;
var key_code = spt.kbd.special_keys_map.ENTER;
spt.dg_table.inline_edit_cell_cbk( value_wdg, cached_data );
'''
} )
value = div
# ------------------------------------------------
# Timecode
elif format in ['MM:SS.FF','MM:SS:FF', 'MM:SS', 'HH:MM:SS.FF', 'HH:MM:SS:FF', 'HH:MM:SS']:
fps = my.get_option('fps')
if not fps:
fps = 24
else:
fps = int(fps)
timecode = TimeCode(frames=value, fps=fps)
value = timecode.get_timecode(format)
# ------------------------------------------------
# Text formats
elif format in ['wiki']:
pass
return value
示例10: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_checked [as 别名]
#.........这里部分代码省略.........
show_subpipeline = True
min_height = '150px'
# create a temp default pipeline
if not pipelines:
pipeline = SearchType.create("sthpw/pipeline")
pipeline.set_value("code", "__default__")
pipeline.set_value("pipeline", '''
<pipeline>
<process name='publish'/>
</pipeline>
''')
# FIXME: HACK to initialize virtual pipeline
pipeline.set_pipeline(pipeline.get_value("pipeline"))
pipelines = [pipeline]
for pipeline in pipelines:
name = pipeline.get_value("name")
if not name:
name = pipeline.get_code()
span = SpanWdg("Pipeline: %s" % name)
span.add_style('font-weight: bold')
v_div = FloatDivWdg(span)
v_div.add_style('margin: 20px')
v_div.add_style('min-height', min_height)
v_div.add(HtmlElement.br(2))
content_div.add(v_div)
processes = pipeline.get_processes(recurse=show_subpipeline, type=['manual','approval'])
cb_name = '%s|task_process' %pipeline.get_code()
master_cb = CheckboxWdg('master_control')
master_cb.set_checked()
master_cb.add_behavior({'type': 'click_up',
'propagate_evt': True,
'cbjs_action': '''
var inputs = spt.api.Utility.get_inputs(bvr.src_el.getParent('.spt_add_task_panel'),'%s');
for (var i = 0; i < inputs.length; i++)
inputs[i].checked = bvr.src_el.checked;
''' %cb_name})
toggle_div = DivWdg()
toggle_div.add(SpanWdg(master_cb, css='small'))
label = HtmlElement.i('toggle all')
label.add_style('color: #888')
toggle_div.add_styles('border-bottom: 1px solid #888; width: 170px')
toggle_div.add(label)
v_div.add(toggle_div)
process_names = []
for process in processes:
process_labels = []
if process.is_from_sub_pipeline():
process_name = process.get_full_name()
else:
process_name = process.get_name()
process_label = process.get_label()
if not process_label:
process_label = ''
if mode =='context':
contexts = pipeline.get_output_contexts(process.get_name())
labels = contexts
if process.is_from_sub_pipeline():
labels = ['%s/%s'%(process.parent_pipeline_code, x) for x in contexts]
示例11: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_checked [as 别名]
#.........这里部分代码省略.........
info_page.add(span)
span.add_style("padding: 20px 20px 20px 20px")
span.add(IconWdg("INFO", IconWdg.CREATE))
span.add_color("background", "background3")
span.add("The project code is a very important key that will tie many components of the project together.")
span.add("<br/><br/>")
span.add("* Note: the project code must contain only alphanumeric characters [A-Z]/[0-9] and only an '_' as a separator")
info_page.add(span)
info_page.add("<br/>"*2)
projects = Project.get_all_projects()
info_page.add("<b>Is Main Project? </b>")
checkbox = CheckboxWdg("is_main_project")
default_project_code = Config.get_value("install", "default_project")
info_page.add(checkbox)
if default_project_code:
default_project = Project.get_by_code(default_project_code)
else:
default_project = None
if default_project:
default_title = default_project.get_value("title")
info_span = SpanWdg()
info_page.add(info_span)
info_span.add("%sCurrent: %s (%s)" % (" "*3, default_title, default_project_code))
info_span.add_style("font-size: 0.9em")
info_span.add_style("font-style: italic")
else:
if len(projects) == 0:
checkbox.set_checked()
info_page.add("<br/>"*2)
span = DivWdg()
info_page.add(span)
span.add_style("padding: 20px 20px 20px 20px")
span.add(IconWdg("INFO", IconWdg.CREATE))
span.add_color("background", "background3")
span.add("A TACTIC installation can have multiple projects, but one can be designated as the main project. This project will appear at the root of the url. This is meant for building custom project launcher which is based on a main project.")
span.add("<br/>"*2)
span.add("* Note: TACTIC may need to be restarted in order for this to take effect")
info_page.add(span)
info_page.add("<br/>")
# add an icon for this project
image_div = DivWdg()
wizard.add(image_div, 'Preview Image')
image_div.add_class("spt_image_top")
image_div.add_color("background", "background")
image_div.add_color("color", "color")
image_div.add_style("padding: 20px")
示例12: get_new_definition_wdg
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_checked [as 别名]
def get_new_definition_wdg(self):
detail_wdg = DivWdg()
detail_wdg.add_style("color: black")
detail_wdg.add_style("width: 350px")
detail_wdg.add_style("margin-top: 10px")
detail_wdg.add_style("padding: 10px")
detail_wdg.add_border()
title = DivWdg()
title.add_style("color: black")
title.add("Column Definition")
title.add_style("margin-top: -22px")
detail_wdg.add(title)
# add a name entry
title = SpanWdg()
detail_wdg.add("Name: ")
detail_wdg.add(title)
input = SpanWdg()
input.add_style('padding-top: 6px')
input.set_id("config_element_name")
text = TextWdg('column_name')
text.set_value(self.name_string)
input.add(text)
detail_wdg.add(input)
hidden = HiddenWdg('target_search_type', self.search_type)
detail_wdg.add(hidden)
detail_wdg.add(HtmlElement.br(2))
# add data_type entry
data_type = SpanWdg()
default_data_types = ['varchar(256)','varchar', 'character', 'text', 'integer', 'float', 'boolean', 'timestamp', 'Other...']
select = SelectWdg('config_data_type', label ='Data Type: ')
#detail_wdg.add(": ")
select.set_option('values', default_data_types )
select.set_value(self.data_type_string)
select.add_behavior({'type': 'change',
'cbjs_action': "if (bvr.src_el.value=='Other...') {spt.show('config_data_type_custom');}\
else {spt.hide('config_data_type_custom');}"})
data_type.add(select)
text = TextWdg('config_data_type_custom')
span = SpanWdg("Other: ", css='med')
span.add(text)
span.set_id('config_data_type_custom')
span.add_style('display','none')
text.set_value(self.data_type_string)
data_type.add("<br/>")
data_type.add(span)
detail_wdg.add(data_type)
detail_wdg.add("<br/>")
# add a nullable entry
nullable = DivWdg()
checkbox = CheckboxWdg('config_nullable', label ='Allow null(empty) value: ')
nullable.add(checkbox)
if self.nullable_string in ['True', 'true']:
checkbox.set_checked()
detail_wdg.add(nullable)
return detail_wdg
示例13: get_simple_definition_wdg
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_checked [as 别名]
def get_simple_definition_wdg(self):
detail_wdg = DivWdg()
detail_wdg.add_color("color", "color")
detail_wdg.add_style("width: 350px")
detail_wdg.add_style("margin-top: 10px")
detail_wdg.add_style("padding: 10px")
detail_wdg.add_border()
title = DivWdg()
title.add_style("margin-top: -23px")
detail_wdg.add(title)
if not self.name_string:
title.add('No database column')
return detail_wdg
title.add("Column Definition")
# add a name entry
detail_wdg.add("<br/>")
title = SpanWdg()
detail_wdg.add("Name: ")
detail_wdg.add(title)
input = SpanWdg()
input.add_style('padding-top: 6px')
input.set_id("config_element_name")
input.add(HtmlElement.b(self.name_string))
detail_wdg.add(input)
hidden = HiddenWdg('column_name', self.name_string)
detail_wdg.add(hidden)
hidden = HiddenWdg('target_search_type', self.search_type)
detail_wdg.add(hidden)
detail_wdg.add(HtmlElement.br(2))
# add data_type entry
data_type = SpanWdg()
default_data_types = ['varchar(256)','varchar', 'character', 'text', 'integer', 'float', 'boolean', 'timestamp', 'Other...']
select = SelectWdg('config_data_type', label ='Data Type: ')
#detail_wdg.add(": ")
select.set_option('values', default_data_types )
select.set_value(self.data_type_string)
select.add_behavior({'type': 'change',
'cbjs_action': "if (bvr.src_el.value=='Other...') {spt.show('config_data_type_custom');}\
else {spt.hide('config_data_type_custom');}"})
data_type.add(select)
text = TextWdg('config_data_type_custom')
span = SpanWdg("Other: ", css='med')
span.add(text)
span.set_id('config_data_type_custom')
span.add_style('display','none')
text.set_value(self.data_type_string)
data_type.add("<br/>")
data_type.add(span)
detail_wdg.add(data_type)
detail_wdg.add("<br/>")
# add a nullable entry
nullable = SpanWdg()
checkbox = CheckboxWdg('config_nullable', label ='Allow null(empty) value: ')
#detail_wdg.add(": ")
nullable.add(checkbox)
if self.nullable_string in ['True', 'true']:
checkbox.set_checked()
detail_wdg.add(nullable)
#constraint = DivWdg()
#detail_wdg.add(constraint)
#constraint.add_style("margin-top: 10px")
#constraint.add("Constraint: ")
#select = SelectWdg("config_constraint")
#constraint.add(select)
#select.set_option("values", "unique|indexed")
#select.add_empty_option("-- None --")
button_div = DivWdg()
button_div.add_style("text-align: center")
button_div.add_behavior( {
'type': 'load',
'cbjs_action': '''
spt.manage_search_type = {};
spt.manage_search_type.change_column_cbk = function(bvr) {
var class_name = 'tactic.ui.panel.AlterSearchTypeCbk';
var options ={
'alter_mode': bvr.alter_mode,
'title': bvr.title
#.........这里部分代码省略.........
示例14: get_new_custom_widget
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_checked [as 别名]
def get_new_custom_widget(my, view):
custom_table = Table(css="table")
name_text = TextWdg("new_custom_name")
custom_table.add_row()
custom_table.add_cell("Name: ")
custom_table.add_cell(name_text)
type_select = SelectWdg("new_custom_type")
#type_select.add_empty_option("-- Select --")
type_select.set_option("values", "Name/Code|Foreign Key|List|Checkbox|Text|Number|Date|Date Range")
custom_table.add_row()
custom_table.add_cell("Predefined Type: ")
td = custom_table.add_cell(type_select)
td.add( HtmlElement.script('''
function property_type_select(el) {
if (el.value == "Foreign Key") {
set_display_on('foreign_key_options')
}
else if (el.value == "List") {
set_display_on('list_options')
}
else {
set_display_off('foreign_key_options')
set_display_off('list_options')
}
}
''') )
type_select.add_event("onchange", "property_type_select(this)")
# extra info for foreign key
custom_table.add_row()
div = DivWdg()
div.set_id("foreign_key_options")
div.add_style("display: none")
div.add_style("margin-top: 10px")
div.add("Options")
div.add(HtmlElement.br())
# TODO: this class should not be in prod!!
from pyasm.prod.web import SearchTypeSelectWdg
div.add("Relate to: ")
search_type_select = SearchTypeSelectWdg("foreign_key_search_select", mode=SearchTypeSelectWdg.CURRENT_PROJECT)
div.add(search_type_select)
td.add(div)
# extra info for foreign key
custom_table.add_row()
div = DivWdg()
div.set_id("list_options")
div.add_style("display: none")
div.add_style("margin-top: 10px")
div.add("Options")
div.add(HtmlElement.br())
# TODO: this class should not be in prod!!
from pyasm.prod.web import SearchTypeSelectWdg
div.add("Values: ")
search_type_text = TextWdg("list_values")
div.add(search_type_text)
td.add(div)
custom_table.add_row()
description_wdg = TextAreaWdg("new_description")
custom_table.add_cell( "Description: " )
custom_table.add_cell( description_wdg )
# add to current view
if view not in ['edit', 'insert']:
custom_table.add_row()
current_view_wdg = CheckboxWdg("add_to_current_view")
current_view_wdg.set_checked()
custom_table.add_cell("Add To Current View: ")
td = custom_table.add_cell(current_view_wdg)
custom_table.add_row()
edit_view_wdg = CheckboxWdg("add_to_edit_view")
edit_view_wdg.set_checked()
custom_table.add_cell("Add To Edit View: ")
custom_table.add_cell(edit_view_wdg)
# add to edit view
custom_table.add_row()
custom_table.add_blank_cell()
custom_table.add_cell(SpanWdg('If you check this for a search type already in the system, it will create an edit view that overrides the built-in edit view. This may affect its editability. You can always delete the edit view in the Configure Widgets tab afterwards.', css='warning smaller'))
custom_table.add_row()
from pyasm.prod.web import ProdIconSubmitWdg, ProdIconButtonWdg
submit = ProdIconSubmitWdg("Insert/Next")
tr, td = custom_table.add_row_cell(submit)
td.add_style("text-align: center")
submit = ProdIconSubmitWdg("Insert/Exit")
td.add(submit)
#.........这里部分代码省略.........
示例15: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_checked [as 别名]
def get_display(my):
my.init_kwargs()
sobject = my.get_current_sobject()
table = Table(css='minimal')
table.add_color("color", "color")
table.add_style("font-size: 0.9em")
snapshots = my.get_snapshot(my.mode)
for snapshot in snapshots:
table.add_row()
value = my.get_input_value(sobject, snapshot)
current_version = snapshot.get_value("version")
current_context = snapshot.get_value("context")
current_revision = snapshot.get_value("revision", no_exception=True)
current_snapshot_type = snapshot.get_value("snapshot_type")
# hack hard coded type translation
if current_snapshot_type == "anim_export":
current_snapshot_type = "anim"
# ignore icon context completely
if current_context == "icon":
table.add_blank_cell()
table.add_cell("(---)")
return table
checkbox = CheckboxWdg('%s_%s' %(my.search_type, my.CB_NAME))
# this is added back in for now to work with 3.7 Fast table
checkbox.add_behavior({'type': 'click_up',
'propagate_evt': True})
checkbox.add_class('spt_latest_%s' %my.mode)
checkbox.set_option("value", value )
table.add_cell( checkbox )
load_all = False
if load_all:
checkbox.set_checked()
# add the file type icon
xml = snapshot.get_snapshot_xml()
file_name = xml.get_value("snapshot/file/@name")
icon_link = ThumbWdg.find_icon_link(file_name)
image = HtmlElement.img(icon_link)
image.add_style("width: 15px")
table.add_cell(image)
namespace = my.get_namespace(sobject, snapshot)
asset_code = my.get_asset_code()
# force asset mode = True
my.session.set_asset_mode(asset_mode=my.get_session_asset_mode())
node_name = my.get_node_name(snapshot, asset_code, namespace)
# get session info
session_context = session_version = session_revision = None
if my.session:
session_context = my.session.get_context(node_name, asset_code, current_snapshot_type)
session_version = my.session.get_version(node_name, asset_code, current_snapshot_type)
session_revision = my.session.get_revision(node_name, asset_code,current_snapshot_type)
# Maya Specific: try with namespace in front of it for referencing
referenced_name = '%s:%s' %(namespace, node_name)
if not session_context or not session_version:
session_context = my.session.get_context(referenced_name, asset_code, current_snapshot_type)
session_version = my.session.get_version(referenced_name, asset_code, current_snapshot_type)
session_revision = my.session.get_revision(referenced_name, asset_code, current_snapshot_type)
from version_wdg import CurrentVersionContextWdg, SubRefWdg
version_wdg = CurrentVersionContextWdg()
data = {'session_version': session_version, \
'session_context': session_context, \
'session_revision': session_revision, \
'current_context': current_context, \
'current_version': current_version, \
'current_revision': current_revision }
version_wdg.set_options(data)
table.add_cell(version_wdg, "no_wrap")
td = table.add_cell(HtmlElement.b("(%s)" %current_context))
td.add_tip("Snapshot code: %s" % snapshot.get_code())
#table.add_cell(snapshot.get_code() )
#if snapshot.is_current():
# current = IconWdg("current", IconWdg.CURRENT)
# table.add_cell(current)
#else:
# table.add_blank_cell()
# handle subreferences
#.........这里部分代码省略.........