[GRASS-SVN] r38159 - in grass/trunk/gui/wxpython: . gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 2 07:14:39 EDT 2009


Author: martinl
Date: 2009-07-02 07:14:39 -0400 (Thu, 02 Jul 2009)
New Revision: 38159

Modified:
   grass/trunk/gui/wxpython/gui_modules/preferences.py
   grass/trunk/gui/wxpython/wxgui.py
Log:
wxGUI: reuse preferences dialog


Modified: grass/trunk/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/preferences.py	2009-07-02 10:37:00 UTC (rev 38158)
+++ grass/trunk/gui/wxpython/gui_modules/preferences.py	2009-07-02 11:14:39 UTC (rev 38159)
@@ -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,
@@ -1675,6 +1677,9 @@
         if self.__UpdateSettings():
             self.Close()
 
+    def OnCloseWindow(self, event):
+        self.Hide()
+        
     def OnCancel(self, event):
         """!Button 'Cancel' pressed"""
         self.Close()

Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py	2009-07-02 10:37:00 UTC (rev 38158)
+++ grass/trunk/gui/wxpython/wxgui.py	2009-07-02 11:14:39 UTC (rev 38159)
@@ -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
@@ -892,9 +893,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