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

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

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

revision 422 by frank, Thu Feb 20 16:23:31 2003 UTC revision 535 by bh, Fri Mar 14 20:42:18 2003 UTC
# Line 1  Line 1 
1  # Copyright (c) 2001, 2002 by Intevation GmbH  # Copyright (c) 2001, 2002, 2003 by Intevation GmbH
2  # Authors:  # Authors:
3  # Bernhard Herzog <[email protected]>  # Bernhard Herzog <[email protected]>
4  #  #
# Line 12  from wxPython.grid import * Line 12  from wxPython.grid import *
12    
13  from Thuban import _  from Thuban import _
14    
 import view  
15  from dialogs import NonModalDialog  from dialogs import NonModalDialog
16  from controls import RecordListCtrl, RecordGridCtrl  from controls import RecordListCtrl, RecordGridCtrl
17  from messages import SELECTED_SHAPE  from messages import SHAPES_SELECTED
18    
19  class IdentifyListCtrl(RecordListCtrl):  class IdentifyListCtrl(RecordListCtrl):
20    
# Line 37  class IdentifyGridCtrl(RecordGridCtrl): Line 36  class IdentifyGridCtrl(RecordGridCtrl):
36    
37  class IdentifyView(NonModalDialog):  class IdentifyView(NonModalDialog):
38    
39      def __init__(self, parent, interactor, name):      def __init__(self, parent, name):
40          NonModalDialog.__init__(self, parent, interactor, name,          NonModalDialog.__init__(self, parent, name, _("Identify Shape"))
41                                  _("Identify Shape"))          parent.Subscribe(SHAPES_SELECTED, self.selected_shape)
42          self.interactor.Subscribe(SELECTED_SHAPE, self.selected_shape)  
           
43          panel = wxPanel(self, -1, style = wxWANTS_CHARS)          panel = wxPanel(self, -1, style = wxWANTS_CHARS)
44          #self.list = IdentifyListCtrl(panel, -1)          #self.list = IdentifyListCtrl(panel, -1)
45          self.list = IdentifyGridCtrl(panel)          self.list = IdentifyGridCtrl(panel)
46    
47          sizer = wxBoxSizer(wxVERTICAL)          sizer = wxBoxSizer(wxVERTICAL)
48          sizer.Add(self.list, 1, wx.wxEXPAND| wx.wxALL, 0)          sizer.Add(self.list, 1, wx.wxEXPAND| wx.wxALL, 0)
49            
50          self.SetSize(wxSize(300,200))          self.SetSize(wxSize(300,200))
51          panel.SetAutoLayout(true)          panel.SetAutoLayout(true)
52          panel.SetSizer(sizer)          panel.SetSizer(sizer)
53          sizer.Fit(panel)          sizer.Fit(panel)
54    
55      def OnClose(self, event):      def OnClose(self, event):
56          self.interactor.Unsubscribe(SELECTED_SHAPE, self.selected_shape)          self.parent.Unsubscribe(SHAPES_SELECTED, self.selected_shape)
57          NonModalDialog.OnClose(self, event)          NonModalDialog.OnClose(self, event)
58    
59      def selected_shape(self, layer, shape):      def selected_shape(self, layer, shapes):
60            """Subscribed to the SHAPES_SELECTED messages.
61    
62            If exatly one shape is selected, pass that shape id to the
63            list's selected_shape method. Otherwise pass None as the shape
64            id.
65            """
66            if len(shapes) == 1:
67                shape = shapes[0]
68            else:
69                shape = None
70          self.list.selected_shape(layer, shape)          self.list.selected_shape(layer, shape)

Legend:
Removed from v.422  
changed lines
  Added in v.535

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26