本文整理汇总了Python中pyasm.web.DivWdg.add_smart_style方法的典型用法代码示例。如果您正苦于以下问题:Python DivWdg.add_smart_style方法的具体用法?Python DivWdg.add_smart_style怎么用?Python DivWdg.add_smart_style使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.DivWdg
的用法示例。
在下文中一共展示了DivWdg.add_smart_style方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_smart_style [as 别名]
def get_display(self):
# NOTE: need to add this to fit as a table layout
self.chunk_size = 10000
self.edit_permission = True
self.view_editable = True
search_key = self.kwargs.get("search_key")
if search_key:
sobject = Search.get_by_search_key(search_key)
self.sobjects = [sobject]
elif self.kwargs.get("do_search") != "false":
self.handle_search()
top = DivWdg()
self.top = top
self.set_as_panel(top)
top.add_class("spt_sobject_top")
inner = DivWdg()
top.add(inner)
inner.add_color("background", "background")
inner.add_color("color", "color")
# NOTE: this is not the table and is called this for backwards
# compatibility
inner.add_class("spt_table")
inner.add_class("spt_layout")
# set the sobjects to all the widgets then preprocess
for widget in self.widgets:
widget.set_sobjects(self.sobjects)
widget.set_parent_wdg(self)
# preprocess the elements
widget.preprocess()
#is_refresh = self.kwargs.get("is_refresh")
#if self.kwargs.get("show_shelf") not in ['false', False]:
# action = self.get_action_wdg()
# inner.add(action)
# get all the edit widgets
"""
if self.view_editable and self.edit_permission:
edit_wdgs = self.get_edit_wdgs()
edit_div = DivWdg()
edit_div.add_class("spt_edit_top")
edit_div.add_style("display: none")
inner.add(edit_div)
for name, edit_wdg in edit_wdgs.items():
edit_div.add(edit_wdg)
"""
inner.set_unique_id()
inner.add_smart_style("spt_header", "vertical-align", "top")
inner.add_smart_style("spt_header", "text-align", "left")
inner.add_smart_style("spt_header", "width", "150px")
inner.add_smart_style("spt_header", "padding", "5px")
border = inner.get_color("table_border")
#inner.add_smart_style("spt_header", "border", "solid 1px %s" % border)
inner.add_smart_style("spt_cell_edit", "background-repeat", "no-repeat")
inner.add_smart_style("spt_cell_edit", "background-position", "bottom right")
inner.add_smart_style("spt_cell_edit", "padding", "5px")
inner.add_smart_style("spt_cell_edit", "min-width", "200px")
for i, sobject in enumerate(self.sobjects):
table = Table()
table.add_color("color", "color")
table.add_style("padding: 10px")
#table.add_style("margin-bottom: 10px")
table.add_style("width: 100%")
inner.add(table)
for j, widget in enumerate(self.widgets):
name = widget.get_name()
if name == 'preview':
continue
widget.set_current_index(i)
title = widget.get_title()
tr = table.add_row()
if isinstance(title, HtmlElement):
title.add_style("float: left")
th = table.add_header(title)
th.add_class("spt_header")
td = table.add_cell(widget.get_buffer_display())
td.add_class("spt_cell_edit")
if j % 2 == 0:
#.........这里部分代码省略.........
示例2: get_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_smart_style [as 别名]
#.........这里部分代码省略.........
button = ActionButtonWdg(title="Save As", tip="Save template as file")
button.add_style("float: right")
top.add(button)
button.add_behavior( {
'type': 'click_up',
'template_dir': template_dir,
'cbjs_action': '''
var applet = spt.Applet.get();
var dirname = applet.open_file_browser();
if (!dirname) {
return;
}
var class_name = 'tactic.ui.app.ProjectTemplateDownloadCmd';
var kwargs = {
'template_dir': bvr.template_dir
}
var server = TacticServerStub.get();
var ret_val = server.execute_cmd(class_name, kwargs);
var info = ret_val['info'];
var filename = info['filename'];
var env = spt.Environment.get();
var ticket = env.get_ticket();
var server = env.get_server_url();
var url = server + "/assets/_cache/" + ticket + "/" + filename;
applet.download_file(url, dirname + "/" + filename);
applet.open_explorer(dirname);
'''
} )
#button = ActionButtonWdg(title="Dump", tip="Create a template from a project")
#button.add_style("float: right")
#top.add(button)
#button.add_behavior( {
# 'type': 'click_up',
# 'cbjs_action': '''
# '''
#} )
info_div = DivWdg()
top.add(info_div)
info_div.add_style("padding: 20px")
info_div.set_unique_id()
info_div.add_smart_style("spt_none", "font-style", "italic")
info_div.add_smart_style("spt_none", "opacity", "0.5")
#project = Project.get()
# import the transaction data
from tactic.command import PluginInstaller
installer = PluginInstaller(manifest=manifest_xml)
project_path = "%s/%s" % (template_dir, "sthpw_project.spt")
jobs = installer.import_data(project_path, commit=False)
project = jobs[0]
project_code = project.get_code()
info_div.add("<br/>")
info_div.add("Template Code: <b>%s</b><br/>" % project_code)
info_div.add("<br/>")
info_div.add("Title: <b>%s</b><br/>" % project.get_value("title"))
info_div.add("<br/>")
description = project.get_value("description", no_exception=True)
if not description:
description = "<span class='spt_none'>None</span>"
info_div.add("Description: %s<br/>" % description)
info_div.add("<br/>")
version = project.get_value("version", no_exception=True)
if not version:
version = "<span class='spt_none'>None</span>"
info_div.add("Version: %s<br/>" % version)
info_div.add("<br/>")
status = project.get_value("status", no_exception=True)
if not status:
status = "<span class='spt_none'>None</span>"
info_div.add("Status: %s<br/>" % status )
info_div.add("<br/>")
top.add("<span style='opacity: 0.5'>Manifest Path: %s</span>" % manifest_path)
return top
示例3: get_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_smart_style [as 别名]
def get_display(self):
top = DivWdg()
top.add_color("background", "background")
top.add_color("color", "color")
top.add_style("min-width: 600px")
os_name = os.name
top.set_unique_id()
top.add_smart_style("spt_info_title", "background", self.top.get_color("background3"))
top.add_smart_style("spt_info_title", "padding", "3px")
top.add_smart_style("spt_info_title", "font-weight", "bold")
# server
title_div = DivWdg()
top.add(title_div)
title_div.add("Server")
title_div.add_class("spt_info_title")
os_div = DivWdg()
top.add(os_div)
os_info = platform.uname()
try:
os_login = os.getlogin()
except Exception:
os_login = os.environ.get("LOGNAME")
table = Table()
table.add_color("color", "color")
table.add_style("margin: 10px")
os_div.add(table)
for i, title in enumerate(['OS','Node Name','Release','Version','Machine']):
table.add_row()
td = table.add_cell("%s: " % title)
td.add_style("width: 150px")
table.add_cell( os_info[i] )
table.add_row()
table.add_cell("CPU Count: ")
try :
import multiprocessing
table.add_cell( multiprocessing.cpu_count() )
except (ImportError, NotImplementedError):
table.add_cell( "n/a" )
table.add_row()
table.add_cell("Login: ")
table.add_cell( os_login )
# python
title_div = DivWdg()
top.add(title_div)
title_div.add("Python")
title_div.add_class("spt_info_title")
table = Table()
table.add_color("color", "color")
table.add_style("margin: 10px")
top.add(table)
table.add_row()
td = table.add_cell("Version: ")
td.add_style("width: 150px")
table.add_cell( sys.version )
# client
title_div = DivWdg()
top.add(title_div)
title_div.add("Client")
title_div.add_class("spt_info_title")
web = WebContainer.get_web()
user_agent = web.get_env("HTTP_USER_AGENT")
table = Table()
table.add_color("color", "color")
table.add_style("margin: 10px")
top.add(table)
table.add_row()
td = table.add_cell("User Agent: ")
td.add_style("width: 150px")
table.add_cell( user_agent )
table.add_row()
td = table.add_cell("TACTIC User: ")
table.add_cell( web.get_user_name() )
top.add('<br/>')
self.handle_load_balancing(top)
#.........这里部分代码省略.........