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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 372 - (hide annotations)
Mon Jan 27 13:50:58 2003 UTC (22 years, 1 month ago) by jonathan
File MIME type: text/x-python
File size: 2764 byte(s)
Dialog box for modifying classification information

1 jonathan 372 # Copyright (c) 2001 by Intevation GmbH
2     # Authors:
3     # Jonathan Coles <[email protected]>
4     #
5     # This program is free software under the GPL (>=v2)
6     # Read the file COPYING coming with Thuban for details.
7    
8     """Dialog for classifying how layers are displayed"""
9    
10     __version__ = "$Revision$"
11    
12     from wxPython.wx import *
13     from wxPython.grid import *
14    
15     ID_PROPERTY_SELECT = 4010
16     ID_CLASS_TABLE = 40011
17    
18     ID_CLASSIFY_OK = 4001
19     ID_CLASSIFY_CANCEL = 4002
20    
21     class Classifier(wxDialog):
22    
23     def __init__(self, parent, layer):
24     wxDialog.__init__(self, parent, -1, "Classify",
25     style = wxRESIZE_BORDER)
26    
27     topBox = wxBoxSizer(wxVERTICAL)
28    
29     propertyBox = wxBoxSizer(wxHORIZONTAL)
30     propertyBox.Add(wxStaticText(self, -1, "Property"),
31     0, wxALIGN_CENTER | wxALL, 4)
32    
33     self.properties = wxComboBox(self, ID_PROPERTY_SELECT, "",
34     style = wxCB_READONLY)
35    
36     self.num_cols = layer.table.field_count()
37     for i in range(self.num_cols):
38     type, name, len, decc = layer.table.field_info(i)
39     self.properties.Append(name)
40    
41     propertyBox.Add(self.properties, 0, wxALL, 4)
42     EVT_COMBOBOX(self, ID_PROPERTY_SELECT, self.OnPropertySelect)
43    
44     topBox.Add(propertyBox, 0, 0)
45    
46     #
47     # Classification data table
48     #
49    
50     table = wxPyGridTableBase()
51     tableBox = wxGridSizer(25)
52     self.classTable = wxGrid(self, ID_CLASS_TABLE)
53     self.classTable.CreateGrid(10, 2)
54     self.classTable.SetTable(table, true)
55     #table.SetNumberRows(10)
56     #table.SetNumberCols(2)
57     table.SetColLabelValue(0, "Class")
58     table.SetColLabelValue(1, "Value")
59     #self.classTable.SetColLabelValue(0, "Class")
60     #self.classTable.SetColLabelValue(1, "Value")
61     #self.classTable.SetCellValue(1, 1, "Value")
62    
63     tableBox.Add(self.classTable, 0, wxALL, 4)
64    
65     topBox.Add(self.classTable, 0, 0)
66    
67     #
68     # Control buttons:
69     #
70     buttonBox = wxBoxSizer(wxHORIZONTAL)
71     buttonBox.Add(wxButton(self, ID_CLASSIFY_OK, "OK"),
72     0, wxALL, 4)
73     buttonBox.Add(wxButton(self, ID_CLASSIFY_CANCEL, "Cancel"),
74     0, wxALL, 4)
75     topBox.Add(buttonBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_BOTTOM, 10)
76    
77     EVT_BUTTON(self, ID_CLASSIFY_OK, self.OnOK)
78     EVT_BUTTON(self, ID_CLASSIFY_CANCEL, self.OnCancel)
79    
80     self.SetAutoLayout(true)
81     self.SetSizer(topBox)
82     topBox.Fit(self)
83     topBox.SetSizeHints(self)
84    
85     def OnPropertySelect(self, event): pass
86    
87     def OnOK(self, event):
88     self.EndModal(wxID_OK)
89    
90     def OnCancel(self, event):
91     self.EndModal(wxID_CANCEL)
92    

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26