本文整理汇总了Python中pyasm.widget.CheckboxWdg.is_checked方法的典型用法代码示例。如果您正苦于以下问题:Python CheckboxWdg.is_checked方法的具体用法?Python CheckboxWdg.is_checked怎么用?Python CheckboxWdg.is_checked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.CheckboxWdg
的用法示例。
在下文中一共展示了CheckboxWdg.is_checked方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import is_checked [as 别名]
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()
示例2: get_instantiation_wdg
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import is_checked [as 别名]
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
示例3: postprocess
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import is_checked [as 别名]
def postprocess(self):
web = get_web_container()
self.files = []
self.file_types = []
if self.get_option('upload_type') == 'arbitrary':
self._upload_arbitrary_files()
else:
self._upload_specified_files()
context = self.get_value("%s|context" % self.name)
subcontext = self.get_value("%s|subcontext" % self.name)
if subcontext:
context = '%s/%s' %(context, subcontext)
description = self.get_value("%s|description" % self.name)
from pyasm.widget import CheckboxWdg
cb = CheckboxWdg("%s|is_revision" % self.get_input_name())
is_rev = cb.is_checked(False)
# let checkin take care of moving files to the lib
from pyasm.checkin import FileCheckin
self.checkin = FileCheckin.get( self.sobject, self.files, self.file_types, \
context=context, snapshot_type="file" )
self.checkin.set_description(description)
self.checkin.set_revision(is_rev)
self.checkin.execute()
self.sobjects.append(self.sobject)
self.info['context'] = context
self.add_description('File Publish for [%s]' %self.sobject.get_code())
# remove the files in upload area
for file in self.files:
if os.path.exists(file):
os.unlink(file)
Trigger.call(self, "email")
示例4: execute
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import is_checked [as 别名]
def execute(self):
web = WebContainer.get_web()
alter_mode = self.kwargs.get("alter_mode")
title = self.kwargs.get("title")
config_mode = web.get_form_value("config_mode")
view = web.get_form_value('view')
constraint = web.get_form_value("config_constraint")
data_type = ''
if config_mode == "advanced" :
config_string = web.get_form_value("config_xml")
if config_string:
xml = Xml()
xml.read_string(config_string)
node = xml.get_root_node()
data_type = xml.get_attribute(node, "data_type")
nullable = xml.get_attribute(node, "nullable") in ['true','True']
else:
data_type = web.get_form_value("config_data_type")
if data_type == 'Other...':
data_type = web.get_form_value("config_data_type_custom")
cb = CheckboxWdg("config_nullable")
nullable = cb.is_checked()
# if advanced is selected in the Widget Column view, data_type is ''
# read from UI
if not data_type and view == 'definition':
data_type = web.get_form_value("config_data_type")
if data_type == 'Other...':
data_type = web.get_form_value("config_data_type_custom")
cb = CheckboxWdg("config_nullable")
nullable = cb.is_checked()
column_name = web.get_form_value("column_name")
search_type = web.get_form_value("target_search_type")
if alter_mode == ManageSearchTypeDetailWdg.REMOVE_COLUMN:
cmd = ColumnDropCmd(search_type, column_name)
Command.execute_cmd(cmd)
# delete widget config from definition view
widget_config = WidgetDbConfig.get_by_search_type(search_type, 'definition')
if widget_config:
config = WidgetConfig.get('definition', xml=widget_config.get_xml_value('config'))
config.remove_xml_element(column_name)
new_xml = config.get_xml().to_string()
widget_config.set_value("config", new_xml)
widget_config.commit()
# set cache to {}
from pyasm.common import Container
Container.put("WidgetConfigView:config_cache", {})
#Container.put("WidgetConfig:config_cache", {})
elif alter_mode == ManageSearchTypeDetailWdg.MODIFY_COLUMN:
cmd = ColumnAlterCmd(search_type, column_name, data_type, nullable)
Command.execute_cmd(cmd)
element_options = {}
element_options['type'] = data_type
if title:
element_options['title'] = title
# handle the "default" view
# update the widget config data type in the xml
view = self.DEFAULT_VIEW
config = WidgetDbConfig.get_by_search_type(search_type, view)
if config:
config.append_display_element(column_name, options={}, \
element_attrs=element_options)
config.commit_config()
elif alter_mode == ManageSearchTypeDetailWdg.ADD_COLUMN:
cmd = ColumnAddCmd(search_type, column_name, data_type, nullable)
Command.execute_cmd(cmd)
if constraint:
# add constraint
from pyasm.command import ColumnAddIndexWdg
cmd = ColumnAddIndexWdg()
cmd.execute()
else:
# remove constraint
pass
示例5: get_first_row_wdg
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import is_checked [as 别名]
#.........这里部分代码省略.........
option_div_top.add_color('background','background', -5)
option_div_top.add_style("padding: 10px")
option_div_top.add_border()
option_div_top.add_style("width: 300px")
swap = SwapDisplayWdg(title="Parsing Options")
option_div_top.add(swap)
option_div_top.add_style("margin-right: 30px")
my.search_type_obj = SearchType.get(my.search_type)
option_div = DivWdg()
swap.set_content_id(option_div.set_unique_id() )
option_div.add_style("display: none")
option_div.add_style('margin-left: 14px')
option_div.add_style('margin-top: 10px')
option_div.add_style("font-weight: bold")
option_div_top.add(option_div)
# first row and second row
#option_div.add( HtmlElement.br() )
option_div.add(SpanWdg("Use Title Row: ", css='small'))
title_row_checkbox = CheckboxWdg("has_title")
title_row_checkbox.set_default_checked()
title_row_checkbox.add_behavior({'type' : 'click_up',
'propagate_evt': 'true',
'cbjs_action': "spt.panel.refresh('preview_data',\
spt.api.Utility.get_input_values('csv_import_main'))"})
option_div.add(title_row_checkbox)
option_div.add( HintWdg("Set this to use the first row as a title row to match up columns in the database") )
option_div.add( HtmlElement.br(2) )
option_div.add(SpanWdg("Use Lowercase Title: ", css='small'))
lower_title_checkbox = CheckboxWdg("lowercase_title")
lower_title_checkbox.add_behavior({'type' : 'click_up',
'propagate_evt': 'true',
'cbjs_action': "spt.panel.refresh('preview_data',\
spt.api.Utility.get_input_values('csv_import_main'))"})
option_div.add(lower_title_checkbox)
option_div.add( HtmlElement.br(2) )
option_div.add(SpanWdg("Sample Data Row: ", css='small'))
data_row_text = SelectWdg("data_row")
data_row_text.set_option('values', '1|2|3|4|5')
data_row_text.set_value('1')
data_row_text.add_behavior({'type' : 'change',
'cbjs_action': "spt.panel.refresh('preview_data',\
spt.api.Utility.get_input_values('csv_import_main'))"})
option_div.add(data_row_text)
option_div.add( HintWdg("Set this as a sample data row for display here") )
option_div.add( HtmlElement.br(2) )
# encoder
option_div.add(SpanWdg("Encoder: ", css='small'))
select_wdg = SelectWdg('encoder')
select_wdg.set_option('values', ['','utf-8', 'iso_8859-1'])
select_wdg.set_option('labels', ['ASCII (default)','UTF-8','Excel ISO 8859-1'])
select_wdg.add_behavior({'type' : 'change',
'cbjs_action': "spt.panel.refresh('preview_data',\
spt.api.Utility.get_input_values('csv_import_main'))"})
option_div.add(select_wdg)
option_div.add( HtmlElement.br(2) )
option_div.add(SpanWdg("Identifying Column: ", css='small'))
select_wdg = SelectWdg('id_col')
select_wdg.set_option('empty','true')
#columns = my.search_type_obj.get_columns()
columns = SearchType.get_columns(my.search_type)
# make sure it starts off with id, code where applicable
if 'code' in columns:
columns.remove('code')
columns.insert(0, 'code')
if 'id' in columns:
columns.remove('id')
columns.insert(0, 'id')
select_wdg.set_option('values', columns)
option_div.add(select_wdg)
option_div.add( HintWdg("Set which column to use for identifying an item to update during CSV Import") )
option_div.add( HtmlElement.br(2) )
div.add(option_div_top)
my.has_title = title_row_checkbox.is_checked()
# need to somehow specify defaults for columns
div.add(my.get_preview_wdg())
return div
示例6: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import is_checked [as 别名]
def get_display(self):
widget = Widget()
div = DivWdg(css='spt_ui_options')
div.set_unique_id()
table = Table()
div.add(table)
table.add_style("margin: 5px 15px")
table.add_color('color','color')
swap = SwapDisplayWdg()
#swap.set_off()
app = WebContainer.get_web().get_selected_app()
outer_span = SpanWdg()
outer_span.add_style('float: right')
span = SpanWdg(app, css='small')
icon = IconWdg(icon=eval("IconWdg.%s"%app.upper()), width='13px')
outer_span.add(span)
outer_span.add(icon)
title = SpanWdg("Loading Options")
title.add(outer_span)
SwapDisplayWdg.create_swap_title(title, swap, div, is_open=False)
widget.add(swap)
widget.add(title)
widget.add(div)
if not self.hide_instantiation:
table.add_row()
table.add_blank_cell()
div = DivWdg(HtmlElement.b("Instantiation: "))
table.add_cell(div)
div = self.get_instantiation_wdg()
table.add_cell(div)
setting = self.get_default_setting()
default_instantiation = setting.get('instantiation')
default_connection = setting.get('connection')
default_dependency = setting.get('texture_dependency')
if not self.hide_connection:
table.add_row()
table.add_blank_cell()
con_div = DivWdg(HtmlElement.b("Connection: "))
table.add_cell(con_div)
td = table.add_cell()
is_unchecked = True
default_cb = None
for value in ['http', 'file system']:
name = self.get_element_name("connection")
checkbox = CheckboxWdg( name )
checkbox.set_option("value", value)
checkbox.set_persistence()
if value == default_connection:
default_cb = checkbox
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)
td.add(span)
if is_unchecked:
default_cb.set_checked()
if not self.hide_dependencies:
table.add_row()
table.add_blank_cell()
div = DivWdg(HtmlElement.b("Texture Dependencies: "))
table.add_cell(div)
td = table.add_cell()
is_unchecked = True
default_cb = None
for value in ['as checked in', 'latest', 'current']:
name = self.get_element_name("dependency")
checkbox = CheckboxWdg( name )
checkbox.set_option("value", value)
checkbox.set_persistence()
checkbox.add_behavior({'type': 'click_up',
'propagate_evt': True,
"cbjs_action": "spt.toggle_checkbox(bvr, '.spt_ui_options', '%s')" %name})
if value == default_dependency:
default_cb = checkbox
if checkbox.is_checked():
is_unchecked = False
span = SpanWdg(checkbox, css='small')
span.add(value)
#.........这里部分代码省略.........
示例7: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import is_checked [as 别名]
def get_display(my):
div = DivWdg()
div.add_style("padding: 10px 0px 10px 0px")
behavior = {"type": "keyboard", "kbd_handler_name": "DgTableMultiLineTextEdit"}
div.add_behavior(behavior)
project_code = None
sobject = my.get_current_sobject()
if sobject:
project_code = sobject.get_project_code()
project_filter = Project.get_project_filter(project_code)
query_filter = my.get_option("query_filter")
if not query_filter:
# try getting it from the search_type
web = WebContainer.get_web()
search_type = web.get_form_value("search_type")
if search_type:
search_type_obj = SearchType.get(search_type)
base_search_type = search_type_obj.get_base_search_type()
query_filter = "search_type = '%s'" % base_search_type
# add the project filter
if query_filter:
query_filter = "%s and %s" % (query_filter, project_filter)
else:
query_filter = project_filter
my.set_option("query_filter", query_filter)
select = SelectWdg()
select.add_empty_option("-- Select --")
select.copy(my)
select.add_event("onchange", "alert('cow')")
div.add(select)
span = SpanWdg(css="med")
span.add("Add Initial Tasks: ")
checkbox = CheckboxWdg("add_initial_tasks")
checkbox.set_persistence()
if checkbox.is_checked(False):
checkbox.set_checked()
span.add(checkbox)
div.add(span)
# list all of the processes with checkboxes
pipeline_code = select.get_value()
if pipeline_code:
pipeline = Pipeline.get_by_code(pipeline_code)
if not pipeline:
print "WARNING: pipeline '%s' does not exist" % pipeline_code
return
process_names = pipeline.get_process_names(recurse=True)
process_div = DivWdg()
for process in process_names:
checkbox = CheckboxWdg("add_initial_tasks")
process_div.add(checkbox)
process_div.add(" ")
process_div.add(process)
process_div.add(HtmlElement.br())
div.add(process_div)
return div
示例8: get_viewer
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import is_checked [as 别名]
#.........这里部分代码省略.........
key = split_cb.get_key()
#cb.add_style('float: left')
split_cb.add_behavior({'type': 'click_up',
'propagate_evt': True,
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_note_viewer_top");
var table_top = top.getElement(".spt_note_viewer_table");
var cbs = top.getElement('.spt_main_context_cb');
var values = spt.api.Utility.get_input_values(cbs);
var processes = values.note_context_cb;
var kwargs = { process_names: processes};
if (bvr.src_el.checked) {
kwargs.split_view = 'true';
kwargs.show_context = 'true';
kwargs.left_process_names = processes;
kwargs.right_process_names = processes;
}
spt.input.save_selected(bvr, '%s','%s');
spt.app_busy.show("Note Viewer", 'Loading') ;
setTimeout(function(){
spt.panel.refresh(table_top, kwargs, false);
if (bvr.src_el.checked)
spt.hide(cbs);
else
spt.show(cbs);
spt.app_busy.hide();
}, 50 );
''' % ( checkbox_name, key)
})
split_div.add(split_cb)
top.add(split_div)
top.add(div)
div.add(content_div)
top.add(HtmlElement.br())
checkbox_name = 'note_main_context_cb'
cb = CheckboxWdg(checkbox_name)
cb.persistence = True
cb.persistence_obj = cb
self.checked_process_names = cb.get_values()
for value in self.process_names:
#self.checked_process_names = web.get_form_values('process_names')
cb = CheckboxWdg(checkbox_name, label=value)
if value in self.checked_process_names:
self.checked_processes.append(value)
# FIXME: this is very tenous. Accessing private members to
# override behavior
cb.persistence = True
cb.persistence_obj = cb
key = cb.get_key()
cb.set_option('value', value)
cb.add_behavior({
'type': 'click_up',
'propagate_evt': True,
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_note_viewer_top")
var table_top = top.getElement('.spt_note_viewer_table');
var cbs = top.getElement('.spt_main_context_cb');
var values = spt.api.Utility.get_input_values(cbs);
var processes = values.note_main_context_cb;
var kwargs = { process_names: processes};
spt.input.save_selected(bvr, '%s','%s');
spt.panel.refresh(table_top, kwargs, false);
''' % (checkbox_name, key)
})
content_div.add(cb)
table_top = DivWdg(css='spt_note_viewer_table')
expression = "@SOBJECT(sthpw/note['context','in','%s'])" %'|'.join(self.checked_processes)
if split_cb.is_checked():
table = self.get_split_viewer()
else:
table_id = 'main_table1'
table = TableLayoutWdg(table_id=table_id, search_type='sthpw/note', view=self.view,\
show_row_select=True, show_insert=False, state={'parent_key': self.parent_key}, inline_search=False, show_refresh=True, expression=expression )
self.set_as_panel(table_top)
table_top.add_style('float: left')
top.add(table_top)
table_top.add(table)
return top
示例9: get_action_wdg
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import is_checked [as 别名]
def get_action_wdg(self, name):
'''get the action widget for ui option of note entry'''
note_wdg = DivWdg()
note_wdg.add_style("padding-top: 3px")
# note options
option = DivWdg(css='spt_uber_note_option')
cb = CheckboxWdg('is_private')
#cb.set_default_checked()
checkbox_name = 'note_master_private_cb'
master_cb = CheckboxWdg(checkbox_name)
if master_cb.is_checked():
cb.set_default_checked()
option.add_style('margin-right','5px')
option.add_style('float','right')
option.add(cb)
option.add('private')
#commit = TextBtnWdg(label='save', size='small')
commit = ActionButtonWdg(title='save', tip="Save Changes")
commit.add_style('margin-top: -5px')
commit.add_style('margin-bottom: 5px')
commit.add_style('float: right')
commit.add_behavior({
'type': 'click_up',
'cbjs_action': '''
var td = bvr.src_el.getParent(".spt_table_td");
var text = td.getElement(".spt_note_text");
text.blur();
spt.dg_table.update_row(evt, bvr);
td.setStyle('background-color','');
''',
'cell_only': True
})
#commit.set_scale("0.75")
# do some gynastics to handle a refresh.
if self.parent_wdg:
info = self.parent_wdg.get_aux_info()
sobject_dict = info.get('sobjects')
sobject = sobject_dict.get(self.get_name())
parent = info.get('parent')
else:
sobject = None
parent = None
if not sobject:
if self.parent_key:
parent = SearchKey.get_by_search_key(self.parent_key)
# get the latest note
#search_key = self.kwargs.get("search_key")
#if search_key:
# sobject = SearchKey.get_by_search_key(search_key)
search = Search('sthpw/note')
search.add_parent_filter(parent)
search.add_filter('context', name)
# Make the assumption that the last one entered is by timestamp
search.add_order_by('timestamp desc')
sobject = search.get_sobject()
# Show a history of notes
if sobject:
history = ActionButtonWdg(title='history', tip="Show note history")
#history = TextBtnWdg(label='history', size='small')
#history.get_top_el().add_style("margin-left: 4px")
#history.get_top_el().add_style('float: left')
history.add_style("float: left")
history.add_style("margin-top: -5px")
history.add_style("margin-bottom: 5px")
note_wdg.add(history)
self.parent_key = SearchKey.get_by_sobject(parent)
context = name
filter = '[{"prefix":"main_body","main_body_enabled":"on","main_body_column":"context","main_body_relation":"is","main_body_value":"%s"}]' % context
history.add_behavior( {
'type': 'click_up',
'cbjs_action': "spt.popup.get_widget(evt, bvr)",
'options': {
'class_name': 'tactic.ui.panel.ViewPanelWdg',
'title': 'Notes History',
'popup_id': 'Notes_History_%s'%context
},
'args': {
'search_type': 'sthpw/note',
'view': 'summary',
'parent_key': self.parent_key,
'filter': filter,
#.........这里部分代码省略.........
示例10: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import is_checked [as 别名]
#.........这里部分代码省略.........
var tbody = top.getElements('.spt_table_tbody')[2];
var values = spt.api.Utility.get_input_values(tbody);
spt.panel.refresh(top, values, false);
'''
} )
process_div.add("<hr/>")
selected_process_names = []
step = 0
for idx, value in enumerate(self.process_names):
checkbox_name = 'note_process_cb'
if self.child_mode:
selected_process_names.append(value)
#break
cb = CheckboxWdg(checkbox_name, label=value)
cb.persistence = True
cb.persistence_obj = cb
key = cb.get_key()
cb.set_option('value', value)
#cb.set_persistence()
cb.add_behavior({
'type': 'click_up',
'cbjs_action': '''
spt.input.save_selected(bvr, '%s','%s');
''' % (checkbox_name, key)
})
# only 1 is selected in child_mode
if cb.is_checked():
selected_process_names.append(value)
if idx == 0 or idx == 10 * step:
# add a new inner div
inner_div = self._get_inner_div()
process_div.add(inner_div, 'inner%s'%step)
step += 1
inner_div.add(cb)
inner_div.add("<br/>")
# if less than 10, make it wider
if len(self.process_names) < 10:
inner_div.add_style('width: 100px')
# add a master private checkbox
if not self.child_mode:
checkbox_name = 'note_master_private_cb'
cb = CheckboxWdg(checkbox_name, label='make notes private')
cb.persistence = True
cb.persistence_obj = cb
key = cb.get_key()
cb.add_behavior({
'type': 'click_up',
'propagate_evt': True,
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_uber_notes_top");
var tbody = top.getElements('.spt_table_tbody')[2];
var inputs = spt.api.Utility.get_inputs(tbody,'is_private');