lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: frescobaldi themes


From: Jean Abou Samra
Subject: Re: frescobaldi themes
Date: Sun, 30 Apr 2023 22:52:51 +0200
User-agent: Evolution 3.48.1 (3.48.1-1.fc38)

Le dimanche 30 avril 2023 à 18:30 +0200, Valentin Petzel a écrit :

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.

If that config file is messed up, all your Frescobaldi preferences are lost, including custom snippets, LilyPond versions, yada, yada. I don't think this is really a problem; after all, the config file is read and written by QSettings, Qt's built-in tool for storing app settings, which has all the battle-testedness behind Qt.

(You're not supposed to edit the file by hand.)

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.

That sounds like a simple and useful change, could you submit a PR for it?

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]