Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/view
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2007-02-28 14:42:41 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2007-02-28 14:42:41 (GMT)
commitaec4fcf874f7262a63bd08368d4cf3c16b122f44 (patch)
tree2d5c99a2d496be5209ba9020b6863ab72d959b5d /shell/view
parent0f1adfe1de7f51562a4429c47f0674becd8b5f56 (diff)
More work on devices, getting there
Diffstat (limited to 'shell/view')
-rw-r--r--shell/view/devices/battery.py7
-rw-r--r--shell/view/devices/wirelessnetwork.py28
-rw-r--r--shell/view/home/MeshBox.py28
3 files changed, 32 insertions, 31 deletions
diff --git a/shell/view/devices/battery.py b/shell/view/devices/battery.py
index a13304e..332590a 100644
--- a/shell/view/devices/battery.py
+++ b/shell/view/devices/battery.py
@@ -1,6 +1,11 @@
from view.devices import deviceview
+from sugar.graphics import canvasicon
+
+_ICON_NAME = 'device-battery'
class DeviceView(deviceview.DeviceView):
def __init__(self, model):
deviceview.DeviceView.__init__(self, model)
- self.props.icon_name = 'theme:stock-close'
+
+ icon_name = canvasicon.get_icon_state(_ICON_NAME, 60)
+ self.props.icon_name = icon_name
diff --git a/shell/view/devices/wirelessnetwork.py b/shell/view/devices/wirelessnetwork.py
index 9164810..f85700e 100644
--- a/shell/view/devices/wirelessnetwork.py
+++ b/shell/view/devices/wirelessnetwork.py
@@ -15,16 +15,12 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+from sugar.graphics import canvasicon
+from sugar.graphics import color
from view.devices import deviceview
from model.devices import wirelessnetwork
-_strength_to_icon = {
- (0, 20) : 'stock-net-wireless-00',
- (21, 40) : 'stock-net-wireless-21-40',
- (41, 60) : 'stock-net-wireless-41-60',
- (61, 80) : 'stock-net-wireless-61-80',
- (81, 100) : 'stock-net-wireless-81-100'
-}
+_ICON_NAME = 'device-network-wireless'
class DeviceView(deviceview.DeviceView):
def __init__(self, model):
@@ -52,18 +48,20 @@ class DeviceView(deviceview.DeviceView):
self.props.tooltip = self._model.props.name
def _update_icon(self):
- strength = self._model.props.strength
- for interval in _strength_to_icon.keys():
- if strength >= interval[0] and strength <= interval[1]:
- stock_name = _strength_to_icon[interval]
- self.props.icon_name = 'theme:' + stock_name
+ icon_name = canvasicon.get_icon_state(
+ _ICON_NAME, self._model.props.strength)
+ if icon_name:
+ self.props.icon_name = icon_name
def _update_state(self):
# FIXME Change icon colors once we have real icons
state = self._model.props.state
if state == wirelessnetwork.STATE_ACTIVATING:
- self.props.background_color = 0xFF0000FF
+ self.props.fill_color = color.ICON_FILL_INACTIVE
+ self.props.stroke_color = color.ICON_STROKE_INACTIVE
elif state == wirelessnetwork.STATE_ACTIVATED:
- self.props.background_color = 0x00FF00FF
+ self.props.fill_color = None
+ self.props.stroke_color = None
elif state == wirelessnetwork.STATE_INACTIVE:
- self.props.background_color = 0x00000000
+ self.props.fill_color = color.ICON_FILL_INACTIVE
+ self.props.stroke_color = color.ICON_STROKE_INACTIVE
diff --git a/shell/view/home/MeshBox.py b/shell/view/home/MeshBox.py
index ad94bef..3521c14 100644
--- a/shell/view/home/MeshBox.py
+++ b/shell/view/home/MeshBox.py
@@ -22,17 +22,13 @@ import gobject
from sugar.graphics.spreadbox import SpreadBox
from sugar.graphics.snowflakebox import SnowflakeBox
from sugar.graphics.canvasicon import CanvasIcon
+from sugar.graphics import color
from model import accesspointmodel
from hardware import hardwaremanager
from view.BuddyIcon import BuddyIcon
+from sugar.graphics import canvasicon
-_strength_to_icon = {
- (0, 20) : 'stock-net-wireless-00',
- (21, 40) : 'stock-net-wireless-21-40',
- (41, 60) : 'stock-net-wireless-41-60',
- (61, 80) : 'stock-net-wireless-61-80',
- (81, 100) : 'stock-net-wireless-81-100'
-}
+_ICON_NAME = 'device-network-wireless'
class AccessPointView(CanvasIcon):
def __init__(self, model):
@@ -69,20 +65,22 @@ class AccessPointView(CanvasIcon):
self.props.tooltip = self._model.props.name
def _update_icon(self):
- strength = self._model.props.strength
- for interval in _strength_to_icon.keys():
- if strength >= interval[0] and strength <= interval[1]:
- stock_name = _strength_to_icon[interval]
- self.props.icon_name = 'theme:' + stock_name
+ icon_name = canvasicon.get_icon_state(
+ _ICON_NAME, self._model.props.strength)
+ if icon_name:
+ self.props.icon_name = icon_name
def _update_state(self):
# FIXME Change icon colors once we have real icons
if self._model.props.state == accesspointmodel.STATE_CONNECTING:
- self.props.background_color = 0xFF0000FF
+ self.props.fill_color = color.ICON_FILL_INACTIVE
+ self.props.stroke_color = color.ICON_STROKE_INACTIVE
elif self._model.props.state == accesspointmodel.STATE_CONNECTED:
- self.props.background_color = 0x00FF00FF
+ self.props.fill_color = None
+ self.props.stroke_color = None
elif self._model.props.state == accesspointmodel.STATE_NOTCONNECTED:
- self.props.background_color = 0x00000000
+ self.props.fill_color = color.ICON_FILL_INACTIVE
+ self.props.stroke_color = color.ICON_STROKE_INACTIVE
class ActivityView(SnowflakeBox):
def __init__(self, shell, menu_shell, model):