Example #1
0
    def compile_css_for_picker(css_form_dict):
        # Check css values
        for key in css_form_dict.keys():
            if ";" in css_form_dict[key] or "}" in css_form_dict[key]:
                css_form_dict[key] = ""

        css_text = ""
        if "projecttitlefont" in css_form_dict and css_form_dict["projecttitlefont"] != "":
            css_text += "/*projecttitlefont*/.project_title{font-family:%s;}\n" % (css_form_dict["projecttitlefont"])

        if "projecttitlecolor" in css_form_dict and css_form_dict["projecttitlecolor"] != "":
            css_text += "/*projecttitlecolor*/.project_title{color:%s;}\n" % (css_form_dict["projecttitlecolor"])

        if "barontop" in css_form_dict and css_form_dict["barontop"] != "":
            css_text += "/*barontop*/.pad h2.colored {background-color:%(bgcolor)s; background-image: none;}\n" % {
                "bgcolor": css_form_dict["barontop"]
            }

        if "titlebarbackground" in css_form_dict and css_form_dict["titlebarbackground"] != "":
            css_text += (
                "/*titlebarbackground*/.pad h2.title{background-color:%(bgcolor)s; background-image: none;}\n"
                % {"bgcolor": css_form_dict["titlebarbackground"]}
            )

        if "titlebarcolor" in css_form_dict and css_form_dict["titlebarcolor"] != "":
            icon_theme = ""
            if "addopt-icon-theme" in css_form_dict:
                if css_form_dict["addopt-icon-theme"] == "dark":
                    icon_theme = ".pad h2.dark small b.ico {background-image: url('%s%s');}" % (
                        g.theme_href(""),
                        "images/neo-icon-set-ffffff-256x350.png",
                    )
                elif css_form_dict["addopt-icon-theme"] == "white":
                    icon_theme = ".pad h2.dark small b.ico {background-image: url('%s%s');}" % (
                        g.theme_href(""),
                        "images/neo-icon-set-454545-256x350.png",
                    )

            css_text += "/*titlebarcolor*/.pad h2.title, .pad h2.title small a {color:%s;} %s\n" % (
                css_form_dict["titlebarcolor"],
                icon_theme,
            )

        return css_text
    def compile_css_for_picker(css_form_dict):
        # Check css values
        for key in css_form_dict.keys():
            if ';' in css_form_dict[key] or '}' in css_form_dict[key]:
                css_form_dict[key] = ''

        css_text = ""
        if 'projecttitlefont' in css_form_dict and css_form_dict[
                'projecttitlefont'] != '':
            css_text += "/*projecttitlefont*/.project_title{font-family:%s;}\n" % (
                css_form_dict['projecttitlefont'])

        if 'projecttitlecolor' in css_form_dict and css_form_dict[
                'projecttitlecolor'] != '':
            css_text += "/*projecttitlecolor*/.project_title{color:%s;}\n" % (
                css_form_dict['projecttitlecolor'])

        if 'barontop' in css_form_dict and css_form_dict['barontop'] != '':
            css_text += "/*barontop*/.pad h2.colored {background-color:%(bgcolor)s; background-image: none;}\n" % \
                        {'bgcolor': css_form_dict['barontop']}

        if 'titlebarbackground' in css_form_dict and css_form_dict[
                'titlebarbackground'] != '':
            css_text += "/*titlebarbackground*/.pad h2.title{background-color:%(bgcolor)s; background-image: none;}\n" % \
                        {'bgcolor': css_form_dict['titlebarbackground']}

        if 'titlebarcolor' in css_form_dict and css_form_dict[
                'titlebarcolor'] != '':
            icon_theme = ''
            if 'addopt-icon-theme' in css_form_dict:
                if css_form_dict['addopt-icon-theme'] == "dark":
                    icon_theme = ".pad h2.dark small b.ico {background-image: url('%s%s');}" % (
                        g.theme_href(''),
                        'images/neo-icon-set-ffffff-256x350.png')
                elif css_form_dict['addopt-icon-theme'] == "white":
                    icon_theme = ".pad h2.dark small b.ico {background-image: url('%s%s');}" % (
                        g.theme_href(''),
                        'images/neo-icon-set-454545-256x350.png')

            css_text += "/*titlebarcolor*/.pad h2.title, .pad h2.title small a {color:%s;} %s\n" % (
                css_form_dict['titlebarcolor'], icon_theme)

        return css_text
