From 1f8ff1db1fddbf60fc776c484b980d8926c44538 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Wed, 4 Oct 2006 00:55:20 +0200 Subject: [PATCH] Move all the canvas code that doesn't depend on goocanvas anymore in graphics. --- shell/conf/Profile.py | 8 ++++---- shell/model/BuddyModel.py | 2 +- shell/model/Invites.py | 2 +- shell/model/MeshModel.py | 2 +- shell/view/ActivityHost.py | 2 +- shell/view/frame/Frame.py | 4 ++-- shell/view/frame/RightPanel.py | 2 +- shell/view/home/HomeWindow.py | 2 +- shell/view/home/MeshBox.py | 2 +- shell/view/home/MyIcon.py | 2 +- sugar/canvas/IconItem.py | 2 +- sugar/graphics/__init__.py | 2 +- sugar/graphics/canvasicon.py | 2 +- sugar/{canvas/Colors.py => graphics/colors.py} | 0 sugar/{canvas/IconColor.py => graphics/iconcolor.py} | 6 +++--- sugar/{canvas/MenuShell.py => graphics/menushell.py} | 0 .../SnowflakeLayout.py => graphics/snowflakelayout.py} | 0 sugar/{canvas/Timeline.py => graphics/timeline.py} | 0 tests/simulator/kiu.py | 2 +- tests/test-grid.py | 10 +++++----- tests/test-icon-layout.py | 8 ++++---- tests/test-icons.py | 6 +++--- tests/test-snowflake.py | 10 +++++----- tests/test-theme.py | 6 +++--- 24 files changed, 41 insertions(+), 41 deletions(-) rename sugar/{canvas/Colors.py => graphics/colors.py} (100%) rename sugar/{canvas/IconColor.py => graphics/iconcolor.py} (82%) rename sugar/{canvas/MenuShell.py => graphics/menushell.py} (100%) rename sugar/{canvas/SnowflakeLayout.py => graphics/snowflakelayout.py} (100%) rename sugar/{canvas/Timeline.py => graphics/timeline.py} (100%) diff --git a/shell/conf/Profile.py b/shell/conf/Profile.py index ced73cf2..30172ff4 100644 --- a/shell/conf/Profile.py +++ b/shell/conf/Profile.py @@ -1,14 +1,14 @@ import os from ConfigParser import ConfigParser -from sugar.canvas import IconColor +from sugar.graphics import iconcolor from sugar import env class _Profile: def __init__(self,): self._path = env.get_profile_path() self._nick_name = None - self._color = IconColor.IconColor() + self._color = iconcolor.IconColor() self._ensure_dirs() @@ -19,8 +19,8 @@ class _Profile: self._nick_name = cp.get('Buddy', 'NickName') if cp.has_option('Buddy', 'Color'): color = cp.get('Buddy', 'Color') - if IconColor.is_valid(color): - self._color = IconColor.IconColor(color) + if iconcolor.is_valid(color): + self._color = iconcolor.IconColor(color) def _ensure_dirs(self): try: diff --git a/shell/model/BuddyModel.py b/shell/model/BuddyModel.py index 0a4f1c9b..310cb229 100644 --- a/shell/model/BuddyModel.py +++ b/shell/model/BuddyModel.py @@ -1,5 +1,5 @@ from sugar.presence import PresenceService -from sugar.canvas.IconColor import IconColor +from sugar.graphics.iconcolor import IconColor import gobject _NOT_PRESENT_COLOR = "#888888,#BBBBBB" diff --git a/shell/model/Invites.py b/shell/model/Invites.py index 24f99134..87dd03ed 100644 --- a/shell/model/Invites.py +++ b/shell/model/Invites.py @@ -2,7 +2,7 @@ import gobject import conf from sugar.presence import PresenceService -from sugar.canvas.IconColor import IconColor +from sugar.graphics.iconcolor import IconColor class Invite: def __init__(self, issuer, bundle_id, activity_id): diff --git a/shell/model/MeshModel.py b/shell/model/MeshModel.py index d8b86407..a95cecfe 100644 --- a/shell/model/MeshModel.py +++ b/shell/model/MeshModel.py @@ -1,7 +1,7 @@ import gobject import conf -from sugar.canvas.IconItem import IconColor +from sugar.graphics.iconcolor import IconColor from sugar.presence import PresenceService from model.BuddyModel import BuddyModel diff --git a/shell/view/ActivityHost.py b/shell/view/ActivityHost.py index 259f3fb1..d03e398e 100644 --- a/shell/view/ActivityHost.py +++ b/shell/view/ActivityHost.py @@ -4,7 +4,7 @@ import dbus import conf from sugar.activity import Activity from sugar.presence import PresenceService -from sugar.canvas.IconColor import IconColor +from sugar.graphics.iconcolor import IconColor from sugar.p2p import Stream from sugar.p2p import network from sugar.chat import ActivityChat diff --git a/shell/view/frame/Frame.py b/shell/view/frame/Frame.py index 1c82b49b..9b43fd1c 100644 --- a/shell/view/frame/Frame.py +++ b/shell/view/frame/Frame.py @@ -6,8 +6,8 @@ import wnck from view.frame.ActivitiesBox import ActivitiesBox from view.frame.ZoomBox import ZoomBox from view.frame.PanelWindow import PanelWindow -from sugar.canvas.Timeline import Timeline -from sugar.canvas.MenuShell import MenuShell +from sugar.graphics.timeline import Timeline +from sugar.graphics.menushell import MenuShell from sugar.graphics.grid import Grid class EventFrame(gobject.GObject): diff --git a/shell/view/frame/RightPanel.py b/shell/view/frame/RightPanel.py index 9c164020..366dbfda 100644 --- a/shell/view/frame/RightPanel.py +++ b/shell/view/frame/RightPanel.py @@ -1,7 +1,7 @@ import hippo from sugar.graphics.CanvasIcon import CanvasIcon -from sugar.canvas.IconColor import IconColor +from sugar.graphics.iconcolor import IconColor from sugar.presence import PresenceService from view.BuddyIcon import BuddyIcon from model.BuddyModel import BuddyModel diff --git a/shell/view/home/HomeWindow.py b/shell/view/home/HomeWindow.py index fad4476f..e58447cc 100644 --- a/shell/view/home/HomeWindow.py +++ b/shell/view/home/HomeWindow.py @@ -4,7 +4,7 @@ import hippo import cairo from sugar.canvas.CanvasView import CanvasView -from sugar.canvas.MenuShell import MenuShell +from sugar.graphics.menushell import MenuShell from view.home.MeshBox import MeshBox from view.home.HomeGroup import HomeGroup from view.home.FriendsBox import FriendsBox diff --git a/shell/view/home/MeshBox.py b/shell/view/home/MeshBox.py index f97de7b8..281ddc1a 100644 --- a/shell/view/home/MeshBox.py +++ b/shell/view/home/MeshBox.py @@ -5,7 +5,7 @@ import hippo from sugar.graphics.spreadlayout import SpreadLayout from sugar.graphics.canvasicon import CanvasIcon from view.BuddyIcon import BuddyIcon -from sugar.canvas.SnowflakeLayout import SnowflakeLayout +from sugar.graphics.snowflakelayout import SnowflakeLayout import conf class ActivityView(hippo.CanvasBox): diff --git a/shell/view/home/MyIcon.py b/shell/view/home/MyIcon.py index 226520d2..0671bec9 100644 --- a/shell/view/home/MyIcon.py +++ b/shell/view/home/MyIcon.py @@ -1,6 +1,6 @@ import conf from sugar.canvas.IconItem import IconItem -from sugar.canvas.IconColor import IconColor +from sugar.graphics.iconcolor import IconColor class MyIcon(IconItem): def __init__(self, size): diff --git a/sugar/canvas/IconItem.py b/sugar/canvas/IconItem.py index 52b8bc60..dfc17760 100644 --- a/sugar/canvas/IconItem.py +++ b/sugar/canvas/IconItem.py @@ -7,7 +7,7 @@ import rsvg import cairo from sugar.util import GObjectSingletonMeta -from sugar.canvas.IconColor import IconColor +from sugar.graphics.iconcolor import IconColor class _IconCache: def __init__(self): diff --git a/sugar/graphics/__init__.py b/sugar/graphics/__init__.py index b494b9f9..b3c54e1e 100644 --- a/sugar/graphics/__init__.py +++ b/sugar/graphics/__init__.py @@ -1,7 +1,7 @@ import gtk from sugar.graphics import style -from sugar.canvas.IconColor import IconColor +from sugar.graphics.iconcolor import IconColor if gtk.gdk.screen_width() == 1200: _medium_icon_size = 75 diff --git a/sugar/graphics/canvasicon.py b/sugar/graphics/canvasicon.py index 17a0193d..4da00616 100644 --- a/sugar/graphics/canvasicon.py +++ b/sugar/graphics/canvasicon.py @@ -6,7 +6,7 @@ import hippo import rsvg import cairo -from sugar.canvas.IconColor import IconColor +from sugar.graphics.iconcolor import IconColor class _IconCache: def __init__(self): diff --git a/sugar/canvas/Colors.py b/sugar/graphics/colors.py similarity index 100% rename from sugar/canvas/Colors.py rename to sugar/graphics/colors.py diff --git a/sugar/canvas/IconColor.py b/sugar/graphics/iconcolor.py similarity index 82% rename from sugar/canvas/IconColor.py rename to sugar/graphics/iconcolor.py index 77e67ef3..97c13c84 100644 --- a/sugar/canvas/IconColor.py +++ b/sugar/graphics/iconcolor.py @@ -1,6 +1,6 @@ import random -from sugar.canvas import Colors +from sugar.graphics.colors import colors def _parse_string(color_string): if color_string == 'white': @@ -18,8 +18,8 @@ def is_valid(color_string): class IconColor: def __init__(self, color_string=None): if color_string == None or not is_valid(color_string): - n = int(random.random() * (len(Colors.colors) - 1)) - [self._stroke, self._fill] = Colors.colors[n] + n = int(random.random() * (len(colors) - 1)) + [self._stroke, self._fill] = colors[n] else: [self._stroke, self._fill] = _parse_string(color_string) diff --git a/sugar/canvas/MenuShell.py b/sugar/graphics/menushell.py similarity index 100% rename from sugar/canvas/MenuShell.py rename to sugar/graphics/menushell.py diff --git a/sugar/canvas/SnowflakeLayout.py b/sugar/graphics/snowflakelayout.py similarity index 100% rename from sugar/canvas/SnowflakeLayout.py rename to sugar/graphics/snowflakelayout.py diff --git a/sugar/canvas/Timeline.py b/sugar/graphics/timeline.py similarity index 100% rename from sugar/canvas/Timeline.py rename to sugar/graphics/timeline.py diff --git a/tests/simulator/kiu.py b/tests/simulator/kiu.py index 4c1b6c0d..18f30fd1 100755 --- a/tests/simulator/kiu.py +++ b/tests/simulator/kiu.py @@ -2,7 +2,7 @@ from sugar.simulator import Bot from sugar.simulator import ShareActivityAction -from sugar.canvas.IconColor import IconColor +from sugar.graphics.iconcolor import IconColor import os, random, gobject class KiuBot(Bot): diff --git a/tests/test-grid.py b/tests/test-grid.py index ea179333..7d031372 100755 --- a/tests/test-grid.py +++ b/tests/test-grid.py @@ -10,11 +10,11 @@ session.start() import gtk import goocanvas -from sugar.canvas.IconColor import IconColor -from sugar.canvas.IconItem import IconItem -from sugar.canvas.CanvasView import CanvasView -from sugar.canvas.CanvasBox import CanvasBox -from sugar.canvas.Grid import Grid +from sugar.graphics.iconcolor import IconColor +from sugar.graphics.IconItem import IconItem +from sugar.graphics.CanvasView import CanvasView +from sugar.graphics.CanvasBox import CanvasBox +from sugar.graphics.Grid import Grid def _new_icon_clicked_cb(icon): box.remove_child(icon) diff --git a/tests/test-icon-layout.py b/tests/test-icon-layout.py index 1e3a20b7..45ea3857 100755 --- a/tests/test-icon-layout.py +++ b/tests/test-icon-layout.py @@ -15,10 +15,10 @@ import gtk import goocanvas from view.home.IconLayout import IconLayout -from sugar.canvas import IconColor -from sugar.canvas.IconItem import IconItem -from sugar.canvas.CanvasView import CanvasView -from sugar.canvas.Grid import Grid +from sugar.graphics import IconColor +from sugar.graphics.IconItem import IconItem +from sugar.graphics.CanvasView import CanvasView +from sugar.graphics.Grid import Grid def _create_icon(): color = IconColor.IconColor() diff --git a/tests/test-icons.py b/tests/test-icons.py index c4247060..f3b6037b 100755 --- a/tests/test-icons.py +++ b/tests/test-icons.py @@ -13,9 +13,9 @@ import random import gtk import hippo -from sugar.canvas import IconColor -from sugar.canvas.CanvasIcon import CanvasIcon -from sugar.canvas.CanvasView import CanvasView +from sugar.graphics import IconColor +from sugar.graphics.CanvasIcon import CanvasIcon +from sugar.graphics.CanvasView import CanvasView window = gtk.Window() window.connect("destroy", lambda w: gtk.main_quit()) diff --git a/tests/test-snowflake.py b/tests/test-snowflake.py index eeed46d9..022cfe2b 100755 --- a/tests/test-snowflake.py +++ b/tests/test-snowflake.py @@ -14,11 +14,11 @@ import random import gtk import goocanvas -from sugar.canvas.SnowflakeLayout import SnowflakeLayout -from sugar.canvas import IconColor -from sugar.canvas.IconItem import IconItem -from sugar.canvas.CanvasView import CanvasView -from sugar.canvas.Grid import Grid +from sugar.graphics.snowflakelayout import SnowflakeLayout +from sugar.graphics import IconColor +from sugar.graphics.IconItem import IconItem +from sugar.graphics.CanvasView import CanvasView +from sugar.graphics.Grid import Grid def _create_snowflake(group, children): color = IconColor.IconColor() diff --git a/tests/test-theme.py b/tests/test-theme.py index 37fe8dc9..88386f10 100755 --- a/tests/test-theme.py +++ b/tests/test-theme.py @@ -10,9 +10,9 @@ session.start() import gtk import goocanvas -from sugar.canvas import IconColor -from sugar.canvas.IconItem import IconItem -from sugar.canvas.CanvasView import CanvasView +from sugar.graphics import IconColor +from sugar.graphics.IconItem import IconItem +from sugar.graphics.CanvasView import CanvasView # Main window window = gtk.Window()