本文整理汇总了Python中pyasm.common.Container.get方法的典型用法代码示例。如果您正苦于以下问题:Python Container.get方法的具体用法?Python Container.get怎么用?Python Container.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.common.Container
的用法示例。
在下文中一共展示了Container.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get [as 别名]
def __init__(self, dynamic_load=0, tab_key="tab", css=REG):
self.tab_names = []
self.wdg_dict = {}
self.dynamic_load = dynamic_load
self.set_tab_key(tab_key)
self.tab_style = css
self.content_height = 0
self.mode = Container.get("tab_mode")
# setting tab path
self.tab_path = Container.get("tab_path")
if not self.tab_path:
self.tab_path = "Main"
self.error_wdg = None
self.div = DivWdg(css='left_content')
if Environment.has_tactic_database():
self.invisible_list = ProdSetting.get_seq_by_key('invisible_tabs')
else:
self.invisible_list = []
super(TabWdg,self).__init__()
示例2: __init__
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get [as 别名]
def __init__(my, dynamic_load=0, tab_key="tab", css=REG):
my.tab_names = []
my.wdg_dict = {}
my.dynamic_load = dynamic_load
my.set_tab_key(tab_key)
my.tab_style = css
my.content_height = 0
my.mode = Container.get("tab_mode")
# setting tab path
my.tab_path = Container.get("tab_path")
if not my.tab_path:
my.tab_path = "Main"
my.error_wdg = None
my.div = DivWdg(css='left_content')
if Environment.has_tactic_database():
my.invisible_list = ProdSetting.get_seq_by_key('invisible_tabs')
else:
my.invisible_list = []
super(TabWdg,my).__init__()
示例3: add_behavior
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get [as 别名]
def add_behavior(my, bvr_spec):
'''adds an individual behavior specification to the HTML based widget'''
#print "bvr: ", str(bvr_spec).replace(r"\n", "\n")
#print "---"
if my.behaviors == None:
my.behaviors = []
if type(bvr_spec) == types.DictType:
# handle any cbjs string value that has newlines (e.g. ones specified using triple single quote block
# quotes in order to have the javascript code readable as indented multi-line code) ...
regex = re.compile( r'\n\s*' )
if my.__class__.__name__.find('CheckboxWdg') != -1:
if bvr_spec.get('propagate_evt') == None:
bvr_spec['propagate_evt'] = True
script_path = bvr_spec.get('cbjs_script_path')
if script_path:
script_sobj = Container.get("HTML::custom_script")
if script_sobj == None:
basename = os.path.basename(script_path)
dirname = os.path.dirname(script_path)
search = Search("config/custom_script")
search.add_filter("folder", dirname)
search.add_filter("title", basename)
script_sobj = search.get_sobject()
if script_sobj:
Container.put("HTML::custom_script", script_sobj)
v = script_sobj.get_value("script")
bvr_spec['cbjs_action'] = regex.sub( '\n', v )
else:
raise Exception( "Error: script path [%s] does not exist" % script_path )
for k,v in bvr_spec.iteritems():
if 'cbjs' in k and '\n' in v:
bvr_spec[k] = regex.sub( '\n', v )
my.behaviors.append( bvr_spec )
elif type(bvr_spec) == types.StringType:
# legacy support for any '.add_behavior' calls that provide a bvr_spec argument that is a string
# representation of a behavior specification dictionary
my.behaviors.append( my.convert_behavior_str(bvr_spec) )
else:
raise Exception( "Behavior specification should be a dictionary, %s spec is not supported." %
type(bvr_spec) )
count = Container.get("Widget:bvr_count")
if not count:
count = 1
else:
count += 1
Container.put("Widget:bvr_count", count)
示例4: get_display
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get [as 别名]
def get_display(my):
# assert my.search is not None
# search_type_obj = my.search.get_search_type_obj()
search_key = my.sobject.get_search_key()
title = my.sobject.get_code()
upload_url = WebContainer.get_web().get_widget_url()
upload_url.set_option("widget", "pyasm.prod.web.SObjectUploadWdg")
upload_url.set_option("search_key", search_key)
# upload_url.set_option("mode", "copy")
upload_url.set_option("naming", "no")
for name, value in my.upload_options.items():
upload_url.set_option(name, value)
# get the main iframe
iframe = Container.get("iframe")
iframe.set_width(65)
upload_action = iframe.get_on_script(upload_url.get_url())
# upload button
upload_button = IconButtonWdg("file publish %s" % title, IconWdg.UPLOAD)
upload_button.add_event("onclick", upload_action)
my.add(upload_button, "upload_button")
return super(SObjectFilePublishWdg, my).get_display()
示例5: get_by_key
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get [as 别名]
def get_by_key(cls, key, user=None, project_code=None, use_cache=True):
if not user:
user = Environment.get_user_name()
# ignore the project_code column for now
dict_key = '%s:%s:%s' %(cls.SEARCH_TYPE, project_code, user)
if use_cache:
settings_dict = Container.get(dict_key)
else:
settings_dict = None
# explicit check for None
if settings_dict == None:
settings_dict = {}
if use_cache:
Container.put(dict_key, settings_dict)
search = Search(cls.SEARCH_TYPE)
search.add_filter("login", user)
if project_code:
search.add_filter("project_code", project_code)
else:
search.add_null_filter("project_code")
# don't filter with the key in order to build a dict
pref_settings = search.get_sobjects()
for setting in pref_settings:
settings_dict[setting.get_value('key')] = setting
pref_setting = settings_dict.get(key)
return pref_setting
示例6: get
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get [as 别名]
def get():
key = 'CacheList'
cache_list = Container.get(key)
if not cache_list:
cache_list = CacheList()
Container.put(key, cache_list)
return cache_list
示例7: init
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get [as 别名]
def init(my):
help = HelpItemWdg('Loader', 'The Loader lets you load 3D assets into your 3D applications. Among many options, you can choose to either reference, import, or open the asset through http or the internal file system.')
my.add(help)
pref = PrefSetting.get_value_by_key("use_java_maya")
app = WebContainer.get_web().get_app_name_by_uri()
if app == "Maya":
if not Container.get('GeneralAppletWdg'):
my.add( GeneralAppletWdg() )
Container.put('GeneralAppletWdg', True)
site_menu = SiteMenuWdg()
site_menu.add_style("float", "right")
site_menu.add_style("margin-top", "-2px")
my.add(site_menu)
WebContainer.add_js('MayaWebTools.js')
WebContainer.add_js('PyMaya.js')
tab = MayaTabWdgImpl()
tab_value = tab.set_tab_key("maya_tab")
#my.handle_tab(tab)
#my.add(tab,"tab")
my.setup_tab("maya_tab", tab=tab)
my.add( ProgressWdg() )
示例8: __init__
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get [as 别名]
def __init__(self, data=[]):
if not data:
self.data = []
elif type(data) in types.StringTypes:
try:
# optimize the loading of json data
json_data = Container.get("json_data")
if json_data == None:
json_data = {}
Container.put("json_data", json_data)
self.data = json_data.get(data)
if self.data == None:
self.data = jsonloads(data)
json_data[data] = self.data
except ValueError, e:
if e.__str__().find('No JSON object') != -1:
raise SetupException('Data is not decodable as JSON.')
# try a straight eval
self.data = eval(data)
except Exception as e:
if e.__str__().find('cannot parse JSON description') != -1:
raise SetupException('Data is not valid JSON.')
示例9: get_display
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get [as 别名]
def get_display(my):
sobject = my.get_current_sobject()
widget_class = my.get_option("class")
if widget_class == '':
raise WidgetException("No widget class defined")
url = WebContainer.get_web().get_widget_url()
url.set_option("widget", widget_class)
url.set_option("search_key", sobject.get_search_key())
ref = url.get_url()
iframe = Container.get("iframe")
iframe.set_width(90)
action = iframe.get_on_script(ref)
info_type = my.get_option("info_type")
button = IconButtonWdg("%s info" % info_type, IconWdg.INFO)
button.add_event("onclick", "%s" % (action) )
button.add_style("margin: 3px 5px")
return button
示例10: get_global_project_code
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get [as 别名]
def get_global_project_code(cls):
PROJECT_KEY = "Project:global"
project_code = Container.get(PROJECT_KEY)
if not project_code:
project_code = "admin"
Project.set_global_project_code(project_code)
return project_code
示例11: _test_add_drop_column
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get [as 别名]
def _test_add_drop_column(my):
#Project.set_project('unittest')
from pyasm.command import ColumnAddCmd, ColumnDropCmd, Command
cmd = ColumnAddCmd('unittest/country','special_place','varchar(256)')
Command.execute_cmd(cmd)
search_type = 'unittest/country'
# clear cache
SearchType.clear_column_cache(search_type)
DatabaseImpl.clear_table_cache()
exists = SearchType.column_exists(search_type, 'special_place')
my.assertEquals(exists, True)
# now drop the column
cmd = ColumnDropCmd(search_type,'special_place')
Command.execute_cmd(cmd)
# clear cache
SearchType.clear_column_cache(search_type)
cache_dict = Container.get("DatabaseImpl:column_info")
# assume database is the same as sthpw
database_type = Project.get_by_code("unittest").get_database_type()
db_resource = DbResource.get_default('unittest')
table_info = cache_dict.get("%s:%s" % (db_resource, "country"))
my.assertEquals(table_info == None, True)
key = "%s:%s" % (db_resource, "country")
cache_dict[key] = None
exists = SearchType.column_exists(search_type, 'special_place')
my.assertEquals(exists, False)
示例12: get
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get [as 别名]
def get():
# try getting from the web from
state = Container.get("WebState")
if not state:
state = WebState()
Container.put("WebState", state)
return state
示例13: push_palette
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get [as 别名]
def push_palette(cls, palette):
palettes = Container.get("Palette:palettes")
if palettes == None:
palettes = []
Container.put("Palette:palettes", palettes)
palette = Palette(palette=palette)
palettes.append(palette)
示例14: set_pipeline
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get [as 别名]
def set_pipeline(my, pipeline_xml, cache=True):
'''set the pipeline externally'''
# cache according to pipeline code, which will share the same xml object
if my.is_insert():
cache = False
search_key = my.get_search_key()
xml_dict = Container.get("Pipeline:xml")
if xml_dict == None:
xml_dict = {}
Container.put("Pipeline:xml", xml_dict)
my.xml = xml_dict.get(search_key)
if my.xml == None:
my.xml = Xml()
if cache:
xml_dict[search_key] = my.xml
if not pipeline_xml:
pipeline_xml = "<pipeline/>"
try:
my.xml.read_string(pipeline_xml)
except XmlException, e:
my.xml.read_string("<pipeline/>")
示例15: get_action_html
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get [as 别名]
def get_action_html(self):
from pyasm.prod.site import EditorialTabWdg, MainTabWdg, ClientTabWdg
#edit = SubmitWdg("do_edit", "Submit/Next" )
edit_continue = SubmitWdg("do_edit", "Submit/Close" )
edit_continue.add_event("onclick", "document.form.%s.value='true'"%self.CLOSE_WDG)
# call an edit event
#event = WebContainer.get_event("sthpw:submit")
#edit.add_event( "onclick", event.get_caller() )
# create a cancel button to close the window
cancel = ButtonWdg("Cancel")
iframe = Container.get("iframe")
cancel.add_event("onclick", "window.parent.%s" % iframe.get_off_script() )
div = DivWdg(css='centered')
div.center()
#div.add(SpanWdg(edit, css='med'))
div.add(SpanWdg(edit_continue, css='med'))
div.add(SpanWdg(cancel, css='med'))
return div