本文整理汇总了Python中pyasm.widget.TextWdg类的典型用法代码示例。如果您正苦于以下问题:Python TextWdg类的具体用法?Python TextWdg怎么用?Python TextWdg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextWdg类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_save_wdg
def get_save_wdg(my):
# add the popup
popup = PopupWdg(id="save_search_wdg")
popup.add("Save Search", "title")
div = DivWdg()
div.add("Save current search as: ")
text = TextWdg("save_search_text")
text.set_id("save_search_text")
div.add(text)
save_button = ButtonWdg("Save Search")
behavior = {"type": "click", "mouse_btn": "LMB", "cbjs_action": "spt.dg_table.save_search_cbk(evt, bvr);"}
save_button.add_behavior(behavior)
cancel_button = ButtonWdg("Cancel")
cancel_button.add_event("onclick", "$('save_search_wdg').style.display = 'none'")
div.add(HtmlElement.hr())
button_div = DivWdg()
button_div.add_style("text-align: center")
button_div.add(save_button)
button_div.add(" ")
button_div.add(cancel_button)
div.add(button_div)
popup.add(div, "content")
return popup
示例2: get_save_wdg
def get_save_wdg(self):
div = DivWdg()
div.add("Save current search as: ")
text = TextWdg("save_search_text")
text.set_id("save_search_text")
div.add(text)
save_button = ButtonWdg("Save Search")
behavior = {
'cbjs_action': 'spt.table.save_search();'
}
save_button.add_behavior( behavior )
cancel_button = ButtonWdg("Cancel")
cancel_button.add_event("onclick", "$('save_search_wdg').style.display = 'none'")
div.add(HtmlElement.hr())
button_div = DivWdg()
button_div.add_style("text-align: center")
button_div.add(save_button)
button_div.add(" ")
button_div.add(cancel_button)
div.add(button_div)
return div
示例3: get_display
def get_display(my):
sobject = my.get_current_sobject()
key = sobject.get_value("key")
options = sobject.get_value("options")
type = sobject.get_value("type")
# get the value of the users preferences
search = Search("sthpw/pref_setting")
search.add_user_filter()
search.add_filter("key", key)
pref_setting = search.get_sobject()
if pref_setting:
value = pref_setting.get_value("value")
else:
value = ""
div = DivWdg()
element_name = "%s_%s" % (my.get_name(), sobject.get_id() )
script = '''var server = TacticServerStub.get();
var value = bvr.src_el.value;
if (!value) return;
spt.app_busy.show("Saving", "Saving Preference for [%s]");
setTimeout( function() {
try{
server.execute_cmd('tactic.ui.table.SetPreferenceCmd', {key: '%s', value: value});
}catch(e){
spt.alert(spt.exception.handler(e));
}
spt.app_busy.hide()
}, 200);'''%(key, key)
if key in ['skin', 'palette', 'js_logging_level']:
script = '''%s; spt.app_busy.show('Reloading Page ...'); setTimeout('spt.refresh_page()', 200);'''%script
if type == "sequence":
from pyasm.prod.web import SelectWdg
select = SelectWdg(element_name)
select.add_behavior({'type': "change",
'cbjs_action': script})
select.set_option("values",options)
if value:
select.set_value(value)
div.add(select)
else:
text = TextWdg(element_name)
text.add_behavior({'type': "blur",
'cbjs_action': script})
if value:
text.set_value(value)
div.add(text)
return div
示例4: get_display
def get_display(my):
div = SpanWdg()
div.add(" is ")
text = TextWdg("year")
value = my.values.get("year")
if value:
text.set_value(value)
div.add(text)
return div
示例5: get_display
def get_display(my):
from tactic.ui.widget import SObjectCheckinHistoryWdg
my.code = str(my.kwargs.get('source_code'))
my.sk = my.server.build_search_key('twog/source',my.code)
my.movement_code = str(my.kwargs.get('movement_code'))
ms = MovementScripts(movement_code=my.movement_code)
clients_expr = "@SOBJECT(twog/client['@ORDER_BY','name desc'])"
clients = my.server.eval(clients_expr)
client_sel = '<select class="REPLACE_ME"><option value="">--Select--</option>'
for client in clients:
client_sel = '%s<option value="%s">%s</option>' % (client_sel, client.get('code'), client.get('name'))
client_sel = '%s</select>' % client_sel
existing_expr = "@SOBJECT(twog/outside_barcode['source_code','%s'])" % my.code
existing = my.server.eval(existing_expr)
count = 0
table = Table()
table.add_attr('class','movement_outside_barcodes')
for obc in existing:
table.add_row()
barcode_text_wdg = TextWdg('outside_barcode_insert_%s' % count)
barcode_text_wdg.set_value(obc.get('barcode'))
barcode_text_wdg.add_attr('curr_code',obc.get('code'))
table.add_cell(barcode_text_wdg)
new_sel = client_sel
new_sel2 = new_sel.replace('REPLACE_ME','outside_client_%s' % count)
found = new_sel2.find('"%s"' % obc.get('client_code'))
if found > 0:
part1 = new_sel2[:found]
part2 = new_sel2[found:]
found2 = part2.find('>')
if found2 > 0:
good2 = part2[found2:]
new_sel2 = '%s"%s" selected="selected"%s' % (part1, obc.get('client_code'),good2)
table.add_cell(new_sel2)
count = count + 1
additional_count = [1, 2, 3, 4, 5]
for n in additional_count:
table.add_row()
barcode_text_wdg = TextWdg('outside_barcode_insert_%s' % count)
barcode_text_wdg.add_attr('curr_code','')
table.add_cell(barcode_text_wdg)
new_sel = client_sel
new_sel = new_sel.replace('REPLACE_ME','outside_client_%s' % count)
table.add_cell(new_sel)
count = count + 1
table.add_row()
save_tbl = Table()
save_tbl.add_row()
s1 = save_tbl.add_cell(' ')
s1.add_attr('width','100%s' % '%')
save_cell = table.add_cell('<input type="button" value="Save All"/>')
save_cell.add_attr('align','center')
save_cell.add_behavior(ms.get_save_outside_barcodes_behavior(my.code))
s2 = save_tbl.add_cell(' ')
s2.add_attr('width','100%s' % '%')
ss = table.add_cell(save_tbl)
ss.add_attr('colspan','2')
ss.add_attr('align','center')
return table
示例6: get_config_wdg
def get_config_wdg(my):
widget = Widget()
search = Search("sthpw/widget_config")
div = DivWdg(css="filter_box")
span = SpanWdg(css="med")
span.add("Search Type: ")
select = FilterSelectWdg("config_search_type")
select.add_empty_option("-- Select --")
search_type_search = Search("sthpw/search_object")
search_type_search.add_order_by("search_type")
span.add(select)
project = Project.get()
project_type = project.get_base_type()
filter = search.get_regex_filter("search_type", "login|task|note|timecard", "EQ")
search_type_search.add_where(
"""
namespace = '%s' or namespace = '%s' or %s
"""
% (project_type, project.get_code(), filter)
)
select.set_search_for_options(search_type_search, value_column="search_type")
div.add(span)
search_type_value = select.get_value()
span = SpanWdg()
view_text = TextWdg("view")
view_text.set_persist_on_submit()
span.add("View: ")
span.add(view_text)
div.add(span)
widget.add(div)
view = view_text.get_value()
if view:
search.add_filter("view", view)
if search_type_value:
search.add_filter("search_type", search_type_value)
table = TableWdg("sthpw/widget_config")
table.set_search(search)
widget.add(table)
return widget
示例7: get_display
def get_display(my):
widget = DivWdg()
table = Table()
table.add_attr('class','scraper')
table.add_row()
tb = TextWdg('title_box')
tb.add_attr('id','title_box')
multiple_titles = None
print "MY.TITLE_OF_SHOW = %s" % my.title_of_show
if my.title_of_show not in [None,'']:
tb.set_value(my.title_of_show)
#poster_url_text = my.get_poster_url(my.title_of_show)
#poster_url = poster_url_text.split('=')[1]
multiple_titles = my.get_multiple_title_info(my.title_of_show)
print "MULTIPLE_TITLES = %s" % multiple_titles
tb.add_behavior(my.get_search())
table.add_cell(tb)
if multiple_titles not in [None,''] and len(multiple_titles) > 0:
for m in multiple_titles:
table.add_row()
table.add_cell('<img src="%s"/>' % m['TopLevel']['poster'])
mkeys = m.keys()
for k in mkeys:
table.add_row()
table.add_cell('<b><u>%s</u></b>' % k)
dudes = m[k]
dkeys = dudes.keys()
for d in dkeys:
table.add_row()
table.add_cell('%s: %s' % (d, dudes[d]))
widget.add(table)
return widget
示例8: get_display
def get_display(my):
name = my.get_name()
# get the sobject required by this input
sobject = my.get_current_sobject()
widget = DivWdg()
# add an advanced widget
text = TextWdg("%s" % name)
text.set_attr("size", 90)
value = sobject.get_value(name)
text.set_value(value)
div = DivWdg()
# div.add("Advanced: ")
div.add(text)
widget.add(div)
return widget
示例9: get_display
def get_display(my):
raise Exception("tactic.widget.ColorInputWdg is deprecated")
color_div = DivWdg()
color_div.add_style("z-index: 1000")
# color_div.add_style("float: left")
import random
number = random.randint(1, 1000)
rainbow_id = "rainbow_%s" % number
color_div.add(
"""
<img id="%s" src="/context/spt_js/mooRainbow/rainbow.png" alt="[r]" width="16" height="16" />
"""
% rainbow_id
)
# <input id="myInput" name="myInput" type="text" size="13" />
text = TextWdg(my.get_name())
text.set_id("myInput")
behavior = {"type": "keyboard", "kbd_handler_name": "DgTableMultiLineTextEdit"}
text.add_behavior(behavior)
color_div.add(text)
color_div.add_behavior(
{
"type": "load",
"cbjs_action": """
var r = new MooRainbow('%s', {
startColor: [58, 142, 246],
imgPath: '/context/spt_js/mooRainbow/images/',
onComplete: function(color) { $(myInput).value=color.hex; }
});
"""
% rainbow_id,
}
)
return color_div
示例10: 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")
div.add("User: ")
text = TextWdg("user")
div.add(text)
text.add_class("spt_add_chat_user")
add_button = ActionButtonWdg(title="Start Chat")
div.add(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
示例11: get_display
def get_display(my):
from pyasm.search import Search
#from tactic_client_lib import TacticServerStub
barcode = ''
sources = []
bad_sources = []
if 'barcode' in my.kwargs.keys():
barcode = my.kwargs.get('barcode')
tracker_s = Search("twog/location_tracker")
tracker_s.add_filter('location_barcode',barcode)
trackers = tracker_s.get_sobjects()
#print "BARCODE = %s" % barcode
#print "LEN TRACKERS = %s" % len(trackers)
for t in trackers:
tdate = t.get('timestamp')
source_barcode = t.get('source_barcode')
other_tracks = Search("twog/location_tracker")
other_tracks.add_filter('source_barcode',source_barcode)
other_tracks.add_filter('timestamp',tdate, op=">")
others = other_tracks.get_sobjects()
if len(others) == 0:
source_s = Search("twog/source")
source_s.add_filter('barcode',source_barcode)
source = source_s.get_sobject()
if source:
if source.get_value('in_house') in [True,'true','True',1,'1']:
sources.append(source)
else:
bad_sources.append({'barcode': source_barcode, 'title': 'UNKNOWN SOURCE'})
table = Table()
table.add_attr('class','location_inventory_wdg')
table.add_row()
bc = TextWdg('nextbc')
bc.add_attr('id', 'location_inventory_txtbox')
bc.add_behavior(my.get_entry_bvr())
bc.set_value(barcode)
table.add_cell(bc)
#print "LEN SOURCES = %s" % len(sources)
if len(sources) > 0:
table.add_row()
table.add_cell("<b>TOTAL: %s (UNKNOWN: %s)</b>" % (len(sources), len(bad_sources)))
for source in sources:
table.add_row()
table.add_cell('Barcode: %s, Code: %s, Name: %s: %s' % (source.get_value('barcode'), source.get_code(), source.get_value('title'), source.get_value('episode')))
if len(bad_sources) > 0:
table.add_row()
table.add_cell("<b>UNKNOWN SOURCES</b>")
for b in bad_sources:
table.add_row()
table.add_cell('Barcode: %s, Name: %s' % (b.get('barcode'), b.get('title')))
widget = DivWdg()
widget.add(table)
return widget
示例12: get_xmlrpc_mode_wdg
def get_xmlrpc_mode_wdg(self):
div = DivWdg()
div.add_style("margin-top: 15px")
div.add_style("margin-bottom: 15px")
div.add_class("spt_xmlrpc_mode")
div.add_style("display: none")
div.add("Server: ")
text = TextWdg("host")
text.add_style("width: 300px")
div.add(text)
div.add("<br/>"*2)
div.add("Each server requires an authentication that will be used to enable sending transactions to the remote server. The remote server must have this ticket defined in order to recieve the transaction.")
div.add("<br/>"*2)
div.add("Authentication Ticket: ")
text = TextWdg("auth_ticket")
text.add_style("width: 300px")
div.add(text)
return div
示例13: get_display
def get_display(my):
widget = DivWdg()
table = Table()
table.add_attr('class', 'scraper')
table.add_style('background-color: #FFFFFF;')
table.add_style('height: 1000px;')
table.add_row()
tb = TextWdg('title_box')
tb.add_attr('id', 'title_box')
tb.add_attr('size', '45')
multiple_titles = None
searched_imdb = False
orders = []
# TODO: Remove hard-coded URL
no_img = 'http://tactic.2gdigital.com/imdb_images/no_image.png'
if 'code' in my.kwargs.keys() and my.title_of_show in [None, '']:
server = TacticServerStub.get()
this_order = server.eval("@SOBJECT(twog/order['code','%s'])" % my.kwargs.get('code'))[0]
my.title_of_show = this_order.get('name')
if my.title_of_show not in [None, '']:
tb.set_value(my.title_of_show)
if my.search_when_loaded:
# poster_url_text = my.get_poster_url(my.title_of_show)
# poster_url = poster_url_text.split('=')[1]
server = TacticServerStub.get()
orders = server.eval("@SOBJECT(twog/order['name','~','%s']['classification','not in','Master|Cancelled'])" % my.title_of_show)
# order_s = Search("twog/order")
# order_s.add_where("\"name\" like '%s%s%s'" % ('%', my.title_of_show.lower(), '%'))
# statement = order_s.get_statement()
# print "STATEMENT = %s" % statement
# orders = order_s.get_sobjects()
# print "ORDER LEN = %s" % len(orders)
if len(orders) > 0:
multiple_titles = get_multiple_title_info(my.title_of_show)
# print "MULTIPLE TITLES = %s" % multiple_titles
searched_imdb = True
tb.add_behavior(my.get_search())
top_tbl = Table()
top_tbl.add_attr('width', '400px')
top_tbl.add_attr('height', '50px')
top_tbl.add_attr('cellpadding', '20')
top_tbl.add_attr('cellspacing', '20')
top_tbl.add_style('background-color: #417e97;')
top_tbl.add_row()
if len(orders) > 0:
butt = top_tbl.add_cell('<input type="button" value="Associate All Selected"/>')
butt.add_behavior(my.get_associate_em())
sn = top_tbl.add_cell('<font color="#d9af1f"><b>Search Name:</b></font> ')
sn.add_attr('align', 'right')
sn.add_attr('nowrap', 'nowrap')
tb_cell1 = top_tbl.add_cell(tb)
tb_cell = table.add_cell(top_tbl)
tb_cell.add_attr('colspan', '2')
tb_cell.add_attr('align', 'center')
order_table = Table()
order_table.add_attr('border', '1')
order_table.add_attr('cellpadding', '10')
order_table.add_row()
if len(orders) > 0:
toggler = CustomCheckboxWdg(name='chk_toggler', additional_js=my.get_toggler(), value_field='toggler',
id='selection_toggler', checked='false', text='<b><- Select/Deselect ALL</b>',
text_spot='right', text_align='left', nowrap='nowrap')
order_table.add_cell(toggler)
order_table.add_row()
order_table.add_cell('Selector')
order_table.add_cell('Poster')
order_table.add_cell('Order Builder')
order_table.add_cell('Code')
order_table.add_cell('Name')
order_table.add_cell('Client')
order_table.add_cell('PO Number')
order_table.add_cell('Classification')
order_table.add_cell('Platform')
order_table.add_cell('Due Date')
order_table.add_cell('Completion Ratio')
order_table.add_cell('Scheduler')
elif my.title_of_show not in [None, ''] and my.search_when_loaded:
description_box = order_table.add_cell('<b>No Tactic Orders Were Found With "%s" In The Name</b>' % my.title_of_show)
description_box.add_style('font-size: 14px;')
else:
description_box = order_table.add_cell('<b>Please type the name of the show in the box above</b>')
description_box.add_style('font-size: 14px;')
for order in orders:
checkbox = CustomCheckboxWdg(name='associate_order_%s' % order.get('code'),
additional_js=my.highlight_order_row(order.get('code')),
alert_name=order.get('name'),
value_field=order.get('code'),
checked='false',
dom_class='associated_orders')
imarow = order_table.add_row()
imarow.add_attr('id', 'row_%s' % order.get('code'))
chk = order_table.add_cell(checkbox)
chk.add_attr('align', 'center')
poster_cell = order_table.add_cell(OrderImageWdg(code=order.get('code')))
poster_cell.add_attr('id', 'img_%s' % order.get('code'))
#.........这里部分代码省略.........
示例14: get_display
def get_display(my):
my.title_code = str(my.kwargs.get('title_code'))
my.title_sk = str(my.kwargs.get('title_sk'))
my.order_sk = str(my.kwargs.get('order_sk'))
origin_search = Search("twog/title_origin")
origin_search.add_filter('title_code',my.title_code)
origins = origin_search.get_sobjects()
groups_str = ''
user_group_names = Environment.get_group_names()
for mg in user_group_names:
if groups_str == '':
groups_str = mg
else:
groups_str = '%s,%s' % (groups_str, mg)
user_is_scheduler = False
if 'scheduling' in groups_str:
user_is_scheduler = True
table = Table()
table.add_attr('width','100%s' % '%')
table.add_attr('bgcolor','#cbe49e')
table.add_style('border-bottom-right-radius', '10px')
table.add_style('border-bottom-left-radius', '10px')
table.add_style('border-top-right-radius', '10px')
table.add_style('border-top-left-radius', '10px')
table.add_row()
source_limit = 7
count = 0
if len(origins) > 0:
table.add_row()
mr_title = table.add_cell('<b><u><i>Sources</i></u></b>')
mr_title.add_style('font-size: 90%s;' % '%')
seen = []
for origin in origins:
source_code = origin.get_value('source_code')
if source_code not in seen:
seen.append(source_code)
source_search = Search("twog/source")
source_search.add_filter('code',source_code)
source = source_search.get_sobject()
if count % source_limit == 0:
table.add_row()
celly = None
if not source.get_value('high_security'):
celly = table.add_cell('<font color="#3e3e3e"><b><u>(%s): %s</u></b></font>' % (source.get_value('barcode'),source.get_value('title')))
else:
celly = table.add_cell('<font color="#ff0000"><b><u>!!!(%s): %s!!!</u></b></font>' % (source.get_value('barcode'),source.get_value('title')))
celly.add_attr('nowrap','nowrap')
celly.add_style('cursor: pointer;')
celly.add_style('font-size: 80%s;' % '%')
celly.add_behavior(get_launch_source_behavior(my.title_code, my.title_sk, source.get_value('code'), source.get_search_key(), my.order_sk))
table.add_cell(' ')
count += 1
else:
my.server = TacticServerStub.get()
my.server.retire_sobject(origin.get_search_key())
table2 = Table()
if user_is_scheduler:
table2.add_row()
barcode_text_wdg = TextWdg('barcode_insert')
barcode_text_wdg.add_behavior(my.get_barcode_insert_behavior(my.title_code, my.title_sk, my.order_sk))
bct = table2.add_cell(barcode_text_wdg)
bct.add_attr('align','right')
bct.add_attr('width','100%s' % '%')
two_gether = Table()
two_gether.add_row()
srcs = two_gether.add_cell(table)
srcs.add_attr('width','100%s' % '%')
srcs.add_attr('valign','top')
if user_is_scheduler:
bcentry = two_gether.add_cell(table2)
bcentry.add_attr('valign','top')
return two_gether
示例15: get_display
def get_display(self):
web = WebContainer.get_web()
key = web.get_form_value('name')
top = DivWdg()
top.add_class('ad_search_wdg_top')
self.set_as_panel(top)
text = TextWdg("name")
text.set_value(key)
close_wdg = SpanWdg()
close_wdg.add( IconWdg("Close", IconWdg.POPUP_WIN_CLOSE) )
close_wdg.add_style("float: right")
close_wdg.add_class("hand")
# NOTE: the div we are looking for to hide on 'close' is outside of the this widget and
# is part of the parent widget
close_wdg.add_behavior({
'type': 'click_up',
'cbjs_action': '''
var ad_input_content = bvr.src_el.getParent(".ad_input_content");
spt.toggle_show_hide(ad_input_content);
'''
})
top.add( close_wdg )
top.add("Active Directory Search:<br clear='all'/> ")
table = Table()
table.add_row()
table.add_cell(text)
td = table.add_cell(self.get_search_wdg())
td.add_style("display", "")
top.add(table)
results_div = DivWdg()
top.add(results_div)
results_div.add_style("border: solid 1px #444")
results_div.add_style("margin: 10px")
results_div.add_style("padding: 5px")
#results_div.add_style("max-height: 400px")
results_div.add_style("overflow: auto")
if not key:
results_div.add("Please enter search criteria")
return top
results_div.add("Results Found ...")
users = self.find_users(key)
max_num_users = 20
if len(users) > max_num_users:
display_users = users[:max_num_users]
else:
display_users = users
for user in display_users:
user_div = DivWdg()
user_div.add_style("margin: 5px")
user_div.add_class("hand")
user_div.add_event("onmouseover", "$(this).setStyle('background','#444')")
user_div.add_event("onmouseout", "$(this).setStyle('background','#222')")
checkbox = CheckboxWdg()
user_div.add(checkbox)
display_name = user.get('display_name')
if not display_name:
display_name = "%s %s" % (user.get('first_name'), user.get('last_name'))
email = user.get('email')
login = user.get('login')
phone_number = user.get('phone_number')
user_div.add(display_name)
if email:
user_div.add(" (%s) " % email)
self.cbjs_action = self.kwargs.get('cbjs_action')
if self.cbjs_action:
user_behavior = {
'type': 'click_up',
'cbjs_action': self.cbjs_action
}
user_div.add_behavior( user_behavior )
else:
user_behavior = {
'type': 'click_up',
'cbjs_action': 'alert("Not implemented")'
}
user_div.add_behavior( user_behavior )
user_div.add_attr("spt_input_value", login)
user_div.add_attr("spt_display_value", display_name)
user_div.add_attr("spt_phone_number", phone_number)
user_div.add_attr("spt_email", email)
#.........这里部分代码省略.........