joey: thuban/Thuban/UI mainwindow.py,1.133,1.134

cvs@intevation.de cvs at intevation.de
Fri Oct 1 20:18:51 CEST 2004


Author: joey

Update of /thubanrepository/thuban/Thuban/UI
In directory doto:/tmp/cvs-serv28207/Thuban/UI

Modified Files:
	mainwindow.py 
Log Message:
Move the logic for checking whether a dialog is already opened (and
raising it to the users attention) and creating a new dialog into a
function of its own

Index: mainwindow.py
===================================================================
RCS file: /thubanrepository/thuban/Thuban/UI/mainwindow.py,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -d -r1.133 -r1.134
--- mainwindow.py	1 Oct 2004 18:07:14 -0000	1.133
+++ mainwindow.py	1 Oct 2004 18:18:49 -0000	1.134
@@ -349,6 +349,23 @@
         """
         self.SetStatusText(text)
 
+    def OpenOrRaiseDialog(self, name, dialog_class, *args, **kw):
+        """
+        Open or raise a dialog.
+
+        If a dialog with the denoted name does already exist it is
+        raised.  Otherwise a new dialog, an instance of dialog_class,
+        is created, inserted into the main list and displayed.
+        """
+        dialog = self.get_open_dialog(name)
+
+        if dialog is None:
+            dialog = dialog_class(self, name, *args, **kw)
+            self.add_dialog(name, dialog)
+            dialog.Show(True)
+        else:
+            dialog.Raise()
+                          
     def save_modified_session(self, can_veto = 1):
         """If the current session has been modified, ask the user
         whether to save it and do so if requested. Return the outcome of
@@ -705,15 +722,16 @@
         self.OpenLayerProperties(layer)
 
     def OpenLayerProperties(self, layer, group = None):
-        name = "layer_properties" + str(id(layer))
-        dialog = self.get_open_dialog(name)
-
-        if dialog is None:
-            dialog = Classifier(self, name, layer, group)
-            self.add_dialog(name, dialog)
-            dialog.Show()
-        dialog.Raise()
+        """
+        Open or raise the properties dialog.
 
+        This method opens or raises the properties dialog for the
+        currently selected layer if one is defined for this layer
+        type.
+        """
+        name = "layer_properties" + str(id(layer))
+        self.OpenOrRaiseDialog(name, Classifier, layer, group = group)
+        
     def LayerJoinTable(self):
         layer = self.canvas.SelectedLayer()
         if layer is not None:





More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)