/[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 29 by bh, Thu Sep 6 13:30:59 2001 UTC revision 80 by bh, Mon Feb 4 19:53:01 2002 UTC
# Line 1  Line 1 
1  # Copyright (c) 2001 by Intevation GmbH  # Copyright (c) 2001, 2002 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  import view  import view
14  from dialogs import NonModalDialog  from dialogs import NonModalDialog
15    from controls import RecordListCtrl, RecordGridCtrl
16  from messages import SELECTED_SHAPE  from messages import SELECTED_SHAPE
17    
18  class IdentifyListCtrl(wxListCtrl):  class IdentifyListCtrl(RecordListCtrl):
19    
20      def __init__(self, parent, id):      def selected_shape(self, layer, shape):
21          wxListCtrl.__init__(self, parent, id, style = wxLC_REPORT)          if layer is not None:
   
         self.InsertColumn(0, "Field")  
         self.SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER)  
         self.InsertColumn(1, "Value")  
         self.SetColumnWidth(1, wxLIST_AUTOSIZE_USEHEADER)  
   
     def fill_list(self, layer, shape):  
         self.DeleteAllItems()  
   
         if shape is not None:  
22              table = layer.shapetable              table = layer.shapetable
23              num_cols = table.field_count()          else:
24              num_rows = table.record_count()              table = None
25                        self.fill_list(table, shape)
             names = []  
             for i in range(num_cols):  
                 type, name, length, decc = table.field_info(i)  
                 names.append(name)  
             record = table.read_record(shape)  
             i = 0  
             for name in names:  
                 value = record[name]  
                 i = self.InsertStringItem(i, name)  
                 self.SetStringItem(i, 1, str(value))  
26    
27      def selected_shape(self, layer, shape):  class IdentifyGridCtrl(RecordGridCtrl):
         self.fill_list(layer, shape)  
               
28    
29        def selected_shape(self, layer, shape):
30            if layer is not None:
31                table = layer.shapetable
32            else:
33                table = None
34            self.SetTableRecord(table, shape)
35    
36  class IdentifyView(NonModalDialog):  class IdentifyView(NonModalDialog):
37    
# Line 56  class IdentifyView(NonModalDialog): Line 41  class IdentifyView(NonModalDialog):
41          self.interactor.Subscribe(SELECTED_SHAPE, self.selected_shape)          self.interactor.Subscribe(SELECTED_SHAPE, self.selected_shape)
42                    
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)
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)

Legend:
Removed from v.29  
changed lines
  Added in v.80

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26