本文整理汇总了Python中pyasm.web.WebContainer.get_web方法的典型用法代码示例。如果您正苦于以下问题:Python WebContainer.get_web方法的具体用法?Python WebContainer.get_web怎么用?Python WebContainer.get_web使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.WebContainer
的用法示例。
在下文中一共展示了WebContainer.get_web方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init
# 需要导入模块: from pyasm.web import WebContainer [as 别名]
# 或者: from pyasm.web.WebContainer import get_web [as 别名]
def init(self):
#print "DEPRECATED"
#raise TacticException("Use of GeneralAppletWdg is Deprecated")
# it's generated thru JS in IE
if WebContainer.get_web().is_IE():
return
context_url = WebContainer.get_web().get_context_url()
print "-"*20
print self.APPLET_CLASS
# create applet
applet = HtmlElement("applet")
applet.set_attr("code", self.APPLET_CLASS)
applet.set_attr("codebase", "%s/java" % context_url.get_url() )
applet.set_attr("archive", self.APPLET_JAR)
applet.set_attr("width", "1")
applet.set_attr("height", "1")
applet.set_attr("id", self.APPLET_ID)
# create param for applet
param = HtmlElement("param")
param.set_attr("name","scriptable")
param.set_attr("value","true")
applet.add(param)
self.add(applet)
示例2: get_instantiation_options
# 需要导入模块: from pyasm.web import WebContainer [as 别名]
# 或者: from pyasm.web.WebContainer import get_web [as 别名]
def get_instantiation_options(self):
options = ['reference', 'import', 'open']
if WebContainer.get_web().get_selected_app() == 'Houdini':
options = ['import', 'open']
elif WebContainer.get_web().get_selected_app() == 'XSI':
options = ['open']
return options
示例3: get_instantiation_options
# 需要导入模块: from pyasm.web import WebContainer [as 别名]
# 或者: from pyasm.web.WebContainer import get_web [as 别名]
def get_instantiation_options(my):
options = ["reference", "import", "open"]
if WebContainer.get_web().get_selected_app() == "Houdini":
options = ["import", "open"]
elif WebContainer.get_web().get_selected_app() == "XSI":
options = ["open"]
return options
示例4: check
# 需要导入模块: from pyasm.web import WebContainer [as 别名]
# 或者: from pyasm.web.WebContainer import get_web [as 别名]
def check(my):
my.add = WebContainer.get_web().get_form_value(\
SObjectGroupWdg.ADD_LABEL) != ''
my.remove = WebContainer.get_web().get_form_value(\
SObjectGroupCmd.REMOVE_CMD) != ''
if my.add or my.remove:
if my.grouping_search_type and my.item_foreign_key and \
my.container_foreign_key:
return True
else:
return False
示例5: get_display
# 需要导入模块: from pyasm.web import WebContainer [as 别名]
# 或者: from pyasm.web.WebContainer import get_web [as 别名]
def get_display(self):
# set up the self refresh event for other widgets or callbacks to call
event_container = WebContainer.get_event_container()
script = ClipboardWdg.get_self_refresh_script(show_progress=False)
event_container.add_listener(self.EVENT_ID, script, replace=True )
if self.is_from_ajax():
div = Widget()
else:
div = DivWdg()
div.set_id(self.ID)
div.add_style("display: block")
div.add_class("background_box")
div.add_style("padding-left: 3px")
div.add_style("padding-right: 3px")
div.add_style("height: 1.5em")
div.add_style("width: 150px")
# handle the ajax
self.set_ajax_top_id(self.ID)
self.register_cmd(ClipboardClearCbk)
refresh_script = self.get_refresh_script()
search = Search("sthpw/clipboard")
search.add_user_filter()
search.add_filter("category", "select")
count = search.get_count()
div.add("Clipboard: %s items: " % count)
web = WebContainer.get_web()
url = WebContainer.get_web().get_widget_url()
url.set_option("widget", "pyasm.widget.ClipboardListWdg")
ref = url.to_string()
iframe = WebContainer.get_iframe()
iframe.set_width(64)
action = iframe.get_on_script(ref)
button = IconButtonWdg("View Clipboard", IconWdg.LOAD)
button.add_event("onclick", action)
div.add(button)
# add the clear clipboard icon
clear_icon = IconButtonWdg("Clear Clipboard", IconWdg.CLEAR)
clear_icon.add_event("onclick", refresh_script)
div.add(clear_icon)
return div
示例6: _checkin
# 需要导入模块: from pyasm.web import WebContainer [as 别名]
# 或者: from pyasm.web.WebContainer import get_web [as 别名]
def _checkin(my, instance, context, asset_type='asset', is_current=True, \
is_revision=True, snapshot_type="asset", texture_search_type=None):
'''retrieve the asset sobject and run the checkin command'''
web = WebContainer.get_web()
namespace, asset_code, instance_name = instance.split("|")
description = WebContainer.get_web().get_form_value(\
"%s_description" % instance_name)
# get the sobject from asset_code
my.sobject = Search.get_by_code(my.search_type, asset_code)
if my.sobject == None:
raise CommandException("SObject '%s' does not exist'" % asset_code)
# now checkin the asset
checkin = None
# we assume asset_type = 'asset' by default
if asset_type == 'asset':
checkin = MayaAssetCheckin(my.sobject)
checkin.set_instance(instance_name)
checkin.set_option('texture_search_type', texture_search_type)
elif asset_type =='set':
checkin = MayaGroupCheckin(my.sobject)
else:
raise CommandException('Unknown asset type[%s] found' %asset_type)
checkin.set_description(description)
checkin.set_process(my.process)
checkin.set_context(context)
checkin.set_current(is_current)
checkin.set_revision(is_revision)
use_handoff_dir = web.get_form_value("use_handoff_dir")
if use_handoff_dir in ['true','on']:
checkin.set_use_handoff(True)
if snapshot_type:
checkin.set_snapshot_type(snapshot_type)
checkin.set_option("unknown_ref", web.get_form_value("unknown_ref"))
checkin.execute()
snapshot = checkin.get_snapshot()
version = snapshot.get_version()
if description == "":
description = "<No description>"
my.add_description("Checked in %s '%s', context: %s, v%0.3d, %s" % \
(asset_type.capitalize(), instance_name, context, version, description))
my.sobjects = [my.sobject]
示例7: get_file_type_wdg
# 需要导入模块: from pyasm.web import WebContainer [as 别名]
# 或者: from pyasm.web.WebContainer import get_web [as 别名]
def get_file_type_wdg(my):
'''drop down which selects which file type to export to'''
# add a filter
div = DivWdg()
filter_div = FloatDivWdg(HtmlElement.b("File Type:"), width="15em")
div.add(filter_div)
select = SelectWdg()
select.set_name("file_type")
select.set_id("file_type")
app = WebContainer.get_web().get_selected_app()
if app == 'Maya':
select.set_option("values", "mayaAscii|mayaBinary|obj|collada")
select.set_option("labels", "Maya Ascii (.ma)|Maya Binary (.mb)|Wavefront .obj|Collada (.dae)")
elif app == 'Houdini':
select.set_option("values", "otl")
select.set_option("labels", "Houdini Digital Asset(.otl)")
elif app == 'XSI':
select.set_option("values", "emdl|dotXSI|obj")
select.set_option("labels", "3D Model (.emdl)|SoftImage dotXSI (.xsi)|Wavefront .obj")
else:
select.set_option("values", "mayaAscii|mayaBinary|obj|collada")
select.set_option("labels", "Maya Ascii (.ma)|Maya Binary (.mb)|Wavefront .obj|Collada (.dae)")
select.add_style("font-size: 0.8em")
select.add_style("margin-top: 5px")
select.add_style("margin-right: 10px")
select.set_persistence()
div.add(select)
return div
示例8: check
# 需要导入模块: from pyasm.web import WebContainer [as 别名]
# 或者: from pyasm.web.WebContainer import get_web [as 别名]
def check(my):
search_key = my.kwargs.get('search_key')
my.sobject = SearchKey.get_by_search_key(search_key)
from pyasm.web import WebContainer
web = WebContainer.get_web()
my.old_password = web.get_form_value("old password")
if isinstance(my.old_password, list):
my.old_password = my.old_password[0]
#encrypted = md5.new(my.old_password).hexdigest()
encrypted = hashlib.md5(my.old_password).hexdigest()
if encrypted != my.sobject.get_value('password'):
raise UserException('Old password is incorrect.')
my.password = web.get_form_value("password")
if isinstance(my.password, list):
my.password = my.password[0]
if my.sobject == None:
return UserException("Current user cannot be determined.")
my.re_enter = web.get_form_value("password re-enter")
if isinstance(my.re_enter, list):
my.re_enter = my.re_enter[0]
if my.re_enter != "" and my.re_enter != my.password:
raise UserException( "Passwords must match. Please fill in the re-enter.")
return True
示例9: execute
# 需要导入模块: from pyasm.web import WebContainer [as 别名]
# 或者: from pyasm.web.WebContainer import get_web [as 别名]
def execute(self):
self.search_key_list = self.kwargs.get('search_key_list')
web = WebContainer.get_web()
skip_duplicated = web.get_form_value('skip_duplicated') == 'on'
pipeline_mode = web.get_form_value('pipeline_mode')
sobjects = SearchKey.get_by_search_keys(self.search_key_list)
count = 0
offset = 0
for sobject in sobjects:
if isinstance(sobject, Task):
raise TacticException('Creation of task for [Task] is not allowed')
sk = SearchKey.get_by_sobject(sobject)
if not sobject.has_value('pipeline_code'):
#raise TacticException('Creation of task is not allowed for item with no pipeline_code attribute.')
pipeline_code = '__default__'
sobject.set_value("pipeline_code", pipeline_code)
else:
pipeline_code = sobject.get_value('pipeline_code')
input_name = '%s|task_process'% pipeline_code
contexts = []
process_names = web.get_form_values(input_name)
process_names = [name for name in process_names if name]
if pipeline_mode == 'context':
# when pipeline_mode is context, we only specify contexts
# in add_initial_tasks
contexts = process_names[:]
process_names = []
tasks = Task.add_initial_tasks(sobject, sobject.get_value('pipeline_code'),
processes=process_names, contexts=contexts, skip_duplicate=skip_duplicated, mode=pipeline_mode, start_offset=offset)
count += len(tasks)
offset += 5
self.add_description("%s Tasks added in total." % count)
示例10: init
# 需要导入模块: from pyasm.web import WebContainer [as 别名]
# 或者: from pyasm.web.WebContainer import get_web [as 别名]
def init(self):
self.search_type = self.kwargs.get('search_type')
if not self.search_type:
self.search_type = WebContainer.get_web().get_form_value('search_type')
self.view = self.kwargs.get('view')
if not self.view:
self.view = "database_definition"
示例11: init
# 需要导入模块: from pyasm.web import WebContainer [as 别名]
# 或者: from pyasm.web.WebContainer import get_web [as 别名]
def init(my):
my.search_type = my.kwargs.get("search_type")
if not my.search_type:
my.search_type = WebContainer.get_web().get_form_value("search_type")
my.view = my.kwargs.get("view")
if not my.view:
my.view = "database_definition"
示例12: execute
# 需要导入模块: from pyasm.web import WebContainer [as 别名]
# 或者: from pyasm.web.WebContainer import get_web [as 别名]
def execute(my):
web = WebContainer.get_web()
if web.get_form_value("update") != "true":
return
my.element_name = my.kwargs.get("element_name")
security_groups = web.get_form_values("security")
from pyasm.security import AccessRuleBuilder, AccessManager
rule_group = "side_bar"
# get all of the groups
search = Search("sthpw/login_group")
login_groups = search.get_sobjects()
for login_group in login_groups:
access_rules = login_group.get_xml_value("access_rules")
# add the rule to each group
builder = AccessRuleBuilder(access_rules)
code = login_group.get_value("login_group")
if code in security_groups:
builder.remove_rule(rule_group, my.element_name)
else:
builder.add_rule(rule_group, my.element_name, "deny")
login_group.set_value("access_rules", builder.to_string())
login_group.commit()
示例13: get_display
# 需要导入模块: from pyasm.web import WebContainer [as 别名]
# 或者: from pyasm.web.WebContainer import get_web [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
示例14: get_display
# 需要导入模块: from pyasm.web import WebContainer [as 别名]
# 或者: from pyasm.web.WebContainer import get_web [as 别名]
def get_display(my):
widget = Widget()
thumb = super(ThumbPublishWdg, my).get_display()
widget.add(thumb)
sobject = my.get_current_sobject()
search_type = sobject.get_search_type()
search_id = sobject.get_id()
publish_link = PublishLinkWdg(search_type,search_id)
div = DivWdg(publish_link)
div.set_style('clear: left; padding-top: 6px')
widget.add(div)
# build an iframe to show publish browsing
browse_link = IconButtonWdg("Publish Browser", IconWdg.CONTENTS)
iframe = WebContainer.get_iframe()
iframe.set_width(100)
url = WebContainer.get_web().get_widget_url()
url.set_option("widget", "pyasm.prod.web.PublishBrowserWdg")
url.set_option("search_type", search_type)
url.set_option("search_id", search_id)
script = iframe.get_on_script(url.to_string())
browse_link.add_event("onclick", script)
div.add(browse_link)
div.set_style('padding-top: 6px')
return widget
示例15: init
# 需要导入模块: from pyasm.web import WebContainer [as 别名]
# 或者: from pyasm.web.WebContainer import get_web [as 别名]
def init(my):
web = WebContainer.get_web()
my.is_refresh = my.kwargs.get('is_refresh')
my.search_type = my.kwargs.get('search_type')
if not my.search_type:
my.search_type = web.get_form_value('search_type_filter')
my.close_cbfn = my.kwargs.get('close_cbfn')
my.web_url = web.get_form_value("web_url")
my.file_path = None
if my.web_url:
import urllib2
response = urllib2.urlopen(my.web_url)
csv = response.read()
my.file_path = "/tmp/test.csv"
f = open(my.file_path, 'w')
f.write(csv)
f.close()
if not my.file_path:
my.file_path = web.get_form_value('file_path')
if not my.file_path:
file_name = web.get_form_value('file_name')
ticket = web.get_form_value('html5_ticket')
if not ticket:
ticket = web.get_form_value('csv_import|ticket')
if file_name:
# this is treated the same in FileUplaod class
file_name = File.get_filesystem_name(str(file_name))
my.file_path = '%s/%s' %(web.get_upload_dir(ticket=ticket), file_name)