[Skencil-commits] r760 - skencil/branches/skencil-0.6/src/Sketch/UI

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Oct 15 19:30:06 CEST 2010


Author: igor_n
Date: 2010-10-15 19:30:05 +0200 (Fri, 15 Oct 2010)
New Revision: 760

Modified:
   skencil/branches/skencil-0.6/src/Sketch/UI/skapp.py
Log:
main window is screen centered on application start

Modified: skencil/branches/skencil-0.6/src/Sketch/UI/skapp.py
===================================================================
--- skencil/branches/skencil-0.6/src/Sketch/UI/skapp.py	2010-10-11 08:26:32 UTC (rev 759)
+++ skencil/branches/skencil-0.6/src/Sketch/UI/skapp.py	2010-10-15 17:30:05 UTC (rev 760)
@@ -181,6 +181,7 @@
     def __init__(self, filename, screen_name = None, geometry = None,
                  run_script = None):
         self.filename = filename
+        self.geometry = geometry
         self.run_script = run_script
         TkApplication.__init__(self, screen_name = screen_name,
                                geometry = geometry)
@@ -204,6 +205,14 @@
         tooltips.Init(self.root)
         self.main_window.UpdateCommands()
         # Enter Main Loop
+        if self.geometry is None:
+            width = self.root.winfo_reqwidth()
+            height = self.root.winfo_reqheight()
+            if width < 800 : width = 800
+            if height < 600 : height = 600
+            posx = (self.root.winfo_screenwidth() - width)/2
+            posy = (self.root.winfo_screenheight() - height)/2
+            self.root.geometry('%dx%d%+d%+d' % (width, height, posx, posy))
         self.main_window.Run()
 
     def Exit(self):



More information about the Skencil-commits mailing list