本文整理汇总了Python中pyasm.widget.CheckboxWdg.set_default_checked方法的典型用法代码示例。如果您正苦于以下问题:Python CheckboxWdg.set_default_checked方法的具体用法?Python CheckboxWdg.set_default_checked怎么用?Python CheckboxWdg.set_default_checked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.CheckboxWdg
的用法示例。
在下文中一共展示了CheckboxWdg.set_default_checked方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_default_checked [as 别名]
#.........这里部分代码省略.........
var title = title_el.value;
var name = spt.convert_to_alpha_numeric(title);
name_el.value = name;
}
if (name_value == "") {
spt.alert("Please fill in a value for name.");
return;
}
spt.side_bar.manage_section_action_cbk(
{ 'value':'save_folder'}, bvr.view, bvr.is_personal);
''' }
save_button.add_behavior(bvr)
div.add(HtmlElement.br())
elif my.type == 'new_link':
div.set_attr('spt_view', 'new_link')
div.add(HtmlElement.b('Create New Link'))
div.add(HtmlElement.br())
item_div = DivWdg(css='spt_new_item')
item_div.add_style('display: none')
div.add(HtmlElement.br())
div.add(item_div)
text = TextWdg('new_link_title')
span = SpanWdg('Title: ')
span.add(text)
div.add(span)
div.add(HtmlElement.br(2))
cb = CheckboxWdg('include_search_view', label='Include Saved Search')
cb.set_default_checked()
div.add(cb)
div.add(HtmlElement.br(2))
div.add("Select a search type and view of this link")
div.add(HtmlElement.br())
select = SelectWdg("new_search_type")
select.add_empty_option("-- Select Search type --")
security = Environment.get_security()
if security.check_access("builtin", "view_site_admin", "allow"):
search_types = Project.get().get_search_types(include_sthpw=True, include_config=True)
else:
search_types = Project.get().get_search_types()
values = [x.get_value("search_type") for x in search_types]
labels = ["%s (%s)" % (x.get_value("search_type"), x.get_title()) for x in search_types]
values.append("CustomLayoutWdg")
labels.append("CustomLayoutWdg")
select.set_option("values", values)
select.set_option("labels", labels)
#security = Environment.get_security()
#if security.check_access("builtin", "view_site_admin", "allow"):
# select_mode = SearchTypeSelectWdg.ALL
#else:
# select_mode = SearchTypeSelectWdg.ALL_BUT_STHPW
#select = SearchTypeSelectWdg(name='new_search_type', \
# mode=select_mode)
示例2: get_first_row_wdg
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_default_checked [as 别名]
def get_first_row_wdg(my):
# read the csv file
#my.file_path = ""
div = DivWdg(id='csv_import_main')
div.add_class('spt_panel')
div.add( my.get_upload_wdg() )
if not my.search_type:
return div
if not my.file_path:
return div
if not my.file_path.endswith(".csv"):
div.add('<br>')
div.add( "Uploaded file [%s] is not a csv file. Refreshing in 3 seconds. . ."% os.path.basename(my.file_path))
div.add_behavior( {'type': 'load', \
'cbjs_action': "setTimeout(function() {spt.panel.load('csv_import_main','%s', {}, {\
'search_type_filter': '%s'});}, 3000);" %(Common.get_full_class_name(my), my.search_type) } )
return div
if not os.path.exists(my.file_path):
raise TacticException("Path '%s' does not exist" % my.file_path)
div.add(HtmlElement.br(2))
# NOT NEEDED: clear the widget settings before drawing
#expr = "@SOBJECT(sthpw/wdg_settings['key','EQ','pyasm.widget.input_wdg.CheckboxWdg|column_enabled_']['login','$LOGIN']['project_code','$PROJECT'])"
#sobjs = Search.eval(expr)
#for sobj in sobjs:
# sobj.delete(log=False)
div.add( HtmlElement.b("The following is taken from the first line in the uploaded csv file. Select the appropriate column to match.") )
div.add(HtmlElement.br())
"""
text = HtmlElement.b("Make sure you have all the required columns** in the csv.")
text.add_style('text-align: left')
div.add(text)
"""
div.add(HtmlElement.br(2))
option_div_top = DivWdg()
option_div_top.add_color('color','color')
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',\
#.........这里部分代码省略.........
示例3: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_default_checked [as 别名]
#.........这里部分代码省略.........
return table
# use overriding element names and derived titles if available
config = WidgetConfigView.get_by_search_type(my.search_type, my.view)
if my.element_names and config:
filtered_columns = my.element_names
titles = []
for name in my.element_names:
title = config.get_element_title(name)
titles.append(title)
else:
# excluding FunctionalTableElement
filtered_columns = []
titles = []
if not config:
columns = search.get_columns()
filtered_columns = columns
titles = ['n/a'] * len(filtered_columns)
else:
columns = config.get_element_names()
filtered_columns = columns
titles = config.get_element_titles()
"""
# commented out until it is decided 2.5 widgets will
# use this class to differentiate between reg and functional element
from pyasm.widget import FunctionalTableElement
for column in columns:
widget = config.get_display_widget(column)
if isinstance(widget, FunctionalTableElement):
continue
filtered_columns.append(column)
"""
for idx, column in enumerate(filtered_columns):
table.add_row()
cb = CheckboxWdg(cb_name)
cb.set_option('value', column)
cb.set_checked()
table.add_cell(cb)
title = titles[idx]
table.add_cell('<b>%s</b> (%s) '%(title, column))
action_div = DivWdg()
widget = DivWdg()
table.add_row_cell(widget)
widget.add_style("margin: 20px 0 10px 0px")
cb = CheckboxWdg('include_id', label=" Include ID")
cb.set_default_checked()
widget.add(cb)
hint = HintWdg('To update entries with specific ID later, please check this option. For new inserts in this or other table later on, uncheck this option.')
widget.add(hint)
label = string.capwords(my.mode.replace('_', ' '))
button = ActionButtonWdg(title=label)
is_export_all = my.mode == 'export_all'
button.add_behavior({
'type': "click_up",
'cbfn_action': 'spt.dg_table_action.csv_export',
'element': 'csv_export',
'column_names': 'csv_column_name',
'search_type': my.search_type,
'view': my.view,
'search_keys' : my.selected_search_keys,
'is_export_all' : is_export_all
})
my.close_action = "var popup = bvr.src_el.getParent('.spt_popup');spt.popup.close(popup)"
if my.close_action:
close_button = ActionButtonWdg(title='Close')
close_button.add_behavior({
'type': "click",
'cbjs_action': my.close_action
})
table = Table()
action_div.add(table)
table.center()
table.add_row()
td = table.add_cell(button)
td.add_style("width: 130px")
table.add_cell(close_button)
action_div.add("<br clear='all'/>")
top.add(div)
top.add(HtmlElement.br())
top.add(action_div)
return top
示例4: get_action_wdg
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_default_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,
#.........这里部分代码省略.........