コード例 #1
0
ファイル: opencollab.py プロジェクト: execgit/graphingwiki
    def __init__(self, request):
        ThemeParent.__init__(self, request)
        sheetsnames = ['stylesheets', 'stylesheets_print', 'stylesheets_projection']

        # include css and icon files from this theme when in inherited theme
        if self.name is not NAME:
            for sheetsname in sheetsnames:
                theme_sheets = getattr(self, sheetsname)
                parent_sheets = []
                for sheet in theme_sheets:
                    link = (sheet[0], THEME_PATH + "/css/" + sheet[1])
                    parent_sheets.append(link)

                # remove css files that are not defined in css_files of the inherited theme
                theme_sheets = [sheet for sheet in theme_sheets if sheet[1] in self.css_files]
                setattr(self, sheetsname, tuple(parent_sheets + theme_sheets))

            for key, val in self.icons.items():
                val = list(val)
                val[1] = THEME_PATH + "/img/" + val[1]
                self.icons[key] = tuple(val)

        # bootstrap css file should be before themes
        for sheet in reversed(BOOTSTRAP_THEME_CSS):
            link = (sheet[0], "../../bootstrap/css/" + sheet[1])
            self.stylesheets = (link,) + self.stylesheets

        actions = get_available_actions(request.cfg,
                                        request.page,
                                        request.user)

        excluded = self.EXCLUDED_ACTIONS + getattr(request.cfg, 'actions_excluded', [])
        included = getattr(request.cfg, 'actions_included', [])
        self.available_actions = [action for action in actions
                                  if action in included or action not in excluded]
コード例 #2
0
ファイル: modernized_mobile.py プロジェクト: happytk/moin
    def __init__(self, request):
        ThemeBase.__init__(self, request)

        import re
        self.is_mobile = re.search(r"android.+mobile|iphone|ipod", request.http_user_agent, re.I|re.M) is not None