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

Python chrome.add_stylesheet函数代码示例

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

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



在下文中一共展示了add_stylesheet函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: prepare_for_action

 def prepare_for_action(self, req):
     add_stylesheet(req, 'pmmm/pmmm.css')
     self.is_project_admin = req.perm.has_permission("PROJECT_ADMIN")
     self.is_trac_admin = req.perm.has_permission("TRAC_ADMIN")
     self.is_dep_admin = req.perm.has_permission("DEPARTMENT_ADMIN")
     self.log.debug("User %s is_admin %d" % (req.authname,
                                              self.is_project_admin))
开发者ID:RYTong,项目名称:pmmm,代码行数:7,代码来源:controller.py


示例2: filter_stream

    def filter_stream(self, req, method, filename, stream, data):
        filter_ = []
        if req.path_info.startswith("/ticket"):
            filter_.extend(self._ticket_filter(req, data))
        elif req.path_info.startswith("/timeline"):
            filter_.extend(self._timeline_filter(req, data))
        elif req.path_info.startswith("/browser") or req.path_info.startswith("/changeset"):
            filter_.extend(self._browser_filter(req, data))
        elif req.path_info.startswith("/log"):
            filter_.extend(self._log_filter(req, data))
        elif req.path_info.startswith("/search"):
            filter_.extend(self._search_filter(req, data))
        elif req.path_info.startswith("/report") or req.path_info.startswith("/query"):
            filter_.extend(self._report_filter(req, data))
        elif req.path_info.startswith("/wiki"):
            filter_.extend(self._wiki_filter(req, data))
        elif req.path_info.startswith("/attachment"):
            filter_.extend(self._attachment_filter(req, data))
        
        if 'attachments' in data and data.get('attachments', {}).get('attachments'):
            filter_.extend(self._page_attachments_filter(req, data))

        for f in filter_:
            if f is not None:
                stream |= f

        add_stylesheet(req, 'userpictures/userpictures.css')
        return stream
开发者ID:rjollos,项目名称:trac-UserPicturesPlugin,代码行数:28,代码来源:__init__.py


示例3: post_process_request

 def post_process_request(self, req, template, data, content_type):
     path = req.path_info
     if path.startswith('/ticket/') or path.startswith('/wiki') \
        or path.startswith('/attachment/'):
         add_script(req, EMBED_PATH_FLOWPLAYER['js'])
         add_stylesheet(req, EMBED_PATH_FLOWPLAYER['css'])
     return template, data, content_type
开发者ID:arielnetworks,项目名称:TracMovieMacro,代码行数:7,代码来源:macro.py


示例4: process_request

    def process_request(self, req):
        from tractags.api import TagEngine
        from trac.web.chrome import add_stylesheet

        add_stylesheet(req, 'tags/css/tractags.css')

        pagename = req.args.get('page', 'WikiStart')
        action = req.args.get('action', 'view')

        engine = TagEngine(self.env)
        wikitags = engine.tagspace.wiki
        tags = list(wikitags.get_tags([pagename]))
        tags.sort()

        if action == 'edit':
            req.hdf['tags'] = req.args.get('tags', ', '.join(tags))
        elif action == 'view':
            hdf_tags = []
            for tag in tags:
                href, title = engine.get_tag_link(tag)
                hdf_tags.append({'name': tag,
                                 'href': href,
                                 'title': title})
            req.hdf['tags'] = hdf_tags
        result = WikiModule.process_request(self, req)
        if result is None:
            return None
        if result[0] == 'wiki.cs':
            return 'tagswiki.cs', None
        return result
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:30,代码来源:web_ui.py


示例5: process_admin_request

    def process_admin_request(self, req, cat, page, path_info):
        assert req.perm.has_permission('PROJECT_CREATE')
        if page != 'createproj':
            raise TracError("Invalid page %s" % page)

        # filter out the project-specific arguments and remove the prefix
        prefix = 'createproject.'
        projkeys = filter(lambda x: x.startswith(prefix), req.args.iterkeys())
        args = dict((key[len(prefix):], req.args[key]) for key in projkeys)

        if req.method == 'POST':
            # handle form submission
            (projects_root_url, _) = os.path.split(self.env.project_url)
            (projects_root_path, _) = os.path.split(self.env.path)

            project_url = os.path.join(projects_root_url, args['dir_name'])
            path = os.path.join(projects_root_path, args['dir_name'])

            args.setdefault('url', project_url)
            args.setdefault('path', path)

            new_env = self._do_create_proj(args)
            self._add_global_settings(new_env, args)
            self._delete_unwanted_files(new_env)
            req.redirect(project_url)

        args.setdefault('repos_type', 'svn')

        # store the input arguments back in the form fields so the user
        # can correct errors
        for name, val in args.iteritems():
            req.hdf[prefix + name] = val

        add_stylesheet(req, 'createproj/css/createproj.css')
        return 'createproj.cs', None
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:35,代码来源:api.py


