本文整理汇总了Python中pyasm.common.Container.get_dict方法的典型用法代码示例。如果您正苦于以下问题:Python Container.get_dict方法的具体用法?Python Container.get_dict怎么用?Python Container.get_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.common.Container
的用法示例。
在下文中一共展示了Container.get_dict方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: use_applet
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get_dict [as 别名]
def use_applet(self):
# determines whether the applet should be used for local file
# operations
use_applet = Config.get_value("checkin", "use_applet")
if use_applet in ['false', False]:
use_applet = False
elif use_applet in ['true', True]:
use_applet = True
else:
browser = self.get_browser()
# TEAM can always use the applet
if browser == "Qt":
use_applet = True
else:
# Otherwise we need a way to detect the java applet reliably
if Container.get_dict("JSLibraries", "spt_applet"):
use_applet = True
else:
use_applet = False
return use_applet
示例2: init
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get_dict [as 别名]
def init(my):
#my.inner = DivWdg()
my.dialog = None
my.button = DivWdg()
my.hit_wdg = DivWdg()
my.hit_wdg.add_class("spt_button_hit_wdg")
my.arrow_div = DivWdg()
my.arrow_menu = IconButtonWdg(title="More Options", icon=IconWdg.ARROWHEAD_DARK_DOWN)
my.show_arrow_menu = False
# for icon decoration
my.icon_div = DivWdg()
my.is_disabled = my.kwargs.get("is_disabled") in [True,"true"]
if not Container.get_dict("JSLibraries", "spt_button"):
doc_top = Container.get("TopWdg::top")
if doc_top:
doc_top.add_behavior( {
'type': 'load',
'cbjs_action': '''
spt.Environment.get().add_library("spt_button");
'''
} )
bvr_wdg = doc_top
else:
bvr_wdg = my.top
# change to a relay behavior
bvr_wdg.add_relay_behavior( {
'type': 'mousedown',
'bvr_match_class': 'spt_button_hit_wdg',
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_button_top")
var over = top.getElement(".spt_button_over");
var click = top.getElement(".spt_button_click");
over.setStyle("display", "none");
click.setStyle("display", "");
'''
} )
bvr_wdg.add_relay_behavior( {
'type': 'mouseup',
'bvr_match_class': 'spt_button_hit_wdg',
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_button_top")
var over = top.getElement(".spt_button_over");
var click = top.getElement(".spt_button_click");
over.setStyle("display", "");
click.setStyle("display", "none");
'''
} )
bvr_wdg.add_relay_behavior( {
'type': 'mouseenter',
'bvr_match_class': 'spt_button_hit_wdg',
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_button_top")
var over = top.getElement(".spt_button_over");
var click = top.getElement(".spt_button_click");
over.setStyle("display", "");
click.setStyle("display", "none");
''',
} )
bvr_wdg.add_relay_behavior( {
'type': 'mouseleave',
'bvr_match_class': 'spt_button_hit_wdg',
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_button_top")
var over = top.getElement(".spt_button_over");
var click = top.getElement(".spt_button_click");
over.setStyle("display", "none");
click.setStyle("display", "none");
'''
} )
示例3: get_display
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get_dict [as 别名]
def get_display(self):
self.view_editable = True
#if self.kwargs.get("do_search") != "false":
# self.handle_search()
self._process_search_args()
#self.kwargs['show_gear'] = 'false'
from tile_layout_wdg import TileLayoutWdg
self.tile_layout = TileLayoutWdg(search_type=self.search_type, expand_mode=self.expand_mode, process=self.process)
# 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()
"""
# TEST code to return only the content
temp = self.kwargs.get("temp")
if temp:
content = DivWdg()
content.add( self.get_content_wdg() )
return content
"""
# extraneous variables inherited from TableLayoutWdg
self.edit_permission = True
top = self.top
self.set_as_panel(top)
top.add_class("spt_sobject_top")
top.add_class("spt_layout_top")
inner = DivWdg()
top.add(inner)
# This is handled elsewhere
#inner.add_color("background", "background")
inner.add_color("color", "color")
inner.add_attr("spt_version", "2")
inner.add_class("spt_table")
inner.add_class("spt_layout")
self.layout_wdg = inner
class_name = Common.get_full_class_name(self)
inner.add_attr("spt_class_name", class_name)
if not Container.get_dict("JSLibraries", "spt_html5upload"):
from tactic.ui.input import Html5UploadWdg
upload_wdg = Html5UploadWdg()
inner.add(upload_wdg)
self.upload_id = upload_wdg.get_upload_id()
inner.add_attr('upload_id',self.upload_id)
# this interferes with Html5Upload function on first load, commenting it out
#thumb = ThumbWdg()
#thumb.handle_layout_behaviors(inner)
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)
info = self.search_limit.get_info()
if info.get("count") == None:
info["count"] = len(self.sobjects)
show_search_limit = self.kwargs.get("show_search_limit")
if show_search_limit in ['false', False]:
search_limit_mode = None
else:
search_limit_mode = self.kwargs.get('search_limit_mode')
if not search_limit_mode:
search_limit_mode = 'bottom'
if search_limit_mode in ['top','both']:
from tactic.ui.app import SearchLimitSimpleWdg
limit_wdg = SearchLimitSimpleWdg(
count=info.get("count"),
search_limit=info.get("search_limit"),
current_offset=info.get("current_offset")
)
#.........这里部分代码省略.........
示例4: get_display
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get_dict [as 别名]
def get_display(my):
top = my.top
form = my.form
form.add_style("margin: 0px")
form.add_style("padding: 0px")
top.add(form)
input = HtmlElement.input()
form.add(input)
input.set_attr("name", "file")
input.add_class("spt_file")
input.set_attr("type", "file")
#input.add_style("display: none")
#input.add_style("visibility: hidden")
input.add_style("position: absolute")
input.add_style("margin-left: -5000px")
#input.add_style("margin-left: 500px")
#input.add_style("margin-top: -50px")
multiple = my.kwargs.get("multiple")
if multiple in [True, 'true']:
input.add_attr("multiple", "multiple")
from pyasm.common import Container
if not Container.get_dict("JSLibraries", "spt_html5upload"):
form.add_behavior( {
'type': 'load',
'form_id': my.form_id,
'cbjs_action': '''
if (spt.html5upload)
return;
spt.Environment.get().add_library("spt_html5upload")
spt.html5upload = {};
spt.html5upload.form = $(bvr.form_id);
spt.html5upload.files = [];
spt.html5upload.events = {};
spt.html5upload.set_form = function(form) {
if (!form) {
spt.alert('Cannot initialize the HTML upload. Invalid form detected.');
return;
}
spt.html5upload.form = form;
}
// get the last one in the list since this FileList is readonly and it is additive if multiple attr is on
spt.html5upload.get_file = function() {
var files = spt.html5upload.get_files();
if (files.length == 0) {
return null;
}
return files[files.length-1];
}
//FIXME: it doesn't need to be stored as files since it should be called
// every time an upload occurs
spt.html5upload.get_files = function() {
var file_input = spt.html5upload.form.getElement('.spt_file');
spt.html5upload.files = file_input.files;
return spt.html5upload.files;
}
spt.html5upload.select_file = function(onchange) {
var files = spt.html5upload.select_files(onchange);
if (!files) {
spt.alert('You may need to refresh this page.');
return null;
}
if (files.length == 0) {
return null;
}
return files[0];
}
spt.html5upload.select_files = function(onchange) {
var form = spt.html5upload.form;
if (!form) {
spt.alert('Cannot locate the upload form. Refresh this page/tab and try again');
return;
}
var el = form.getElement(".spt_file") ;
/*
if (replace) {
spt.html5upload.events['select_file'] = null;
el.removeEventListener("change", onchange);
alert('remove')
}
*/
#.........这里部分代码省略.........
示例5: get_display
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get_dict [as 别名]
def get_display(my):
top = my.top
top.add_class("spt_script_editor_top")
"""
top.add_class("SPT_CHANGE")
top.add_behavior( {
'type': 'load',
'cbjs_action': '''
register_change = function(bvr) {
var change_top = bvr.src_el.getParent(".SPT_CHANGE");
change_top.addClass("SPT_HAS_CHANGES");
change_top.update_change(change_top, bvr);
}
has_changes = function(bvr) {
var change_top = bvr.src_el.getParent(".SPT_CHANGE");
return change_top.hasClass("SPT_HAS_CHANGES");
}
bvr.src_el.update_change = function(top, bvr) {
change_el = top.getElement(".spt_change_element");
change_el.setStyle("display", "");
}
'''
} )
"""
change_div = DivWdg()
top.add(change_div)
#change_div.add("CHANGES!!!")
change_div.add_style("display: none")
change_div.add_class("spt_change_element");
top.add_class("spt_panel")
top.add_class("spt_js_editor")
top.add_attr("spt_class_name", Common.get_full_class_name(my) )
top.add_color("background", "background")
top.add_style("padding", "10px")
div = DivWdg()
top.add(div)
# if script_path
script_path = my.kwargs.get("script_path")
search_key = my.kwargs.get("search_key")
if script_path:
search = Search("config/custom_script")
dirname = os.path.dirname(script_path)
basename = os.path.basename(script_path)
search.add_filter("folder", dirname)
search.add_filter("title", basename)
script_sobj = search.get_sobject()
elif search_key:
script_sobj = Search.get_by_search_key(search_key)
else:
script_sobj = None
if script_sobj:
script_code = script_sobj.get_value("code")
script_folder = script_sobj.get_value("folder")
script_name = script_sobj.get_value("title")
script_value = script_sobj.get_value("script")
script_language = script_sobj.get_value("langauge")
else:
script_code = ''
script_folder = ''
script_name = ''
script_value = ''
editor = AceEditorWdg(custom_script=script_sobj)
my.editor_id = editor.get_editor_id()
if not Container.get_dict("JSLibraries", "spt_script_editor"):
div.add_behavior( {
'type': 'load',
'cbjs_action': my.get_onload_js()
} )
# create the insert button
help_button_wdg = DivWdg()
div.add(help_button_wdg)
help_button_wdg.add_style("float: right")
help_button = ActionButtonWdg(title="?", tip="Script Editor Help", size='s')
help_button_wdg.add(help_button)
#.........这里部分代码省略.........
示例6: get_display
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get_dict [as 别名]
def get_display(my):
search_type_obj = SearchType.get(my.search_type)
sobj_title = search_type_obj.get_title()
my.color_mode = my.kwargs.get("color_mode")
if not my.color_mode:
my.color_mode = "default"
top_div = my.top
top_div.add_class("spt_edit_top")
if not my.is_refresh:
my.set_as_panel(top_div)
content_div = DivWdg()
content_div.add_class("spt_edit_top")
content_div.add_class("spt_edit_form_top")
content_div.set_attr("spt_search_key", my.search_key)
if not Container.get_dict("JSLibraries", "spt_edit"):
content_div.add_behavior( {
'type': 'load',
'cbjs_action': my.get_onload_js()
} )
layout_view = my.kwargs.get("layout_view")
if layout_view:
layout_wdg = my.get_custom_layout_wdg(layout_view)
content_div.add(layout_wdg)
return content_div
# add close listener
# NOTE: this is an absolute search, but is here for backwards
# compatibility
content_div.add_named_listener('close_EditWdg', '''
var popup = bvr.src_el.getParent( ".spt_popup" );
if (popup)
spt.popup.close(popup);
''')
attrs = my.config.get_view_attributes()
default_access = attrs.get("access")
if not default_access:
default_access = "edit"
project_code = Project.get_project_code()
security = Environment.get_security()
base_key = search_type_obj.get_base_key()
key = {
'search_type': base_key,
'project': project_code
}
access = security.check_access("sobject", key, "edit", default=default_access)
if not access:
my.is_disabled = True
else:
my.is_disabled = False
disable_wdg = None
if my.is_disabled:
# TODO: This overlay doesn't work in IE, size, position,
# and transparency all fail.
disable_wdg = DivWdg(id='edit_wdg')
disable_wdg.add_style("position: absolute")
disable_wdg.add_style("height: 90%")
disable_wdg.add_style("width: 100%")
disable_wdg.add_style("left: 0px")
#disable_wdg.add_style("bottom: 0px")
#disable_wdg.add_style("top: 0px")
disable_wdg.add_style("opacity: 0.2")
disable_wdg.add_style("background: #fff")
#disable_wdg.add_style("-moz-opacity: 0.2")
disable_wdg.add_style("filter: Alpha(opacity=20)")
disable_wdg.add("<center>EDIT DISABLED</center>")
content_div.add(disable_wdg)
attrs = my.config.get_view_attributes()
inner = DivWdg()
content_div.add(inner)
menu = my.get_header_context_menu()
menus = [menu.get_data()]
menus_in = {
'HEADER_CTX': menus,
}
SmartMenu.attach_smart_context_menu( inner, menus_in, False )
#.........这里部分代码省略.........
示例7: get_display
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get_dict [as 别名]
def get_display(my):
top = my.top
top.add_class("spt_script_editor_top")
"""
top.add_class("SPT_CHANGE")
top.add_behavior( {
'type': 'load',
'cbjs_action': '''
register_change = function(bvr) {
var change_top = bvr.src_el.getParent(".SPT_CHANGE");
change_top.addClass("SPT_HAS_CHANGES");
change_top.update_change(change_top, bvr);
}
has_changes = function(bvr) {
var change_top = bvr.src_el.getParent(".SPT_CHANGE");
return change_top.hasClass("SPT_HAS_CHANGES");
}
bvr.src_el.update_change = function(top, bvr) {
change_el = top.getElement(".spt_change_element");
change_el.setStyle("display", "");
}
'''
} )
"""
change_div = DivWdg()
top.add(change_div)
#change_div.add("CHANGES!!!")
change_div.add_style("display: none")
change_div.add_class("spt_change_element");
top.add_class("spt_panel")
top.add_class("spt_js_editor")
top.add_attr("spt_class_name", Common.get_full_class_name(my) )
top.add_color("background", "background")
top.add_style("padding", "10px")
div = DivWdg()
top.add(div)
# if script_path
script_path = my.kwargs.get("script_path")
search_key = my.kwargs.get("search_key")
if script_path:
search = Search("config/custom_script")
dirname = os.path.dirname(script_path)
basename = os.path.basename(script_path)
search.add_filter("folder", dirname)
search.add_filter("title", basename)
script_sobj = search.get_sobject()
elif search_key:
script_sobj = Search.get_by_search_key(search_key)
else:
script_sobj = None
if script_sobj:
script_code = script_sobj.get_value("code")
script_folder = script_sobj.get_value("folder")
script_name = script_sobj.get_value("title")
script_value = script_sobj.get_value("script")
script_language = script_sobj.get_value("language")
else:
script_code = ''
script_folder = ''
script_name = ''
script_value = ''
editor = AceEditorWdg(custom_script=script_sobj)
my.editor_id = editor.get_editor_id()
if not Container.get_dict("JSLibraries", "spt_script_editor"):
div.add_behavior( {
'type': 'load',
'cbjs_action': my.get_onload_js()
} )
# create the insert button
help_button_wdg = DivWdg()
div.add(help_button_wdg)
help_button_wdg.add_style("float: right")
help_button = ActionButtonWdg(title="?", tip="Script Editor Help", size='s')
help_button_wdg.add(help_button)
#.........这里部分代码省略.........
示例8: get_display
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get_dict [as 别名]
def get_display(my):
div = DivWdg()
if not Container.get_dict("JSLibraries", "spt_popup"):
div.add_style("position: fixed")
div.add_style("top: 0px")
div.add_style("left: 0px")
div.add_style("opacity: 0.4")
div.add_style("background", "#000")
div.add_style("padding: 100px")
div.add_style("height: 100%")
div.add_style("width: 100%")
div.add_class("spt_popup_background")
div.add_style("display: none")
div.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
spt.hide(bvr.src_el);
'''
} )
Container.put("PopupWdg:background", True)
# This is the absolute outside of a popup, including the drop shadow
widget = DivWdg()
div.add(widget)
widget.add_class("spt_popup")
if not Container.get_dict("JSLibraries", "spt_popup"):
widget.add_behavior( {
'type': 'load',
'cbjs_action': my.get_onload_js()
} )
width = my.kwargs.get("width")
if not width:
width = 10
#widget.add_behavior( {
# 'type': 'load',
# 'cbjs_action': 'bvr.src_el.makeResizable({handle:bvr.src_el.getElement(".spt_popup_resize")})'
#} )
web = WebContainer.get_web()
widget.set_id(my.name)
if my.kwargs.get("display") == "true":
pass
else:
widget.add_style("display: none")
widget.add_style("position: absolute")
widget.add_style("left: 400px")
widget.add_style("top: 100px")
widget.add_border()
widget.add_color("background", "background")
#widget.set_box_shadow(color="#000")
widget.set_box_shadow()
table = Table()
table.add_behavior( {
'type': 'load',
'width': width,
'cbjs_action': '''
bvr.src_el.setStyle("width", bvr.width)
var popup = bvr.src_el.getParent(".spt_popup");
var window_size = $(window).getSize();
var size = bvr.src_el.getSize();
var left = window_size.x/2 - size.x/2;
var top = window_size.y/2 - size.y/2;
popup.setStyle("left", left);
//popup.setStyle("top", top);
'''
} )
table.add_row()
"""
# Qt doesn't support shadows very well
if web.get_browser() == 'Qtx':
# dynamically add css files
table.add_class("css_shadow_table")
td = table.add_cell()
td.add_class("css_shadow_td css_shadow_top_left SPT_POPUP_SHADOW")
#.........这里部分代码省略.........
示例9: get_display
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import get_dict [as 别名]
def get_display(my):
search_type_obj = SearchType.get(my.search_type)
sobj_title = search_type_obj.get_title()
my.color_mode = my.kwargs.get("color_mode")
if not my.color_mode:
my.color_mode = "default"
top_div = my.top
top_div.add_class("spt_edit_top")
if not my.is_refresh:
my.set_as_panel(top_div)
content_div = DivWdg()
content_div.add_class("spt_edit_top")
content_div.add_class("spt_edit_form_top")
content_div.set_attr("spt_search_key", my.search_key)
if not Container.get_dict("JSLibraries", "spt_edit"):
content_div.add_behavior( {
'type': 'load',
'cbjs_action': my.get_onload_js()
} )
layout_view = my.kwargs.get("layout_view")
if layout_view:
layout_wdg = my.get_custom_layout_wdg(layout_view)
content_div.add(layout_wdg)
return content_div
# add close listener
# NOTE: this is an absolute search, but is here for backwards
# compatibility
content_div.add_named_listener('close_EditWdg', '''
var popup = bvr.src_el.getParent( ".spt_popup" );
if (popup)
spt.popup.close(popup);
''')
attrs = my.config.get_view_attributes()
default_access = attrs.get("access")
if not default_access:
default_access = "edit"
project_code = Project.get_project_code()
security = Environment.get_security()
base_key = search_type_obj.get_base_key()
key = {
'search_type': base_key,
'project': project_code
}
access = security.check_access("sobject", key, "edit", default=default_access)
if not access:
my.is_disabled = True
else:
my.is_disabled = False
disable_wdg = None
if my.is_disabled:
# TODO: This overlay doesn't work in IE, size, position,
# and transparency all fail.
disable_wdg = DivWdg(id='edit_wdg')
disable_wdg.add_style("position: absolute")
disable_wdg.add_style("height: 90%")
disable_wdg.add_style("width: 100%")
disable_wdg.add_style("left: 0px")
#disable_wdg.add_style("bottom: 0px")
#disable_wdg.add_style("top: 0px")
disable_wdg.add_style("opacity: 0.2")
disable_wdg.add_style("background: #fff")
#disable_wdg.add_style("-moz-opacity: 0.2")
disable_wdg.add_style("filter: Alpha(opacity=20)")
disable_wdg.add("<center>EDIT DISABLED</center>")
content_div.add(disable_wdg)
attrs = my.config.get_view_attributes()
#inner doesn't get styled.
inner = DivWdg()
content_div.add(inner)
menu = my.get_header_context_menu()
menus = [menu.get_data()]
menus_in = {
'HEADER_CTX': menus,
}
SmartMenu.attach_smart_context_menu( inner, menus_in, False )
#insert the header before body into inner
#.........这里部分代码省略.........