Eben Eliason wrote:
I made the following changes to the patch:
- display the AP icon in the palette in color
- display the badge as well
- removed the channel info in the secondary-text (for now)
Sounds good.
What do you mean here?
+ self.props.icon_name = icon_name
+ # This breaks style guidelines; we should store a reference
+ self._palette._icon.props.icon_name = icon_name
I'm accessing the private _icon member of the palette class, rather
than keeping a reference to it to use for this purpose. It was a
quick hack.
I changed this now to be:
+ self.props.icon_name = icon_name
+ icon = self._palette.props.icon
+ icon.props.icon_name = icon_name
Full patch is attached.
The Connect icon is 'dialog-ok' the disconnect 'media-eject', should we
make this 'dialog-cancel' to be consistent?
Well, it's consistent in naming, but not necessarily in experience.
Where possible, I'd like to find ways to avoid the overloaded 'x'
icon. It seems that using the eject icon for various types of
external media makes sense, and I thought it might also apply to
access points, which we treat as wireless devices. Alternately, I'd
be open to a better suggestion for a "connect" icon.
Yeah that sounds maybe like the best approach - to have a specific icon
for connect/disconnect. Using a plug (connected/unconnected) icon might
suggest a physical connection - not sure if we would want that
association. Let's see if I can come up with something better.
Another thought that come to my mind - the AP icon in the frame should
maybe come with a badge as well.
Hmm, perhaps. Although I'm not sure that the info provided by the
badge is needed once it is shown in the Frame anyway. Also, we need to
leave room for an alert badge if the wireless device in the Frame has
trouble. I'd leave it as is, for now.
I thought of it more like instantly knowing which AP you are connecting
to. The badge is a visual hint as well. But the alert badge might be a
reason not to have it.
Simon
diff --git a/src/view/home/MeshBox.py b/src/view/home/MeshBox.py
index 427e08a..20e3402 100644
--- a/src/view/home/MeshBox.py
+++ b/src/view/home/MeshBox.py
@@ -55,6 +55,7 @@ class AccessPointView(CanvasPulsingIcon):
self._model = model
self._meshdev = mesh_device
self._disconnect_item = None
+ self._connect_item = None
self._greyed_out = False
self.connect('activated', self._activate_cb)
@@ -67,13 +68,6 @@ class AccessPointView(CanvasPulsingIcon):
style.COLOR_TRANSPARENT.get_svg()))
self.props.pulse_color = pulse_color
- self._palette = self._create_palette()
- self.set_palette(self._palette)
-
- self._update_icon()
- self._update_name()
- self._update_state()
-
# Update badge
caps = model.props.capabilities
if model.get_nm_network().is_favorite():
@@ -81,20 +75,38 @@ class AccessPointView(CanvasPulsingIcon):
elif (caps & NM_802_11_CAP_PROTO_WEP) or (caps & NM_802_11_CAP_PROTO_WPA) or (caps & NM_802_11_CAP_PROTO_WPA2):
self.props.badge_name = "emblem-locked"
+ self._palette = self._create_palette()
+ self.set_palette(self._palette)
+
+ self._update_icon()
+ self._update_name()
+ self._update_state()
+
def _create_palette(self):
- p = palette.Palette(self._model.props.name, menu_after_content=True)
- if not self._meshdev:
- return p
+ icon_name = get_icon_state(_ICON_NAME, self._model.props.strength)
+ palette_icon = Icon(icon_name=icon_name,
+ icon_size=style.STANDARD_ICON_SIZE,
+ badge_name=self.props.badge_name)
+ ap_color = self._model.get_nm_network().get_colors()
+ palette_icon.props.xo_color = XoColor('%s,%s' % ap_color)
+
+ p = palette.Palette(primary_text=self._model.props.name,
+ icon=palette_icon)
+
+ self._connect_item = MenuItem(_('Connect'), 'dialog-ok')
+ self._connect_item.connect('activate', self._activate_cb)
+ p.menu.append(self._connect_item)
# Only show disconnect when there's a mesh device, because mesh takes
# priority over the normal wireless device. NM doesn't have a "disconnect"
# method for a device either (for various reasons) so this doesn't
- # have a good mapping
- self._disconnect_item = gtk.MenuItem(_('Disconnect...'))
- self._disconnect_item.connect('activate', self._disconnect_activate_cb)
- p.menu.append(self._disconnect_item)
- if self._model.props.state == accesspointmodel.STATE_CONNECTED:
- self._disconnect_item.show()
+ # have a good mapping
+ if self._meshdev:
+ self._disconnect_item = MenuItem(_('Disconnect'), 'media-eject')
+ self._disconnect_item.connect('activate',
+ self._disconnect_activate_cb)
+ p.menu.append(self._disconnect_item)
+
return p
def _disconnect_activate_cb(self, menuitem):
@@ -120,25 +132,33 @@ class AccessPointView(CanvasPulsingIcon):
network_manager.set_active_device(device, network)
def _update_name(self):
- self._palette.set_primary_text(self._model.props.name)
+ self._palette.props.primary_text = self._model.props.name
def _update_icon(self):
icon_name = get_icon_state(_ICON_NAME, self._model.props.strength)
if icon_name:
- self.props.icon_name = icon_name
+ self.props.icon_name = icon_name
+ icon = self._palette.props.icon
+ icon.props.icon_name = icon_name
def _update_state(self):
if self._model.props.state == accesspointmodel.STATE_CONNECTING:
if self._disconnect_item:
- self._disconnect_item.hide()
+ self._disconnect_item.show()
+ self._connect_item.hide()
+ self._palette.props.secondary_text = _('Connecting...')
self.props.pulsing = True
elif self._model.props.state == accesspointmodel.STATE_CONNECTED:
if self._disconnect_item:
self._disconnect_item.show()
+ self._connect_item.hide()
+ # TODO: show the channel number
self.props.pulsing = False
elif self._model.props.state == accesspointmodel.STATE_NOTCONNECTED:
if self._disconnect_item:
self._disconnect_item.hide()
+ self._connect_item.show()
+ # TODO: show the channel number
self.props.pulsing = False
if self._greyed_out:
_______________________________________________
Sugar mailing list
[email protected]
http://lists.laptop.org/listinfo/sugar