[gnome-applets/wip/dont-use-deprecated] invest-applet: moved update_position method to gtk3
- From: Enrico Minack <eminack src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-applets/wip/dont-use-deprecated] invest-applet: moved update_position method to gtk3
- Date: Fri, 22 Apr 2011 10:02:38 +0000 (UTC)
commit 5828a7fc0b05baa6731904799294f7fb18f6faee
Author: Enrico Minack <enrico-minack gmx de>
Date: Fri Apr 22 12:00:35 2011 +0200
invest-applet: moved update_position method to gtk3
invest-applet/invest/applet.py | 128 ++++++++++++++++++++--------------------
1 files changed, 64 insertions(+), 64 deletions(-)
---
diff --git a/invest-applet/invest/applet.py b/invest-applet/invest/applet.py
index 18f361e..a73dece 100644
--- a/invest-applet/invest/applet.py
+++ b/invest-applet/invest/applet.py
@@ -137,71 +137,71 @@ class InvestmentsListWindow(Gtk.Window):
Calculates the position and moves the window to it.
"""
self.realize()
- self.set_gravity(Gdk.Gravity.SOUTH_WEST)
+
+ window = self.applet.get_window()
+ screen = window.get_screen()
+ monitor = screen.get_monitor_geometry (screen.get_monitor_at_window (window))
# Get our own dimensions & position
#(wx, wy) = self.get_origin()
-# (ax, ay) = self.applet.window.get_origin()
-#
-# (ww, wh) = self.get_size ()
-# (aw, ah) = self.applet.window.get_size ()
-#
-# screen = self.applet.window.get_screen()
-# monitor = screen.get_monitor_geometry (screen.get_monitor_at_window (self.applet.window))
-#
-# if self.alignment == PanelApplet.ORIENT_LEFT:
-# x = ax - ww
-# y = ay
-#
-# if (y + wh > monitor.y + monitor.height):
-# y = monitor.y + monitor.height - wh
-#
-# if (y < 0):
-# y = 0
-#
-# if (y + wh > monitor.height / 2):
-# gravity = gtk.gdk.GRAVITY_SOUTH_WEST
-# else:
-# gravity = gtk.gdk.GRAVITY_NORTH_WEST
-#
-# elif self.alignment == gnomeapplet.ORIENT_RIGHT:
-# x = ax + aw
-# y = ay
-#
-# if (y + wh > monitor.y + monitor.height):
-# y = monitor.y + monitor.height - wh
-#
-# if (y < 0):
-# y = 0
-#
-# if (y + wh > monitor.height / 2):
-# gravity = gtk.gdk.GRAVITY_SOUTH_EAST
-# else:
-# gravity = gtk.gdk.GRAVITY_NORTH_EAST
-#
-# elif self.alignment == gnomeapplet.ORIENT_DOWN:
-# x = ax
-# y = ay + ah
-#
-# if (x + ww > monitor.x + monitor.width):
-# x = monitor.x + monitor.width - ww
-#
-# if (x < 0):
-# x = 0
-#
-# gravity = gtk.gdk.GRAVITY_NORTH_WEST
-# elif self.alignment == gnomeapplet.ORIENT_UP:
-# x = ax
-# y = ay - wh
-#
-# if (x + ww > monitor.x + monitor.width):
-# x = monitor.x + monitor.width - ww
-#
-# if (x < 0):
-# x = 0
-#
-# gravity = gtk.gdk.GRAVITY_SOUTH_WEST
-#
-# self.move(x, y)
-# self.set_gravity(gravity)
+ (ret, ax, ay) = window.get_origin()
+
+ (ww, wh) = self.get_size()
+ (ignored, ignored, aw, ah) = window.get_geometry()
+
+ if self.alignment == PanelApplet.AppletOrient.LEFT:
+ x = ax - ww
+ y = ay
+
+ if (y + wh > monitor.y + monitor.height):
+ y = monitor.y + monitor.height - wh
+
+ if (y < 0):
+ y = 0
+
+ if (y + wh > monitor.height / 2):
+ gravity = Gdk.Gravity.SOUTH_WEST
+ else:
+ gravity = Gdk.Gravity.NORTH_WEST
+
+ elif self.alignment == PanelApplet.AppletOrient.RIGHT:
+ x = ax + aw
+ y = ay
+
+ if (y + wh > monitor.y + monitor.height):
+ y = monitor.y + monitor.height - wh
+
+ if (y < 0):
+ y = 0
+
+ if (y + wh > monitor.height / 2):
+ gravity = Gdk.Gravity.SOUTH_EAST
+ else:
+ gravity = Gdk.Gravity.NORTH_EAST
+
+ elif self.alignment == PanelApplet.AppletOrient.DOWN:
+ x = ax
+ y = ay + ah
+
+ if (x + ww > monitor.x + monitor.width):
+ x = monitor.x + monitor.width - ww
+
+ if (x < 0):
+ x = 0
+
+ gravity = Gdk.Gravity.NORTH_WEST
+ elif self.alignment == PanelApplet.AppletOrient.UP:
+ x = ax
+ y = ay - wh
+
+ if (x + ww > monitor.x + monitor.width):
+ x = monitor.x + monitor.width - ww
+
+ if (x < 0):
+ x = 0
+
+ gravity = Gdk.Gravity.SOUTH_WEST
+
+ self.move(x, y)
+ self.set_gravity(gravity)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]