properties crashes with invalid theme

Bug #424629 reported by Alex K
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
DockbarX
Fix Released
Medium
Unassigned

Bug Description

DockbarX should to handle invalid themes better. Most importantly, the Properties dialogue should still open.

Currently, if an invalid theme exists inside ~/.dockbar/themes (and, I suppose, /usr/share/dockbar/themes), Properties opens as a tiny (~15x20px), unusable window with nothing in it. If a theme is edited while active, (theme development is the only place where this happens, I think), then it becomes even worse. Sometimes the icons are all replaced with a single vertical white line, which can only be fixed by changing the theme.s extension to .tar.gz.bac (or something similar), removing dockbar from the panel, and adding it again.

This makes pushing the limits of DockbarX's theme engine tricky.

Unfortunately (and I'm working on this), I'm not a programmer. However, I think part of the problem is the way Dockbar checks the themes when you open Properties.

I think it is good that the theme engine is fairly strict. That's good. However, it would be much better if Dockbar could
+ Pop up an error message?
+ Maybe give an option to revert the theme to it's last valid state (if possible)?
+ Automatically switch to a valid theme?
+ Gray out the invalid theme in the dropdown?

Also, having typed this all out, it sounds like a lot of work, but the main thing is how the Properties dialogue crashes when an invalid theme is present.

Alex K (levviathor)
description: updated
Revision history for this message
Matias Särs (msevens) wrote :

The reason why I haven't done anything about this is that the error messages that dockbarx currently gives helps me quite a bit when I'm editing themes. That might be because I've programmed the thing though. But at least when you make xml violations the error message is good, telling you on what line the error is (and only xml violations makes the Properties dialog crash).

E.g. "xml.sax._exceptions.SAXParseException: config:6:3: mismatched tag" tells me that tells me that the element is on the 6th line and starts att the 3rd sign in config file is "mismatched". In this case that's a </if> element. That tells me there are probably a command within the <if></if> that lacks the ending slash. I can quickly find that the problem in this case was <transp_sat opacity="90" saturation="28" > on line five and it was indeed the ending slash (/) that was missing. (I used Minimalistic theme in this example.)

When you make your theme, you run dockbarx in such a way that you get error messages, right? IOn way to do this is to run it in terminal (dockbarx run-in-terminal). If you need to see how your theme looks on the panel you can do that to while still getting error messages by:

1. Kill dockbarx with "killall dockbarx.py"
2. A dialog for restarting the applet turns up, ignore it and leave it open for the moment.
3. In terminal write: dockbarx.py
4. Now choose to restart dockbarx from the dialog.
5. See all error messages in the terminal.

There could be a lot of error warnings that isn't related to theming. Watch out specifically for words like xml and name of theming elements like composite and button_pixmap.

I realize I should put parts of this in the theming howto...

And the bug is still valid as error messages is useless if a enduser gets an invalid theme.

Changed in dockbar:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Alex K (levviathor) wrote :

Thanks for the explanation-- this will definitely help me out a lot.

However, I think things could be handled better. Ah well. Should at least be around by OneOh.

Revision history for this message
Michaël Vanderheeren (michael-vanderheeren) wrote :

Agree on the issue Alex K is pointing out. I think the most appropriate option is to show a popup to the user to note that the theme is invalid and then switch back to the previous theme.

Matias Särs (msevens)
Changed in dockbar:
status: Confirmed → Fix Committed
Revision history for this message
Matias Särs (msevens) wrote :

Ok, with the committed fix dockbarx:
- wont list invalid themes at all (no grey out, sorry).
- Dockbarx will automatically switch to a (random) working theme.
- There is no simple way to switch to the last working state of an invalid theme.
- If there are no working themes dockbarx will show a message dialog to inform the user about this (and in some circumstances kill dockbarx to allow restart when the themes are ok again).

Revision history for this message
Michaël Vanderheeren (michael-vanderheeren) wrote :

I think that's a fair solution! Good work.

Revision history for this message
Matias Särs (msevens) wrote :

For theme makers, this is an example of the kind of error messages you will get in the terminal now:

Error loading theme from /home/matias/.dockbarx/themes/107827-white.tar.gz
config:10:3: mismatched tag

Revision history for this message
Alex K (levviathor) wrote :

Looks awesome! Thanks!

To clarify, the config:10:3: indicates that the error is in the config file, tenth line, third character, correct?

Revision history for this message
Matias Särs (msevens) wrote :

Yes, that's correct. Dockbarx is just passing the last error message along. That should usually be an error that the xml reader (SaxParser) finds in the xml code.

Matias Särs (msevens)
Changed in dockbar:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.