[kupfer] Remove window position-saving



commit c019aece7fbf6465994de5093cba0e8ae0231893
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Sat Aug 28 00:58:10 2010 +0200

    Remove window position-saving
    
    Window positioning using a saved position has at least as many
    negative effects as it has positive (Can be outside visible area,
    does not handle multiple displays well, can cause jumping).

 NEWS                    |    1 +
 kupfer/core/settings.py |   17 -----------------
 kupfer/ui/browser.py    |   32 +-------------------------------
 3 files changed, 2 insertions(+), 48 deletions(-)
---
diff --git a/NEWS b/NEWS
index d726213..99a64f6 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ Not Released Yet
   (:lp:`601861`)
 * Python module `keyring` is now optional for Kupfer (but required for
   the same plugins that used them before)
+* Disable saving window position until a better solution is found
 * Small changes (Francesco Marella)
 * New Czech translation of the help pages (Marek Ä?ernocký)
 * New Galician translation (Fran Diéguez)
diff --git a/kupfer/core/settings.py b/kupfer/core/settings.py
index 090e077..0ff0bf5 100644
--- a/kupfer/core/settings.py
+++ b/kupfer/core/settings.py
@@ -41,9 +41,6 @@ class SettingsController (gobject.GObject, pretty.OutputMixin):
 		"Directories" : { "direct" : default_directories, "catalog" : (), },
 		"DeepDirectories" : { "direct" : (), "catalog" : (), "depth" : 1, },
 		'Keybindings': {},
-		"SessionPositions" : {
-			"main": "",
-		}
 	}
 	def __init__(self):
 		gobject.GObject.__init__(self)
@@ -317,20 +314,6 @@ class SettingsController (gobject.GObject, pretty.OutputMixin):
 	def set_directories(self, dirs):
 		return self._set_config("Directories", "direct", dirs)
 
-	def get_session_position(self, key, default=(-1, -1)):
-		"get ui object position for @key"
-		posstr = self.get_config("SessionPositions", key)
-		try:
-			x, y = ast.literal_eval(posstr)
-		except (SyntaxError, ValueError):
-			return default
-		return x, y
-
-	def set_session_position(self, key, value):
-		"set a ui object position key (x, y) pair"
-		x, y = value
-		self._set_config("SessionPositions", key, repr((x,y)))
-
 	def get_plugin_config(self, plugin, key, value_type=str, default=None):
 		"""Return setting @key for plugin names @plugin, try
 		to coerce to type @value_type.
diff --git a/kupfer/ui/browser.py b/kupfer/ui/browser.py
index b9b1a6e..549a7dc 100644
--- a/kupfer/ui/browser.py
+++ b/kupfer/ui/browser.py
@@ -1407,8 +1407,6 @@ class WindowController (pretty.OutputMixin):
 		"""
 		self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
 		self.window.add_events(gtk.gdk.BUTTON_PRESS_MASK)
-		self.window_position = -1, -1
-		self._latest_window_position = None
 
 		data_controller = data.DataController()
 		data_controller.connect("launched-action", self.launch_callback)
@@ -1498,7 +1496,6 @@ class WindowController (pretty.OutputMixin):
 		"""
 
 		self.window.connect("delete-event", self._close_window)
-		self.window.connect("configure-event", self._window_frame_event)
 		self.window.connect("focus-out-event", self._lost_focus)
 		widget = self.interface.get_widget()
 		widget.show()
@@ -1531,24 +1528,6 @@ class WindowController (pretty.OutputMixin):
 	def result_callback(self, sender, result_type):
 		self.activate()
 
-	def _load_window_position(self):
-		setctl = settings.GetSettingsController()
-		self.window_position = setctl.get_session_position("main")
-
-	def _window_frame_event(self, window, event):
-		# save most recent window position
-		# but only save it on user moves -- detect this by catching two
-		# successive (different) positions
-		window_pos = self.window.get_position()
-		if (self.window.get_property("visible") and
-		    window_pos != self.window_position):
-			self.window_position = self.window.get_position()
-			if (self._latest_window_position is not None and
-			    self._latest_window_position != window_pos):
-				setctl = settings.GetSettingsController()
-				setctl.set_session_position("main", self.window_position)
-			self._latest_window_position = window_pos
-
 	def _lost_focus(self, window, event):
 		setctl = settings.GetSettingsController()
 		if setctl.get_close_on_unfocus():
@@ -1567,24 +1546,16 @@ class WindowController (pretty.OutputMixin):
 			    y not in xrange(w_y, w_y + w_h)):
 				self._window_hide_timer.set_ms(50, self.put_away)
 
-	def _move_window_to_position(self):
-		self._latest_window_position = None
-		pos = self.window.get_position()
-		if self.window_position[0] > 0 and pos != self.window_position:
-			self.window.move(*self.window_position)
-			self.output_debug("Moving window to", self.window_position)
-
 	def activate(self, sender=None, time=0):
 		self._window_hide_timer.invalidate()
-		self._move_window_to_position()
 		if not time:
 			time = (gtk.get_current_event_time() or
 			        keybindings.get_current_event_time())
 		self.window.stick()
 		self.window.present_with_time(time)
 		self.window.window.focus(timestamp=time)
+		self.window.set_position(gtk.WIN_POS_NONE)
 		self.interface.focus()
-		self._move_window_to_position()
 
 	def put_away(self):
 		self.interface.put_away()
@@ -1732,7 +1703,6 @@ class WindowController (pretty.OutputMixin):
 		# Load data and present UI
 		sch = scheduler.GetScheduler()
 		sch.load()
-		self._load_window_position()
 
 		if not quiet:
 			self.activate()



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