Hello Gianmaria,

I’ve looked into how Frescobaldi handles color schemes, and sadly this is done 
in a
rather unpleasant way. Frescobaldi will basically inseart the config for each 
scheme
into its main config file under

[fontscolors]

starting with a key which is either default or user1, user2, ... Under

[editor_schemes]

you then get a names map like

user1=#Zenburn

This is of course much less convenient than having themes in a themes folder
which you can simply copy your themes into, and it also means your themes are
tied to that config file. If that config messes up this also includes all 
schemes.

I suppose the easiest way to be able to install multiple files would be to 
slightly
tweak Frescobaldi’s code (which can easily be done on a distributed copy as it 
is python).
For this find the location of of the frescobaldi_app module and open 
widgets/schemeselector.py.
Here you should find at around line 164 the function definition

    def slotImport(self):
        filetypes = "{0} (*.xml);;{1} (*)".format(_("XML Files"), _("All 
Files"))
        caption = app.caption(_("dialog title", "Import color theme"))
        filename = QFileDialog.getOpenFileName(self, caption, QDir.homePath(), 
filetypes)[0]
        if filename:
            self.parent().import_(filename)

This will open a file selector and load the selected config by name. Simply 
change
QFileDialog.getOpenFileName to QFileDialog.getOpenFileNames to allow multiple 
selection
and then iterate over the result to load multiple files, so change this code to 
something like

    def slotImport(self):
        filetypes = "{0} (*.xml);;{1} (*)".format(_("XML Files"), _("All 
Files"))
        caption = app.caption(_("dialog title", "Import color theme"))
        filenames = QFileDialog.getOpenFileNames(self, caption, 
QDir.homePath(), filetypes)[0]
        for filename in filenames:
            if filename:
                self.parent().import_(filename)

With this change you’ll be able to import multiple themes in one go.

Cheers,
Valentin

Am Freitag, 28. April 2023, 09:40:57 CEST schrieb Gianmaria Lari:
> Hope this is not off topic. Is there any way in Frescobaldi to install a
> bunch of themes all at once (instead of passing trough Edit -> Preferences
> -> Fonts & Colors etc.) ?
> 
> Thanks,
> Gianmaria

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to