本文整理汇总了Python中tactic.ui.input.TextInputWdg.add_attr方法的典型用法代码示例。如果您正苦于以下问题:Python TextInputWdg.add_attr方法的具体用法?Python TextInputWdg.add_attr怎么用?Python TextInputWdg.add_attr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tactic.ui.input.TextInputWdg
的用法示例。
在下文中一共展示了TextInputWdg.add_attr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_attr [as 别名]
def get_display(my):
top = my.top
top.add_class("spt_script_editor_top")
"""
top.add_class("SPT_CHANGE")
top.add_behavior( {
'type': 'load',
'cbjs_action': '''
register_change = function(bvr) {
var change_top = bvr.src_el.getParent(".SPT_CHANGE");
change_top.addClass("SPT_HAS_CHANGES");
change_top.update_change(change_top, bvr);
}
has_changes = function(bvr) {
var change_top = bvr.src_el.getParent(".SPT_CHANGE");
return change_top.hasClass("SPT_HAS_CHANGES");
}
bvr.src_el.update_change = function(top, bvr) {
change_el = top.getElement(".spt_change_element");
change_el.setStyle("display", "");
}
'''
} )
"""
change_div = DivWdg()
top.add(change_div)
#change_div.add("CHANGES!!!")
change_div.add_style("display: none")
change_div.add_class("spt_change_element");
top.add_class("spt_panel")
top.add_class("spt_js_editor")
top.add_attr("spt_class_name", Common.get_full_class_name(my) )
top.add_color("background", "background")
top.add_style("padding", "10px")
div = DivWdg()
top.add(div)
# if script_path
script_path = my.kwargs.get("script_path")
search_key = my.kwargs.get("search_key")
if script_path:
search = Search("config/custom_script")
dirname = os.path.dirname(script_path)
basename = os.path.basename(script_path)
search.add_filter("folder", dirname)
search.add_filter("title", basename)
script_sobj = search.get_sobject()
elif search_key:
script_sobj = Search.get_by_search_key(search_key)
else:
script_sobj = None
if script_sobj:
script_code = script_sobj.get_value("code")
script_folder = script_sobj.get_value("folder")
script_name = script_sobj.get_value("title")
script_value = script_sobj.get_value("script")
script_language = script_sobj.get_value("langauge")
else:
script_code = ''
script_folder = ''
script_name = ''
script_value = ''
editor = AceEditorWdg(custom_script=script_sobj)
my.editor_id = editor.get_editor_id()
if not Container.get_dict("JSLibraries", "spt_script_editor"):
div.add_behavior( {
'type': 'load',
'cbjs_action': my.get_onload_js()
} )
# create the insert button
help_button_wdg = DivWdg()
div.add(help_button_wdg)
help_button_wdg.add_style("float: right")
help_button = ActionButtonWdg(title="?", tip="Script Editor Help", size='s')
help_button_wdg.add(help_button)
#.........这里部分代码省略.........
示例2: get_display
# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_attr [as 别名]
#.........这里部分代码省略.........
# add the search_type
table.add_row()
td = table.add_cell()
td.add("sType: ")
td = table.add_cell()
select = SelectWdg("search_type")
td.add(select)
search_types = Project.get().get_search_types()
values = [x.get_value("search_type") for x in search_types]
select.set_option("values", values)
search_type = self.kwargs.get("search_type")
if search_type:
select.set_value(search_type)
# add the search_type
table.add_row()
td = table.add_cell()
td.add("Context: ")
td = table.add_cell()
select = SelectWdg("context")
td.add(select)
select.set_option("values", ['publish', 'by rule', 'custom'])
# add extra values
extra_div = DivWdg()
text = TextWdg("extra_name")
text.add_attr("spt_is_multiple", "true")
extra_div.add(text)
extra_div.add(" = ")
text = TextWdg("extra_value")
extra_div.add(text)
text.add_attr("spt_is_multiple", "true")
template_div = DivWdg()
text = TextWdg("extra_name")
text.add_attr("spt_is_multiple", "true")
template_div.add(text)
template_div.add(" = ")
text = TextWdg("extra_value")
template_div.add(text)
text.add_attr("spt_is_multiple", "true")
table.close_tbody()
table.add_row()
td = table.add_cell("<br/>")
table.add_row()
td = table.add_cell()
td.add("Extra Keywords: ")
td.add_style("vertical-align: top")
td.add_style("padding-top: 5px")
td = table.add_cell()
text = TextWdg("keywords")
text.add_style("width: 300px")
td.add(text)
示例3: get_display
# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_attr [as 别名]
def get_display(my):
top = my.top
top.add_class("spt_script_editor_top")
"""
top.add_class("SPT_CHANGE")
top.add_behavior( {
'type': 'load',
'cbjs_action': '''
register_change = function(bvr) {
var change_top = bvr.src_el.getParent(".SPT_CHANGE");
change_top.addClass("SPT_HAS_CHANGES");
change_top.update_change(change_top, bvr);
}
has_changes = function(bvr) {
var change_top = bvr.src_el.getParent(".SPT_CHANGE");
return change_top.hasClass("SPT_HAS_CHANGES");
}
bvr.src_el.update_change = function(top, bvr) {
change_el = top.getElement(".spt_change_element");
change_el.setStyle("display", "");
}
'''
} )
"""
change_div = DivWdg()
top.add(change_div)
#change_div.add("CHANGES!!!")
change_div.add_style("display: none")
change_div.add_class("spt_change_element");
top.add_class("spt_panel")
top.add_class("spt_js_editor")
top.add_attr("spt_class_name", Common.get_full_class_name(my) )
top.add_color("background", "background")
top.add_style("padding", "10px")
div = DivWdg()
top.add(div)
# if script_path
script_path = my.kwargs.get("script_path")
search_key = my.kwargs.get("search_key")
if script_path:
search = Search("config/custom_script")
dirname = os.path.dirname(script_path)
basename = os.path.basename(script_path)
search.add_filter("folder", dirname)
search.add_filter("title", basename)
script_sobj = search.get_sobject()
elif search_key:
script_sobj = Search.get_by_search_key(search_key)
else:
script_sobj = None
if script_sobj:
script_code = script_sobj.get_value("code")
script_folder = script_sobj.get_value("folder")
script_name = script_sobj.get_value("title")
script_value = script_sobj.get_value("script")
script_language = script_sobj.get_value("language")
else:
script_code = ''
script_folder = ''
script_name = ''
script_value = ''
editor = AceEditorWdg(custom_script=script_sobj)
my.editor_id = editor.get_editor_id()
if not Container.get_dict("JSLibraries", "spt_script_editor"):
div.add_behavior( {
'type': 'load',
'cbjs_action': my.get_onload_js()
} )
# create the insert button
help_button_wdg = DivWdg()
div.add(help_button_wdg)
help_button_wdg.add_style("float: right")
help_button = ActionButtonWdg(title="?", tip="Script Editor Help", size='s')
help_button_wdg.add(help_button)
#.........这里部分代码省略.........