示例6: expand_macro

 def expand_macro(self, formatter, name, args):
     req = formatter.req
     chrome = Chrome(self.env)
     report = ReportModule(self.env)
     
     comma_splitter = re.compile(r'(?<!\\),')
     kwargs = {}
     for arg in comma_splitter.split(args):
         arg = arg.replace(r'\,', ',')
         m = re.match(r'\s*[^=]+=', arg)
         if m:
             kw = arg[:m.end() - 1].strip()
             value = arg[m.end():]
             if re.match(r'^\$[A-Z]*$', value):
                value = req.args.get(value[1:])
             kwargs[kw] = value if value!= None else ''
         else:
             if re.match(r'^\$[A-Z]*$', arg):
                arg = req.args.get(arg[1:])
             id = int(arg)
     
     req.args = kwargs
     req.args['page'] = '1'
     template, data, content_type = report._render_view(req, id)
     add_stylesheet(req, 'common/css/report.css')
     
     fullpath = ''
     if pkg_resources.resource_exists('wikireport', 'WikiReport.html'):
         fullpath = pkg_resources.resource_filename('wikireport', 'WikiReport.html')
     else:
         filepath = os.path.dirname(os.path.abspath( __file__ ))
         fullpath = os.path.join(filepath, 'WikiReport.html')
 
     return chrome.render_template(req, fullpath, data, None, fragment=True)
开发者ID:trac-hacks,项目名称:WikiReportMacro,代码行数:34,代码来源:WikiReport.py


示例7: process_request

    def process_request(self, req):
        # Create request context.
        context = Context.from_request(req)
        context.realm = 'screenshots-core'

        # Template data dictionary.
        req.data = {}

        # Get database access.
        db = self.env.get_db_cnx()
        context.cursor = db.cursor()

        # Prepare data structure.
        req.data['title'] = self.mainnav_title or self.metanav_title
        req.data['has_tags'] = self.env.is_component_enabled(
          'tracscreenshots.tags.ScreenshotsTags')

        # Get action from request and perform them.
        actions = self._get_actions(context)
        self.log.debug('actions: %s' % (actions,))
        template, content_type = self._do_actions(context, actions)

        # Add CSS style and JavaScript scripts.
        add_stylesheet(req, 'screenshots/css/screenshots.css')
        add_script(req, 'screenshots/js/screenshots.js')

        # Return template and its data.
        db.commit()
        return (template + '.html', {'screenshots' : req.data}, content_type)
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:29,代码来源:core.py


示例8: filter_stream

    def filter_stream(self, req, method, filename, stream, data):
        crumbs = self._get_crumbs(req.session)
        if not crumbs:
            return stream
            
        add_stylesheet(req, 'breadcrumbs/css/breadcrumbs.css')
        li = []

        href = req.href(req.base_path)
        
        for crumb in crumbs:
            realm, resource = crumb.split('/', 1)
            name = resource.replace('_', ' ')

            if realm == "ticket":
                name = "#" + resource
            elif realm != "wiki":
                name = "%s:%s" % (realm, name)

            link = req.href(realm, resource)
            
            li.append(
                tag.li(
                    tag.a(title=name, href=link,
                    )(name)
                )
            )
            
        insert = tag.ul(class_="nav", id="breadcrumbs")(("Breadcrumbs:"), li)

        return stream | Transformer('//div[@id="metanav"]/ul').after(insert)
        
开发者ID:chrishildebrandt,项目名称:breadcrumbsnavplugin,代码行数:31,代码来源:breadcrumbs.py


示例9: post_process_request

 def post_process_request(self, req, template, data, content_type):
     if req.path_info.startswith('/ticket/') or \
        req.path_info.startswith('/newticket'):
         add_script(req, 'keywordsuggest/jquery.bgiframe.min.js')
         add_script(req, 'keywordsuggest/jquery.autocomplete.pack.js')
         add_stylesheet(req, 'keywordsuggest/autocomplete.css')
     return template, data, content_type
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:7,代码来源:keywordsuggest.py


