本文整理汇总了Python中pyasm.widget.TextAreaWdg.add_class方法的典型用法代码示例。如果您正苦于以下问题:Python TextAreaWdg.add_class方法的具体用法?Python TextAreaWdg.add_class怎么用?Python TextAreaWdg.add_class使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.TextAreaWdg
的用法示例。
在下文中一共展示了TextAreaWdg.add_class方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.widget import TextAreaWdg [as 别名]
# 或者: from pyasm.widget.TextAreaWdg import add_class [as 别名]
def get_display(self):
self.run_init()
name = self.get_name()
if not name:
name = self.kwargs.get("name")
if self.is_refresh:
widget = Widget()
else:
widget = DivWdg()
self.set_as_panel(widget)
widget.add_class("spt_note_top")
widget.set_attr("spt_name", name)
widget.set_attr("spt_parent_key", self.parent_key)
web = WebContainer.get_web()
value = web.get_form_value(name)
text = TextAreaWdg(name)
widget.add(text)
if value:
text.set_value(value)
text.add_style("width: 100%")
text.add_style("min-width: 200")
text.add_attr("rows", "5")
text.add_class('spt_note_text')
color = text.get_color("background", -10);
text.add_behavior( {
'type': 'blur',
'cbjs_action': '''
//spt.dg_table._toggle_commit_btn($(this), false);
var el = bvr.src_el;
var td = el.getParent(".spt_table_td");
var tbody = el.getParent(".spt_table_tbody");
td.setStyle('background-color','#909977');
td.addClass('spt_value_changed');
tbody.addClass('spt_value_changed');
td.setAttribute('spt_input_value', el.value);
'''
} )
#text.add_event("onblur", "spt.dg_table._toggle_commit_btn($(this), false);$(this).getParent('.spt_table_td').setStyle('background-color','#030');$(this).getParent('.spt_table_td').addClass('spt_value_changed');$(this).getParent('.spt_table_tbody').addClass('spt_value_changed');$(this).getParent('.spt_table_td').setAttribute('spt_input_value',this.value)")
#text.add_event("onclick", "spt.dg_table.edit_cell_cbk( this, spt.kbd.special_keys_map.ENTER)" );
#behavior = {
# 'type': 'keyboard',
# 'kbd_handler_name': 'DgTableMultiLineTextEdit'
#}
#text.add_behavior(behavior)
action_wdg = self.get_action_wdg(name)
widget.add(action_wdg)
return widget
示例2: get_data_wdg
# 需要导入模块: from pyasm.widget import TextAreaWdg [as 别名]
# 或者: from pyasm.widget.TextAreaWdg import add_class [as 别名]
#.........这里部分代码省略.........
category_div = DivWdg()
name_div.add(category_div)
checkbox = RadioWdg("category")
checkbox.set_option("value", "by_week")
category_div.add(checkbox)
category_div.add(" Categorize files by Week")
category_div.add_style("margin-bottom: 5px")
category_div = DivWdg()
name_div.add(category_div)
checkbox = RadioWdg("category")
checkbox.set_option("value", "by_year")
category_div.add(checkbox)
category_div.add(" Categorize files by Year")
category_div.add_style("margin-bottom: 5px")
"""
checkbox = RadioWdg("category")
checkbox.set_option("value", "custom")
name_div.add(checkbox)
name_div.add(" Custom")
"""
name_div.add("<br/>")
hidden = HiddenWdg(name="parent_key")
dialog_data_div.add(hidden)
hidden.add_class("spt_parent_key")
parent_key = my.kwargs.get("parent_key") or ""
if parent_key:
hidden.set_value(parent_key)
dialog_data_div.add("Keywords:<br/>")
dialog.add(dialog_data_div)
text = TextAreaWdg(name="keywords")
dialog_data_div.add(text)
text.add_class("spt_keywords")
text.add_style("padding: 1px")
dialog_data_div.add("<br/>"*2)
extra_data = my.kwargs.get("extra_data")
if not isinstance(extra_data, basestring):
extra_data = jsondumps(extra_data)
dialog_data_div.add("Extra Data (JSON):<br/>")
text = TextAreaWdg(name="extra_data")
dialog_data_div.add(text)
if extra_data != "null":
text.set_value(extra_data)
text.add_class("spt_extra_data")
text.add_style("padding: 1px")
示例3: get_display
# 需要导入模块: from pyasm.widget import TextAreaWdg [as 别名]
# 或者: from pyasm.widget.TextAreaWdg import add_class [as 别名]
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;
}
#.........这里部分代码省略.........
示例4: get_chat_wdg
# 需要导入模块: from pyasm.widget import TextAreaWdg [as 别名]
# 或者: from pyasm.widget.TextAreaWdg import add_class [as 别名]
def get_chat_wdg(my, key, interval=False):
div = DivWdg()
div.add_class("spt_chat_session_top")
div.add_color("background", "background")
title_wdg = DivWdg()
div.add(title_wdg)
title_wdg.add_color("background", "background3")
title_wdg.add_style("padding: 5px")
title_wdg.add_style("font-weight: bold")
title_wdg.add_border()
icon = IconButtonWdg(title="Remove Chat", icon=IconWdg.DELETE)
icon.add_style("float: right")
icon.add_style("margin-top: -5px")
title_wdg.add(icon)
icon.add_behavior( {
'type': 'click_up',
'key': key,
'cbjs_action': '''
var server = TacticServerStub.get();
var top = bvr.src_el.getParent(".spt_chat_session_top");
spt.behavior.destroy_element(top);
'''
} )
current_user = Environment.get_user_name()
logins = Search.eval("@SOBJECT(sthpw/subscription['message_code','%s'].sthpw/login)" % key)
for login in logins:
if login.get_value("login") == current_user:
continue
thumb = ThumbWdg()
thumb.set_icon_size(45)
thumb.set_sobject(login)
thumb.add_style("float: left")
thumb.add_style("margin: -5px 10px 0px -5px")
title_wdg.add(thumb)
title_wdg.add(login.get_value("display_name"))
title_wdg.add("<br clear='all'/>")
history_div = DivWdg()
div.add(history_div)
history_div.add_class("spt_chat_history")
history_div.add_style("width: auto")
history_div.add_style("height: auto")
history_div.add_style("max-height: 400px")
history_div.add_style("padding: 5px")
history_div.add_class("spt_resizable")
history_div.add_border()
history_div.add_style("overflow-y: auto")
#history_div.add_style("font-size: 0.9em")
search = Search("sthpw/message_log")
search.add_filter("message_code", key)
search.add_order_by("timestamp")
message_logs = search.get_sobjects()
last_login = None;
last_date = None;
for message_log in message_logs:
login = message_log.get("login")
message = message_log.get("message")
timestamp = message_log.get_datetime_value("timestamp")
#timestamp = timestamp.strftime("%b %d, %Y - %H:%M")
timestamp_str = timestamp.strftime("%H:%M")
date_str = timestamp.strftime("%b %d, %Y")
msg = "";
msg += "<table style='margin-top: 5px; font-size: 0.9em; width: 100%'><tr><td colspan='2'>";
if date_str != last_date:
msg += "<br/><b style='font-size: 1.0em'>"+date_str+"</b><hr/></td></tr>";
msg += "<tr><td>";
last_login = None
if login != last_login:
msg += "<b>"+login+"</b><br/>";
msg += message.replace("\n",'<br/>');
msg += "</td><td style='text-align: right; margin-bottom: 5px; width: 75px; vertical-align: top'>";
msg += timestamp_str;
msg += "</td></tr></table>";
history_div.add(msg)
last_login = login
last_date = date_str
history_div.add_behavior( {
'type': 'load',
'cbjs_action': '''
bvr.src_el.scrollTop = bvr.src_el.scrollHeight;
'''
#.........这里部分代码省略.........
示例5: get_buttons_wdg
# 需要导入模块: from pyasm.widget import TextAreaWdg [as 别名]
# 或者: from pyasm.widget.TextAreaWdg import add_class [as 别名]
def get_buttons_wdg(my):
buttons_div = DivWdg()
buttons_div.add_style("margin-left: 20px")
buttons_div.add_style("margin-right: 20px")
# add brush size
text_note_wdg = DivWdg()
text_note_wdg.add("<b>Text Note</b>")
buttons_div.add(text_note_wdg)
text_note = TextAreaWdg("spt_text_note")
text_note.add_style("width: 400px")
text_note.add_class("spt_text_note")
buttons_div.add(text_note)
from pyasm.widget import IconButtonWdg, IconWdg
save_button = IconButtonWdg("Export", IconWdg.SAVE)
save_button.add_style("float: right")
buttons_div.add(save_button)
script = '''
try {
function getFlashMovie(movieName) {
var isIE = navigator.appName.indexOf("Microsoft") != -1;
return (isIE) ? window[movieName] : document[movieName];
}
spt.app_busy.show("Exporting Visual Note", " ")
var data = getFlashMovie("visual_notes_wdg").visual_notes_export();
var applet = spt.Applet.get();
var server = TacticServerStub.get();
//server.start();
var search_key = bvr.kwargs.search_key;
var txt_path = "c:/sthpw/sandbox/temp/visual_notes/visual_notes_temp.txt"
var jpg_path = "c:/sthpw/sandbox/temp/visual_notes/visual_notes_temp.jpg"
applet.create_file(txt_path, data);
applet.decodeFileToFile(txt_path, jpg_path);
var top_el = bvr.src_el.getParent(".spt_visual_notes_top");
var context = bvr.kwargs.context;
var snapshot = server.simple_checkin(search_key, context, jpg_path);
//var note_context = context + "|note";
var note_context = context;
var note = top_el.getElement(".spt_text_note").value;
var note_sobj = server.insert("sthpw/note", { note: note, context: note_context}, {parent_key: search_key} );
server.connect_sobjects( snapshot, note_sobj);
//server.finish("Visual Notes");
spt.app_busy.hide();
alert("Visual note added for [" + context + "]");
}
catch(err) {
spt.app_busy.hide();
alert(err);
}
'''
save_button.add_behavior( {
'type': 'click_up',
'cbjs_action': script,
'kwargs': {
'search_key': my.search_key,
'context': my.note_context
}
})
return buttons_div
示例6: get_display
# 需要导入模块: from pyasm.widget import TextAreaWdg [as 别名]
# 或者: from pyasm.widget.TextAreaWdg import add_class [as 别名]
def get_display(self):
top = DivWdg()
name = self.get_name()
top.add_class("spt_note_input_top")
context = self.get_option("context")
if not context:
context = name
sobject = self.get_option("sobject")
if not sobject:
search_key = self.get_option("search_key")
sobject = Search.get_by_search_key(search_key)
else:
search_key = sobject.get_search_key()
if search_key or (sobject and not sobject.is_insert()):
search = Search("sthpw/note")
#search.add_relationship_filters(self.filtered_parents, type='hierarchy')
search.add_parent_filter(sobject)
search.add_filter("context", context)
search.add_order_by("process")
search.add_order_by("context")
search.add_order_by("timestamp desc")
search.add_filter("context", context)
count = search.get_count()
last_note = search.get_sobject()
else:
last_note = None
count = 0
#if not last_note:
# last_note = SearchType.create("sthpw/note")
# last_note.set_value("login", "")
# 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 )
#.........这里部分代码省略.........