Example #3
0
    def icon_url(self, size):
        '''Subclasses (tools) provide their own icons (preferred) or in
        extraordinary circumstances override this routine to provide
        the URL to an icon of the requested size specific to that tool.

        Application.icons is simply a default if no more specific icon
        is available.
        '''
        resource = self.icons.get(size)
        if resource:
            return g.theme_href(resource)
        return ''
Example #4
0
    def icon_url(self, size):
        '''Subclasses (tools) provide their own icons (preferred) or in
        extraordinary circumstances override this routine to provide
        the URL to an icon of the requested size specific to that tool.

        Application.icons is simply a default if no more specific icon
        is available.
        '''
        resource = self.icons.get(size)
        if resource:
            return g.theme_href(resource)
        return ''
Example #5
0
    def icon_url(self, size):
        """Return URL for icon of the given ``size``.

        Subclasses can define their own icons by overriding
        :attr:`icons` or by overriding this method (which, by default,
        returns the URLs defined in :attr:`icons`).

        """
        resource = self.icons.get(size)
        if resource:
            return g.theme_href(resource)
        return ''
Example #6
0
    def icon_url(cls, size):
        """Return URL for icon of the given ``size``.

        Subclasses can define their own icons by overriding
        :attr:`icons`.

        """
        resource, url = cls.icons.get(size), ""
        if resource:
            resource_path = os.path.join("nf", resource)
            url = g.forge_static(resource) if cls.has_resource(resource_path) else g.theme_href(resource)
        return url
Example #7
0
    def icon_url(cls, size):
        """Return URL for icon of the given ``size``.

        Subclasses can define their own icons by overriding
        :attr:`icons`.

        """
        resource, url = cls.icons.get(size), ''
        if resource:
            resource_path = os.path.join('nf', resource)
            url = (g.forge_static(resource) if cls.has_resource(resource_path)
                   else g.theme_href(resource))
        return url
    def compile_css_for_picker(css_form_dict):
        # Check css values
        for key in css_form_dict.keys():
            if ';' in css_form_dict[key] or '}' in css_form_dict[key]:
                css_form_dict[key] = ''

        css_text = ""
        if 'projecttitlefont' in css_form_dict and css_form_dict['projecttitlefont'] != '':
            css_text += "/*projecttitlefont*/.project_title{font-family:%s;}\n" % (
                css_form_dict['projecttitlefont'])

        if 'projecttitlecolor' in css_form_dict and css_form_dict['projecttitlecolor'] != '':
            css_text += "/*projecttitlecolor*/.project_title{color:%s;}\n" % (
                css_form_dict['projecttitlecolor'])

        if 'barontop' in css_form_dict and css_form_dict['barontop'] != '':
            css_text += "/*barontop*/.pad h2.colored {background-color:%(bgcolor)s; background-image: none;}\n" % \
                        {'bgcolor': css_form_dict['barontop']}

        if 'titlebarbackground' in css_form_dict and css_form_dict['titlebarbackground'] != '':
            css_text += "/*titlebarbackground*/.pad h2.title{background-color:%(bgcolor)s; background-image: none;}\n" % \
                        {'bgcolor': css_form_dict['titlebarbackground']}

        if 'titlebarcolor' in css_form_dict and css_form_dict['titlebarcolor'] != '':
            icon_theme = ''
            if 'addopt-icon-theme' in css_form_dict:
                if css_form_dict['addopt-icon-theme'] == "dark":
                    icon_theme = ".pad h2.dark small b.ico {background-image: url('%s%s');}" % (
                                 g.theme_href(''),
                        'images/neo-icon-set-ffffff-256x350.png')
                elif css_form_dict['addopt-icon-theme'] == "white":
                    icon_theme = ".pad h2.dark small b.ico {background-image: url('%s%s');}" % (
                                 g.theme_href(''),
                        'images/neo-icon-set-454545-256x350.png')

            css_text += "/*titlebarcolor*/.pad h2.title, .pad h2.title small a {color:%s;} %s\n" % (
                css_form_dict['titlebarcolor'], icon_theme)

        return css_text
Example #9
0
 def app_icon_url(self, app, size):
     """returns the default icon for the given app (or non-app thing like 'subproject').
         Takes an instance of class Application, or else a string.
         Expected to be overriden by derived Themes.
     """
     if isinstance(app, unicode):
         app = str(app)
     if isinstance(app, str):
         if app in self.icons and size in self.icons[app]:
             return g.theme_href(self.icons[app][size])
         else:
             return g.entry_points['tool'][app].icon_url(size)
     else:
         return app.icon_url(size)