本文整理汇总了Python中pyasm.widget.TextAreaWdg.add_attr方法的典型用法代码示例。如果您正苦于以下问题:Python TextAreaWdg.add_attr方法的具体用法?Python TextAreaWdg.add_attr怎么用?Python TextAreaWdg.add_attr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.TextAreaWdg
的用法示例。
在下文中一共展示了TextAreaWdg.add_attr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.widget import TextAreaWdg [as 别名]
# 或者: from pyasm.widget.TextAreaWdg import add_attr [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_display
# 需要导入模块: from pyasm.widget import TextAreaWdg [as 别名]
# 或者: from pyasm.widget.TextAreaWdg import add_attr [as 别名]
def get_display(my):
my.search_key = my.kwargs.get("search_key")
sobject = Search.get_by_search_key(my.search_key)
if sobject.get_base_search_type() == "sthpw/snapshot":
snapshot = sobject
elif sobject.get_base_search_type() == "sthpw/file":
# if it is a file object
snapshot = sobject.get_parent()
else:
snapshots = Snapshot.get_by_sobject(sobject)
snapshot = snapshots[0]
#parent = snapshot.get_parent()
top = my.top
from tactic.ui.container import ResizableTableWdg
table = ResizableTableWdg()
top.add(table)
table.add_row()
table.add_style("width: 100%")
from tactic.ui.widget import EmbedWdg
td = table.add_cell()
td.add_color("background", "background",)
td.add_style("vertical-align: middle")
td.add_style("height: 200px")
td.add_style("overflow-x: auto")
file_type = "icon"
thumb_path = snapshot.get_web_path_by_type(file_type)
file_type = "main"
src = snapshot.get_web_path_by_type(file_type)
lib_path = snapshot.get_lib_path_by_type(file_type)
parts = os.path.splitext(src)
ext = parts[1]
ext = ext.lower()
content_div = DivWdg()
if ext in ['.doc','.xls']:
from pyasm.widget import ThumbWdg
link = ThumbWdg.find_icon_link(src)
img = HtmlElement.img(src=link)
href = DivWdg()
href.add_style("text-align: center")
href.add(img)
td.add(href)
href.add_behavior( {
'type': 'click_up',
'src': src,
'cbjs_action': '''
window.open(bvr.src);
'''
} )
href.add_class("hand")
elif ext in ['.txt','.html', '.ini']:
f = open(lib_path, 'r')
content = f.read(10000)
f.close()
if not content:
text = "No Content"
else:
size = os.path.getsize(lib_path)
from pyasm.common import FormatValue
value = FormatValue().get_format_value(size, "KB")
content_div.add("Showing first 10K of %s<hr/>" % value)
text = TextAreaWdg()
text.add(content)
text.add_style("width: 100%")
text.add_style("height: 300px")
text.add_style("padding: 10px")
text.add_style("border: none")
text.add_attr("readonly", "true")
content_div.add(text)
td.add(content_div)
content_div.add_style("color", "#000")
content_div.add_style("width", "auto")
content_div.add_style("margin", "20px")
elif thumb_path == "__DYNAMIC__":
td.add("No Preview")
else:
embed_wdg = EmbedWdg(src=src, thumb_path=thumb_path)
td.add(embed_wdg)
#.........这里部分代码省略.........
示例3: get_display
# 需要导入模块: from pyasm.widget import TextAreaWdg [as 别名]
# 或者: from pyasm.widget.TextAreaWdg import add_attr [as 别名]
#.........这里部分代码省略.........
table.add_style("width: 100%")
table.add_style("text-align", "center")
from tactic.ui.widget import EmbedWdg
td = table.add_cell()
td.add_color("background", "background",)
td.add_style("vertical-align: middle")
td.add_style("height: inherit")
td.add_style("overflow-x: auto")
if ext in ['txt','html', 'ini']:
content_div = DivWdg()
f = open(lib_path, 'r')
content = f.read(10000)
f.close()
if not content:
text = "No Content"
else:
size = os.path.getsize(lib_path)
from pyasm.common import FormatValue
value = FormatValue().get_format_value(size, "KB")
content_div.add("Showing first 10K of %s<hr/>" % value)
text = TextAreaWdg()
text.add(content)
text.add_style("width: 100%")
text.add_style("height: 100%")
text.add_style("padding: 10px")
text.add_style("border: none")
text.add_attr("readonly", "true")
content_div.add(text)
td.add(content_div)
content_div.add_style("color", "#000")
content_div.add_style("width", "auto")
content_div.add_style("margin", "20px")
content_div.add_style("height", "100%")
elif ext in File.IMAGE_EXT or ext == "gif":
if lib_path.find("#") != -1:
img = DivWdg()
file_range = snapshot.get_file_range()
file_range_div = DivWdg()
file_range_div.add("File Range: %s" % file_range.get_display())
img.add(file_range_div)
file_range_div.add_style("font-size: 1.4em")
file_range_div.add_style("margin: 15px 0px")
"""
left_chevron = IconWdg("Previous", "BS_CHEVRON_LEFT")
file_range_div.add(left_chevron)
right_chevron = IconWdg("Next", "BS_CHEVRON_RIGHT")
file_range_div.add(right_chevron)
"""
expanded_paths = snapshot.get_expanded_web_paths()
lib_paths = snapshot.get_expanded_lib_paths()
lib_path = lib_paths[0]
items_div = DivWdg()