Re: [Sugar-devel] [DESIGN] [PATCH RFC sugar] Wireless network Frame device: add suport for disabling wireless devices
On Thu, Jul 7, 2011 at 11:44 PM, Frederick Grose fgr...@gmail.com wrote: On Mon, Jun 27, 2011 at 7:27 AM, Sascha Silbe si...@activitycentral.com wrote: This duplicates the existing functionality in the Control Panel for more convenient access. Disabling wifi devices can save power, thereby increasing battery life. Signed-off-by: Sascha Silbe si...@activitycentral.com --- {...} We could also do with a better icon. Maybe something like the circles from emblem-outofrange combined with the arrow from emblem-charging, striking out the arrow depending on the current action (disable or enable wifi)? Two potential icons for this purpose follow: (Adapted from the Fedora HighContrast network-wireless.svg) Enabling coloring of the icon would help to indicate the locality of the action. I'm uncertain if the background handling is optimal for the black control palette. Two more variations using the XO radio LED shape. One set with broadcast and receive wavefront lines; the other with broadcast wavefronts only. --Fred attachment: disable-radio.svgattachment: enable-radio.svgattachment: disable-radio_b.svgattachment: enable-radio_b.svg___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [DESIGN] [PATCH RFC sugar] Wireless network Frame device: add suport for disabling wireless devices
On 27 June 2011 12:27, Sascha Silbe si...@activitycentral.com wrote: This duplicates the existing functionality in the Control Panel for more convenient access. Disabling wifi devices can save power, thereby increasing battery life. On XO-1 (and also currently on XO-1.5) we have the option of removing power from the wifi device when it is disabled. While this is clearly desirable, we don't have the code in place right now, but it will come. So, this will cause the device to disppear and the frame will be updated accordingly. This means that you'd lose symmetry - you could disable the device from the frame, but then the icon would disappear and you wouldn't have the same way of enabling it again. I know it is a rare case for a user to have multiple active wireless devices, but the way that you are linking a global wifi on-off switch to an individual wireless device lacks a bit of consistency in design (and is actually the cause of the above). Daniel ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [DESIGN] [PATCH RFC sugar] Wireless network Frame device: add suport for disabling wireless devices
On 8 Jul 2011, at 10:28, Daniel Drake d...@laptop.org wrote: On 27 June 2011 12:27, Sascha Silbe si...@activitycentral.com wrote: This duplicates the existing functionality in the Control Panel for more convenient access. Disabling wifi devices can save power, thereby increasing battery life. On XO-1 (and also currently on XO-1.5) we have the option of removing power from the wifi device when it is disabled. While this is clearly desirable, we don't have the code in place right now, but it will come. So, this will cause the device to disppear and the frame will be updated accordingly. This means that you'd lose symmetry - you could disable the device from the frame, but then the icon would disappear and you wouldn't have the same way of enabling it again. I know it is a rare case for a user to have multiple active wireless devices, but the way that you are linking a global wifi on-off switch to an individual wireless device lacks a bit of consistency in design (and is actually the cause of the above). I have to agree with you, Sacha has quite a long list of network related UI design change preposals and this seemed like the least offensive one, but if, as you point out above, the frame icon will be removed when the device is really powered off (with some future patch), then I'd not want to see this extra menu item landed. My original suggestion for covering the extra functionality that Sacha has been preposing was to work on a feature allowing a control panel module to be opened directly from else where in Sugar (the wireless device palette opening the networking module in this case), so that a user could quickly access the relevant cp module, in context, for more advanced tweaking. The new features can than be added to cp modules as needed. I believe this was originally preposed by Eben some time back to try and help keep the primary Sugar UI design as focused as possible and avoid feature creep/clutter. Regards, --Gary Daniel ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [DESIGN] [PATCH RFC sugar] Wireless network Frame device: add suport for disabling wireless devices
On Mon, Jun 27, 2011 at 7:27 AM, Sascha Silbe si...@activitycentral.com wrote: This duplicates the existing functionality in the Control Panel for more convenient access. Disabling wifi devices can save power, thereby increasing battery life. Signed-off-by: Sascha Silbe si...@activitycentral.com --- {...} We could also do with a better icon. Maybe something like the circles from emblem-outofrange combined with the arrow from emblem-charging, striking out the arrow depending on the current action (disable or enable wifi)? Two potential icons for this purpose follow: (Adapted from the Fedora HighContrast network-wireless.svg) Enabling coloring of the icon would help to indicate the locality of the action. I'm uncertain if the background handling is optimal for the black control palette. ?xml version=1.0 ?!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [ !ENTITY stroke_color #66 !ENTITY fill_color #ff ]svg height=55px id=Layer_1 version=1.1 viewBox=0 0 55 55 width=55px xml:space=preserve xmlns=http://www.w3.org/2000/svg; xmlns:cc=http://creativecommons.org/ns#; xmlns:dc=http://purl.org/dc/elements/1.1/; xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#; xmlns:svg=http://www.w3.org/2000/svg;metadata id=metadata12rdf:RDFcc:Work rdf:about=dc:formatimage/svg+xml/dc:formatdc:type rdf:resource=http://purl.org/dc/dcmitype/StillImage/dc:title//cc:Work/rdf:RDF/metadatadefs id=defs10 /defs path d=m -25.020493,25.584017 a 19.272541,19.272541 0 1 1 -38.545082,0 19.272541,19.272541 0 1 1 38.545082,0 z id=path5250 style=fill:#ff;;fill-opacity:1;stroke:#ff;;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none transform=matrix(1.2037367,0,0,1.2037367,80.81715,-3.29642)/g id=g5276path d=m 36.16249,21.545068 a 14,14 0 0 1 0.143788,12.912179 id=path3159-1 style=fill:none;stroke:stroke_color;;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none/path d=m 18.583255,21.697344 a 14,14 0 0 0 -0.09989,12.687778 id=path3163-7 style=fill:none;stroke:stroke_color;;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none/path d=m 41.411429,16 a 19,19 0 0 1 0.175642,22.925015 id=path3165-4 style=fill:none;stroke:stroke_color;;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none/path d=M 13.588571,16.074985 A 19,19 0 0 0 13.412929,39 id=path3167-3 style=fill:none;stroke:stroke_color;;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none//gpath d=m 32.412929,28 a 5,5 0 0 1 -10,0 5,5 0 1 1 10,0 z id=path2385 style=fill:fill_color;;fill-opacity:1;stroke:none/path d=M 11.75,8.65625 8.90625,11.46875 43.25,46.34375 46.09375,43.53125 11.75,8.65625 z id=path2989 style=fill:#00;fill-opacity:1;stroke:#ff;;stroke-width:0.2721;stroke-miterlimit:4;stroke-opacity:1;/path d=m 27.5,0.625 c -7.059709,0 -14.00803,2.8830332 -19,7.875 -4.9919697,4.991967 -7.875,11.94029 -7.875,19 0,7.05971 2.8830303,14.008033 7.875,19 4.99197,4.991967 11.940291,7.875 19,7.875 7.059709,0 14.00803,-2.883033 19,-7.875 4.99197,-4.991967 7.875,-11.94029 7.875,-19 0,-7.05971 -2.88303,-14.008033 -7.875,-19 C 41.50803,3.5080332 34.559709,0.625 27.5,0.625 z m 0,3.9375 c 5.981978,0 11.988854,2.4888566 16.21875,6.71875 4.229896,4.229893 6.71875,10.236773 6.71875,16.21875 0,5.981977 -2.488854,11.988857 -6.71875,16.21875 C 39.488854,47.948643 33.481978,50.4375 27.5,50.4375 21.518022,50.4375 15.511146,47.948643 11.28125,43.71875 7.0513541,39.488857 4.5625,33.481977 4.5625,27.5 4.5625,21.518023 7.0513541,15.511143 11.28125,11.28125 15.511146,7.0513566 21.518022,4.5625 27.5,4.5625 z id=path3759 style=fill:#00;fill-opacity:1;stroke:#ff;;stroke-width:0.5;//svg ?xml version=1.0 ?!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [ !ENTITY stroke_color #66 !ENTITY fill_color #ff ]svg height=55px viewBox=0 0 55 55 width=55px xml:space=preserve xmlns=http://www.w3.org/2000/svg; xmlns:cc=http://creativecommons.org/ns#; xmlns:svg=http://www.w3.org/2000/svg;metadata id=metadata12rdf:RDFcc:Work rdf:about=dc:formatimage/svg+xml/dc:formatdc:type rdf:resource=http://purl.org/dc/dcmitype/StillImage/dc:title//cc:Work/rdf:RDF/metadatadefs id=defs10 /defs g id=g4240 transform=translate(75.199814,-24.831967)path d=m 29,24 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z id=path2385 style=fill:fill_color;;fill-opacity:1;stroke:none transform=translate(-71.786885,28.831967)/path d=m 36.349644,11.405586 a 14,14 0 0 1 0.143788,12.912179 id=path3159 style=fill:none;stroke:stroke_color;;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none
[Sugar-devel] [DESIGN] [PATCH RFC sugar] Wireless network Frame device: add suport for disabling wireless devices
This duplicates the existing functionality in the Control Panel for more convenient access. Disabling wifi devices can save power, thereby increasing battery life. Signed-off-by: Sascha Silbe si...@activitycentral.com --- This is fully working but I'm not sure about the correct way to change the label of a MenuItem. Accessing it via MenuItem.child seems hacky. Suggestions? We could also do with a better icon. Maybe something like the circles from emblem-outofrange combined with the arrow from emblem-charging, striking out the arrow depending on the current action (disable or enable wifi)? Since the wiki is down I've uploaded the screenshot to the scratch area on my own server [1,2]. [1] http://sascha.silbe.org/tmp/sugar-wifi-conn-disable.png [2] http://sascha.silbe.org/tmp/sugar-wifi-enable.png extensions/deviceicon/network.py | 57 ++ 1 files changed, 57 insertions(+), 0 deletions(-) diff --git a/extensions/deviceicon/network.py b/extensions/deviceicon/network.py index 9a74237..85ca884 100644 --- a/extensions/deviceicon/network.py +++ b/extensions/deviceicon/network.py @@ -72,12 +72,15 @@ class WirelessPalette(Palette): __gsignals__ = { 'deactivate-connection': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])), +'disable-wifi': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, []), +'enable-wifi': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, []), } def __init__(self, primary_text): Palette.__init__(self, label=primary_text) self._disconnect_item = None +self._enabled = True self._channel_label = gtk.Label() self._channel_label.props.xalign = 0.0 @@ -109,6 +112,13 @@ class WirelessPalette(Palette): self.__disconnect_activate_cb) self.menu.append(self._disconnect_item) +label = glib.markup_escape_text(_('Disable all wireless devices')) +self._powercontrol_item = MenuItem(label, 'system-shutdown') +self._powercontrol_item.connect('activate', +self.__powercontrol_activate_cb) +self._powercontrol_item.show() +self.menu.append(self._powercontrol_item) + def set_connecting(self): self.props.secondary_text = _('Connecting...') @@ -132,9 +142,26 @@ class WirelessPalette(Palette): self._disconnect_item.hide() self.set_content(None) +def set_enabled(self, enabled): +self._enabled = enabled +if enabled: +label = glib.markup_escape_text(_('Disable all wireless devices')) +else: +self.set_disconnected() +label = glib.markup_escape_text(_('Enable wireless devices')) + +# FIXME: what's the right way to do this? +self._powercontrol_item.child.set_markup(label) + def __disconnect_activate_cb(self, menuitem): self.emit('deactivate-connection') +def __powercontrol_activate_cb(self, menuitem): +if self._enabled: +self.emit('disable-wifi') +else: +self.emit('enable-wifi') + def _set_frequency(self, frequency): channel = network.frequency_to_channel(frequency) self._set_channel(channel) @@ -402,6 +429,8 @@ class WirelessDeviceView(ToolButton): self._palette = WirelessPalette(self._name) self._palette.connect('deactivate-connection', self.__deactivate_connection_cb) +self._palette.connect('disable-wifi', self.__disable_wifi_cb) +self._palette.connect('enable-wifi', self.__enable_wifi_cb) self.set_palette(self._palette) self._palette.set_group_id('frame') @@ -420,6 +449,16 @@ class WirelessDeviceView(ToolButton): path=self._device.object_path, dbus_interface=_NM_DEVICE_IFACE) +obj = self._bus.get_object(_NM_SERVICE, _NM_PATH) +network_manager = dbus.Interface(obj, _NM_IFACE) +self._nm_props = dbus.Interface(network_manager, dbus.PROPERTIES_IFACE) +self._nm_props.connect_to_signal('PropertiesChanged', + self.__nm_props_changed_cb, + dbus_interface=_NM_IFACE) +self._nm_props.Get(_NM_IFACE, 'XWirelessEnabled', + reply_handler=self.__nm_wifi_enabled_reply_cb, + error_handler=self.__nm_wifi_enabled_error_cb) + def disconnect(self): self._bus.remove_signal_receiver(self.__state_changed_cb, signal_name='StateChanged', @@ -578,6 +617,24 @@ class WirelessDeviceView(ToolButton): def __activate_error_cb(self, err): logging.debug('Failed to create network: %s', err) +def __nm_wifi_enabled_reply_cb(self, enabled): +self._palette.set_enabled(enabled)
Re: [Sugar-devel] [DESIGN] [PATCH RFC sugar] Wireless network Frame device: add suport for disabling wireless devices
Hi Sascha, On 27 Jun 2011, at 12:27, Sascha Silbe si...@activitycentral.com wrote: This duplicates the existing functionality in the Control Panel for more convenient access. Disabling wifi devices can save power, thereby increasing battery life. Signed-off-by: Sascha Silbe si...@activitycentral.com --- This is fully working but I'm not sure about the correct way to change the label of a MenuItem. Accessing it via MenuItem.child seems hacky. Suggestions? We could also do with a better icon. Maybe something like the circles from emblem-outofrange combined with the arrow from emblem-charging, striking out the arrow depending on the current action (disable or enable wifi)? I'll have a think. Since the wiki is down I've uploaded the screenshot to the scratch area on my own server [1,2]. [1] http://sascha.silbe.org/tmp/sugar-wifi-conn-disable.png [2] http://sascha.silbe.org/tmp/sugar-wifi-enable.png Thanks for the screenshots. For the sugar-wifi-enable palette can we loose the empty section at the top, or perhaps if that's complicated we can place some descriptive text there so it doesn't look like a bug? Would the text better read as Enable my wireless radio and Disable my wireless radio? How does this interact with Mesh/Adhoc? I assume their icons will vanish from the neighbourhood as well, and their palettes will have the same enable/disable radio menu option? Regards, --Gary extensions/deviceicon/network.py | 57 ++ 1 files changed, 57 insertions(+), 0 deletions(-) diff --git a/extensions/deviceicon/network.py b/extensions/deviceicon/network.py index 9a74237..85ca884 100644 --- a/extensions/deviceicon/network.py +++ b/extensions/deviceicon/network.py @@ -72,12 +72,15 @@ class WirelessPalette(Palette): __gsignals__ = { 'deactivate-connection': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])), +'disable-wifi': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, []), +'enable-wifi': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, []), } def __init__(self, primary_text): Palette.__init__(self, label=primary_text) self._disconnect_item = None +self._enabled = True self._channel_label = gtk.Label() self._channel_label.props.xalign = 0.0 @@ -109,6 +112,13 @@ class WirelessPalette(Palette): self.__disconnect_activate_cb) self.menu.append(self._disconnect_item) +label = glib.markup_escape_text(_('Disable all wireless devices')) +self._powercontrol_item = MenuItem(label, 'system-shutdown') +self._powercontrol_item.connect('activate', +self.__powercontrol_activate_cb) +self._powercontrol_item.show() +self.menu.append(self._powercontrol_item) + def set_connecting(self): self.props.secondary_text = _('Connecting...') @@ -132,9 +142,26 @@ class WirelessPalette(Palette): self._disconnect_item.hide() self.set_content(None) +def set_enabled(self, enabled): +self._enabled = enabled +if enabled: +label = glib.markup_escape_text(_('Disable all wireless devices')) +else: +self.set_disconnected() +label = glib.markup_escape_text(_('Enable wireless devices')) + +# FIXME: what's the right way to do this? +self._powercontrol_item.child.set_markup(label) + def __disconnect_activate_cb(self, menuitem): self.emit('deactivate-connection') +def __powercontrol_activate_cb(self, menuitem): +if self._enabled: +self.emit('disable-wifi') +else: +self.emit('enable-wifi') + def _set_frequency(self, frequency): channel = network.frequency_to_channel(frequency) self._set_channel(channel) @@ -402,6 +429,8 @@ class WirelessDeviceView(ToolButton): self._palette = WirelessPalette(self._name) self._palette.connect('deactivate-connection', self.__deactivate_connection_cb) +self._palette.connect('disable-wifi', self.__disable_wifi_cb) +self._palette.connect('enable-wifi', self.__enable_wifi_cb) self.set_palette(self._palette) self._palette.set_group_id('frame') @@ -420,6 +449,16 @@ class WirelessDeviceView(ToolButton): path=self._device.object_path, dbus_interface=_NM_DEVICE_IFACE) +obj = self._bus.get_object(_NM_SERVICE, _NM_PATH) +network_manager = dbus.Interface(obj, _NM_IFACE) +self._nm_props = dbus.Interface(network_manager, dbus.PROPERTIES_IFACE) +self._nm_props.connect_to_signal('PropertiesChanged', + self.__nm_props_changed_cb, +
Re: [Sugar-devel] [DESIGN] [PATCH RFC sugar] Wireless network Frame device: add suport for disabling wireless devices
On Mon, Jun 27, 2011 at 9:44 AM, Gary Martin garycmar...@googlemail.com wrote: Hi Sascha, On 27 Jun 2011, at 12:27, Sascha Silbe si...@activitycentral.com wrote: This duplicates the existing functionality in the Control Panel for more convenient access. Disabling wifi devices can save power, thereby increasing battery life. Signed-off-by: Sascha Silbe si...@activitycentral.com --- This is fully working but I'm not sure about the correct way to change the label of a MenuItem. Accessing it via MenuItem.child seems hacky. Suggestions? We could also do with a better icon. Maybe something like the circles from emblem-outofrange combined with the arrow from emblem-charging, striking out the arrow depending on the current action (disable or enable wifi)? I'll have a think. Since the wiki is down I've uploaded the screenshot to the scratch area on my own server [1,2]. [1] http://sascha.silbe.org/tmp/sugar-wifi-conn-disable.png [2] http://sascha.silbe.org/tmp/sugar-wifi-enable.png Thanks for the screenshots. For the sugar-wifi-enable palette can we loose the empty section at the top, or perhaps if that's complicated we can place some descriptive text there so it doesn't look like a bug? Would the text better read as Enable my wireless radio and Disable my wireless radio? Wireless radio is a bit redundant, do you think? :) -walter How does this interact with Mesh/Adhoc? I assume their icons will vanish from the neighbourhood as well, and their palettes will have the same enable/disable radio menu option? Regards, --Gary extensions/deviceicon/network.py | 57 ++ 1 files changed, 57 insertions(+), 0 deletions(-) diff --git a/extensions/deviceicon/network.py b/extensions/deviceicon/network.py index 9a74237..85ca884 100644 --- a/extensions/deviceicon/network.py +++ b/extensions/deviceicon/network.py @@ -72,12 +72,15 @@ class WirelessPalette(Palette): __gsignals__ = { 'deactivate-connection': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])), + 'disable-wifi': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, []), + 'enable-wifi': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, []), } def __init__(self, primary_text): Palette.__init__(self, label=primary_text) self._disconnect_item = None + self._enabled = True self._channel_label = gtk.Label() self._channel_label.props.xalign = 0.0 @@ -109,6 +112,13 @@ class WirelessPalette(Palette): self.__disconnect_activate_cb) self.menu.append(self._disconnect_item) + label = glib.markup_escape_text(_('Disable all wireless devices')) + self._powercontrol_item = MenuItem(label, 'system-shutdown') + self._powercontrol_item.connect('activate', + self.__powercontrol_activate_cb) + self._powercontrol_item.show() + self.menu.append(self._powercontrol_item) + def set_connecting(self): self.props.secondary_text = _('Connecting...') @@ -132,9 +142,26 @@ class WirelessPalette(Palette): self._disconnect_item.hide() self.set_content(None) + def set_enabled(self, enabled): + self._enabled = enabled + if enabled: + label = glib.markup_escape_text(_('Disable all wireless devices')) + else: + self.set_disconnected() + label = glib.markup_escape_text(_('Enable wireless devices')) + + # FIXME: what's the right way to do this? + self._powercontrol_item.child.set_markup(label) + def __disconnect_activate_cb(self, menuitem): self.emit('deactivate-connection') + def __powercontrol_activate_cb(self, menuitem): + if self._enabled: + self.emit('disable-wifi') + else: + self.emit('enable-wifi') + def _set_frequency(self, frequency): channel = network.frequency_to_channel(frequency) self._set_channel(channel) @@ -402,6 +429,8 @@ class WirelessDeviceView(ToolButton): self._palette = WirelessPalette(self._name) self._palette.connect('deactivate-connection', self.__deactivate_connection_cb) + self._palette.connect('disable-wifi', self.__disable_wifi_cb) + self._palette.connect('enable-wifi', self.__enable_wifi_cb) self.set_palette(self._palette) self._palette.set_group_id('frame') @@ -420,6 +449,16 @@ class WirelessDeviceView(ToolButton): path=self._device.object_path, dbus_interface=_NM_DEVICE_IFACE) + obj = self._bus.get_object(_NM_SERVICE, _NM_PATH) + network_manager = dbus.Interface(obj, _NM_IFACE) + self._nm_props = dbus.Interface(network_manager, dbus.PROPERTIES_IFACE) +
Re: [Sugar-devel] [DESIGN] [PATCH RFC sugar] Wireless network Frame device: add suport for disabling wireless devices
On 27 Jun 2011, at 14:49, Walter Bender walter.ben...@gmail.com wrote: On Mon, Jun 27, 2011 at 9:44 AM, Gary Martin garycmar...@googlemail.com wrote: Hi Sascha, On 27 Jun 2011, at 12:27, Sascha Silbe si...@activitycentral.com wrote: This duplicates the existing functionality in the Control Panel for more convenient access. Disabling wifi devices can save power, thereby increasing battery life. Signed-off-by: Sascha Silbe si...@activitycentral.com --- This is fully working but I'm not sure about the correct way to change the label of a MenuItem. Accessing it via MenuItem.child seems hacky. Suggestions? We could also do with a better icon. Maybe something like the circles from emblem-outofrange combined with the arrow from emblem-charging, striking out the arrow depending on the current action (disable or enable wifi)? I'll have a think. Since the wiki is down I've uploaded the screenshot to the scratch area on my own server [1,2]. [1] http://sascha.silbe.org/tmp/sugar-wifi-conn-disable.png [2] http://sascha.silbe.org/tmp/sugar-wifi-enable.png Thanks for the screenshots. For the sugar-wifi-enable palette can we loose the empty section at the top, or perhaps if that's complicated we can place some descriptive text there so it doesn't look like a bug? Would the text better read as Enable my wireless radio and Disable my wireless radio? Wireless radio is a bit redundant, do you think? :) Lol, how true! :) I was trying to avoid 'devices' as it's a little technical, and not used elsewhere in sugar that I remember — so looked at the language used in the Networking module, 'Turn off the wireless radio to save battery life'... I'd like to claim I was a victim of group think :) How about 'Enable my radio network' with 'Disable my radio network'? Or 'Enable my wireless network' with 'Disable my wireless network'? --Gary -walter How does this interact with Mesh/Adhoc? I assume their icons will vanish from the neighbourhood as well, and their palettes will have the same enable/disable radio menu option? Regards, --Gary extensions/deviceicon/network.py | 57 ++ 1 files changed, 57 insertions(+), 0 deletions(-) diff --git a/extensions/deviceicon/network.py b/extensions/deviceicon/network.py index 9a74237..85ca884 100644 --- a/extensions/deviceicon/network.py +++ b/extensions/deviceicon/network.py @@ -72,12 +72,15 @@ class WirelessPalette(Palette): __gsignals__ = { 'deactivate-connection': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])), +'disable-wifi': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, []), +'enable-wifi': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, []), } def __init__(self, primary_text): Palette.__init__(self, label=primary_text) self._disconnect_item = None +self._enabled = True self._channel_label = gtk.Label() self._channel_label.props.xalign = 0.0 @@ -109,6 +112,13 @@ class WirelessPalette(Palette): self.__disconnect_activate_cb) self.menu.append(self._disconnect_item) +label = glib.markup_escape_text(_('Disable all wireless devices')) +self._powercontrol_item = MenuItem(label, 'system-shutdown') +self._powercontrol_item.connect('activate', +self.__powercontrol_activate_cb) +self._powercontrol_item.show() +self.menu.append(self._powercontrol_item) + def set_connecting(self): self.props.secondary_text = _('Connecting...') @@ -132,9 +142,26 @@ class WirelessPalette(Palette): self._disconnect_item.hide() self.set_content(None) +def set_enabled(self, enabled): +self._enabled = enabled +if enabled: +label = glib.markup_escape_text(_('Disable all wireless devices')) +else: +self.set_disconnected() +label = glib.markup_escape_text(_('Enable wireless devices')) + +# FIXME: what's the right way to do this? +self._powercontrol_item.child.set_markup(label) + def __disconnect_activate_cb(self, menuitem): self.emit('deactivate-connection') +def __powercontrol_activate_cb(self, menuitem): +if self._enabled: +self.emit('disable-wifi') +else: +self.emit('enable-wifi') + def _set_frequency(self, frequency): channel = network.frequency_to_channel(frequency) self._set_channel(channel) @@ -402,6 +429,8 @@ class WirelessDeviceView(ToolButton): self._palette = WirelessPalette(self._name) self._palette.connect('deactivate-connection', self.__deactivate_connection_cb) +self._palette.connect('disable-wifi', self.__disable_wifi_cb) +