• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python web.WebContainer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyasm.web.WebContainer的典型用法代码示例。如果您正苦于以下问题:Python WebContainer类的具体用法?Python WebContainer怎么用?Python WebContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了WebContainer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
开发者ID:mincau,项目名称:TACTIC,代码行数:28,代码来源:app_init_wdg.py


示例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
开发者ID:0-T-0,项目名称:TACTIC,代码行数:32,代码来源:prod_table_element_wdg.py


示例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
开发者ID:mincau,项目名称:TACTIC,代码行数:7,代码来源:load_options_wdg.py


示例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
开发者ID:0-T-0,项目名称:TACTIC,代码行数:30,代码来源:app_init_wdg.py


示例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')
开发者ID:mincau,项目名称:TACTIC,代码行数:28,代码来源:admin_tab_wdg.py


示例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
开发者ID:hellios78,项目名称:TACTIC,代码行数:7,代码来源:load_options_wdg.py


示例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)
开发者ID:mincau,项目名称:TACTIC,代码行数:31,代码来源:applet.py


示例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() )
开发者ID:0-T-0,项目名称:TACTIC,代码行数:26,代码来源:maya_tab_wdg.py


示例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)
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:59,代码来源:reset_password_wdg.py


示例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()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:9,代码来源:base_xmlrpc.py


示例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
开发者ID:0-T-0,项目名称:TACTIC,代码行数:11,代码来源:sobject_group_wdg.py


示例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
开发者ID:mincau,项目名称:TACTIC,代码行数:53,代码来源:clipboard_wdg.py


示例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
开发者ID:mincau,项目名称:TACTIC,代码行数:50,代码来源:custom_view_app_wdg.py


示例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    
开发者ID:0-T-0,项目名称:TACTIC,代码行数:15,代码来源:shadowbox_wdg.py


示例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]
开发者ID:0-T-0,项目名称:TACTIC,代码行数:48,代码来源:prod_checkin_cbk.py


示例16: execute

    def execute(my):

        from pyasm.web import WebContainer
        web = WebContainer.get_web()

        # If the tag <force_lowercase_login> is set to "true"
        # in the TACTIC config file,
        # then force the login string argument to be lowercase.
        # This tag is false by default.
        my.login = web.get_form_value("login")
        if Config.get_value("security","force_lowercase_login") == "true":
            my.login = my.login.lower()
        my.password = web.get_form_value("password")
        my.domain = web.get_form_value("domain")

        if my.login == "" and my.password == "":
            return False

        
        if my.login == "" or  my.password == "":
            web.set_form_value(WebLoginWdg.LOGIN_MSG, \
                "Empty username or password") 
            return False
        
        security = WebContainer.get_security()

        # handle windows domains
        #if my.domain:
        #    my.login = "%s\\%s" % (my.domain, my.login)

        verify_password = web.get_form_value("verify_password")
        if verify_password:
            if verify_password != my.password:
                web.set_form_value(WebLoginWdg.LOGIN_MSG, \
                    "Passwords do not match.") 
                return False

            my.password = Login.get_default_password()

        try:
            security.login_user(my.login, my.password, domain=my.domain)
        except SecurityException, e:
            msg = str(e)
            if not msg:
                msg = "Incorrect username or password"

            from pyasm.widget import WebLoginWdg
            web.set_form_value(WebLoginWdg.LOGIN_MSG, msg)
开发者ID:talha81,项目名称:TACTIC-DEV,代码行数:48,代码来源:web_login_cmd.py


示例17: execute

    def execute(my):

        # make sure tmp config is unset.
        Config.unset_tmp_config()
        Config.reload_config()

        web = WebContainer.get_web()

        vendor = web.get_form_value("database/vendor")


        if vendor == 'Sqlite':
            db_dir = web.get_form_value("database/sqlite_db_dir")
            database = "sthpw"
            db_path = "%s/%s.db" % (db_dir, database)
            if os.path.exists(db_path):
                return

        elif vendor == 'PostgreSQL':
            my.test_postgres(vendor)
            return

        elif vendor in ['MySQL','SQLServer','Oracle']:
            my.test_postgres(vendor)
            return

        my.info['error'] = "Cannot connect to database"
开发者ID:blezek,项目名称:TACTIC,代码行数:27,代码来源:db_config_wdg.py


示例18: _add_icon

    def _add_icon(my):
        # icon is optional
        if not my.icon_path:
            return
        
        if not my.icon_path.startswith("/"):
            # icon_path = "/context/icons/oo/%s" % my.icon_path
            icon_path = "/context/icons/silk/%s" % my.icon_path
        else:
            icon_path = my.icon_path

        icon = HtmlElement.img(icon_path)
        icon.set_attr("title", my.name)
        icon.add_styles(my.icon_styles)   
        if my.long:
            img_id = my.generate_unique_id(my.name)
            icon.add_class("icon_out") 
            my.add_event("onmouseover","wdg_opacity('%s','over');" % (img_id))
            my.add_event("onmouseout","wdg_opacity('%s','out');" % (img_id))
            icon.set_id(img_id)
        else:
            icon.add_class("simple_button")


        if WebContainer.get_web().is_IE():
            icon.add_style("vertical-align: top")
        else:
            icon.add_style("vertical-align: middle")
       
        my.add(icon)
开发者ID:blezek,项目名称:TACTIC,代码行数:30,代码来源:icon_wdg.py


示例19: get_value

    def get_value(self, name):
        web = WebContainer.get_web()
        value = web.get_form_value(name)
        if not value:
            value = self.kwargs.get(name)

        return value
开发者ID:mincau,项目名称:TACTIC,代码行数:7,代码来源:ingestion_wdg.py


示例20: execute

    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()
开发者ID:blezek,项目名称:TACTIC,代码行数:32,代码来源:view_manager_wdg.py



注:本文中的pyasm.web.WebContainer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python web.Widget类代码示例发布时间:2022-05-25
下一篇:
Python web.Table类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap