Dynamic Web Report Themes

I can’t seem to install the Mainz theme in Dynamic Web Reports, what am I missing? The theme is selected and report generated but no Mainz theme.

Eventually I’d like to create my own theme, but I’m unable to find much documentation on Dynamic Web Report themes or custom pages, I’m not fluent in python. :joy:
https://gramps-project.org/wiki/index.php/DynamicWeb_report

I found Mainz stylesheets:
data/css/Web_Mainz.css
data/css/swanky-purse/jquery-ui-1.7.3.custom.css

And some Mainz plugin Folders:
gramps/plugins/webstuff/webstuff.py
gramps/plugins/webreport/webcal.py
gramps/plugins/webreport/basepage.py
gramps/plugins/webreport/narrativeweb.py

I’m guessing I must hack all these to add a new theme or is there an easier way?

AIO64-5.1.4-1 / Win10

The style sheets are provided for the narrativeweb. You may have problems with the dynamic web report because the html structures are different between these two reports.

For the narrativeweb, you can copy the css in ~/.gramps/css/ (you must create that directory)
ie: cp data/css/Web_Mainz.css ~/.gramps/css/My_NewCSS.css
For the Web_Mainz css, you need to copy the png files or add your own png files.

For the dynamic web (DWR), you can’t do that.
If you want to have your own css for the DWR, you need to look at in gramps/plugins/webreport/basepage.py:

    # create all alternate stylesheets
    # Cannot use it on local files (file://)
    for css_f in CSS:
        already_done = []
        for css_fn in ("UsEr_", "Basic", "Mainz", "Nebraska"):
            if css_fn in css_f and css_f not in already_done:
                css_f = css_f.replace("UsEr_", "")
                already_done.append(css_f)
                if self.usecms:
                    fname = "/".join(["css", css_f + ".css"])
                elif self.the_lang:
                    fname = "/".join(([".."]*sub_cal + ["css",
                                                        css_f + ".css"]))
                elif cal > 0:
                    fname = "/".join(([".."]*cal + ["css",
                                                    css_f + ".css"]))
                else:
                    fname = "/".join(["css", css_f + ".css"])
                urlx = self.report.build_url_fname(fname, None,
                                                   self.uplink)
                links += Html("link", rel="alternate stylesheet",
                              title=self._(css_f), indent=False,
                              media="screen", type="text/css",
                              href=urlx)

and in gramps/plugins/webstuff/webstuff.py:

# If we add css user files, we must restart gramps to use them.
if os.path.exists(USER_CSS):
    list_files = os.listdir(USER_CSS)
    for cssfile in list_files:
        if cssfile.endswith(".css"):
            css_f = cssfile.replace('.css', '')
            CSS_FILES.append(["UsEr_" + css_f, 1, css_f,
                              os.path.join(USER_CSS, cssfile), None,
                              looking_for_urls_in_user_css(cssfile),
                              []])

Hope it can help.

1 Like

The css files for the dynamicweb are provided with the plugin and therefore different than the narrativeweb.
The css for the Mainz style is in templates/dwr_mainz/data/
For the other possible css, the directory is templates/dwr_default/data/

In the dynamicweb.py source file, we can see:
CSS style sheets build:
The CSS files are built from *.less files.
This is inspired from the Bootstrap CSS files build.

1 Like

Ah yes thanks, that makes more sense. I’m familiar with Bootstrap, I should be able to put something together now.

But I can’t seem to switch to the Mainz theme in Dynamicweb. I have selected the dropdown but Dynamicweb only generates the default theme…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.