diff options
author | Simon Schampijer <simon@laptop.org> | 2012-09-12 11:03:00 (GMT) |
---|---|---|
committer | Simon Schampijer <simon@laptop.org> | 2012-09-12 13:38:21 (GMT) |
commit | ab8570784532f9b5a77d60a563da1726a678980e (patch) | |
tree | 8e2e0b21e600b1f93000ce02944d3122c728e914 /src | |
parent | 135dd2cce4f796f55b4c81aa3778ea8cffc927eb (diff) |
Replace cairo.RectangleInt with Gdk.Rectangle
The Gdk.Rectangle is basically a cairo.RectangleInt but that way we
do not need to import the dynamic cairo bindings explicitly.
Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel QuiƱones <manuq@laptop.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/jarabe/desktop/favoriteslayout.py | 15 | ||||
-rw-r--r-- | src/jarabe/desktop/grid.py | 6 | ||||
-rw-r--r-- | src/jarabe/frame/frameinvoker.py | 3 | ||||
-rw-r--r-- | src/jarabe/frame/framewindow.py | 3 |
4 files changed, 12 insertions, 15 deletions
diff --git a/src/jarabe/desktop/favoriteslayout.py b/src/jarabe/desktop/favoriteslayout.py index 13b5095..a367ab6 100644 --- a/src/jarabe/desktop/favoriteslayout.py +++ b/src/jarabe/desktop/favoriteslayout.py @@ -22,7 +22,6 @@ from gettext import gettext as _ from gi.repository import Gtk from gi.repository import Gdk -from gi.repository import cairo from sugar3.graphics import style @@ -86,7 +85,7 @@ class ViewLayout(Layout): y -= owner_height / 2 # calculate x coordinate and create allocation - owner_icon_allocation = cairo.RectangleInt() + owner_icon_allocation = Gdk.Rectangle() owner_icon_allocation.x = (width - owner_width) / 2 owner_icon_allocation.y = allocation.y + y owner_icon_allocation.width = owner_width @@ -107,7 +106,7 @@ class ViewLayout(Layout): # Position the current activity below the XO icon # FIXME must ensure we cross into next grid cell here.. activity_request = activity_icon.size_request() - activity_icon_allocation = cairo.RectangleInt() + activity_icon_allocation = Gdk.Rectangle() activity_icon_allocation.x = (width - activity_request.width) / 2 activity_icon_allocation.y = owner_icon_allocation.y + owner_height activity_icon_allocation.width = activity_request.width @@ -130,7 +129,7 @@ class ViewLayout(Layout): child_request = child.size_request() rect = self._grid.get_child_rect(child) - child_allocation = cairo.RectangleInt() + child_allocation = Gdk.Rectangle() child_allocation.x = int(round(rect.x * _CELL_SIZE)) child_allocation.y = int(round(rect.y * _CELL_SIZE)) child_allocation.width = child_request.width @@ -146,7 +145,7 @@ class ViewLayout(Layout): def __grid_child_changed_cb(self, grid, child): request = child.size_request() rect = self._grid.get_child_rect(child) - child_allocation = cairo.RectangleInt() + child_allocation = Gdk.Rectangle() child_allocation.x = int(round(rect.x * _CELL_SIZE)) child_allocation.y = int(round(rect.y * _CELL_SIZE)) child_allocation.width = request.width @@ -175,7 +174,7 @@ class SpreadLayout(ViewLayout): requisition = child.size_request() rect = self._grid.get_child_rect(child) - child_allocation = cairo.RectangleInt() + child_allocation = Gdk.Rectangle() child_allocation.x = int(round(rect.x * _CELL_SIZE)) child_allocation.y = int(round(rect.y * _CELL_SIZE)) + allocation.y child_allocation.width = requisition.width @@ -248,7 +247,7 @@ class RandomLayout(SpreadLayout): x / _CELL_SIZE, y / _CELL_SIZE) rect = self._grid.get_child_rect(child) - child_allocation = cairo.RectangleInt() + child_allocation = Gdk.Rectangle() child_allocation.x = int(round(rect.x * _CELL_SIZE)) child_allocation.y = int(round(rect.y * _CELL_SIZE)) + allocation.y child_allocation.width = child_requisition.width @@ -380,7 +379,7 @@ class RingLayout(ViewLayout): allocation.height) child.size_request() child.set_size(icon_size) - child_allocation = cairo.RectangleInt() + child_allocation = Gdk.Rectangle() child_allocation.x = allocation.x + x child_allocation.y = allocation.y + y child_allocation.width = icon_size diff --git a/src/jarabe/desktop/grid.py b/src/jarabe/desktop/grid.py index aa7dce2..851c23e 100644 --- a/src/jarabe/desktop/grid.py +++ b/src/jarabe/desktop/grid.py @@ -19,7 +19,7 @@ import random from gi.repository import GObject from gi.repository import Gtk -from gi.repository import cairo +from gi.repository import Gdk from gi.repository import SugarExt @@ -49,7 +49,7 @@ class Grid(SugarExt.Grid): def add(self, child, width, height, x=None, y=None, locked=False): if x is not None and y is not None: - rect = cairo.RectangleInt() + rect = Gdk.Rectangle() rect.x = x rect.y = y rect.width = width @@ -59,7 +59,7 @@ class Grid(SugarExt.Grid): trials = _PLACE_TRIALS weight = _MAX_WEIGHT while trials > 0 and weight: - rect = cairo.RectangleInt() + rect = Gdk.Rectangle() rect.x = int(random.random() * (self.width - width)) rect.y = int(random.random() * (self.height - height)) rect.width = width diff --git a/src/jarabe/frame/frameinvoker.py b/src/jarabe/frame/frameinvoker.py index a2d5fb2..b9cd11d 100644 --- a/src/jarabe/frame/frameinvoker.py +++ b/src/jarabe/frame/frameinvoker.py @@ -16,7 +16,6 @@ from gi.repository import Gtk from gi.repository import Gdk -from gi.repository import cairo from sugar3.graphics import style from sugar3.graphics.palette import WidgetInvoker @@ -25,7 +24,7 @@ from sugar3.graphics.palette import WidgetInvoker def _get_screen_area(): frame_thickness = style.GRID_CELL_SIZE - screen_area = cairo.RectangleInt() + screen_area = Gdk.Rectangle() screen_area.x = screen_area.y = frame_thickness screen_area.width = Gdk.Screen.width() - frame_thickness screen_area.height = Gdk.Screen.height() - frame_thickness diff --git a/src/jarabe/frame/framewindow.py b/src/jarabe/frame/framewindow.py index 70c52ae..6d1b324 100644 --- a/src/jarabe/frame/framewindow.py +++ b/src/jarabe/frame/framewindow.py @@ -16,7 +16,6 @@ from gi.repository import Gtk from gi.repository import Gdk -from gi.repository import cairo from sugar3.graphics import style @@ -82,7 +81,7 @@ class FrameContainer(Gtk.Bin): # exclude grid squares at two ends of the frame # allocate remaining space to child box, minus the space needed for # drawing the border - allocation = cairo.RectangleInt() + allocation = Gdk.Rectangle() if self.is_vertical(): allocation.x = 0 if self._position == Gtk.PositionType.LEFT \ else style.LINE_WIDTH |