Pavion / tvstreamrecord

Timed TV stream recording for Python
GNU General Public License v3.0
45 stars 10 forks source link

Default theme (smoothness) configuration setting fix #61

Open cjaone opened 1 year ago

cjaone commented 1 year ago

After first start the configuration parameter "Interface theme" is empty in the GUI, i.e. it is not "smoothness":

TSR_empty_theme

If you just change the recording path configuration (or nothing at all) and press "Submit changes" the current theme suddenly is lost. Example screenshot shows the channels page:

TSR_no_theme

Root cause for this is wrong default setting of the theme in config.py and tvstreamrecord.py.

(Please note that in the 2 files there are different line ending characters for a few lines which was automatically fixed by the code editor on save. That's the reason why the diffs show these lines, too.)

Pavion commented 1 year ago

Sorry, I've missed your PR, just saw it now. It's a strange behavior here. It seems to me, jquery-ui.min.css is a proper CSS, using theme.css from the same folder fails for me. Your fix is not working proper on my quick Windows setup. Anyway the theme selection is error prone, I'll look into it as soon as I can. Thanks for pointing it out!

Pavion commented 1 year ago

I've looked into this today and it's a curious bug.

1) I'm sure I've seen this error myself but I wasn't able to reproduce it in a fresh setup. It might have happened due to version or database migration or some misconfiguration

2) As already written, larger jquery-ui.min.css is the necessary one, theme.css is not. In fact, if you look into any jquery-ui.min.css, you'll see:

image

3) The theme selection itself is flawed and selects first css from a theme folder:

image

So normally this should select an alphabetic first file jquery-ui.min.css. On some system it probably could select theme.css instead, which would lead to the error. As I'm too lazy to rewrite this function, I'd rather delete all theme.css from all folders thus reducing the overall footprint. On both Win and Linux with both Py2 and Py3 it looks proper.

4) There is a bug in the code you've addressed: while config.py default setting is right and should not be changed, tvstreamrecord.py fallback is wrong:

image

Instead of my code or your proposal it should be:

        config.cfg_theme = "smoothness/jquery-ui.min.css"

This wrong fallback setting could too have triggered the same error but shouldn't fire under any circumstances.

Anyway, I'll fix it after merging the first PR.

Thanks!