Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/view
diff options
context:
space:
mode:
authorMartin Dengler <martin@martindengler.com>2008-06-06 03:00:25 (GMT)
committer Martin Dengler <martin@martindengler.com>2008-06-06 03:00:25 (GMT)
commit7164ae7c2a24505d782e6916fcaf494065a970dc (patch)
treeff492000e276dd04e36cc0847c016d2649cc544b /src/view
parent006058be744c61b4a93bb00e418e6205f0ce9af5 (diff)
#7215: bad device icon in frame shouldn't crash sugar
Diffstat (limited to 'src/view')
-rw-r--r--src/view/frame/devicestray.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/view/frame/devicestray.py b/src/view/frame/devicestray.py
index 1accdad..7e6e797 100644
--- a/src/view/frame/devicestray.py
+++ b/src/view/frame/devicestray.py
@@ -14,11 +14,15 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+import logging
+
from sugar.graphics.tray import HTray
from view.devices import deviceview
from model import shellmodel
+_logger = logging.getLogger('DevicesTray')
+
class DevicesTray(HTray):
def __init__(self):
HTray.__init__(self)
@@ -35,11 +39,15 @@ class DevicesTray(HTray):
self.__device_disappeared_cb)
def _add_device(self, device):
- view = deviceview.create(device)
- # TODO: *Tray classes don't allow yet to set the alignment.
- self.add_item(view)
- view.show()
- self._device_icons[device.get_id()] = view
+ try:
+ view = deviceview.create(device)
+ # TODO: *Tray classes don't allow yet to set the alignment.
+ self.add_item(view)
+ view.show()
+ self._device_icons[device.get_id()] = view
+ except Exception, message:
+ _logger.warn("Not able to add icon for device [%r], because of "
+ "an error (%s). Continuing." % (device, message))
def _remove_device(self, device):
self.remove_item(self._device_icons[device.get_id()])