Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-03-16 02:03:42 (GMT)
committer Dan Williams <dcbw@redhat.com>2007-03-16 02:03:42 (GMT)
commitb45c810ca1263f797b387548fffa8ed4ee738490 (patch)
treee9ca1e766a3d45cfceb6d68c22f7eaa0d1890819 /shell
parentd0c5050a254a30576353fbbe2f99a2131a2a9cfd (diff)
Make access points have persistent colors
Diffstat (limited to 'shell')
-rw-r--r--shell/view/home/MeshBox.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/shell/view/home/MeshBox.py b/shell/view/home/MeshBox.py
index df6b8ec..6af48d6 100644
--- a/shell/view/home/MeshBox.py
+++ b/shell/view/home/MeshBox.py
@@ -23,6 +23,7 @@ from sugar.graphics.spreadbox import SpreadBox
from sugar.graphics.snowflakebox import SnowflakeBox
from sugar.graphics.canvasicon import CanvasIcon
from sugar.graphics import color
+from sugar.graphics import xocolor
from sugar.graphics import canvasicon
from model import accesspointmodel
from hardware import hardwaremanager
@@ -42,9 +43,19 @@ class AccessPointView(PulsingIcon):
model.connect('notify::name', self._name_changed_cb)
model.connect('notify::state', self._state_changed_cb)
+ import sha
+ sh = sha.new()
+ data = self._model.props.name + hex(self._model.props.capabilities) + \
+ hex(self._model.props.mode)
+ sh.update(data)
+ h = hash(sh.digest())
+ idx = h % len(xocolor._colors)
+ self._inactive_stroke_color = xocolor._colors[idx][0]
+ self._inactive_fill_color = xocolor._colors[idx][1]
+
self.props.colors = [
[ None, None ],
- [ color.ICON_FILL_INACTIVE, color.ICON_STROKE_INACTIVE ]
+ [ self._inactive_stroke_color, self._inactive_fill_color ]
]
self._update_icon()
@@ -85,8 +96,8 @@ class AccessPointView(PulsingIcon):
self.props.stroke_color = None
elif self._model.props.state == accesspointmodel.STATE_NOTCONNECTED:
self.props.pulsing = False
- self.props.fill_color = color.ICON_FILL_INACTIVE
- self.props.stroke_color = color.ICON_STROKE_INACTIVE
+ self.props.fill_color = color.HTMLColor(self._inactive_fill_color)
+ self.props.stroke_color = color.HTMLColor(self._inactive_stroke_color)
class ActivityView(SnowflakeBox):
def __init__(self, shell, menu_shell, model):