本文整理汇总了Python中pyasm.web.WebContainer类的典型用法代码示例。如果您正苦于以下问题:Python WebContainer类的具体用法?Python WebContainer怎么用?Python WebContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WebContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
def get_display(self):
web = WebContainer.get_web()
user = WebContainer.get_user_name()
local_dir = web.get_local_dir()
context_url = web.get_site_context_url().to_string()
server = web.get_base_url().to_string()
upload_url = web.get_upload_url()
html = Html()
html.writeln('<script language="JavaScript" src="resource:///res/RunHCommand.js"></script>')
html.writeln('''\n<script>try{ app = new PyHoudini(); }
catch(e){
app = null;}
if (app) {
app.user = '%(user)s';
app.local_dir = '%(local_dir)s';
app.context_url = '%(context_url)s';
app.base_url = '%(server)s';
app.upload_url = '%(upload_url)s';
app.project_code = '%(project_code)s';} </script>'''%{'user': user,
'local_dir': local_dir,
'context_url' : context_url,
'server': server,
'upload_url': upload_url,
'project_code': Project.get_project_code()})
return html
示例2: get_display
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
示例3: get_instantiation_options
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
示例4: get_display
def get_display(my):
web = WebContainer.get_web()
user = WebContainer.get_user_name()
local_dir = web.get_local_dir()
context_url = web.get_site_context_url().to_string()
server = web.get_base_url().to_string()
upload_url = web.get_upload_url()
html = Html()
html.writeln('''\n<script>try{ app = new PyXSI(); }
catch(e){
app = null;}
if (app) {
app.user = '%(user)s';
app.local_dir = '%(local_dir)s';
app.context_url = '%(context_url)s';
app.base_url = '%(server)s';
app.upload_url = '%(upload_url)s';
app.project_code = '%(project_code)s';} </script>'''%{'user': user,
'local_dir': local_dir,
'context_url' : context_url,
'server': server,
'upload_url': upload_url,
'project_code': Project.get_project_code()})
return html
示例5: handle_tab
def handle_tab(self, tab):
# Hide this for now
#tab.add( self.get_create_wdg, "Create")
#tab.add( self.get_edit_wdg, "Edit" )
tab.add( LoginWdg, _("Users") )
tab.add( LoginGroupWdg, _("Groups") )
tab.add( self.get_user_group_wdg, _("Users -> Groups"))
tab.add( self.get_group_user_wdg, _("Groups -> Users") )
tab.add( QueueWdg, _("Queue") )
tab.add( self.get_render_policy_wdg, _("Render Policy") )
#tab.add( PipelineEditorWdg, _("Pipelines") )
tab.add( self.get_pipeline_wdg, _("Pipelines") )
tab.add( self.get_group_notification_wdg, _("Notification -> Group") )
tab.add( self.get_notification_group_wdg, _("Group -> Notification" ) )
tab.add( self.get_milestone_wdg, _("Project Milestones") )
tab.add( self.get_project_settings_wdg, _("Project Settings") )
tab.add( CustomProjectTabWdg, _("Customize Project") )
from setup_tab_wdg import SetupTabWdg
tab.add( SetupTabWdg, _("Setup Wizard"))
tab.add(self.get_import_wdg, _("Import Data") )
WebContainer.add_js('wz_dragdrop.js')
示例6: get_instantiation_options
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
示例7: init
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)
示例8: init
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() )
示例9: execute
def execute(my):
# Since this is not called with Command.execute_cmd
my.check()
web = WebContainer.get_web()
reset_on = my.kwargs.get('reset') == True
if reset_on:
security = WebContainer.get_security()
#Batch()
login = Login.get_by_login(my.login)
if not login:
web.set_form_value(ResetPasswordWdg.MSG, 'This user [%s] does not exist or has been disabled. Please contact the Administrator.'%my.login)
return
email = login.get_value('email')
if not email:
web.set_form_value(ResetPasswordWdg.MSG, 'This user [%s] does not have an email entry for us to email you the new password. Please contact the Administrator.'%my.login)
return
# auto pass generation
unique_code = ''.join([ random.choice('abcdefghijklmno12345') for i in xrange(0, 5)])
auto_password = unique_code
msg = ResetPasswordWdg.RESET_MSG
# send the email
try:
from pyasm.command import EmailTriggerTestCmd
admin = Login.get_by_login('admin')
if admin:
sender_email = admin.get_value('email')
else:
sender_email = '[email protected]'
recipient_emails = [email]
email_msg = 'Your TACTIC password has been reset. The new password is:\n%s\nYou can change your password once you log in by going to Edit My Account at the top right corner.'%auto_password
email_cmd = EmailTriggerTestCmd(sender_email=sender_email, recipient_emails=recipient_emails, msg= email_msg, subject='TACTIC password change')
email_cmd.execute()
except TacticException, e:
msg = "Failed to send an email for your new password. Reset aborted."
web.set_form_value(ResetPasswordWdg.MSG, msg)
raise
else:
encrypted = hashlib.md5(auto_password).hexdigest()
login.set_value('password', encrypted)
login.commit()
web.set_form_value(ResetPasswordWdg.MSG, 'A new password has been sent to your email address. Please check your email.')
# handle windows domains
#if my.domain:
# my.login = "%s\\%s" % (my.domain, my.login)
web.set_form_value(ResetPasswordWdg.MSG, msg)
示例10: init
def init(my, ticket):
XmlRpcInit(ticket)
# initialize the web environment object and register it
adapter = my.get_adapter()
WebContainer.set_web(adapter)
my.set_templates()
示例11: check
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
示例12: get_display
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
示例13: get_new_tab_wdg
def get_new_tab_wdg(self):
widget = Widget()
span = SpanWdg()
swap = SwapDisplayWdg.get_triangle_wdg()
title = SpanWdg("Tab Creation")
span.add(swap)
span.add(title)
span.add_style("float: left")
widget.add(span)
widget.add(HtmlElement.br() )
# add the tab selector
div = DivWdg()
SwapDisplayWdg.create_swap_title( title, swap, div)
tab_text = TextWdg("tab")
tab_text.set_persistence()
span = SpanWdg(css="med")
span.add("Tab: ")
span.add(tab_text)
div.add(span)
# parent
index_text = TextWdg("parent_tab")
index_text.set_persistence()
span = SpanWdg(css="med")
span.add("Parent Tab: ")
span.add(index_text)
span.add(HintWdg("Enter the name of the tab that this will fall under. Leave empty to put on the main tab") )
div.add(span)
# index
index_text = TextWdg("index")
index_text.set_attr("size", "4")
index_text.set_persistence()
span = SpanWdg(css="med")
span.add("Index: ")
span.add(index_text)
span.add(HintWdg("Enter the numeric location for this tab to be placed") )
div.add(span)
WebContainer.register_cmd("CreateTabCmd")
button = IconSubmitWdg("Create Tab", IconWdg.CREATE, True)
div.add(button)
widget.add(div)
return widget
示例14: get_popup_script
def get_popup_script(msg='', css='', icon='', ref=None, width=70):
''' returns a javascript that will trigger a popup message box in
an iframe '''
if not ref:
url = WebContainer.get_web().get_widget_url()
url.set_option("widget", "MessageWdg")
url.set_option("args", [msg, css, icon])
ref = url.get_url()
# open iframe
iframe = WebContainer.get_iframe()
iframe.set_width(width)
action = iframe.get_on_script(ref)
return action
示例15: _checkin
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]