Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/OficinaActivity.py
diff options
context:
space:
mode:
authorManuel Kaufmann <humitos@gmail.com>2012-06-19 17:51:23 (GMT)
committer Manuel QuiƱones <manuq@laptop.org>2012-06-19 21:06:05 (GMT)
commit05379e0238aeda8b3f162cd718e0aff0d77371d2 (patch)
tree870e3ce24822911886508d2d91941b7f9bc560ca /OficinaActivity.py
parent685ca78f102f3559836216d21718b1706aa3a231 (diff)
Center images smaller than the canvas SL #3677
Rotate and center the image. Besides, if a smaller (than the canvas) image is opened it is centered on the screen. Signed-off-by: Manuel Kaufmann <humitos@gmail.com> Acked-by: Manuel QuiƱones <manuq@laptop.org>
Diffstat (limited to 'OficinaActivity.py')
-rw-r--r--OficinaActivity.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/OficinaActivity.py b/OficinaActivity.py
index 1745d0a..64dace4 100644
--- a/OficinaActivity.py
+++ b/OficinaActivity.py
@@ -201,13 +201,15 @@ class OficinaActivity(activity.Activity):
canvas_width = self.canvas.allocation.width
canvas_height = self.canvas.allocation.height
area_width, area_height = self.area.get_size_request()
- x = (canvas_width - area_width) / 2
- y = (canvas_height - area_height) / 2
+
+ # Avoid 'x' and 'y' to be outside the screen
+ x = max(0, (canvas_width - area_width) / 2)
+ y = max(0, (canvas_height - area_height) / 2)
return x, y
def center_area(self):
x, y = self._get_area_displacement()
- self.fixed.move(self.area, x, 0)
+ self.fixed.move(self.area, x, y)
def move_textview(self, dx, dy):
x, y = self._get_area_displacement()