/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/legend.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/UI/legend.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2186 by frank, Fri Oct 31 10:13:32 2003 UTC revision 2187 by jan, Sun Apr 18 20:37:45 2004 UTC
# Line 31  from Thuban.UI.classifier import ClassDa Line 31  from Thuban.UI.classifier import ClassDa
31  from Thuban.UI.dock import DockPanel  from Thuban.UI.dock import DockPanel
32  from Thuban.UI.scalebar import ScaleBar  from Thuban.UI.scalebar import ScaleBar
33    
34    from Thuban.UI.menu import Menu
35    
36  from Thuban.Lib.connector import ConnectorError  from Thuban.Lib.connector import ConnectorError
37    
38  ID_LEGEND_TOP = 4001  ID_LEGEND_TOP = 4001
# Line 42  ID_LEGEND_PROPS = 4006 Line 44  ID_LEGEND_PROPS = 4006
44  ID_LEGEND_SHOWLAYER = 4007  ID_LEGEND_SHOWLAYER = 4007
45  ID_LEGEND_HIDELAYER = 4008  ID_LEGEND_HIDELAYER = 4008
46    
 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  
   
47  BMP_SIZE_W = 15  BMP_SIZE_W = 15
48  BMP_SIZE_H = 15  BMP_SIZE_H = 15
49    
# Line 63  SHOW_BMP  = "show_layer" Line 55  SHOW_BMP  = "show_layer"
55  HIDE_BMP  = "hide_layer"  HIDE_BMP  = "hide_layer"
56  PROPS_BMP = "layer_properties"  PROPS_BMP = "layer_properties"
57    
   
58  class LegendPanel(DockPanel):  class LegendPanel(DockPanel):
59    
60      def __init__(self, parent, map, mainWindow):      def __init__(self, parent, map, mainWindow):
# Line 118  class LegendPanel(DockPanel): Line 109  class LegendPanel(DockPanel):
109          EVT_TOOL(self, ID_LEGEND_SHOWLAYER, self._OnShowLayer)          EVT_TOOL(self, ID_LEGEND_SHOWLAYER, self._OnShowLayer)
110          EVT_TOOL(self, ID_LEGEND_HIDELAYER, self._OnHideLayer)          EVT_TOOL(self, ID_LEGEND_HIDELAYER, self._OnHideLayer)
111    
         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)  
           
112          self.tree = LegendTree(self, ID_LEGEND_TREE, map, mainWindow)          self.tree = LegendTree(self, ID_LEGEND_TREE, map, mainWindow)
113    
114          panelBox.Add(self.tree, 1, wxGROW, 0)          panelBox.Add(self.tree, 1, wxGROW, 0)
# Line 280  class LegendTree(wxTreeCtrl): Line 261  class LegendTree(wxTreeCtrl):
261          item = event.GetItem()          item = event.GetItem()
262          self.SelectItem(item)          self.SelectItem(item)
263    
264          # Create the menu          # Define the menu
265          menu = wxMenu("", 0)          popup_menu = Menu("PopUp", "",
266                              [ "layer_visibility",
267          # The "Visible" item is a special ...                              None,
268          menuitem = wxMenuItem(menu, ID_POPUP_VISIBLE, _("Visible"),                              "layer_properties",
269                                  "", wxITEM_CHECK)                              "layer_projection",
270          menu.AppendItem(menuitem)                              "layer_remove",
271          layer, group = self.GetSelectedHierarchy()                              "layer_show_table",
272          menuitem.Check(layer.Visible())                              None,
273                                "layer_to_top",
274          menu.AppendSeparator()                              "layer_raise",
275          menu.Append(ID_POPUP_PROPS, _("&Properties..."))                              "layer_lower",
276          menu.Append(ID_POPUP_PROJ, _("Pro&jection..."))                              "layer_to_bottom"
277          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"))  
278    
279          # Display the menu          # Display the menu
280          pos = event.GetPoint()          pos = event.GetPoint()
281          shift = self.ClientToScreen((0,0))          shift = self.ClientToScreen((0,0))
282          self.PopupMenu(menu, pos)          self.PopupMenu(self.mainWindow.build_menu(popup_menu), pos)
283    
284      def find_layer(self, layer):      def find_layer(self, layer):
285          """Return the tree item for the layer"""          """Return the tree item for the layer"""

Legend:
Removed from v.2186  
changed lines
  Added in v.2187

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26