jan: thuban/Thuban/UI legend.py,1.36,1.37

cvs@intevation.de cvs at intevation.de
Sun Apr 18 22:37:47 CEST 2004


Author: jan

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

Modified Files:
	legend.py 
Log Message:
ID_POP_xxx: removed.
(LegendPanel.__init__): Removed EVT_MENU bindings.
(LegendTree._OnRightClick): Replace direct creation of
menu via wx Classes by applying the menu definition
as of Menu class of menu.py.


Index: legend.py
===================================================================
RCS file: /thubanrepository/thuban/Thuban/UI/legend.py,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- legend.py	31 Oct 2003 10:13:32 -0000	1.36
+++ legend.py	18 Apr 2004 20:37:45 -0000	1.37
@@ -31,6 +31,8 @@
 from Thuban.UI.dock import DockPanel
 from Thuban.UI.scalebar import ScaleBar
 
+from Thuban.UI.menu import Menu
+
 from Thuban.Lib.connector import ConnectorError
 
 ID_LEGEND_TOP = 4001
@@ -42,16 +44,6 @@
 ID_LEGEND_SHOWLAYER = 4007
 ID_LEGEND_HIDELAYER = 4008
 
-ID_POPUP_TOP = 4501
-ID_POPUP_UP  = 4502
-ID_POPUP_DOWN = 4503
-ID_POPUP_BOTTOM = 4504
-ID_POPUP_PROPS  = 4506
-ID_POPUP_VISIBLE = 4507
-ID_POPUP_PROJ = 4509
-ID_POPUP_REMOVE = 4510
-ID_POPUP_SHOWTABLE = 4511
-
 BMP_SIZE_W = 15
 BMP_SIZE_H = 15
 
@@ -63,7 +55,6 @@
 HIDE_BMP  = "hide_layer"
 PROPS_BMP = "layer_properties"
 
-
 class LegendPanel(DockPanel):
 
     def __init__(self, parent, map, mainWindow): 
@@ -118,16 +109,6 @@
         EVT_TOOL(self, ID_LEGEND_SHOWLAYER, self._OnShowLayer)
         EVT_TOOL(self, ID_LEGEND_HIDELAYER, self._OnHideLayer)
 
-        EVT_MENU(self, ID_POPUP_PROPS, self._OnProperties)
-        EVT_MENU(self, ID_POPUP_TOP, self._OnMoveTop)
-        EVT_MENU(self, ID_POPUP_UP, self._OnMoveUp)
-        EVT_MENU(self, ID_POPUP_DOWN, self._OnMoveDown)
-        EVT_MENU(self, ID_POPUP_BOTTOM, self._OnMoveBottom)
-        EVT_MENU(self, ID_POPUP_VISIBLE, self._OnToggleVisibility)
-        EVT_MENU(self, ID_POPUP_PROJ, self._OnProjection)
-        EVT_MENU(self, ID_POPUP_REMOVE, self._OnRemoveLayer)
-        EVT_MENU(self, ID_POPUP_SHOWTABLE, self._OnShowTable)
-        
         self.tree = LegendTree(self, ID_LEGEND_TREE, map, mainWindow)
 
         panelBox.Add(self.tree, 1, wxGROW, 0)
@@ -280,31 +261,25 @@
         item = event.GetItem()
         self.SelectItem(item)
 
-        # Create the menu
-        menu = wxMenu("", 0)
-
-        # The "Visible" item is a special ...
-        menuitem = wxMenuItem(menu, ID_POPUP_VISIBLE, _("Visible"), 
-                                "", wxITEM_CHECK)
-        menu.AppendItem(menuitem)
-        layer, group = self.GetSelectedHierarchy()
-        menuitem.Check(layer.Visible())
-
-        menu.AppendSeparator()
-        menu.Append(ID_POPUP_PROPS, _("&Properties..."))
-        menu.Append(ID_POPUP_PROJ, _("Pro&jection..."))
-        menu.Append(ID_POPUP_REMOVE, _("&Remove Layer"))
-        menu.Append(ID_POPUP_SHOWTABLE, _("Show Ta&ble"))
-        menu.AppendSeparator()
-        menu.Append(ID_POPUP_TOP, _("Top Layer"))
-        menu.Append(ID_POPUP_UP, _("Raise Layer"))
-        menu.Append(ID_POPUP_DOWN, _("Lower Layer"))
-        menu.Append(ID_POPUP_BOTTOM, _("Bottom Layer"))
+        # Define the menu
+        popup_menu = Menu("PopUp", "",
+                          [ "layer_visibility",
+                            None,
+                            "layer_properties",
+                            "layer_projection",
+                            "layer_remove",
+                            "layer_show_table",
+                            None,
+                            "layer_to_top",
+                            "layer_raise",
+                            "layer_lower",
+                            "layer_to_bottom"
+                            ])
 
         # Display the menu
         pos = event.GetPoint()
         shift = self.ClientToScreen((0,0))
-        self.PopupMenu(menu, pos)
+        self.PopupMenu(self.mainWindow.build_menu(popup_menu), pos)
 
     def find_layer(self, layer):
         """Return the tree item for the layer"""





More information about the Thuban-devel mailing list

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