本文整理汇总了Python中tactic.ui.input.TextInputWdg.add_style方法的典型用法代码示例。如果您正苦于以下问题:Python TextInputWdg.add_style方法的具体用法?Python TextInputWdg.add_style怎么用?Python TextInputWdg.add_style使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tactic.ui.input.TextInputWdg
的用法示例。
在下文中一共展示了TextInputWdg.add_style方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_text_input_wdg
# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_style [as 别名]
def get_text_input_wdg(name, width=200, pretext=None):
textbox_wdg = TextInputWdg()
textbox_wdg.set_id(name)
textbox_wdg.set_name(name)
textbox_wdg.add_style('width', '{0}px'.format(width))
if pretext:
textbox_wdg.set_value(pretext)
return textbox_wdg
示例2: get_text_input_wdg
# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_style [as 别名]
def get_text_input_wdg(name, width=200, line_data=None):
textbox_wdg = TextInputWdg()
textbox_wdg.set_id(name)
textbox_wdg.set_name(name)
textbox_wdg.add_style('width', '{0}px'.format(width))
if line_data:
textbox_wdg.set_value(line_data)
return textbox_wdg
示例3: get_text_input_wdg
# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_style [as 别名]
def get_text_input_wdg(self, field_name, width=200):
textbox_wdg = TextInputWdg()
textbox_wdg.set_id(field_name)
textbox_wdg.set_name(field_name)
textbox_wdg.add_style('width', '{0}px'.format(width))
if hasattr(self, field_name):
textbox_wdg.set_value(getattr(self, field_name))
return textbox_wdg
示例4: get_timecode_textbox
# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_style [as 别名]
def get_timecode_textbox(self, name, width=200, line_data=None):
timecode_textbox = TextInputWdg()
timecode_textbox.set_id(name)
timecode_textbox.set_name(name)
timecode_textbox.add_style('width', '{0}px'.format(width))
timecode_textbox.add_behavior(get_add_colons_for_time_behavior())
if line_data:
timecode_textbox.set_value(line_data)
return timecode_textbox
示例5: get_text_input_wdg
# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_style [as 别名]
def get_text_input_wdg(name, data, width=200, timecode=False):
textbox_wdg = TextInputWdg()
textbox_wdg.set_id(name)
textbox_wdg.set_name(name)
textbox_wdg.add_style('width', '{0}px'.format(width))
if timecode:
textbox_wdg.add_behavior(get_add_colons_for_time_behavior())
if data:
textbox_wdg.set_value(data)
return textbox_wdg
示例6: get_display
# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_style [as 别名]
def get_display(self):
top = self.top
self.set_as_panel(top)
top.add_class("spt_ingestion_top")
top.add_color("background", "background", -5)
self.data = {}
rules_div = DivWdg()
top.add(rules_div)
rules_div.add_style("padding: 10px")
rules_div.add("Rules: ")
rules_select = SelectWdg("rule_code")
rule_code = self.get_value('rule_code')
if rule_code:
rules_select.set_value(rule_code)
rules_select.set_option("query", "config/ingest_rule|code|title")
rules_select.add_empty_option("-- New --")
rules_div.add(rules_select)
rules_select.add_behavior( {
'type': 'change',
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_ingestion_top");
value = bvr.src_el.value;
var class_name = 'tactic.ui.tools.IngestionToolWdg';
spt.panel.load(top, class_name, {rule_code: value} );
'''
} )
rules_div.add("<hr/>")
# read from the database
if rule_code:
search = Search("config/ingest_rule")
search.add_filter("code", rule_code)
sobject = search.get_sobject()
else:
sobject = None
if sobject:
self.data = sobject.get_value("data")
if self.data:
self.data = jsonloads(self.data)
session_code = self.kwargs.get("session_code")
if session_code:
session = Search.get_by_code("config/ingest_session", session_code)
else:
if sobject:
session = sobject.get_related_sobject("config/ingest_session")
print("sobject: ", sobject.get_code(), sobject.get_value("spt_ingest_session_code"))
print("parent: ", session)
else:
session = None
if not session:
#session = SearchType.create("config/ingest_session")
#session.set_value("code", "session101")
#session.set_value("location", "local")
##session.set_value("base_dir", "C:")
top.add("No session defined!!!")
return top
rule = ""
filter = ""
ignore = ""
# get the base path
if sobject:
base_dir = sobject.get_value("base_dir")
else:
base_dir = ''
#else:
# base_dir = self.get_value("base_dir")
#if not base_dir:
# base_dir = ''
if sobject:
title = sobject.get_value("title")
else:
title = ''
if sobject:
code = sobject.get_value("code")
else:
code = ''
file_list = self.get_value("file_list")
scan_type = self.get_value("scan_type")
action_type = self.get_value("action_type")
rule = self.get_value("rule")
if not rule:
#.........这里部分代码省略.........
示例7: get_nav_wdg
# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_style [as 别名]
def get_nav_wdg(self):
#base_dir = self.kwargs.get("base_dir")
#location = self.kwargs.get("location")
base_dir = self.session.get_value("base_dir")
location = self.session.get_value("location")
nav_wdg = DivWdg()
nav_wdg.add("<b>Session 101 - Clean up self Crap</b><hr/>")
nav_wdg.add_style("margin-bottom: 10px")
nav_wdg.add_class("spt_file_nav")
nav_wdg.add_style("width: 575px")
nav_wdg.add_border()
nav_wdg.set_round_corners()
nav_wdg.add_style("padding: 5px")
button = ActionButtonWdg(title="Scan", tip="Scan for files in specified folder")
button.add_style("float: right")
button.add_style("margin-top: -5px")
nav_wdg.add(button)
from tactic.ui.input import TextInputWdg
title_wdg = "Session Title: "
nav_wdg.add(title_wdg)
text = TextInputWdg(name="title")
text.add_class("spt_title")
text.add_style("width: 300px")
nav_wdg.add(text)
nav_wdg.add("<br/><br/>")
folder_wdg = "Base folder of this session: "
nav_wdg.add(folder_wdg)
text = TextInputWdg(name="base_dir")
text.add_class("spt_base_dir")
text.add_style("width: 300px")
if base_dir:
text.set_value(base_dir)
nav_wdg.add(text)
# add a hidden paths variable
text = HiddenWdg("paths")
text.add_class("spt_paths")
nav_wdg.add(text)
nav_wdg.add("<br/>")
# add a hidden paths variable
select = SelectWdg("location")
if location:
select.set_value(location)
nav_wdg.add("<br/>")
nav_wdg.add("Folder is on ")
nav_wdg.add(select)
select.set_option("values", "local|server")
button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_ingestion_top");
var nav = top.getElement(".spt_file_nav");
var nav_values = spt.api.Utility.get_input_values(nav,null,false);
var base_dir = nav_values.base_dir;
var location = nav_values.location;
spt.app_busy.show("Scanning", base_dir);
if (location == 'local') {
var applet = spt.Applet.get();
var paths = applet.list_dir(base_dir, 2);
var paths_el = nav.getElement(".spt_paths");
var js_paths = [];
for (var i = 0; i < paths.length; i++) {
var js_path = paths[i].replace(/\\\\/g,"/");
if (applet.is_dir(js_path) ) {
js_path = js_path + '/';
js_paths.push(js_path);
}
//if (i > 100) break;
else {
js_paths.push(js_path);
}
}
paths_el.value = js_paths.join("|");
}
//var nav_values = spt.api.Utility.get_input_values(nav,null,false);
//spt.panel.refresh(top, nav_values);
#.........这里部分代码省略.........
示例8: get_display
# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_style [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)
#.........这里部分代码省略.........
示例9: get_display
# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_style [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)
#.........这里部分代码省略.........
示例10: get_display
# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_style [as 别名]
def get_display(self):
top = self.top
top.add_color("background", "background")
top.add_class("spt_pipelines_top")
self.set_as_panel(top)
inner = DivWdg()
top.add(inner)
search_type = self.kwargs.get("search_type")
pipeline_code = self.kwargs.get("pipeline_code")
if search_type:
search = Search("sthpw/pipeline")
search.add_filter("search_type", search_type)
pipelines = search.get_sobjects()
else:
pipeline = Pipeline.get_by_code(pipeline_code)
if pipeline:
pipelines = [pipeline]
else:
pipelines = []
if not pipelines:
div = DivWdg()
inner.add(div)
inner.add_style("padding: 50px")
div.add_border()
div.add_color("color", "color3")
div.add_color("background", "background3")
div.add_style("width: 400px")
div.add_style("height: 100px")
div.add_style("padding: 30px")
icon = IconWdg("WARNING", IconWdg.WARNING)
div.add(icon)
div.add("<b>This Searchable Type does not have pipelines defined.</b>")
div.add("<br/>"*2)
div.add("<b style='padding-left: 35px'>Click Create to add one...</b>")
div.add("<br/>"*2)
button_div = DivWdg()
div.add(button_div)
button = ActionButtonWdg(title="Create", tip="Create pipeline")
button_div.add(button)
button.add_style("margin: auto")
button.add_behavior( {
'type': 'click_up',
'search_type': search_type,
'cbjs_action': '''
var server = TacticServerStub.get();
var cmd = 'tactic.ui.startup.PipelineCreateCbk';
var kwargs = {
search_type: bvr.search_type
}
server.execute_cmd(cmd, kwargs)
var top = bvr.src_el.getParent(".spt_pipelines_top");
spt.panel.refresh(top);
'''
} )
return top
# get the defalt task statuses
task_pipeline = Pipeline.get_by_code("task")
if task_pipeline:
statuses = task_pipeline.get_process_names()
else:
statuses = ['Pending', 'In Progress', 'Complete']
statuses_str = ",".join(statuses)
pipelines_div = DivWdg()
inner.add( pipelines_div )
pipelines_div.add_style("font-size: 12px")
pipelines_div.add_style("padding: 10px")
buttons_div = DivWdg()
pipelines_div.add(buttons_div)
#button = SingleButtonWdg( title="Save Pipelines", icon=IconWdg.SAVE )
button = ActionButtonWdg( title="Save" )
buttons_div.add(button)
button.add_behavior( {
'type': 'click_up',
'default_statuses': statuses_str,
'cbjs_action': '''
spt.app_busy.show("Saving Pipeline...")
setTimeout(function() {
#.........这里部分代码省略.........
示例11: get_file_mode_wdg
# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_style [as 别名]
def get_file_mode_wdg(self):
div = DivWdg()
div.add_style("margin-top: 15px")
div.add_style("margin-bottom: 15px")
div.add_class("spt_file_mode")
# drop folder
div.add("A writable folder is required. This is the folder that sync will drop the transacton file into. This folder should be common to all shares that need to have recieve the transactions.")
div.add("<br/>"*2)
# only valid for standalone
browser = WebContainer.get_web().get_browser()
if browser == 'Qt':
button = ActionButtonWdg(title="Browse")
div.add(button)
button.add_style("float: right")
button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
var applet = spt.Applet.get();
var files = applet.open_file_browser();
if (files.length == 0) {
return;
}
var dir = files[0];
if (!applet.is_dir(dir)) {
spt.alert("Please select a folder");
return;
}
var top = bvr.src_el.getParent(".spt_file_mode");
var folder_el = top.getElement(".spt_sync_folder");
folder_el.value = dir;
'''
} )
div.add("Sync Folder: ")
text = TextInputWdg(name="sync_folder")
text.add_class("spt_sync_folder")
text.add_style("width: 300px")
div.add(text)
#div.add("<br/>"*2)
#div.add("Set whether this transaction is plaintext, zipped or encrypted.")
div.add("<br/>"*3)
div.add("The transactions can be encrypted with an encryption ticket. All shares must set this to be the same value in order for the transaction to be appropriately encrypted and decrypted.")
div.add("<br/>"*2)
div.add("Encrypt Transactions? ")
checkbox = CheckboxWdg("is_encrypted")
div.add(checkbox)
checkbox.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_file_mode");
var el = top.getElement(".spt_encrypt");
if (el.getStyle("display") == "none") {
el.setStyle("display", "");
}
else {
el.setStyle("display", "none");
}
'''
} )
#div.add("Set whether this transaction is plaintext, zipped or encrypted.")
encrypt_div = DivWdg()
encrypt_div.add_class("spt_encrypt")
div.add(encrypt_div)
encrypt_div.add_style("display: none")
encrypt_div.add_style("padding: 30px 20px 30px 20px")
encrypt_div.add("Encryption Key: ")
text = TextWdg("encrypt_key")
text.add_style("width: 300px")
encrypt_div.add(text)
#div.add(self.get_ticket_wdg())
return div
示例12: get_base_dir_wdg
# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_style [as 别名]
def get_base_dir_wdg(self):
div = DivWdg()
title = DivWdg()
div.add(title)
title.add("Sync Project Import: ")
title.add_style("font-size: 14px")
title.add_style("font-weight: bold")
div.add("<br/>")
base_dir = self.kwargs.get("base_dir")
is_local = False
if is_local:
button = ActionButtonWdg(title="Browse")
div.add(button)
button.add_style("float: right")
button.add_style("margin-top: -5px")
button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
var applet = spt.Applet.get();
var files = applet.open_file_browser();
if (!files.length) {
return;
}
var file = files[0];
var top = bvr.src_el.getParent(".spt_sync_import_top");
var el = top.getElement(".spt_sync_base_dir");
el.value = file;
'''
} )
div.add("Share Location: ")
text = TextInputWdg(name="base_dir")
div.add(text)
text.add_class("spt_sync_base_dir")
text.add_style("width: 300px")
if base_dir:
text.set_value(base_dir)
text.add_behavior( {
'type': 'blur',
'is_local': is_local,
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_sync_import_top");
var applet = spt.Applet.get();
var value = bvr.src_el.value;
var manifest_path = value + "/tactic.txt";
if (!value) {
return;
}
if (bvr.is_local) {
if (!applet.exists(value)) {
alert('Share folder does not exist.');
return;
}
if (!applet.exists(manifest_path)) {
alert('Cannot find manifest file.');
return;
}
var data = applet.read_file(manifest_path);
var json = JSON.parse(data);
data = JSON.stringify(json);
top.setAttribute("spt_data", data)
}
top.setAttribute("spt_base_dir", value)
spt.panel.refresh(top);
'''
} )
return div
示例13: get_upload_wdg
# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_style [as 别名]
def get_upload_wdg(my):
'''get search type select and upload wdg'''
key = 'csv_import'
widget = DivWdg(css='spt_import_csv')
widget.add_color('color','color')
widget.add_color('background','background')
widget.add_style('width: 600px')
# get the search type
stype_div = DivWdg()
widget.add(stype_div)
# DEPRECATED
# handle new search_types
"""
new_search_type = CheckboxWdg("new_search_type_checkbox")
new_search_type.add_event("onclick", "toggle_display('new_search_type_div')")
new_search_type_div = DivWdg()
new_search_type_div.set_id("new_search_type_div")
name_input = TextWdg("asset_name")
title = TextWdg("asset_title")
description = TextAreaWdg("asset_description")
table = Table()
table.set_id('csv_main_body')
table.add_style("margin: 10px 10px")
table.add_col().set_attr('width','140')
table.add_col().set_attr('width','400')
table.add_row()
table.add_header("Search Type: ").set_attr('align','left')
table.add_cell(name_input)
table.add_row()
table.add_header("Title: ").set_attr('align','left')
table.add_cell(title)
table.add_row()
table.add_header("Description: ").set_attr('align','left')
table.add_cell(description)
new_search_type_div.add(table)
new_search_type_div.add_style("display: none")
#widget.add(new_search_type_div)
"""
show_stype_select = my.kwargs.get("show_stype_select")
if show_stype_select in ['true',True] or not my.search_type:
title = DivWdg("<b>Select sType to import data into:</b> ")
stype_div.add( title )
title.add_style("float: left")
search_type_select = SearchTypeSelectWdg("search_type_filter", mode=SearchTypeSelectWdg.ALL)
search_type_select.add_empty_option("-- Select --")
if not search_type_select.get_value():
search_type_select.set_value(my.search_type)
search_type_select.set_persist_on_submit()
stype_div.add(search_type_select)
search_type_select.add_behavior( {'type': 'change', \
'cbjs_action': "spt.panel.load('csv_import_main','%s', {}, {\
'search_type_filter': bvr.src_el.value});" %(Common.get_full_class_name(my)) } )
else:
hidden = HiddenWdg("search_type_filter")
stype_div.add(hidden)
hidden.set_value(my.search_type)
if my.search_type:
sobj = None
try:
sobj = SObjectFactory.create(my.search_type)
except ImportError:
widget.add(HtmlElement.br())
widget.add(SpanWdg('WARNING: Import Error encountered. Please choose another search type.', css='warning'))
return widget
required_columns = sobj.get_required_columns()
if required_columns:
widget.add(HtmlElement.br())
req_span = SpanWdg("Required Columns: ", css='med')
req_span.add_color('color','color')
widget.add(req_span)
#required_columns = ['n/a']
req_span.add(', '.join(required_columns))
widget.add( HtmlElement.br() )
if my.file_path:
#.........这里部分代码省略.........
示例14: get_display
# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_style [as 别名]
def get_display(self):
top = self.top
top.add_class("spt_sign_in_top")
top.add_color("background", "background")
top.add_style("padding: 30px")
top.add_style("width: 300px")
icon = IconWdg("Not signed in", IconWdg.WARNING)
top.add(icon)
top.add("You are not signed into Perforce.")
top.add("<br/>"*2)
table = Table()
top.add(table)
from tactic.ui.input import TextInputWdg, PasswordInputWdg
table.add_row()
td = table.add_cell("Port: ")
td.add_style("width: 75px")
text = TextInputWdg(name="port")
td = table.add_cell(text)
td.add_style("vertical-align: top")
text.set_value("1666")
table.add_row()
td = table.add_cell("Login: ")
td.add_style("vertical-align: top")
td.add_style("width: 75px")
text = TextInputWdg(name="user")
td = table.add_cell(text)
td.add_style("vertical-align: top")
user = Environment.get_user_name()
text.set_value(user)
table.add_row()
td = table.add_cell("Password: ")
td.add_style("vertical-align: top")
text = PasswordInputWdg(name="password")
table.add_cell(text)
tr = table.add_row()
table.add_row_cell(" ")
tr = table.add_row()
tr.add_class("spt_workspaces")
#tr.add_style("display: none")
td = table.add_cell("Workspace: ")
td.add_style("vertical-align: top")
workspaces = self.kwargs.get("workspaces")
td = table.add_cell()
button = ActionButtonWdg(width='55', title="Lookup")
td.add(button)
button.add_style("float: right")
button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
try {
var workspaces = spt.scm.get_workspaces();
var clients = [];
for (var i = 0; i < workspaces.length; i++) {
clients.push(workspaces[i].client);
}
clients = clients.join("|");
var kwargs = {
workspaces: clients
}
spt.scm.show_login(kwargs);
}
catch(e) {
spt.scm.signout_user();
spt.scm.show_login();
}
'''
} )
if not workspaces:
text = TextInputWdg(name="workspace")
text.add_style("width: 165px")
td.add(text)
else:
select = SelectWdg("workspace")
td.add(select)
#.........这里部分代码省略.........