diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2005-07-01 17:49:44 +0000 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2005-07-01 17:49:44 +0000 |
commit | 80ec987fbd0cef731cad59cc3cb94309c855fce0 (patch) | |
tree | ab52e08e68d874fd526081672ead10ebce6b8007 | |
parent | c071e4007e9eaff9975a70290683cf5ebfb34aae (diff) |
Make h-d-m tolerate expected device properties which are empty.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | tools/device-manager/Device.py | 7 | ||||
-rw-r--r-- | tools/device-manager/DeviceManager.py | 3 | ||||
-rw-r--r-- | tools/device-manager/Representation.py | 8 |
4 files changed, 22 insertions, 3 deletions
@@ -1,5 +1,12 @@ 2005-07-01 Kay Sievers <kay.sievers@vrfy.org> + * tools/device-manager/Device.py: + * tools/device-manager/DeviceManager.py: + * tools/device-manager/Representation.py: + Make h-d-m tolerate expected device properties which are empty. + +2005-07-01 Kay Sievers <kay.sievers@vrfy.org> + * configure.in: * hald/linux2/addons/addon-storage.c: * hald/linux2/probing/probe-pc-floppy.c: diff --git a/tools/device-manager/Device.py b/tools/device-manager/Device.py index 668881ab..9ead11b4 100644 --- a/tools/device-manager/Device.py +++ b/tools/device-manager/Device.py @@ -21,7 +21,7 @@ class Device: def populate_gtk_tree(self, tree_model, dont_show_virtual, representation): # see if we should show virtual devices if dont_show_virtual: - if self.properties.has_key("info.virtual"): + try: if self.properties["info.virtual"]: # do show all block devices, ide channels if not self.properties["info.bus"] in ["block", "ide_host"]: @@ -32,7 +32,8 @@ class Device: dont_show_virtual, representation) return - + except: + pass if self.parent_device==None: self.row = None else: @@ -47,6 +48,8 @@ class Device: title_name = self.properties["info.product"] except KeyError: title_name = "Unknown Device" + except TypeError: + title_name = "Unknown Device" tree_model.set_value(self.row, Const.TITLE_COLUMN, title_name) tree_model.set_value(self.row, Const.UDI_COLUMN, self.device_name) diff --git a/tools/device-manager/DeviceManager.py b/tools/device-manager/DeviceManager.py index b1a74f44..30f10689 100644 --- a/tools/device-manager/DeviceManager.py +++ b/tools/device-manager/DeviceManager.py @@ -266,6 +266,9 @@ class DeviceManager(LibGladeApplication): except KeyError: # no parent, must be parent of virtual_root parent_name = "/" + except TypeError: + print "Error: no properties for device %s"%name + continue device = Device(name, parent_name, properties) self.device_list.append(device) diff --git a/tools/device-manager/Representation.py b/tools/device-manager/Representation.py index 0ca6f3c5..26a822ef 100644 --- a/tools/device-manager/Representation.py +++ b/tools/device-manager/Representation.py @@ -47,7 +47,13 @@ class Representation: # Default to abstract icon icon = self.icons["abstract"] - product = device.properties.get("info.product", "") + try: + product = device.properties["info.product"] + except KeyError: + product = "Unknown" + except TypeError: + return icon + if product=="Computer": return self.icons["computer"] |