/[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 936 by jonathan, Tue May 20 15:24:32 2003 UTC revision 990 by frank, Thu May 22 16:51:24 2003 UTC
# Line 30  from Thuban.UI.scalebar import ScaleBar Line 30  from Thuban.UI.scalebar import ScaleBar
30    
31  from Thuban.Lib.connector import ConnectorError  from Thuban.Lib.connector import ConnectorError
32    
33  ID_LEGEND_RAISE = 4001  ID_LEGEND_TOP = 4001
34  ID_LEGEND_LOWER = 4002  ID_LEGEND_RAISE = 4002
35  ID_LEGEND_TREE = 4003  ID_LEGEND_LOWER = 4003
36  ID_LEGEND_PROPS = 4004  ID_LEGEND_BOTTOM = 4004
37  ID_LEGEND_SHOWLAYER = 4005  ID_LEGEND_TREE = 4005
38  ID_LEGEND_HIDELAYER = 4006  ID_LEGEND_PROPS = 4006
39    ID_LEGEND_SHOWLAYER = 4007
40    ID_LEGEND_HIDELAYER = 4008
41    
42  BMP_SIZE_W = 30  BMP_SIZE_W = 30
43  BMP_SIZE_H = 15  BMP_SIZE_H = 15
44    
45    TOP_BMP = "top_layer"
46  RAISE_BMP = "raise_layer"  RAISE_BMP = "raise_layer"
47  LOWER_BMP = "lower_layer"  LOWER_BMP = "lower_layer"
48    BOTTOM_BMP = "bottom_layer"
49  SHOW_BMP  = "show_layer"  SHOW_BMP  = "show_layer"
50  HIDE_BMP  = "hide_layer"  HIDE_BMP  = "hide_layer"
51  PROPS_BMP = "layer_properties"  PROPS_BMP = "layer_properties"
# Line 62  class LegendPanel(DockPanel): Line 66  class LegendPanel(DockPanel):
66          self.toolBar = wxToolBar(self, -1)          self.toolBar = wxToolBar(self, -1)
67          self.toolBar.SetToolBitmapSize(wxSize(24, 24))          self.toolBar.SetToolBitmapSize(wxSize(24, 24))
68    
69            bmp = resource.GetBitmapResource(TOP_BMP, wxBITMAP_TYPE_XPM)
70            self.toolBar.AddTool(ID_LEGEND_TOP, bmp,
71                shortHelpString=_("Top Layer"))
72    
73          bmp = resource.GetBitmapResource(RAISE_BMP, wxBITMAP_TYPE_XPM)          bmp = resource.GetBitmapResource(RAISE_BMP, wxBITMAP_TYPE_XPM)
74          self.toolBar.AddTool(ID_LEGEND_RAISE, bmp,          self.toolBar.AddTool(ID_LEGEND_RAISE, bmp,
75              shortHelpString=_("Raise Layer"))              shortHelpString=_("Raise Layer"))
# Line 70  class LegendPanel(DockPanel): Line 78  class LegendPanel(DockPanel):
78          self.toolBar.AddTool(ID_LEGEND_LOWER, bmp,          self.toolBar.AddTool(ID_LEGEND_LOWER, bmp,
79              shortHelpString=_("Lower Layer"))              shortHelpString=_("Lower Layer"))
80    
81            bmp = resource.GetBitmapResource(BOTTOM_BMP, wxBITMAP_TYPE_XPM)
82            self.toolBar.AddTool(ID_LEGEND_BOTTOM, bmp,
83                shortHelpString=_("Bottom Layer"))
84    
85          bmp = resource.GetBitmapResource(SHOW_BMP, wxBITMAP_TYPE_XPM)          bmp = resource.GetBitmapResource(SHOW_BMP, wxBITMAP_TYPE_XPM)
86          self.toolBar.AddTool(ID_LEGEND_SHOWLAYER, bmp,          self.toolBar.AddTool(ID_LEGEND_SHOWLAYER, bmp,
87              shortHelpString=_("Show Layer"))              shortHelpString=_("Show Layer"))
# Line 85  class LegendPanel(DockPanel): Line 97  class LegendPanel(DockPanel):
97          self.toolBar.Realize()          self.toolBar.Realize()
98          panelBox.Add(self.toolBar, 0, wxGROW, 0)          panelBox.Add(self.toolBar, 0, wxGROW, 0)
99    
100            EVT_TOOL(self, ID_LEGEND_TOP, self._OnMoveTop)
101          EVT_TOOL(self, ID_LEGEND_RAISE, self._OnMoveUp)          EVT_TOOL(self, ID_LEGEND_RAISE, self._OnMoveUp)
102          EVT_TOOL(self, ID_LEGEND_LOWER, self._OnMoveDown)          EVT_TOOL(self, ID_LEGEND_LOWER, self._OnMoveDown)
103            EVT_TOOL(self, ID_LEGEND_BOTTOM, self._OnMoveBottom)
104          EVT_TOOL(self, ID_LEGEND_PROPS, self._OnProperties)          EVT_TOOL(self, ID_LEGEND_PROPS, self._OnProperties)
105          EVT_TOOL(self, ID_LEGEND_SHOWLAYER, self._OnShowLayer)          EVT_TOOL(self, ID_LEGEND_SHOWLAYER, self._OnShowLayer)
106          EVT_TOOL(self, ID_LEGEND_HIDELAYER, self._OnHideLayer)          EVT_TOOL(self, ID_LEGEND_HIDELAYER, self._OnHideLayer)
# Line 139  class LegendPanel(DockPanel): Line 153  class LegendPanel(DockPanel):
153      def _OnProperties(self, event):      def _OnProperties(self, event):
154          self.DoOnProperties()          self.DoOnProperties()
155    
156        def _OnMoveTop(self, event):
157            self.tree.MoveCurrentItemTop()
158            
159      def _OnMoveUp(self, event):      def _OnMoveUp(self, event):
160          self.tree.MoveCurrentItemUp()          self.tree.MoveCurrentItemUp()
161    
162      def _OnMoveDown(self, event):      def _OnMoveDown(self, event):
163          self.tree.MoveCurrentItemDown()          self.tree.MoveCurrentItemDown()
164    
165        def _OnMoveBottom(self, event):
166            self.tree.MoveCurrentItemBottom()
167    
168      def _OnShowLayer(self, event):      def _OnShowLayer(self, event):
169          self.tree.DoOnShowLayer()          self.tree.DoOnShowLayer()
170          pass          pass
# Line 160  class LegendPanel(DockPanel): Line 180  class LegendPanel(DockPanel):
180          pass          pass
181    
182      def __EnableButtons(self, on):      def __EnableButtons(self, on):
183            self.toolBar.EnableTool(ID_LEGEND_TOP, on)
184          self.toolBar.EnableTool(ID_LEGEND_RAISE, on)          self.toolBar.EnableTool(ID_LEGEND_RAISE, on)
185          self.toolBar.EnableTool(ID_LEGEND_LOWER, on)          self.toolBar.EnableTool(ID_LEGEND_LOWER, on)
186            self.toolBar.EnableTool(ID_LEGEND_BOTTOM, on)
187          self.toolBar.EnableTool(ID_LEGEND_SHOWLAYER,  on)          self.toolBar.EnableTool(ID_LEGEND_SHOWLAYER,  on)
188          self.toolBar.EnableTool(ID_LEGEND_HIDELAYER,  on)          self.toolBar.EnableTool(ID_LEGEND_HIDELAYER,  on)
189          self.toolBar.EnableTool(ID_LEGEND_PROPS, on)          self.toolBar.EnableTool(ID_LEGEND_PROPS, on)
# Line 226  class LegendTree(wxTreeCtrl): Line 248  class LegendTree(wxTreeCtrl):
248                  #self._OnMsgMapsChanged)                  #self._OnMsgMapsChanged)
249              self.__FillTree(self.map)              self.__FillTree(self.map)
250    
251        def MoveCurrentItemTop(self):
252            layer, group = self.GetSelectedHierarchy()
253    
254            if layer is not None:
255                self.map.TopLayer(layer)
256            else:
257                assert False, "Shouldn't be allowed."
258                pass
259    
260      def MoveCurrentItemUp(self):      def MoveCurrentItemUp(self):
261          layer, group = self.GetSelectedHierarchy()          layer, group = self.GetSelectedHierarchy()
262    
# Line 244  class LegendTree(wxTreeCtrl): Line 275  class LegendTree(wxTreeCtrl):
275              assert False, "Shouldn't be allowed."              assert False, "Shouldn't be allowed."
276              pass              pass
277    
278        def MoveCurrentItemBottom(self):
279            layer, group = self.GetSelectedHierarchy()
280    
281            if layer is not None:
282                self.map.BottomLayer(layer)
283            else:
284                assert False, "Shouldn't be allowed."
285                pass
286    
287      def OnCompareItems(self, item1, item2):      def OnCompareItems(self, item1, item2):
288    
289          data1 = self.GetPyData(item1)          data1 = self.GetPyData(item1)
# Line 441  class LegendTree(wxTreeCtrl): Line 481  class LegendTree(wxTreeCtrl):
481              font.SetStyle(wxNORMAL)              font.SetStyle(wxNORMAL)
482              color = wxBLACK              color = wxBLACK
483          else:          else:
484              font.SetStyle(wxITALIC)              #font.SetStyle(wxITALIC)
485                font.SetStyle(wxNORMAL)
486              color = wxLIGHT_GREY              color = wxLIGHT_GREY
487    
488          self.SetItemTextColour(id, color)          self.SetItemTextColour(id, color)
# Line 467  class ScaleBarBitmap(wxBoxSizer): Line 508  class ScaleBarBitmap(wxBoxSizer):
508          # While the width is fixed, get the height _now_.          # While the width is fixed, get the height _now_.
509          dc = wxMemoryDC()          dc = wxMemoryDC()
510          textwidth, textheight = dc.GetTextExtent("%d"%0)          textwidth, textheight = dc.GetTextExtent("%d"%0)
511          self.width = 200          self.width = 210
512          self.height = textheight + 3*2 + 8          self.height = textheight + 3*2 + 8
513    
514          wxBoxSizer.__init__(self, wxVERTICAL)          wxBoxSizer.__init__(self, wxVERTICAL)

Legend:
Removed from v.936  
changed lines
  Added in v.990

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26