[GRASS-SVN] r38160 - in grass/branches/develbranch_6/gui/wxpython: . gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 2 07:17:36 EDT 2009


Author: martinl
Date: 2009-07-02 07:17:36 -0400 (Thu, 02 Jul 2009)
New Revision: 38160

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
   grass/branches/develbranch_6/gui/wxpython/wxgui.py
Log:
wxGUI: reuse preferences dialog
       (merge from trunk, r38159)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py	2009-07-02 11:14:39 UTC (rev 38159)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py	2009-07-02 11:17:36 UTC (rev 38160)
@@ -865,6 +865,8 @@
         btnCancel.Bind(wx.EVT_BUTTON, self.OnCancel)
         btnCancel.SetToolTipString(_("Close dialog and ignore changes"))
 
+        self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
+
         # sizers
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
         btnSizer.Add(item=btnDefault, proportion=1,
@@ -1684,6 +1686,9 @@
         if self.__UpdateSettings():
             self.Close()
 
+    def OnCloseWindow(self, event):
+        self.Hide()
+        
     def OnCancel(self, event):
         """!Button 'Cancel' pressed"""
         self.Close()

Modified: grass/branches/develbranch_6/gui/wxpython/wxgui.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/wxgui.py	2009-07-02 11:14:39 UTC (rev 38159)
+++ grass/branches/develbranch_6/gui/wxpython/wxgui.py	2009-07-02 11:17:36 UTC (rev 38160)
@@ -124,6 +124,7 @@
         self.georectifying = None         # reference to GCP class or None
         # list of open dialogs
         self.dialogs        = dict()
+        self.dialogs['preferences'] = None
         self.dialogs['atm'] = list()
         
         # creating widgets
@@ -936,9 +937,12 @@
         
     def OnPreferences(self, event):
         """!General GUI preferences/settings"""
-        dlg = preferences.PreferencesDialog(parent=self)
-        dlg.CenterOnScreen()
-        dlg.ShowModal()
+        if not self.dialogs['preferences']:
+            dlg = preferences.PreferencesDialog(parent=self)
+            self.dialogs['preferences'] = dlg
+            self.dialogs['preferences'].CenterOnScreen()
+
+        self.dialogs['preferences'].ShowModal()
         
     def DispHistogram(self, event):
         """



More information about the grass-commit mailing list