本文整理汇总了Python中pyasm.widget.TextAreaWdg类的典型用法代码示例。如果您正苦于以下问题:Python TextAreaWdg类的具体用法?Python TextAreaWdg怎么用?Python TextAreaWdg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextAreaWdg类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
def get_display(my):
wdg = TextAreaWdg(my.get_input_name())
wdg.set_attr("rows", "8")
parent_asset_code = WebContainer.get_web().get_form_value("edit|related")
asset = Asset.get_by_code(parent_asset_code)
if asset:
wdg.set_value(asset.get_description())
return wdg
示例2: get_display
def get_display(my):
top = DivWdg()
text = TextAreaWdg()
text.add_style("width: 98%")
text.add_style("height: 90%")
top.add(text)
return top
示例3: get_custom_layout_wdg
def get_custom_layout_wdg(my, layout_view):
content_div = DivWdg()
from tactic.ui.panel import CustomLayoutWdg
layout = CustomLayoutWdg(view=layout_view)
content_div.add(layout)
for widget in my.widgets:
name = widget.get_name()
if my.input_prefix:
widget.set_input_prefix(my.input_prefix)
layout.add_widget(widget, name)
search_key = SearchKey.get_by_sobject(my.sobjects[0], use_id=True)
search_type = my.sobjects[0].get_base_search_type()
element_names = my.element_names[:]
for element_name in my.skipped_element_names:
element_names.remove(element_name)
config_xml = my.kwargs.get("config_xml")
bvr = {
'type': 'click_up',
'mode': my.mode,
'element_names': element_names,
'search_key': search_key,
'input_prefix': my.input_prefix,
'view': my.view,
'config_xml': config_xml
}
if my.mode == 'insert':
bvr['refresh'] = 'true'
# for adding parent relationship in EditCmd
if my.parent_key:
bvr['parent_key'] = my.parent_key
hidden_div = DivWdg()
hidden_div.add_style("display: none")
content_div.add(hidden_div)
hidden = TextAreaWdg("__data__")
hidden_div.add(hidden)
hidden.set_value( jsondumps(bvr) )
show_action = my.kwargs.get("show_action")
if show_action in [True, 'true']:
content_div.add( my.get_action_html() )
return content_div
示例4: get_text_area_input_wdg
def get_text_area_input_wdg(self, name, id):
text_area_wdg = TextAreaWdg()
text_area_wdg.set_id(id)
if hasattr(self, id):
text_area_wdg.set_value(getattr(self, id))
text_area_div = DivWdg(name)
text_area_div.add_style('font-weight', 'bold')
section_div = DivWdg()
section_div.add_style('margin', '10px')
section_div.add(text_area_div)
section_div.add(text_area_wdg)
return section_div
示例5: init
def init(self):
name = self.kwargs.get("name")
assert(name)
self.text = TextAreaWdg(name)
self.text_id = self.kwargs.get("text_id")
if not self.text_id:
self.text_id = self.text.set_unique_id()
示例6: get_text_area_input_wdg
def get_text_area_input_wdg(name, width=400, styles=None):
textarea_wdg = TextAreaWdg()
textarea_wdg.set_id(name)
textarea_wdg.set_name(name)
textarea_wdg.add_style('width', '{0}px'.format(width))
if styles is None:
styles = []
for style in styles:
textarea_wdg.add_style(style[0], style[1])
return textarea_wdg
示例7: get_advanced_definition_wdg
def get_advanced_definition_wdg(self):
# add the advanced entry
advanced = DivWdg()
advanced.add_style("margin-top: 10px")
advanced.add_style("padding: 10px")
advanced.add_border()
title = DivWdg()
title.add_style("color: black")
title.add("Advanced - XML Column Definition")
title.add_style("margin-top: -23")
advanced.add(title)
advanced.add("<br/>")
input = TextAreaWdg("config_xml")
input.set_id("config_xml")
input.set_option("rows", "10")
input.set_option("cols", "70")
input.set_value(self.config_string)
advanced.add(input)
advanced.add(HtmlElement.br(2))
button_div = DivWdg()
button_div.add_style("text-align: center")
button = ActionButtonWdg(title="Save Definition")
#button = ProdIconButtonWdg("Save Definition")
button.add_event("onclick", "spt.custom_project.save_definition_cbk()")
button_div.add(button)
button_div.add_style("margin-left: 130px")
advanced.add(button_div)
return advanced
示例8: get_general_comments_section
def get_general_comments_section(self):
general_comments_div = DivWdg()
general_comments_div.add_style('margin', '10px')
general_comments_wdg = TextAreaWdg()
general_comments_wdg.set_id('general_comments')
general_comments_wdg.set_name('general_comments')
if hasattr(self, 'general_comments'):
general_comments_wdg.set_value(self.general_comments)
general_comments_text_div = DivWdg('General Comments')
general_comments_text_div.add_style('font-weight', 'bold')
general_comments_div.add(general_comments_text_div)
general_comments_div.add(general_comments_wdg)
return general_comments_div
示例9: handle_xml_mode
def handle_xml_mode(my, custom_table, mode):
tbody = custom_table.add_tbody()
tbody.add_class("spt_custom_xml")
if mode != 'xml':
tbody.add_style('display: none')
# extra for custom config_xml
custom_table.add_row()
td = custom_table.add_cell()
td.add("Config XML Definition")
div = DivWdg()
div.set_id("config_xml_options")
#div.add_style("display: none")
div.add_style("margin-top: 10px")
default = '''
<element name=''>
<display class=''>
<option></option>
</display>
</element>
'''
config_xml_wdg = TextAreaWdg("config_xml")
config_xml_wdg.set_option("rows", "8")
config_xml_wdg.set_option("cols", "50")
config_xml_wdg.set_value(default)
div.add( config_xml_wdg )
custom_table.add_cell(div)
# create columns
custom_table.add_row()
td = custom_table.add_cell()
create_columns_wdg = CheckboxWdg("create_columns")
create_columns_wdg.set_checked()
td.add("Create required columns? ")
td = custom_table.add_cell()
td.add(create_columns_wdg)
custom_table.close_tbody()
示例10: get_display
def get_display(my):
my.sobject = my.kwargs.get("sobject")
search_key = my.sobject.get_search_key()
top = DivWdg()
top.add_class("spt_checkin_publish")
top.add_style("padding: 10px")
margin_top = '60px'
top.add_style("margin-top", margin_top)
top.add_style("position: relative")
current_changelist = WidgetSettings.get_value_by_key("current_changelist")
current_branch = WidgetSettings.get_value_by_key("current_branch")
current_workspace = WidgetSettings.get_value_by_key("current_workspace")
top.add("Branch: %s<br/>" % current_branch)
top.add("Changelist: %s<br/>" % current_changelist)
top.add("Workspace: %s<br/>" % current_workspace)
top.add("<br/>")
checked_out_div = DivWdg()
checkbox = CheckboxWdg("editable")
top.add(checked_out_div)
checkbox.add_class("spt_checkin_editable")
checked_out_div.add(checkbox)
checked_out_div.add("Leave files editable")
top.add("<br/>")
top.add("Publish Description<br/>")
text = TextAreaWdg("description")
# this needs to be set or it will stick out to the right
text.add_style("width: 220px")
text.add_class("spt_checkin_description")
top.add(text)
# add as a note
note_div = DivWdg()
top.add(note_div)
note_div.add_class("spt_add_note")
checkbox = CheckboxWdg("add_note")
web = WebContainer.get_web()
browser = web.get_browser()
if browser in ['Qt']:
checkbox.add_style("margin-top: -4px")
checkbox.add_style("margin-right: 3px")
note_div.add_style("margin-top: 3px")
checkbox.add_class("spt_checkin_add_note")
note_div.add(checkbox)
note_div.add("Also add as note")
top.add("<br/><br/>")
button = ActionButtonWdg(title="Check-in", icon=IconWdg.PUBLISH, size='medium')
top.add(button)
my.repo_type = 'perforce'
if my.repo_type == 'perforce':
# the depot is set per project (unless overridden)
project = my.sobject.get_project()
depot = project.get_value("location", no_exception=True)
if not depot:
depot = project.get_code()
asset_dir = Environment.get_asset_dir()
sandbox_dir = Environment.get_sandbox_dir()
changelist = WidgetSettings.get_value_by_key("current_changelist")
button.add_behavior( {
'type': 'click_up',
'depot': depot,
'changelist': changelist,
'sandbox_dir': sandbox_dir,
'search_key': search_key,
'cbjs_action': '''
var paths = spt.checkin.get_selected_paths();
spt.app_busy.show("Checking in "+paths.length+" file/s into Perforce");
var top = bvr.src_el.getParent(".spt_checkin_top");
var description = top.getElement(".spt_checkin_description").value;
var add_note = top.getElement(".spt_checkin_add_note").value;
var editable = top.getElement(".spt_checkin_editable").value;
if (editable == 'on') {
editable = true;
}
else {
editable = false;
}
#.........这里部分代码省略.........
示例11: get_display
#.........这里部分代码省略.........
# last_note.set_value("timestamp", "")
# last_note.set_value("note", "")
if last_note:
last_div = DivWdg()
top.add(last_div)
table = Table()
table.add_style("width: 100%")
table.add_attr("cellpadding", "0px")
table.add_attr("cellspacing", "0px")
last_div.add(table)
table.add_row()
td = table.add_cell()
td.add_style("vertical-align: top")
td.add_style("padding: 5px 15px 10px 5px")
table.add_border()
table.add_color("background", "background", -5)
note_str = last_note.get_value("note")
login = last_note.get_value("login")
if not login:
login = "unknown"
date = last_note.get_datetime_value("timestamp")
if date:
date_str = "<i style='font-size: 0.8em'>%s</i>" % date.strftime("%Y-%m-%d")
else:
date_str = ""
login = "<i style='opacity: 0.3'>%s</i>" % login
td.add("%s - %s<br/>" % (date_str, login))
note_str_div = DivWdg()
note_str_div.add(note_str)
note_str_div.add_style("padding: 10px 15px 10px 10px")
#td = table.add_cell( note_str_div )
td.add( note_str_div )
#td.add_style("vertical-align: top")
#td.add_style("padding: 10px 15px 10px 10px")
"""
td.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_note_input_top");
var text_el = top.getElement(".spt_add_entry");
text_el.setStyle("display", "");
'''
} )
"""
# log
if count == 0:
td = table.add_cell( "" )
elif count == 1:
td = table.add_cell( "<i style='font-size: 0.8em'>More...><br/>(%s entry)</i>" % count )
else:
td = table.add_cell( "<i style='font-size: 0.8em'>More...><br/>(%s entries)</i>" % count )
td.add_style("vertical-align: top")
td.add_style("padding: 3px")
td.add_class("hand")
td.add_behavior( {
'type': 'click_up',
'search_key': search_key,
'context': context,
'cbjs_action': '''
var class_name = 'tactic.ui.input.note_input_wdg.NoteHistoryWdg';
var kwargs = {
search_key: bvr.search_key,
context: bvr.context
}
spt.panel.load_popup("Notes Log", class_name, kwargs);
'''
} )
name = self.get_input_name()
text = TextAreaWdg(name)
top.add(text)
text.add_style("width: 100%")
text.add_class("spt_add_entry")
"""
if search_key and not sobject.is_insert():
from tactic.ui.widget import DiscussionWdg
discussion_wdg = DiscussionWdg(search_key=search_key, context_hidden=False, show_note_expand=False, show_add=False)
top.add(discussion_wdg)
"""
return top
示例12: handle_instance
#.........这里部分代码省略.........
return
# get the pipeline for this asset and handlers for the pipeline
process_name = my.process_select.get_value()
handler_hidden = my.get_handler_input(asset, process_name)
pipeline = Pipeline.get_by_sobject(asset)
# TEST: switch this to using node name instead, if provided
if node_name:
instance_node = my.session.get_node(node_name)
else:
instance_node = my.session.get_node(instance)
if instance_node is None:
return
if Xml.get_attribute(instance_node,"reference") == "true":
is_ref = True
else:
is_ref = False
namespace = Xml.get_attribute(instance_node, "namespace")
if not namespace:
namespace = instance
asset_code = asset.get_code()
is_set = False
if asset.get_value('asset_type', no_exception=True) in ['set','section']:
is_set = True
tr = table.add_row()
if is_set:
tr.add_class("group")
if publish and (allow_ref_checkin or not is_ref):
checkbox = CheckboxWdg("asset_instances")
if is_set:
checkbox = CheckboxWdg("set_instances")
checkbox.set_option("value", "%s|%s|%s" % \
(namespace, asset_code, instance) )
checkbox.set_persist_on_submit()
td = table.add_cell(checkbox)
else:
td = table.add_blank_cell()
# only one will be added even if there are multiple
if handler_hidden:
td.add(handler_hidden)
# add the thumbnail
thumb = ThumbWdg()
thumb.set_name("images")
thumb.set_sobject(asset)
thumb.set_icon_size(60)
table.add_cell(thumb)
info_wdg = Widget()
info_wdg.add(HtmlElement.b(instance))
if not node_name:
node_name = '%s - %s' %(asset_code, asset.get_name())
info_div = DivWdg(node_name)
info_div.add_style('font-size: 0.8em')
info_wdg.add(info_div)
info_div.add(HtmlElement.br(2))
if pipeline:
info_div.add(pipeline.get_code())
table.add_cell(info_wdg)
# by default can't checkin references
if not allow_ref_checkin and is_ref:
#icon = IconWdg("error", IconWdg.ERROR)
#td = table.add_cell(icon)
td = table.add_cell()
td.add(HtmlElement.b("Ref. instance"))
'''
import_button = ProdIconButtonWdg('import')
import_button.add_event('onclick', "import_instance('%s')" %instance)
td.add(import_button)
'''
table.add_cell(my.get_save_wdg(my.current_sobject) )
elif publish:
textarea = TextAreaWdg()
textarea.set_persist_on_submit()
textarea.set_name("%s_description" % instance)
textarea.set_attr("cols", "35")
textarea.set_attr("rows", "2")
table.add_cell(textarea)
table.add_cell(my.get_save_wdg(my.current_sobject) )
else:
table.add_blank_cell()
table.add_blank_cell()
示例13: get_display
#.........这里部分代码省略.........
})
buttons_list.append( {'label': 'Save as Def', 'tip': 'Save as Definition',
'bvr': { 'cbjs_action': "alert('Not Implemented')" }
})
buttons = TextBtnSetWdg( float="right", buttons=buttons_list,
spacing=6, size='small', side_padding=4 )
inner_div.add(buttons)
title_div = DivWdg()
title_div.add_style("margin-bottom: 10px")
title_div.add_class("maq_search_bar")
title_div.add("Element Definition")
inner_div.add(title_div)
test = SimpleElementDefinitionWdg(config_view=config_view, element_name=element_name)
inner_div.add(test)
config_title_wdg = DivWdg()
inner_div.add(config_title_wdg)
config_title_wdg.add("<b>Definitions in config</b>")
config_title_wdg.add_style("margin: 15px 0px 5px 0px")
for config in config_view.get_configs():
view = config.get_view()
xml = config.get_element_xml(element_name)
config_div = DivWdg()
inner_div.add(config_div)
# add the title
from pyasm.widget import SwapDisplayWdg, IconWdg
view_div = DivWdg()
view_div.add_class("spt_view")
config_div.add(view_div)
if not xml:
icon_wdg = IconWdg( "Nothing defined", IconWdg.DOT_RED )
icon_wdg.add_style("float: right")
view_div.add(icon_wdg)
else:
icon_wdg = IconWdg( "Is defined", IconWdg.DOT_GREEN )
icon_wdg.add_style("float: right")
view_div.add(icon_wdg)
swap = SwapDisplayWdg()
view_div.add(swap)
swap.add_action_script('''
var info_wdg = bvr.src_el.getParent('.spt_view').getElement('.spt_info');
spt.toggle_show_hide(info_wdg);
''')
mode = "predefined"
file_path = config.get_file_path()
if not file_path:
mode = "database"
elif file_path == 'generated':
mode = 'generated'
# display the title
view_div.add("%s" % view)
view_div.add(" - [%s]" % mode)
info_div = DivWdg()
info_div.add_class("spt_info")
info_div.add_style("margin-left: 20px")
info_div.add_style("display: none")
#if not xml:
# info_div.add_style("display: none")
#else:
# swap.set_off()
view_div.add(info_div)
path_div = DivWdg()
if not file_path:
file_path = mode
path_div.add("Defined in: %s" % file_path)
info_div.add(path_div)
text_wdg = TextAreaWdg()
text_wdg.set_option("rows", 15)
text_wdg.set_option("cols", 80)
text_wdg.set_value(xml)
info_div.add(text_wdg)
#view_div.add("<hr/>")
return top
示例14: get_display
def get_display(my):
sobject = my.get_current_sobject()
# handle the start and end
frame_start = sobject.get_value("tc_frame_start")
frame_end = sobject.get_value("tc_frame_end")
frame_start_text = TextWdg("tc_frame_start")
frame_start_text.set_value(frame_start)
frame_start_text.set_option("size", "2")
frame_end_text = TextWdg("tc_frame_end")
frame_end_text.set_value(frame_end)
frame_end_text.set_option("size", "2")
# handle the notes
frame_notes = sobject.get_value("frame_note")
frame_notes_text = TextAreaWdg("frame_note")
frame_notes_text.set_value(frame_notes)
frame_notes_text.set_option("rows", "1")
# handle the in and out handles
frame_in = sobject.get_value("frame_in")
frame_out = sobject.get_value("frame_out")
frame_in_text = TextWdg("frame_in")
frame_in_text.set_value(frame_in)
frame_in_text.set_option("size", "2")
frame_out_text = TextWdg("frame_out")
frame_out_text.set_value(frame_out)
frame_out_text.set_option("size", "2")
div = DivWdg()
table = Table()
div.add(table)
table.add_row()
td = table.add_cell("Range:")
td.add_style("width: 100px")
td = table.add_cell()
td.add("start: ")
td.add(frame_start_text)
td.add(" - end: ")
td.add(frame_end_text)
table.add_row()
table.add_cell("Handles:")
td = table.add_cell()
td.add(" in: ")
td.add(frame_in_text)
td.add(" - out: ")
td.add(frame_out_text)
td.add("<br/>")
table.add_row()
table.add_cell("Notes:")
td = table.add_cell(frame_notes_text)
"""
div.add("Range - start: ")
div.add(frame_start_text)
div.add(" - end: ")
div.add(frame_end_text)
div.add("<br/>")
div.add("Handles - in: ")
div.add(frame_in_text)
div.add(" - out: ")
div.add(frame_out_text)
div.add("<br/>")
div.add("Notes:")
div.add(frame_notes_text)
"""
return div
示例15: get_chat_wdg
#.........这里部分代码省略.........
var last_message = bvr.src_el.getAttribute("spt_last_message");
var last_login = bvr.src_el.getAttribute("spt_last_login");
if (tmp == last_message && login == last_login) {
return;
}
bvr.src_el.setAttribute("spt_last_message", tmp);
bvr.src_el.setAttribute("spt_last_login", login);
var msg = "";
msg += "<table style='margin-top: 5px; font-size: 0.9em; width: 100%'><tr><td>";
if (login != last_login) {
msg += "<b>"+login+"</b><br/>";
}
msg += tmp.replace(/\n/g,'<br/>');
msg += "</td><td style='text-align: right; margin-bottom: 5px; width: 75px; vertical-align: top'>";
msg += timestamp;
msg += "</td></tr></table>";
if (msg == history_el.last_msg) {
return;
}
history_el.innerHTML = history_el.innerHTML + msg;
// remember last message
history_el.last_msg = msg;
history_el.scrollTop = history_el.scrollHeight;
}
spt.message.set_interval(bvr.key, callback, 3000, bvr.src_el);
'''
} )
text = TextAreaWdg("chat")
div.add(text)
text.add_class("spt_chat_text")
text.add_style("width: 100%")
text.add_style("padding: 5px")
text.add_style("margin-top: -1px")
text.add_behavior( {
'type': 'load',
'cbjs_action': '''
bvr.src_el.addEvent("keydown", function(e) {
var keys = ['tab','keys(control+enter)', 'enter'];
var key = e.key;
var input = bvr.src_el
if (keys.indexOf(key) > -1) e.stop();
if (key == 'tab') {
}
else if (key == 'enter') {
if (e.control == false) {
pass;
}
else {
// TODO: check if it's multi-line first
//... use ctrl-ENTER for new-line, regular ENTER (RETURN) accepts value
//var tvals = parse_selected_text(input);
//input.value = tvals[0] + "\\n" + tvals[1];
//spt.set_cursor_position( input, tvals[0].length + 1 );
}
}
} )
'''
} )
button = ActionButtonWdg(title="Send")
div.add(button)
button.add_behavior( {
'type': 'click_up',
'key': key,
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_chat_session_top");
var text_el = top.getElement(".spt_chat_text");
var message = text_el.value;
if (!message) {
return;
}
var history_el = top.getElement(".spt_chat_history");
var category = "chat";
var server = TacticServerStub.get();
var key = bvr.key;
var last_message = server.log_message(key, message, {category:category, status:"in_progress"});
text_el.value = "";
'''
} )
return div