From 10bfe004a8b5ab9176b9b26455f2da14ac052340 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Sun, 25 Feb 2007 15:05:56 +0100 Subject: [PATCH] Fix strength propagation --- shell/hardware/nmclient.py | 2 ++ shell/model/MeshModel.py | 2 +- shell/model/devices/wirelessnetwork.py | 4 ++-- shell/view/home/MeshBox.py | 6 ++++++ sugar/graphics/canvasicon.py | 12 ++++++------ 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/shell/hardware/nmclient.py b/shell/hardware/nmclient.py index 41bf5e2e..d1189f0f 100644 --- a/shell/hardware/nmclient.py +++ b/shell/hardware/nmclient.py @@ -108,6 +108,8 @@ class Network(gobject.GObject): logging.debug("Net(%s): ssid '%s', mode %d, strength %d" % (self._op, self._ssid, self._mode, self._strength)) + self.emit('strength-changed') + def _update_error_cb(self, err): logging.debug("Net(%s): failed to update. (%s)" % (self._op, err)) self._valid = False diff --git a/shell/model/MeshModel.py b/shell/model/MeshModel.py index c2d42ba6..2e4b912b 100644 --- a/shell/model/MeshModel.py +++ b/shell/model/MeshModel.py @@ -37,7 +37,7 @@ class AccessPointModel(gobject.GObject): self._strength_changed_cb) def _strength_changed_cb(self, nm_network): - self.notity('strength') + self.notify('strength') def get_id(self): return self._nm_network.get_op() diff --git a/shell/model/devices/wirelessnetwork.py b/shell/model/devices/wirelessnetwork.py index efbc1b10..c18cf879 100644 --- a/shell/model/devices/wirelessnetwork.py +++ b/shell/model/devices/wirelessnetwork.py @@ -15,8 +15,8 @@ class Device(device.Device): self._nm_device.connect('strength-changed', self._strength_changed_cb) - def _strength_changed_cb(self, nm_device): - self.notity('strength') + def _strength_changed_cb(self, nm_device, strength): + self.notify('strength') def do_get_property(self, pspec): if pspec.name == 'strength': diff --git a/shell/view/home/MeshBox.py b/shell/view/home/MeshBox.py index 707ad6e4..6dcfb0c1 100644 --- a/shell/view/home/MeshBox.py +++ b/shell/view/home/MeshBox.py @@ -31,6 +31,12 @@ class AccessPointView(CanvasIcon): self._model = model self.connect('activated', self._activate_cb) + + model.connect('notify::strength', self._strength_changed_cb) + + self._update_icon() + + def _strength_changed_cb(self, model, pspec): self._update_icon() def _activate_cb(self, icon): diff --git a/sugar/graphics/canvasicon.py b/sugar/graphics/canvasicon.py index fe04074f..56423d8e 100644 --- a/sugar/graphics/canvasicon.py +++ b/sugar/graphics/canvasicon.py @@ -319,12 +319,12 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem): def get_popup(self): if self._tooltip: tooltip_popup = Popup() - canvas_text = hippo.CanvasText(text=self._tooltip) - canvas_text.props.background_color = color.MENU_BACKGROUND.get_int() - canvas_text.props.color = color.LABEL_TEXT.get_int() - canvas_text.props.font_desc = font.DEFAULT.get_pango_desc() - canvas_text.props.padding = units.points_to_pixels(5) - tooltip_popup.append(canvas_text) + text = hippo.CanvasText(text=self._tooltip) + text.props.background_color = color.MENU_BACKGROUND.get_int() + text.props.color = color.LABEL_TEXT.get_int() + text.props.font_desc = font.DEFAULT.get_pango_desc() + text.props.padding = units.points_to_pixels(5) + tooltip_popup.append(text) return tooltip_popup else: