[kupfer] ui: Fix centering of result list window



commit c2f6dd5612632cb23c7569aaf79f73da896afd56
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Sat Mar 19 14:27:30 2011 +0100

    ui: Fix centering of result list window

 kupfer/ui/browser.py |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/kupfer/ui/browser.py b/kupfer/ui/browser.py
index 74194bb..6098527 100644
--- a/kupfer/ui/browser.py
+++ b/kupfer/ui/browser.py
@@ -587,21 +587,24 @@ class Search (gtk.Bin):
 		self.list_window.hide()
 
 	def _show_table(self):
-		# self.window is a GdkWindow
+		# self.window is a GdkWindow (of self's parent)
 		win_width, win_height = self.window.get_size()
 		pos_x, pos_y = self.window.get_position()
+		# find origin in parent's coordinates
+		self_x, self_y = self.translate_coordinates(self.get_parent(), 0, 0)
 		sub_x = pos_x
 		sub_y = pos_y + win_height
-		x_coord = pos_x
 		table_w, table_len = self.table.size_request()
 		subwin_height = min(table_len, 200)
 		subwin_width = self.list_window.size_request()[0]
 		if not text_direction_is_ltr():
-			sub_x += win_width - subwin_width
-		self.list_window.move(sub_x, sub_y)
+			sub_x += win_width - subwin_width + self_x
+		else:
+			sub_x -= self_x
 		if not subwin_height:
 			subwin_height = 200
 			subwin_width = win_width
+		self.list_window.move(sub_x, sub_y)
 		self.list_window.resize(subwin_width, subwin_height)
 
 		win = self.get_toplevel()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]