本文整理汇总了Python中pyasm.common.Container.get_seq方法的典型用法代码示例。如果您正苦于以下问题:Python Container.get_seq方法的具体用法?Python Container.get_seq怎么用?Python Container.get_seq使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.common.Container
的用法示例。
在下文中一共展示了Container.get_seq方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_css_wdg
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get_seq [as 别名]
def get_css_wdg(my):
widget = Widget()
web = WebContainer.get_web()
context_url = web.get_context_url().to_string()
skin = web.get_skin()
# first load context css
Container.append_seq("Page:css", "%s/style/layout.css" % context_url)
# add the color wheel css
Container.append_seq("Page:css", "%s/spt_js/mooRainbow/Assets/mooRainbow.css" % context_url)
Container.append_seq("Page:css", "%s/spt_js/mooDialog/css/MooDialog.css" % context_url)
# get all of the registered css file
css_files = Container.get_seq("Page:css")
for css_file in css_files:
widget.add('<link rel="stylesheet" href="%s" type="text/css" />\n' % css_file )
# TEST TEST TEST
widget.add('<link rel="stylesheet" href="/assets/_video/video-js.min.css" type="text/css" />\n')
return widget
示例2: add_internal_config
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get_seq [as 别名]
def add_internal_config(cls, configs, views):
'''add an internal config based on project base type'''
project = Project.get()
project_type = project.get_base_type()
# catch potential invalid xpath error
try:
if project_type:
tmp_path = __file__
dir_name = os.path.dirname(tmp_path)
file_path="%s/../config/%s-conf.xml" % (dir_name, project_type)
if os.path.exists(file_path):
for view in views:
config = WidgetConfig.get(file_path=file_path, view=view)
if config.get_view_node():
configs.append(config)
# finally, just look at the DEFAULT config
tmp_path = __file__
dir_name = os.path.dirname(tmp_path)
file_path="%s/../config/%s-conf.xml" % (dir_name, "DEFAULT")
if os.path.exists(file_path):
for view in views:
config = WidgetConfig.get(file_path=file_path, view=view)
if config.get_view_node():
configs.append(config)
except XmlException, e:
msg = "Error with view [%s]"% ' '.join(views)
error_list = Container.get_seq(cls.ERR_MSG)
if msg not in error_list:
Container.append_seq(cls.ERR_MSG, msg)
print e.__str__()
示例3: get_css_wdg
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get_seq [as 别名]
def get_css_wdg(self):
widget = Widget()
web = WebContainer.get_web()
context_url = web.get_context_url().to_string()
skin = web.get_skin()
version = Environment.get_release_version()
# Bootstrap
use_bootstrap = True
if use_bootstrap:
Container.append_seq("Page:css", "%s/spt_js/bootstrap/css/bootstrap.min.css?ver=%s" % (context_url, version))
# add the color wheel css
Container.append_seq("Page:css", "%s/spt_js/mooRainbow/Assets/mooRainbow.css" % context_url)
Container.append_seq("Page:css", "%s/spt_js/mooDialog/css/MooDialog.css" % context_url)
Container.append_seq("Page:css", "%s/spt_js/mooScrollable/Scrollable.css" % context_url)
# first load context css
Container.append_seq("Page:css", "%s/style/layout.css" % context_url)
# TEST
Container.append_seq("Page:css", "%s/spt_js/video/video-js.css" % context_url)
# get all of the registered css file
css_files = Container.get_seq("Page:css")
for css_file in css_files:
widget.add('<link rel="stylesheet" href="%s" type="text/css" />\n' % css_file )
# custom js files to include
includes = Config.get_value("install", "include_css")
includes = includes.split(",")
for include in includes:
include = include.strip()
if include:
print("include: ", include)
widget.add('<link rel="stylesheet" href="%s" type="text/css" />\n' % include )
return widget
示例4: execute
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get_seq [as 别名]
#.........这里部分代码省略.........
if code == 'admin':
continue
if not project.database_exists():
ofile.write("*" * 80 + '\n')
msg = "Project [%s] does not have a database\n"% project.get_code()
ofile.write(msg)
print msg
ofile.write("*" * 80 + '\n\n')
continue
upgrade = None
if database_type != 'PostgreSQL':
upgrade_class = "%s%sUpgrade" % (database_type, type.capitalize())
conf_upgrade = eval("%sConfigUpgrade()" % database_type)
else:
upgrade_class = "%sUpgrade" % type.capitalize()
conf_upgrade = eval("ConfigUpgrade()")
upgrade = eval("%s()" % upgrade_class)
# upgrade config (done for every project but sthpw)
conf_upgrade.set_project(project.get_code())
conf_upgrade.set_to_version(my.to_version)
conf_upgrade.set_forced(my.is_forced)
conf_upgrade.set_quiet(my.quiet)
conf_upgrade.set_confirmed(my.is_confirmed)
conf_upgrade.execute()
# append the errors for each upgrade
key = '%s|%s' %(project.get_code(), conf_upgrade.__class__.__name__)
error_list.append((conf_upgrade.__class__.__name__, project.get_code(), \
Container.get_seq(key)))
# perform the upgrade to the other tables
if upgrade:
upgrade.set_project(project.get_code() )
upgrade.set_to_version(my.to_version)
upgrade.set_forced(my.is_forced)
upgrade.set_quiet(my.quiet)
upgrade.set_confirmed(my.is_confirmed)
#Command.execute_cmd(upgrade)
# put each upgrade function in its own transaction
# carried out in BaseUpgrade
upgrade.execute()
# append the errors for each upgrade
key = '%s|%s' %(project.get_code(), upgrade.__class__.__name__)
error_list.append((upgrade.__class__.__name__, project.get_code(), \
Container.get_seq(key)))
from pyasm.search import DatabaseImpl
project.set_value("last_db_update", DatabaseImpl.get().get_timestamp_now(), quoted=False)
if project.has_value('last_version_update'):
last_version = project.get_value('last_version_update')
if my.to_version > last_version:
project.set_value("last_version_update", my.to_version)
else:
# it should be getting the upgrade now, redo the search
print "Please run upgrade_db.py again, the sthpw db has just been updated"
return
project.commit(triggers=False)
示例5: get_display
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get_seq [as 别名]
#.........这里部分代码省略.........
my.mode = my.kwargs.get("mode")
if not my.mode:
my.mode = 'view'
my.default = my.kwargs.get('default') == 'True'
div = DivWdg()
div.add_class("spt_section_top")
div.set_attr("SPT_ACCEPT_DROP", "manageSideBar")
# create the top widgets
label = SpanWdg()
label.add(title)
label.add_style("font-size: 1.1em")
section_div = LabeledHidableWdg(label=label)
div.add(section_div)
section_div.set_attr('spt_class_name', Common.get_full_class_name(my))
for name, value in my.kwargs.items():
if name == "config":
continue
section_div.set_attr("spt_%s" % name, value)
bgcolor = label.get_color("background3")
project_div = RoundedCornerDivWdg(hex_color_code=bgcolor,corner_size="10")
project_div.set_dimensions( width_str='%spx' % width, content_height_str='100px' )
content_div = project_div.get_content_wdg()
#project_div = DivWdg()
#content_div = project_div
section_div.add( project_div )
content_div.add_class("spt_side_bar_content")
content_div.add_attr("spt_view", view)
if type(view) in types.StringTypes:
view = [view]
view_margin_top = '4px'
web = WebContainer.get_web()
for viewx in view:
config = my.get_config(my.config_search_type, viewx, default=my.default)
if not config:
continue
# make up a title
title = DivWdg()
title.add_gradient( "background", "side_bar_title", 0, -15, default="background" )
title.add_color( "color", "side_bar_title_color", default="color" )
title.add_styles( "margin-top: %s; margin-bottom: 3px; vertical-align: middle" % view_margin_top )
if not web.is_IE():
title.add_styles( "margin-left: -5px; margin-right: -5px;")
title.add_looks( "navmenu_header" )
title.add_style( "height: 18px" )
title.add_style( "padding-top: 2px" )
"""
title = DivWdg()
title.add_styles( "margin-top: %s; margin-bottom: 3px; vertical-align: middle" % view_margin_top )
if not web.is_IE():
title.add_styles( "margin-left: -10px; margin-right: -10px;")
title.add_looks( "navmenu_header" )
"""
# FIXME: not sure if this logic should be here. It basically
# makes special titles for certain view names
view_attrs = config.get_view_attributes()
title_str = view_attrs.get("title")
if not title_str:
if viewx.startswith("my_view_"):
title_str = "My Views"
else:
title_str = viewx
title_str = Common.get_display_title(title_str)
title_label = SpanWdg()
title_label.add_styles( "margin-left: 6px; padding-bottom: 2px;" )
title_label.add_looks( "fnt_title_5 fnt_bold" )
title_label.add( title_str )
title.add( title_label )
content_div.add( title )
info = { 'counter' : 10, 'view': viewx }
my.generate_section( config, content_div, info )
error_list = Container.get_seq(my.ERR_MSG)
if error_list:
span = SpanWdg()
span.add_style('background', 'red')
span.add('<br/>'.join(error_list))
content_div.add(span)
Container.clear_seq(my.ERR_MSG)
my.add_dummy(config, content_div)
return div