/[thuban]/trunk/thuban/Thuban/UI/classifier.py
ViewVC logotype

Diff of /trunk/thuban/Thuban/UI/classifier.py

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

revision 374 by jan, Mon Jan 27 14:20:02 2003 UTC revision 379 by jonathan, Tue Jan 28 12:54:01 2003 UTC
# Line 9  Line 9 
9    
10  __version__ = "$Revision$"  __version__ = "$Revision$"
11    
12    import copy
13    
14  from wxPython.wx import *  from wxPython.wx import *
15  from wxPython.grid import *  from wxPython.grid import *
16    
# Line 20  ID_CLASS_TABLE = 40011 Line 22  ID_CLASS_TABLE = 40011
22  ID_CLASSIFY_OK = 4001  ID_CLASSIFY_OK = 4001
23  ID_CLASSIFY_CANCEL = 4002  ID_CLASSIFY_CANCEL = 4002
24    
25    class ClassTable(wxPyGridTableBase):
26    
27        def __init__(self, clinfo):
28            wxPyGridTableBase.__init__(self)
29            self.clinfo = copy.deepcopy(clinfo)
30    
31            self.tdata = []
32    
33            for value, data in self.clinfo.points.items():
34                self.tdata.append([data, value])
35    
36            for range in self.clinfo.ranges:
37                self.tdata.append([range[2], '%s-%s' % range[0], range[1]])
38    
39            self.SetColLabelValue(1, _("Data Values"))
40    
41        def GetNumberRows(self):
42            return len(self.tdata)
43    
44        def GetNumberCols(self):
45            return 2
46    
47        def IsEmptyCell(self, row, col):
48            return false
49    
50        def GetValue(self, row, col):
51            return self.tdata[row][col]
52    
53        def SetValue(self, row, col, value):
54            pass
55        
56    
57    
58  class Classifier(wxDialog):  class Classifier(wxDialog):
59            
60      def __init__(self, parent, layer):      def __init__(self, parent, layer):
# Line 36  class Classifier(wxDialog): Line 71  class Classifier(wxDialog):
71                                       style = wxCB_READONLY)                                       style = wxCB_READONLY)
72    
73          self.num_cols = layer.table.field_count()          self.num_cols = layer.table.field_count()
74            cur_hilight = 0
75          for i in range(self.num_cols):          for i in range(self.num_cols):
76              type, name, len, decc = layer.table.field_info(i)              type, name, len, decc = layer.table.field_info(i)
77                if name == layer.classification.field:
78                    cur_hilight = i
79              self.properties.Append(name)              self.properties.Append(name)
80    
81          propertyBox.Add(self.properties, 0, wxALL, 4)          self.properties.SetSelection(cur_hilight)
82            propertyBox.Add(self.properties, 0, wxGROW, 4)
83          EVT_COMBOBOX(self, ID_PROPERTY_SELECT, self.OnPropertySelect)          EVT_COMBOBOX(self, ID_PROPERTY_SELECT, self.OnPropertySelect)
84    
85          topBox.Add(propertyBox, 0, 0)          topBox.Add(propertyBox, 0, wxGROW, 4)
86    
87          #          #
88          # Classification data table          # Classification data table
89          #          #
90    
91          table = wxPyGridTableBase()          self.classTable = wxGrid(self, ID_CLASS_TABLE, size=(300, 150))
92          tableBox = wxGridSizer(25)  
93          self.classTable = wxGrid(self, ID_CLASS_TABLE)          table = ClassTable(layer.classification)
         self.classTable.CreateGrid(10, 2)  
94          self.classTable.SetTable(table, true)          self.classTable.SetTable(table, true)
95          #table.SetNumberRows(10)  
96          #table.SetNumberCols(2)          topBox.Add(self.classTable, 0, wxGROW, 0)
         table.SetColLabelValue(0, _("Class"))  
         table.SetColLabelValue(1, _("Value"))  
         #self.classTable.SetColLabelValue(0, _("Class"))  
         #self.classTable.SetColLabelValue(1, _("Value"))  
         #self.classTable.SetCellValue(1, 1, _("Value"))  
   
         tableBox.Add(self.classTable, 0, wxALL, 4)  
           
         topBox.Add(self.classTable, 0, 0)  
97    
98          #          #
99          # Control buttons:          # Control buttons:

Legend:
Removed from v.374  
changed lines
  Added in v.379

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26