jan: thuban/Thuban/UI menu.py,1.6,1.7

cvs@intevation.de cvs at intevation.de
Tue May 11 23:39:42 CEST 2004


Author: jan

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

Modified Files:
	menu.py 
Log Message:
(Menu.FindOrInsertMenu): New. Find a given menu or, if not found,
insert it.



Index: menu.py
===================================================================
RCS file: /thubanrepository/thuban/Thuban/UI/menu.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- menu.py	27 May 2003 13:11:18 -0000	1.6
+++ menu.py	11 May 2004 21:39:39 -0000	1.7
@@ -126,6 +126,20 @@
         self.InsertItem(newmenu, menu = menu, after = after)
         return newmenu
 
+    def FindOrInsertMenu(self, name, title, menu = (), after = None):
+        """
+        Find the menu with the specified name. If found, return it.
+        Else insert the menu as specified and return it.
+
+        Parameters: See InsertMenu().
+        """
+
+        m = self.find_menu(name)
+        if m is None:
+            m = self.InsertMenu(name, title, menu, after)
+        return m
+
+
     def SetItems(self, items):
         """Replace the contents of the menu by items."""
         self.items = items





More information about the Thuban-devel mailing list

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