示例10: expand_macro

    def expand_macro(self, formatter, name, content):
        req = formatter.req
        stats_provider, kwargs, is_preview_with_self = self._parse_macro_content(content, req)

        if is_preview_with_self:
            # previewing newticket, without a number but with a reference
            # to current ticket number; show a helpful message
            return tag.div('Progress meter will be inserted here in final ticket')

        # Create & execute the query string
        qstr = '&'.join(['%s=%s' % item
                               for item in kwargs.iteritems()])
        query = Query.from_string(self.env, qstr, max=0)
        try:
            constraints = query.constraints[0]
        except IndexError:
            constraints = query.constraints

        # Calculate stats
        qres = query.execute(req)
        tickets = apply_ticket_permissions(self.env, req, qres)

        stats = get_ticket_stats(stats_provider, tickets)
        stats_data = query_stats_data(req, stats, constraints)

        # ... and finally display them
        add_stylesheet(req, 'common/css/roadmap.css')
        chrome = Chrome(self.env)
        return chrome.render_template(req, 'progressmeter.html', stats_data,
                                      fragment=True)
开发者ID:silk,项目名称:trac-progressmetermacro,代码行数:30,代码来源:macro.py


示例11: render_admin_panel

    def render_admin_panel(self, req, cat, page, path_info):
        if req.method == 'POST':
            self.config.set('theme', 'theme', req.args['theme'].lower())
            self.config.save()
            
            req.redirect(req.href.admin(cat, page)) 
        
        data = {
            'themeengine': {
                'info': self.system.info.items(),
            },
        }

        theme_name = self.system.theme and self.system.theme['name'] or 'default'
        theme_name = theme_name.islower() and theme_name.title() or theme_name
        data['themeengine']['current'] = theme_name
        index = 0
        curtheme = None
        for i, (k, v) in enumerate(data['themeengine']['info']):
            if k.lower() == theme_name.lower():
                index = i
                curtheme = v
                break
        data['themeengine']['current_index'] = index
        data['themeengine']['current_theme'] = curtheme
            
        #add_stylesheet(req, 'themeengine/jquery.jcarousel.css')
        #add_stylesheet(req, 'themeengine/skins/tango/skin.css')
        #add_script(req, 'themeengine/jquery.jcarousel.pack.js')
        add_stylesheet(req, 'themeengine/admin.css')
        add_script(req, 'themeengine/jcarousellite_1.0.1.js')
        return 'admin_theme.html', data
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:32,代码来源:admin.py


示例12: match_request

	def match_request(self, req):
		"""
			Never Match a request but always load the css, trac seems
			to do some caching, so this only happens once per session?
		"""
		add_stylesheet(req, 'shellexampleHdocs/css/shellexample.css')
		return False;
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:7,代码来源:module.py


示例13: process_admin_request

    def process_admin_request(self, req, cat, page, path_info):
        assert req.perm.has_permission('BLOG_ADMIN')

        add_stylesheet(req, 'blog/css/blog.css')
        add_stylesheet(req, 'common/css/wiki.css')

        req.hdf['blogadmin.page'] = page

        admin_fields = {
                        'date_format'    : '%x %X',
                        'page_format'    : '%Y/%m/%d/%H.%M',
                        'default_tag'    : 'blog', 
                        'post_size'      : 1024,
                        'history_days'   : 30,
                        'new_blog_link'  : 'New Blog Post',
                        'first_week_day' : 'SUNDAY',
                        'mark_updated'   : 'true',
                        'nav_link'       : 'Blog',
                        'nav_bar'        : 'true',
                        'macro_blacklist': '',
                        'rss'            : 'true',
                       }
        if req.method == 'POST':
            if page == 'defaults':
                for field in admin_fields.keys():
                    self._set_field_value(req, field)
                self.env.config.save()
        for field, default in admin_fields.items():
            self._get_field_value(req, field, default)
        req.hdf['blogadmin.docs'] = wiki_to_html(self._get_docs(page),
                                                 self.env, req)
        return 'blog_admin.cs', None
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:32,代码来源:admin.py


