本文整理汇总了Python中tactic.ui.input.TextInputWdg类的典型用法代码示例。如果您正苦于以下问题:Python TextInputWdg类的具体用法?Python TextInputWdg怎么用?Python TextInputWdg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextInputWdg类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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) {
#.........这里部分代码省略.........
示例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;
}
示例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
示例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);
#.........这里部分代码省略.........