Image or File Option Window Crash

Bug #1064649 reported by Austin Bowen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Screenlets
Fix Committed
Undecided
Unassigned

Bug Description

I have Screenlets v0.1.5 on Debian 6. When changing an image/file option with a screenlet's properties window, when the file selection window pops up and if no file is given and you press Enter (NOT pressing the Open button) in the empty text field, the file selection window crashes with the following error:

Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/screenlets/options/file_option.py", line 159, in but_callback
    self._entry.set_text(dlg.get_filename())
TypeError: Gtk.Entry.set_text() argument 1 must be string, not None

This error is avoided by pressing the Open button with an empty text field, however.

The Properties window and the screenlet are still responsive, but the file selection window won't close until the screenlet closes. It's a minor bug really, and I fixed it by replacing line 159 in screenlets/options/file_option.py:

self._entry.set_text(dlg.get_filename())

With the following 3 lines:

fn = dlg.get_filename()
if not fn: fn = ""
self._entry.set_text(fn)

That fixed the problem, and it clears the string if None is given. An alternative would also be to only set the string if the filename is not None:

fn = dlg.get_filename()
if (fn != None): self._entry.set_text(fn)

A minor bug, but easy to fix.

Related branches

Revision history for this message
Austin Bowen (austin-bowen-314) wrote :
Märt Põder (boamaod)
Changed in screenlets:
status: New → Fix Committed
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.