示例14: post_process_request

    def post_process_request(self, req, template, data, content_type):
        """Do any post-processing the request might need; typically adding
        values to the template `data` dictionary, or changing template or
        mime type.
        
        `data` may be update in place.

        Always returns a tuple of (template, data, content_type), even if
        unchanged.

        Note that `template`, `data`, `content_type` will be `None` if:
         - called when processing an error page
         - the default request handler did not return any result

        (Since 0.11)
        """
        if template == 'ticket.html':
            add_stylesheet(req, '%s/css/autocomplete.css' % self.prefix)
            add_script(req, '%s/js/autocomplete.js' % self.prefix)
            if req.path_info.rstrip() == '/newticket':
                add_script_data(req, {'KEYWORDS_AC_PATH': 'ac-keywords'})
            else:
                add_script_data(req, {'KEYWORDS_AC_PATH': '../ac-keywords'})
            add_script(req, '%s/js/autocomplete_ticket_keywords.js' % self.prefix)
        return (template, data, content_type)
开发者ID:trac-hacks,项目名称:trac-autocompletekeywords,代码行数:25,代码来源:extendticketpage.py


示例15: process_request

    def process_request(self, req):
        req.perm.require(self.BILLING_PERMISSION)
        messages = []

        def addMessage(s):
            messages.extend([s]);

        if req.method == 'POST':
            if req.args.has_key('setbillingtime'):
                self.set_bill_date(req.authname)
                addMessage("All tickets last bill date updated")

        mgr = CustomReportManager(self.env, self.log)
        data = {};
        data["statuses"] = get_statuses(self)
        data["reports"] = mgr.get_reports_by_group(CustomReportManager.TimingAndEstimationKey);
        #self.log.debug("DEBUG got %s, %s" % (data["reports"], type(data["reports"])));
        data["billing_info"] = {"messages":         messages,
                                "href":             req.href.Billing(),
                                "report_base_href": req.href.report(),
                                "usermanual_href":  req.href.wiki(user_manual_wiki_title),
                                "usermanual_title": user_manual_title }

        self.set_request_billing_dates(data)

        add_stylesheet(req, "Billing/billingplugin.css")
        add_script(req, "Billing/date.js")
        add_script(req, "Billing/linkifyer.js")
        return 'billing.html', data, None
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:29,代码来源:webui.py


示例16: render_admin_panel

    def render_admin_panel( self, req, cat, page, path_info):
        # here comes the page content, handling, etc.
        try:
          logfile = self.api.get_logfile_name()
          if not logfile:
            self.env.log.debug('No log file configured.')
            self.data['err'].append('There is no log file configured for this environment.')
        except IOError:
          self.env.log.debug('Got IOError - configured log file does not exist!')
          self.data['err'].append('The configured log file does not exist.')

        self.data = {}
        self.data['err'] = []
        self.data['msg'] = []
        self.data['log'] = []
        data = {}

        # OK to process?
        if logfile and req.method=="POST":
          self._do_process(req, logfile)

        # append the messages
        data['us_message'] = self.data['msg']
        data['us_error']   = self.data['err']
        data['us_log']     = self.data['log']

        # adding stylesheets
        add_stylesheet(req, 'logviewer/css/logviewer.css')

        return 'logviewer.html', data
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:30,代码来源:web_ui.py


示例17: list_users

    def list_users(self, req):
        """
        Handle user listing
        """
        req.perm.require('USER_AUTHOR')

        data = {}
        userstore = get_userstore()

        # State
        data['states'] = userstore.USER_STATUS_LABELS

        # Available backend organizations
        # TODO: Add support for listing users based on organization in user REST API
        orgman = self.env[OrganizationManager]
        data['organizations'] = [org for org in orgman.get_organizations() if org['type'] == 'backend']

        # Add jquery ui for autocomplete
        add_script(req, 'multiproject/js/jquery-ui.js')
        add_script(req, 'multiproject/js/transparency.js')
        add_script(req, 'multiproject/js/multiproject.js')
        add_script(req, 'multiproject/js/admin_user_list.js')
        add_stylesheet(req, 'multiproject/css/jquery-ui.css')

        return 'admin_user_list.html', data
开发者ID:juhamust,项目名称:multiproject,代码行数:25,代码来源:users.py


