View Single Post
Old 07-05-2022, 11:45 AM   #34
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,809
Karma: 6000000
Join Date: Nov 2009
Device: many
Sigil master now has my first shot at adapting BeckEbook's approach to allow cycling through custom css stylesheets for Preview.

A few notes, the actual implementation had to be changed slightly:

1. Because file access and especially QFileInfo is painfully slow and because Preview needs to reload automatically many many times (so loading speed is very important), the building of the alternative custom urls is done in MainWindow once when Sigil is first opened.

So if you manually create a

"custom_preview_style.css"

or

"custom_preview_style_alt.css";

file after Sigil is open (ie behind Sigil's back so to speak) you will have to open a new MainWindow in order to activate the new css file in Preview.

2. Right now if there are no custom css style files, the icon is greyed out (that action is not enabled) but visually I can not see that in my testing so we probably need to handle that in a different way so when it is disabled it is more visually detectable.

3. The second css file name is based on _alt_ and not _invert_ as technically it can be used for other purposes.

So please everyone thank BeckyEbook for her ingenious approach for implementing this requested feature and her wonderful svg icons!

Feedback and ideas for improvements especially on when the button is disabled welcome. We may need to either remove the button completely or change its icon is a more visible way when no custom css stylesheets are available.
KevinH is offline   Reply With Quote