Comment 22 for bug 1028388

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote : Re: software-properties-gtk crashed with KeyError in show_drivers(): 'model'

This would be my proposed fix so far:

--- softwareproperties/gtk/SoftwarePropertiesGtk.py 2012-08-28 13:29:24 +0000
+++ softwareproperties/gtk/SoftwarePropertiesGtk.py 2012-09-10 16:10:18 +0000
@@ -1265,7 +1265,7 @@
       device_detail = Gtk.Box(spacing=6, orientation=Gtk.Orientation.VERTICAL)
       device_box.pack_start(device_detail, True, True, 0)

- widget = Gtk.Label("{}: {}".format(self.devices[device]['vendor'], self.devices[device]['model']))
+ widget = Gtk.Label("{}: {}".format(self.devices[device].get('vendor', _('Unknown')), self.devices[device].get('model', _('Unknown'))))
       widget.set_halign(Gtk.Align.START)
       device_detail.pack_start(widget, True, False, 0)
       widget = Gtk.Label("<small>{}</small>".format(overall_status))

Replacing the missing strings when the dictionary keys are unavailable with "Unknown", which introduces a new string and thus should need an UI freeze exception.