示例18: _do_login

 def _do_login(self, req):
     # check the referer
     referer = req.get_header('Referer')
     if referer and not (referer == req.base_url or referer.startswith(req.base_url.rstrip('/')+'/')):
         # only redirect to referer if it is from the same site
         referer = None
     if referer:
        req.session['oid.referer'] = referer
     if self.default_openid:
        req.args['openid_identifier'] = self.default_openid
        return self._do_verify(req)
     add_stylesheet(req, 'authopenid/css/openid.css')
     add_script(req, 'authopenid/js/openid-jquery.js')
     return 'openidlogin.html', {
         'images': req.href.chrome('authopenid/images') + '/',
         'action': req.href.openidverify(),
         'message': 'Login using OpenID.',
         'signup': self.signup_link,
         'whatis': self.whatis_link,
         'css_class': 'error',
         'providers_regexp': self.providers_regexp,
         'custom_provider_name': self.custom_provider_name,
         'custom_provider_label': self.custom_provider_label,
         'custom_provider_url': self.custom_provider_url,
         'custom_provider_image': self.custom_provider_image,
         'custom_provider_size': self.custom_provider_size,
         }, None
开发者ID:edgimar,项目名称:authopenid-plugin,代码行数:27,代码来源:authopenid.py


示例19: post_process_request

    def post_process_request(self, req, template, data, content_type):
        if data is None:
            return

        js_data = {
            'comments_rest_url': req.href(CommentsREST.href),
            'formatting_help_url': req.href.wiki('WikiFormatting'),
            'delete_url': req.href(DeleteCommentForm.href),
            'preview_url': req.href(WikiPreview.href),
            'templates': self.templates_js_data(),
            'active_comment_id': req.args.get('codecomment'),
            'username': req.authname,
            'is_admin': 'TRAC_ADMIN' in req.perm,
        }

        original_return_value = template, data, content_type
        if req.path_info.startswith('/changeset/'):
            js_data.update(self.changeset_js_data(req, data))
        elif req.path_info.startswith('/browser'):
            js_data.update(self.browser_js_data(req, data))
        elif re.match(r'/attachment/ticket/\d+/.*', req.path_info):
            js_data.update(self.attachment_js_data(req, data))
        else:
            return original_return_value

        add_script(req, 'code-comments/json2.js')
        add_script(req, 'code-comments/underscore-min.js')
        add_script(req, 'code-comments/backbone-min.js')
        # jQuery UI includes: UI Core, Interactions, Button & Dialog Widgets, Core Effects, custom theme
        add_script(req, 'code-comments/jquery-ui/jquery-ui.js')
        add_stylesheet(req, 'code-comments/jquery-ui/trac-theme.css')
        add_script(req, 'code-comments/jquery.ba-throttle-debounce.min.js')
        add_script(req, 'code-comments/code-comments.js')
        add_script_data(req, {'CodeComments': js_data})
        return original_return_value
开发者ID:highcat,项目名称:trac-code-comments-plugin,代码行数:35,代码来源:web.py


示例20: process_request

 def process_request(self, req):
     if not req.perm.has_permission('PROJECT_MANAGER'):
         raise TracError('Need PROJECT_MANAGER permission')
     pages, providers = self._get_pages(req)
     if not pages:
         raise TracError('No projmanager pages available')
     cat_id = req.args.get('cat_id') or pages[0][0]
     page_id = req.args.get('page_id')
     path_info = req.args.get('path_info')
     if not page_id:
         page_id = filter(lambda page: page[0] == cat_id, pages)[0][2]
     
     provider = providers.get((cat_id, page_id), None)
     if not provider:
         raise TracError('Unknown Proj Manager Page')
     
     # Do the action
     template, content_type = provider.process_projmanager_request(req, cat_id,
                                                             page_id,
                                                             path_info)
     # Get the list of pages
     req.hdf['projmanager.pages'] = [{'cat_id': page[0],
                                'cat_label': page[1],
                                'page_id': page[2],
                                'page_label': page[3],
                                'href': self.env.href.projmanager(page[0], page[2])
                                } for page in pages]
     req.hdf['projmanager.active_cat'] = cat_id
     req.hdf['projmanager.active_page'] = page_id
     req.hdf['projmanager.page_template'] = template
     add_stylesheet(req, 'projmanager/css/projmanager.css')
     return 'projmanager.cs', content_type
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:32,代码来源:web_ui.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python chrome.add_warning函数代码示例发布时间:2022-05-27
下一篇:
Python chrome.add_script_data函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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