Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2007-07-31 14:46:06 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2007-07-31 14:46:06 (GMT)
commitb3f7e0e63241b8e4ea3f20924627578a9ddd136e (patch)
tree236632517d6b9ca72f1fb2807c5f9ad2c1e669d3 /shell
parent72d66793a73a3ca7924b09badb5d269b41d649a3 (diff)
Move from scaling to sizes in CanvasIcon.
Diffstat (limited to 'shell')
-rw-r--r--shell/intro/colorpicker.py4
-rw-r--r--shell/view/clipboardicon.py6
-rw-r--r--shell/view/devices/battery.py4
-rw-r--r--shell/view/devices/network/mesh.py3
-rw-r--r--shell/view/devices/network/wireless.py4
-rw-r--r--shell/view/home/FriendView.py6
-rw-r--r--shell/view/home/FriendsBox.py4
-rw-r--r--shell/view/home/HomeBox.py3
-rw-r--r--shell/view/home/HomeWindow.py10
-rw-r--r--shell/view/home/MeshBox.py4
-rw-r--r--shell/view/home/MyIcon.py4
-rw-r--r--shell/view/home/activitiesdonut.py4
-rw-r--r--shell/view/home/transitionbox.py22
13 files changed, 37 insertions, 41 deletions
diff --git a/shell/intro/colorpicker.py b/shell/intro/colorpicker.py
index 552ba7a..f7ab59c 100644
--- a/shell/intro/colorpicker.py
+++ b/shell/intro/colorpicker.py
@@ -17,7 +17,7 @@
import hippo
from sugar.graphics.canvasicon import CanvasIcon
-from sugar.graphics import units
+from sugar.graphics import style
from sugar.graphics.xocolor import XoColor
class ColorPicker(hippo.CanvasBox, hippo.CanvasItem):
@@ -25,7 +25,7 @@ class ColorPicker(hippo.CanvasBox, hippo.CanvasItem):
hippo.CanvasBox.__init__(self, **kwargs)
self.props.orientation = hippo.ORIENTATION_HORIZONTAL
- self._xo = CanvasIcon(scale=units.XLARGE_ICON_SCALE,
+ self._xo = CanvasIcon(size=style.XLARGE_ICON_SIZE,
icon_name='theme:stock-buddy')
self._set_random_colors()
self._xo.connect('activated', self._xo_activated_cb)
diff --git a/shell/view/clipboardicon.py b/shell/view/clipboardicon.py
index 5ee5467..a47104d 100644
--- a/shell/view/clipboardicon.py
+++ b/shell/view/clipboardicon.py
@@ -23,7 +23,7 @@ import gobject
from sugar.graphics.canvasicon import CanvasIcon
from view.clipboardmenu import ClipboardMenu
from sugar.graphics.xocolor import XoColor
-from sugar.graphics import units
+from sugar.graphics import style
from sugar.clipboard import clipboardservice
from sugar import util
from sugar import profile
@@ -45,9 +45,7 @@ class ClipboardIcon(CanvasIcon):
self._activity = None
self._selected = False
self._hover = False
- self.props.box_width = units.grid_to_pixels(1)
- self.props.box_height = units.grid_to_pixels(1)
- self.props.scale = units.STANDARD_ICON_SCALE
+ self.props.size = style.STANDARD_ICON_SIZE
self.props.xo_color = XoColor(profile.get_color().to_string())
cb_service = clipboardservice.get_instance()
diff --git a/shell/view/devices/battery.py b/shell/view/devices/battery.py
index adc84b0..16863d3 100644
--- a/shell/view/devices/battery.py
+++ b/shell/view/devices/battery.py
@@ -18,7 +18,7 @@ import gtk
from gettext import gettext as _
from sugar.graphics import canvasicon
-from sugar.graphics import units
+from sugar.graphics import style
from sugar.graphics.palette import Palette
_ICON_NAME = 'device-battery'
@@ -29,7 +29,7 @@ _STATUS_FULLY_CHARGED = 2
class DeviceView(canvasicon.CanvasIcon):
def __init__(self, model):
- canvasicon.CanvasIcon.__init__(self, scale=units.MEDIUM_ICON_SCALE)
+ canvasicon.CanvasIcon.__init__(self, size=style.MEDIUM_ICON_SIZE)
self._model = model
self._palette = BatteryPalette(_('My Battery life'))
self.set_palette(self._palette)
diff --git a/shell/view/devices/network/mesh.py b/shell/view/devices/network/mesh.py
index 0a0bdce..1f108cb 100644
--- a/shell/view/devices/network/mesh.py
+++ b/shell/view/devices/network/mesh.py
@@ -17,12 +17,11 @@
from sugar.graphics import canvasicon
from sugar.graphics import style
-from sugar.graphics import units
from model.devices import device
class DeviceView(canvasicon.CanvasIcon):
def __init__(self, model):
- canvasicon.CanvasIcon.__init__(self, scale=units.MEDIUM_ICON_SCALE,
+ canvasicon.CanvasIcon.__init__(self, size=style.MEDIUM_ICON_SIZE,
icon_name='theme:device-network-mesh')
self._model = model
diff --git a/shell/view/devices/network/wireless.py b/shell/view/devices/network/wireless.py
index 498a603..0be096d 100644
--- a/shell/view/devices/network/wireless.py
+++ b/shell/view/devices/network/wireless.py
@@ -17,7 +17,7 @@
from sugar.graphics import canvasicon
from sugar.graphics import style
-from sugar.graphics import units
+from sugar.graphics import style
from model.devices.network import wireless
from sugar.graphics.canvasicon import CanvasIcon
from model.devices import device
@@ -26,7 +26,7 @@ _ICON_NAME = 'device-network-wireless'
class DeviceView(CanvasIcon):
def __init__(self, model):
- CanvasIcon.__init__(self, scale=units.MEDIUM_ICON_SCALE)
+ CanvasIcon.__init__(self, size=style.MEDIUM_ICON_SIZE)
self._model = model
model.connect('notify::name', self._name_changed_cb)
diff --git a/shell/view/home/FriendView.py b/shell/view/home/FriendView.py
index a899a63..b2e87cd 100644
--- a/shell/view/home/FriendView.py
+++ b/shell/view/home/FriendView.py
@@ -18,7 +18,7 @@ import hippo
import gobject
from sugar.graphics.canvasicon import CanvasIcon
-from sugar.graphics import units
+from sugar.graphics import style
from sugar.presence import presenceservice
from model import bundleregistry
@@ -32,10 +32,10 @@ class FriendView(hippo.CanvasBox):
self._buddy = buddy
self._buddy_icon = BuddyIcon(shell, buddy)
- self._buddy_icon.props.scale = units.LARGE_ICON_SCALE
+ self._buddy_icon.props.scale = style.LARGE_ICON_SIZE
self.append(self._buddy_icon)
- self._activity_icon = CanvasIcon(scale=units.LARGE_ICON_SCALE)
+ self._activity_icon = CanvasIcon(size=style.LARGE_ICON_SIZE)
self._activity_icon_visible = False
if self._buddy.is_present():
diff --git a/shell/view/home/FriendsBox.py b/shell/view/home/FriendsBox.py
index 77218b0..473cd64 100644
--- a/shell/view/home/FriendsBox.py
+++ b/shell/view/home/FriendsBox.py
@@ -21,7 +21,7 @@ import gobject
from sugar import profile
from sugar.graphics.spreadlayout import SpreadLayout
-from sugar.graphics import units
+from sugar.graphics import style
from model.BuddyModel import BuddyModel
from view.BuddyIcon import BuddyIcon
@@ -40,7 +40,7 @@ class FriendsBox(hippo.CanvasBox):
buddy_model = BuddyModel(key=profile.get_pubkey())
self._owner_icon = BuddyIcon(shell, buddy_model)
- self._owner_icon.props.scale = units.LARGE_ICON_SCALE
+ self._owner_icon.props.size = style.LARGE_ICON_SIZE
self._layout.add_center(self._owner_icon)
friends = self._shell.get_model().get_friends()
diff --git a/shell/view/home/HomeBox.py b/shell/view/home/HomeBox.py
index fc1563a..bfb4265 100644
--- a/shell/view/home/HomeBox.py
+++ b/shell/view/home/HomeBox.py
@@ -24,7 +24,6 @@ import gtk
import hippo
import dbus
-from sugar.graphics import units
from sugar.graphics import style
from sugar.graphics.xocolor import XoColor
from sugar.graphics.palette import Palette, CanvasInvoker
@@ -46,7 +45,7 @@ class HomeBox(hippo.CanvasBox, hippo.CanvasItem):
box_height=style.zoom(450))
self.append(self._donut)
- self._my_icon = HomeMyIcon(shell, units.XLARGE_ICON_SCALE)
+ self._my_icon = HomeMyIcon(shell, style.XLARGE_ICON_SIZE)
self.append(self._my_icon, hippo.PACK_FIXED)
shell_model = shell.get_model()
diff --git a/shell/view/home/HomeWindow.py b/shell/view/home/HomeWindow.py
index 61c6203..ce8fe74 100644
--- a/shell/view/home/HomeWindow.py
+++ b/shell/view/home/HomeWindow.py
@@ -18,7 +18,7 @@ import gtk
import hippo
import cairo
-from sugar.graphics import units
+from sugar.graphics import style
from view.home.MeshBox import MeshBox
from view.home.HomeBox import HomeBox
@@ -113,13 +113,13 @@ class HomeWindow(gtk.Window):
self._canvas.set_root(self._transition_box)
if level == ShellModel.ZOOM_HOME:
- scale = units.XLARGE_ICON_SCALE
+ size = style.XLARGE_ICON_SIZE
elif level == ShellModel.ZOOM_FRIENDS:
- scale = units.LARGE_ICON_SCALE
+ size = style.LARGE_ICON_SIZE
elif level == ShellModel.ZOOM_MESH:
- scale = units.STANDARD_ICON_SCALE
+ size = style.STANDARD_ICON_SIZE
- self._transition_box.set_scale(scale)
+ self._transition_box.set_size(size)
def _transition_completed_cb(self, transition_box):
if self._level == ShellModel.ZOOM_HOME:
diff --git a/shell/view/home/MeshBox.py b/shell/view/home/MeshBox.py
index 6ea255c..e632770 100644
--- a/shell/view/home/MeshBox.py
+++ b/shell/view/home/MeshBox.py
@@ -25,7 +25,7 @@ from sugar.graphics.canvasicon import CanvasIcon
from sugar.graphics import style
from sugar.graphics import xocolor
from sugar.graphics import canvasicon
-from sugar.graphics import units
+from sugar.graphics import style
from sugar import profile
from model import accesspointmodel
@@ -120,7 +120,7 @@ _MESH_ICON_NAME = 'theme:device-network-mesh'
class MeshDeviceView(PulsingIcon):
def __init__(self, nm_device):
- PulsingIcon.__init__(self, scale=units.MEDIUM_ICON_SCALE,
+ PulsingIcon.__init__(self, size=style.MEDIUM_ICON_SIZE,
icon_name=_MESH_ICON_NAME)
self._nm_device = nm_device
self.set_tooltip(_("Mesh Network"))
diff --git a/shell/view/home/MyIcon.py b/shell/view/home/MyIcon.py
index b31c9ef..2168b0b 100644
--- a/shell/view/home/MyIcon.py
+++ b/shell/view/home/MyIcon.py
@@ -18,7 +18,7 @@ from sugar.graphics.canvasicon import CanvasIcon
from sugar import profile
class MyIcon(CanvasIcon):
- def __init__(self, scale):
- CanvasIcon.__init__(self, scale=scale,
+ def __init__(self, size):
+ CanvasIcon.__init__(self, size=size,
icon_name='theme:stock-buddy',
xo_color=profile.get_color())
diff --git a/shell/view/home/activitiesdonut.py b/shell/view/home/activitiesdonut.py
index 3ddb285..746af4f 100644
--- a/shell/view/home/activitiesdonut.py
+++ b/shell/view/home/activitiesdonut.py
@@ -20,7 +20,7 @@ import gobject
import colorsys
from sugar.graphics.canvasicon import CanvasIcon
-from sugar.graphics import units
+from sugar.graphics import style
from sugar.graphics import xocolor
from sugar import profile
@@ -56,7 +56,7 @@ class ActivityIcon(CanvasIcon):
color = self._icon_colors[self._level]
CanvasIcon.__init__(self, icon_name=icon_name, xo_color=color,
- scale=units.MEDIUM_ICON_SCALE, cache=True)
+ size=style.MEDIUM_ICON_SIZE, cache=True)
self._activity = activity
self._pulse_id = 0
diff --git a/shell/view/home/transitionbox.py b/shell/view/home/transitionbox.py
index 3c5dfe8..421bf9e 100644
--- a/shell/view/home/transitionbox.py
+++ b/shell/view/home/transitionbox.py
@@ -17,23 +17,23 @@
import hippo
import gobject
-from sugar.graphics import units
+from sugar.graphics import style
from sugar.graphics import animator
from sugar.graphics.spreadlayout import SpreadLayout
from view.home.MyIcon import MyIcon
class _Animation(animator.Animation):
- def __init__(self, icon, start_scale, end_scale):
+ def __init__(self, icon, start_size, end_size):
animator.Animation.__init__(self, 0.0, 1.0)
self._icon = icon
- self.start_scale = start_scale
- self.end_scale = end_scale
+ self.start_size = start_size
+ self.end_size = end_size
def next_frame(self, current):
- d = (self.end_scale - self.start_scale) * current
- self._icon.props.scale = self.start_scale + d
+ d = (self.end_size - self.start_size) * current
+ self._icon.props.size = self.start_size + d
class _Layout(gobject.GObject,hippo.CanvasLayout):
__gtype_name__ = 'SugarTransitionBoxLayout'
@@ -70,12 +70,12 @@ class TransitionBox(hippo.CanvasBox):
def __init__(self):
hippo.CanvasBox.__init__(self, background_color=0xe2e2e2ff)
- self._scale = units.XLARGE_ICON_SCALE
+ self._size = style.XLARGE_ICON_SIZE
self._layout = _Layout()
self.set_layout(self._layout)
- self._my_icon = MyIcon(self._scale)
+ self._my_icon = MyIcon(self._size)
self.append(self._my_icon)
self._animator = animator.Animator(0.3)
@@ -84,10 +84,10 @@ class TransitionBox(hippo.CanvasBox):
def _animation_completed_cb(self, anim):
self.emit('completed')
- def set_scale(self, scale):
+ def set_size(self, size):
self._animator.remove_all()
- self._animator.add(_Animation(self._my_icon, self._scale, scale))
+ self._animator.add(_Animation(self._my_icon, self._size, size))
self._animator.start()
- self._scale = scale
+ self._size = size