本文整理汇总了Python中tactic.ui.input.TextInputWdg类的典型用法代码示例。如果您正苦于以下问题:Python TextInputWdg类的具体用法?Python TextInputWdg怎么用?Python TextInputWdg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextInputWdg类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get_display
def get_display(self):
# Set up the outer <div> to hold all the form elements
outer_div = DivWdg()
outer_div.add_class('new-order-entry-form')
outer_div.set_id('new-order-entry-form')
# Set up the <input> widget for 'name'
outer_div.add(HtmlElement.label('Name'))
name_input = TextInputWdg(name='name')
outer_div.add(name_input)
# Set up the <input> widget for 'po_number'
outer_div.add(HtmlElement.label('PO Number'))
po_number_input = TextInputWdg()
po_number_input.set_name('po_number')
outer_div.add(po_number_input)
# Set up the <select> widget and it's options for 'client'
outer_div.add(HtmlElement.label('Client'))
client_select_wdg = get_select_widget_from_search_type('twog/client', 'client', 'name', 'code')
outer_div.add(client_select_wdg)
# Set up the Save button
save_button = SubmitWdg('Save')
save_button.add_behavior(self.save_button_behavior())
outer_div.add(save_button)
# Set up the Save and Add button
save_and_add_button = SubmitWdg('Save and Add')
save_and_add_button.add_behavior(self.save_and_add_button_behavior())
outer_div.add(save_and_add_button)
return outer_div
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:33,代码来源:new_order_entry.py
示例2: get_display
def get_display(self):
outer_div = DivWdg()
outer_div.add_class('new-work-order-entry-form')
page_label = "Work Order for {0}".format(self.title_order)
outer_div.add(page_label)
process_input = TextInputWdg()
process_input.set_name('process')
outer_div.add(get_label_widget('Process'))
outer_div.add(process_input)
instructions_input = TextAreaInputWdg()
instructions_input.set_name('instructions')
outer_div.add(get_label_widget('Instructions'))
outer_div.add(instructions_input)
description_input = TextAreaInputWdg()
description_input.set_name('description')
outer_div.add(get_label_widget('Description (Optional)'))
outer_div.add(description_input)
submit_button = SubmitWdg('Submit')
submit_button.add_behavior(self.submit_button_behavior())
outer_div.add(submit_button)
return outer_div
开发者ID:2gDigitalPost,项目名称:custom,代码行数:31,代码来源:work_order_builder.py
示例3: get_text_input_wdg
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
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:10,代码来源:metadata_report_wdg.py
示例4: get_text_input_wdg
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
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:10,代码来源:prequal_eval_lines_wdg.py
示例5: get_text_input_wdg
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
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:10,代码来源:input_widgets.py
示例6: get_add_chat_wdg
def get_add_chat_wdg(my):
div = DivWdg()
div.add_border()
div.add_style("padding: 20px")
div.add_class("spt_add_chat_top")
table = Table()
table.add_style("width: auto")
div.add(table)
table.add_row()
text = TextInputWdg(title="user", icon="USER_ADD")
table.add_cell(text)
text.add_class("spt_add_chat_user")
add_button = ActionButtonWdg(title="Start Chat")
table.add_cell(add_button)
add_button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_add_chat_top");
var el = top.getElement(".spt_add_chat_user");
var user = el.value;
if (!user) {
alert("Specify a valid user to chat with");
return;
}
// new chat
var server = TacticServerStub.get();
var category = "chat";
var class_name = 'tactic.ui.app.ChatCmd';
var kwargs = {
users: [user]
}
server.execute_cmd(class_name, kwargs);
spt.panel.refresh(bvr.src_el);
'''
} )
return div
开发者ID:0-T-0,项目名称:TACTIC,代码行数:45,代码来源:message_wdg.py
示例7: get_sqlite_wdg
def get_sqlite_wdg(my):
div = DivWdg()
div.add_class("spt_db_options")
div.add_attr("spt_vendor", "Sqlite")
div.add_style("padding: 20px")
div.add("Database Folder: ")
text = TextInputWdg(name="database/sqlite_db_dir")
div.add(text)
db_dir = Config.get_value("database", "sqlite_db_dir")
if not db_dir:
data_dir = Environment.get_data_dir()
db_dir = "%s/db" % data_dir
text.set_value(db_dir)
return div
开发者ID:blezek,项目名称:TACTIC,代码行数:19,代码来源:db_config_wdg.py
示例8: get_display
def get_display(self):
outer_div = DivWdg()
outer_div.add_class('new-order-entry-form')
order_name_input = TextInputWdg()
order_name_input.set_name('name')
outer_div.add(get_label_widget('Name'))
outer_div.add(order_name_input)
po_number_input = TextInputWdg()
po_number_input.set_name('po_number')
outer_div.add(get_label_widget('PO Number'))
outer_div.add(po_number_input)
client_select_wdg = get_select_widget_from_search_type('twog/client', 'client', 'name', 'code')
outer_div.add(get_label_widget('Client'))
outer_div.add(client_select_wdg)
sales_rep_select_wdg = get_select_widget_from_search_type('sthpw/login_in_group', 'Client', 'login_full_name',
'code', [('login_group', 'sales')])
outer_div.add(get_label_widget('Sales Rep'))
outer_div.add(sales_rep_select_wdg)
submit_button = SubmitWdg('Submit')
submit_button.add_behavior(self.submit_button_behavior())
outer_div.add(submit_button)
return outer_div
开发者ID:2gDigitalPost,项目名称:custom,代码行数:33,代码来源:order_entry_wdg.py
示例9: get_display
def get_display(self):
outer_div = DivWdg()
outer_div.add_class('new-title-entry-form')
title_name_input = TextInputWdg()
title_name_input.set_name('name')
outer_div.add(get_label_widget('Name'))
outer_div.add(title_name_input)
episode_input = TextInputWdg()
episode_input.set_name('episode')
outer_div.add(get_label_widget('Episode'))
outer_div.add(episode_input)
description_input = TextAreaInputWdg()
description_input.set_name('description')
outer_div.add(get_label_widget('Description'))
outer_div.add(description_input)
submit_button = SubmitWdg('Submit')
submit_button.add_behavior(self.submit_button_behavior())
outer_div.add(submit_button)
return outer_div
开发者ID:2gDigitalPost,项目名称:custom,代码行数:28,代码来源:title_entry_wdg.py
示例10: get_info_wdg
def get_info_wdg(my):
div = DivWdg()
div.set_name("Info")
div.add_style("padding: 20px")
table = Table()
div.add(table)
table.add_color("color", "color")
#table.add_style("height: 280px")
table.set_unique_id()
table.add_smart_style("spt_table_header", "width", "200px")
table.add_smart_style("spt_table_header", "text-align", "right")
table.add_smart_style("spt_table_header", "padding-right", "20px")
table.add_smart_style("spt_table_header", "margin-bottom", "10px")
table.add_smart_style("spt_table_element", "vertical-align", "top")
table.add_row()
#if my.mode == 'insert':
# read_only = False
#else:
# read_only = True
read_only = False
code = Config.get_value("install", "server") or ""
td = table.add_cell()
td.add_class("spt_table_header")
td.add("Code: ")
td.add_style("vertical-align: top")
text = TextInputWdg(name="code", read_only=read_only)
td = table.add_cell()
td.add_class("spt_table_element")
td.add(text)
text.set_value(code)
return div
开发者ID:blezek,项目名称:TACTIC,代码行数:40,代码来源:share_wdg.py
示例11: get_timecode_textbox
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
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:12,代码来源:prequal_eval_lines_wdg.py
示例12: get_display
def get_display(my):
top = my.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")
table.add_cell(text)
text.set_value("1666")
tr = table.add_row()
table.add_row_cell(" ")
table.add_row()
td = table.add_cell("Login: ")
td.add_style("width: 75px")
text = TextInputWdg(name="user")
table.add_cell(text)
user = Environment.get_user_name()
text.set_value(user)
table.add_row()
table.add_cell("Password: ")
text = PasswordInputWdg(name="password")
table.add_cell(text)
tr = table.add_row()
table.add_row_cell(" ")
tr = table.add_row()
table.add_cell("Workspace: ")
text = TextInputWdg(name="workspace")
table.add_cell(text)
text.add_class("spt_workspace")
top.add("<br/>"*2)
button = ActionButtonWdg(title="Sign In", icon=IconWdg.PUBLISH, size='medium')
top.add(button)
button.add_style("float: right")
button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_sign_in_top");
var values = spt.api.get_input_values(top);
var port = values.port[0];
var user = values.user[0];
var password = values.password[0];
var client = values.workspace[0];
// login in user
spt.scm.port = port;
spt.scm.user = user;
spt.scm.password = password;
spt.scm.client = client;
// test the connection
var ping = spt.scm.ping();
if (ping != "OK") {
spt.scm.show_login();
return;
}
// TODO: get the workspaces and use this as a list
// For now, just fill it in with the first one
if (!client) {
var workspaces = spt.scm.get_workspaces();
if (workspaces.length > 0) {
#.........这里部分代码省略.........
开发者ID:blezek,项目名称:TACTIC,代码行数:101,代码来源:scm_dir_list_wdg.py
示例13: get_upload_wdg
#.........这里部分代码省略.........
values['is_refresh'] = true;
values['file_name'] = file_name;
values['html5_ticket'] = '%s';
try {
var info = spt.panel.load('csv_import_main', class_name, {}, values);
spt.app_busy.hide();
}
catch(e) {
spt.alert(spt.exception.handler(e));
}
}
else {
alert('Error: file object cannot be found.')
}
spt.app_busy.hide();'''%ticket
from tactic.ui.input import UploadButtonWdg
browse = UploadButtonWdg(name='new_csv_upload', title="Browse", tip="Click to choose a csv file",\
on_complete=on_complete, ticket=ticket)
browse.add_style('float: left')
msg.add(browse)
# this is now only used in the copy and paste Upload button for backward-compatibility
upload_wdg = SimpleUploadWdg(key=key, show_upload=False)
upload_wdg.add_style('display: none')
msg.add(upload_wdg)
msg.add("<br/>")
msg.add("<div style='margin: 30px; text-align: center'>-- OR --</div>")
msg.add("<b>Published URL: </b><br/>")
from tactic.ui.input import TextInputWdg
text = TextInputWdg(name="web_url")
text.add_style("width: 100%")
msg.add(text)
msg.add("<div style='margin: 30px; text-align: center'>-- OR --</div>")
msg.add("<b>Copy and Paste from a Spreadsheet: </b><br/>")
text = TextAreaWdg("data")
text.add_style('width: 100%')
text.add_style('height: 100px')
text.add_class("spt_import_cut_paste")
msg.add(text)
msg.add("<br/>"*3)
button = ActionButtonWdg(title="Parse")
button.add_style("margin: 5px auto")
msg.add(button)
button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_import_top");
var el = top.getElement(".spt_import_cut_paste");
var value = el.value;
var csv = [];
// convert to a csv file!
lines = value.split("\\n");
for (var i = 0; i < lines.length; i++) {
if (lines[i] == '') {
continue;
}
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:67,代码来源:data_export_wdg.py
示例14: get_display
#.........这里部分代码省略.........
button = ActionButtonWdg(title="Clear")
button.add_style("float: left")
button.add_style("margin: 0 10 3")
#button = ProdIconButtonWdg("Clear")
#button.add_style("margin: 5 10")
button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
spt.api.Utility.clear_inputs( bvr.src_el.getParent('.spt_js_editor') );
editAreaLoader.setValue('shelf_script', '');
'''
} )
button_div.add(button)
"""
div.add( "<br clear='all'/><br/>")
save_wdg = DivWdg()
div.add(save_wdg)
save_wdg.add_style("padding: 2px 5px 6px 5px")
#save_wdg.add_color("background", "background", -5)
# script code
save_span = Table()
save_wdg.add(save_span)
save_span.add_row()
code_span = SpanWdg()
code_span.add("<b>Code: </b>")
td = save_span.add_cell(code_span)
td.add_style("display: none")
code_text = TextInputWdg(name="shelf_code")
code_text.add_style("display: inline")
code_text.add_style("width: 100px")
code_text.set_value(script_code)
code_text.add_attr("readonly", "true")
code_text.set_id("shelf_code")
code_text.add_class("spt_code")
td = save_span.add_cell(code_text)
td.add_style("padding-top: 10px")
td.add_style("display: none")
save_span.add_cell(" ")
# script name (path??)
td = save_span.add_cell("<b>Script Path: </b>")
td.add_style("padding-top: 10px")
save_text = TextInputWdg(name="shelf_folder")
save_text.add_style("width: 250px")
save_text.set_id("shelf_folder")
save_text.add_class("spt_folder")
save_text.set_value(script_folder)
td = save_span.add_cell(save_text)
td.add_style("padding-top: 10px")
td = save_span.add_cell(" / ")
td.add_style("padding-top: 10px")
td.add_style("font-size: 1.5em")
save_text = TextInputWdg(name="shelf_title")
save_text.add_style("width: 350px")
save_text.add_attr("size", "40")
save_text.set_id("shelf_title")
save_text.add_class("spt_title")
save_text.set_value(script_name)
td = save_span.add_cell(save_text)
td.add_style("padding-top: 10px")
from tactic.ui.container import ResizableTableWdg
table = ResizableTableWdg()
table.add_row()
td = table.add_cell(resize=False)
td.add_style("vertical-align: top")
td.add(editor)
text = TextAreaWdg("shelf_script")
td = table.add_cell()
td.add_style('vertical-align: top')
td.add(my.get_script_wdg())
table.add_row(resize=False)
div.add(table)
if my.kwargs.get("is_refresh"):
return div
else:
return top
开发者ID:0-T-0,项目名称:TACTIC,代码行数:101,代码来源:shelf_wdg.py
示例15: get_nav_wdg
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);
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:101,代码来源:ingestion_wdg.py
示例16: get_priority_widget
def get_priority_widget(outer_div):
priority_input = TextInputWdg()
priority_input.set_name('priority')
outer_div.add(get_label_widget('Priority'))
outer_div.add(priority_input)
开发者ID:2gDigitalPost,项目名称:custom,代码行数:6,代码来源:task_utils.py
示例17: get_file_mode_wdg
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
开发者ID:mincau,项目名称:TACTIC,代码行数:87,代码来源:sync_settings_wdg.py
示例18: get_display
#.........这里部分代码省略.........
tr = table.add_row()
tr.add_color("background", "background", -5)
th = table.add_header("Column Name")
th.add_style("width: 190px")
th.add_style("text-align: left")
th.add_style("padding: 8px 0px")
th = table.add_header("Format")
th.add_style("text-align: left")
th.add_style("padding: 8px 0px")
from tactic.ui.container import DynamicListWdg
dyn_list = DynamicListWdg()
inner.add(dyn_list)
from tactic.ui.manager import FormatDefinitionEditWdg
for i in range(0, 4):
column_div = DivWdg()
column_div.add_class("spt_columns_element")
if i == 0:
dyn_list.add_template(column_div)
else:
dyn_list.add_item(column_div)
column_div.add_style("padding: 3px")
column_div.add_style("float: left")
table = Table()
column_div.add(table)
table.add_row()
from tactic.ui.input import TextInputWdg
text_wdg = TextInputWdg(name="name", height="30px", width="170px")
text_wdg.add_class("form-control")
text_wdg.add_class("display: inline-block")
td = table.add_cell(text_wdg)
text_wdg.add_behavior( {
'type': 'blur',
'cbjs_action': '''
var value = bvr.src_el.value;
var code = spt.convert_to_alpha_numeric(value);
bvr.src_el.value = code;
'''
} )
option = {
'name': '_dummy',
'values': 'integer|float|percent|currency|date|time|scientific|boolean|text|timecode',
}
format_wdg = FormatDefinitionEditWdg(option=option)
td = table.add_cell(format_wdg)
td.add_style("width: 550px")
td.add_style("padding-left: 10px")
# show the current columns
title_wdg = DivWdg()
inner.add(title_wdg)
title_wdg.add_style("margin-top: 25px")
title_wdg.add("<b>Existing Columns</b>")
title_wdg.add_style("padding: 5px")
title_wdg.add_style("margin: 20px -10px 10px -10px")
开发者ID:mincau,项目名称:TACTIC,代码行数:66,代码来源:column_edit_wdg.py
示例19: get_display
#.........这里部分代码省略.........
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_saved_search_top")
var input = top.getElement(".spt_saved_search_input");
var value = input.value;
if (!value) {
spt.alert("Please select a saved search to load.");
return;
}
var popup = bvr.src_el.getParent(".spt_popup");
var activator = popup.activator;
var layout = activator.getElement(".spt_layout");
spt.table.set_layout(layout);
spt.table.load_search(value);
'''
}
retrieve_button.add_behavior( behavior )
retrieve_button.add_style("display: inline-block")
remove_button = ActionButtonWdg(title="Remove")
remove_button.add_behavior( {
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_saved_search_top")
var input = top.getElement(".spt_saved_search_input");
var value = input.value;
if (!value) {
spt.alert("Please select a saved search to remove.");
return;
}
spt.alert("Remove: " + value);
'''
} )
remove_button.add_style("display: inline-block")
cancel_button = ActionButtonWdg(title="Cancel")
cancel_button.add_behavior( {
'cbjs_action': '''
var popup = bvr.src_el.getParent(".spt_popup");
spt.popup.close(popup);
'''
} )
cancel_button.add_style("display: inline-block")
div.add("<br/>")
button_div = DivWdg()
button_div.add_style("text-align: center")
button_div.add(retrieve_button)
button_div.add(" ")
button_div.add(remove_button)
button_div.add(" ")
button_div.add(cancel_button)
div.add(button_div)
div.add("<hr/>")
save_div = DivWdg()
div.add(save_div)
save_div.add("Save Current Search")
save_div.add("<br/>")
save_div.add("<br/>")
text = TextInputWdg(name="new_search_name")
save_div.add(text)
text.add_class("spt_new_search_name")
save_div.add("<br/>")
save_button = ActionButtonWdg(title="Save Search", width="200")
save_div.add(save_button)
save_button.add_behavior( {
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_saved_search_top");
var input = top.getElement(".spt_new_search_name");
var value = input.value;
if (!value) {
spt.alert("No view name specified");
return;
}
spt.table.save_search(value, {personal: true});
spt.notify.show_message("Search saved");
var popup = bvr.src_el.getParent(".spt_popup");
spt.popup.close(popup);
'''
} )
save_button.add_style("display: inline-block")
return div
开发者ID:mincau,项目名称:TACTIC,代码行数:101,代码来源:search_wdg.py
示例20: get_base_dir_wdg
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
开发者ID:mincau,项目名称:TACTIC,代码行数:92,代码来源:sync_import_wdg.py
注:本文中的tactic.ui.input.TextInputWdg类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论