PyRoom needs failsafe theme handling after upgrades

Bug #426490 reported by Duncan Lock on 2009-09-08
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PyRoom
Medium
Unassigned
0.4
Medium
Unassigned

Bug Description

When upgrading the theme format, fallbacks like we use on preferences should be implemented, as to not crash PyRoom when things from older custom theme files are missing.

Original report: Starting either pyroom 0.4.1 from the PPA, or the latest trunk retrieved just now with bzr branch lp:pyroom - crashes at startup with the following traceback:

Traceback (most recent call last):

  File "/usr/bin/pyroom", line 38, in <module>
    sys.exit(PyRoom.cmdline.main())

  File "/usr/lib/python2.6/dist-packages/PyRoom/cmdline.py", line 65, in main
    pyroom = BasicEdit(pyroom_config=pyroom_config)

  File "/usr/lib/python2.6/dist-packages/PyRoom/basic_edit.py", line 355, in __init__
    self.gui = GUI(pyroom_config, self)

  File "/usr/lib/python2.6/dist-packages/PyRoom/gui.py", line 184, in __init__
    self.apply_theme()

  File "/usr/lib/python2.6/dist-packages/PyRoom/gui.py", line 233, in apply_theme
    self.textbox.modify_bg(gtk.STATE_NORMAL, parse_color('textboxbg'))

  File "/usr/lib/python2.6/dist-packages/PyRoom/gui.py", line 227, in <lambda>
    parse_color = lambda x: gtk.gdk.color_parse(self.theme[x])

KeyError: 'textboxbg'

I'm using Ubuntu Jaunty AMD 64, Python 2.6.2.

Florian Heinle (tiax) wrote :

Did you run PyRoom before another version, perhaps?

Looks like something's wrong with the theme you're using. Deleting ~/.config/pyroom and ~/.local/share/pyroom should restore default settings and make PyRoom work again.

If you did change theme settings in PyRoom preferences or by hand, I'd be interested in what could have changed the problem with that.

If this is a fresh installation that has never been run, the problem would be someplace else and would require further investigation

Thanks!

Renaming those two config files fixed it. Here are the contents of the old
files:

~/.config/pyroom/pyroom.conf:

[visual]
theme = custom
linespacing = 1
linenumber = 0

[editor]
session = True
autosavetime = 2
autosave = 1

~/.local/share/pyroom/custom.theme:
[theme]
foreground = #0000ffff0000
height = 0.75
padding = 8
width = 0.45
fontsize = 11
background = #000000000000
font = Droid Sans Mono
border = #000033330000

Investigating a bit more, it seems that the old custom theme was at fault.
The pyroom.conf file works ok on it's own, provided that the theme file has
been renamed, or you change the theme= line to something else; trying to
load pyroom with this theme causes this error. If you load with a default
pyroom.conf, but leave the custom.theme file there, it appears in the theme
config UI but doesn't actually work.

Anyway, problem solved, thanks!
Dunc

2009/9/8 Florian Heinle <email address hidden>

> Did you run PyRoom before another version, perhaps?
>
> Looks like something's wrong with the theme you're using. Deleting
> ~/.config/pyroom and ~/.local/share/pyroom should restore default
> settings and make PyRoom work again.
>
> If you did change theme settings in PyRoom preferences or by hand, I'd
> be interested in what could have changed the problem with that.
>
> If this is a fresh installation that has never been run, the problem
> would be someplace else and would require further investigation
>
> --
> 0.4.1 and lp:pyroom both crash at startup
> https://bugs.launchpad.net/bugs/426490
> You received this bug notification because you are a direct subscriber
> of the bug.
>
>

Ah! Thanks for your information.

Forensics now: we've removed "font" some time ago but added "textboxbg" in more recent versions. It appears you've been using an older version of PyRoom, upgraded and switched to "custom" without changing any settings for the custom theme, hence letting it use the old version that hasn't been overwritten by customizations made in the dialog.

Would that be plausible? I'll be adding some more update mechanisms to themes then.

I think I've used an older version, selected and customized the custom
theme, then either upgraded via the PPA, or switched to lp:pyroom, can't
really remember which. When this error happened, I stopped using pyroom for
a while and then came back to it yesterday to attempt to get to the bottom
of it, and checked out the latest trunk again.

2009/9/9 Florian Heinle <email address hidden>

> Ah! Thanks for your information.
>
> Forensics now: we've removed "font" some time ago but added "textboxbg"
> in more recent versions. It appears you've been using an older version
> of PyRoom, upgraded and switched to "custom" without changing any
> settings for the custom theme, hence letting it use the old version that
> hasn't been overwritten by customizations made in the dialog.
>
> Would that be plausible? I'll be adding some more update mechanisms to
> themes then.
>
> --
> 0.4.1 and lp:pyroom both crash at startup
> https://bugs.launchpad.net/bugs/426490
> You received this bug notification because you are a direct subscriber
> of the bug.
>
>

Florian Heinle (tiax) on 2009-09-21
summary: - 0.4.1 and lp:pyroom both crash at startup
+ PyRoom needs failsafe theme handling after upgrades
description: updated
Changed in pyroom:
status: New → Confirmed
importance: Undecided → Medium
Florian Heinle (tiax) wrote :

Fixed in both trunk and 0.4 bugfixing branch

Changed in pyroom:
status: Confirmed → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers