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

Annotation of /branches/WIP-pyshapelib-bramz/Thuban/UI/labeldialog.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 421 - (hide annotations)
Thu Feb 20 16:23:12 2003 UTC (22 years ago) by frank
Original Path: trunk/thuban/Thuban/UI/labeldialog.py
File MIME type: text/x-python
File size: 2195 byte(s)
(LabelDialog.dialog_layout): Set size of listctrl.

1 bh 6 # Copyright (c) 2001 by Intevation GmbH
2     # Authors:
3     # Bernhard Herzog <[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     __version__ = "$Revision$"
9    
10     from wxPython.wx import *
11    
12 jan 374 from Thuban import _
13    
14 bh 52 from controls import SelectableRecordListCtrl
15 bh 6
16 bh 52 class LabelListCtrl(SelectableRecordListCtrl):
17 bh 6
18 bh 52 def __init__(self, parent, id, table, shape):
19     SelectableRecordListCtrl.__init__(self, parent, id)
20     self.fill_list(table, shape)
21 bh 6
22    
23     class LabelDialog(wxDialog):
24    
25     def __init__(self, parent, table, shape_index):
26 jan 374 wxDialog.__init__(self, parent, -1, _("Label Values"),
27     wxDefaultPosition,
28 bh 6 style = wxRESIZE_BORDER|wxCAPTION|wxDIALOG_MODAL)
29    
30     self.parent = parent
31     self.dialog_layout(table, shape_index)
32    
33     def dialog_layout(self, table, shape_index):
34     top_box = wxBoxSizer(wxVERTICAL)
35    
36     self.list = LabelListCtrl(self, -1, table, shape_index)
37 frank 421 self.list.SetSize(wxSize(305,200))
38 bh 6 top_box.Add(self.list, 1, wxEXPAND|wxALL, 4)
39    
40     box = wxBoxSizer(wxHORIZONTAL)
41 jan 374 box.Add(wxButton(self, wxID_OK, _("OK")), 0, wxALL, 4)
42     box.Add(wxButton(self, wxID_CANCEL, _("Cancel")), 0, wxALL, 4)
43 bh 6 top_box.Add(box, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 10)
44    
45     EVT_BUTTON(self, wxID_OK, self.OnOK)
46     EVT_BUTTON(self, wxID_CANCEL, self.OnCancel)
47    
48     self.SetAutoLayout(true)
49     self.SetSizer(top_box)
50     top_box.Fit(self)
51     top_box.SetSizeHints(self)
52    
53     def OnOK(self, event):
54     result = self.list.GetValue()
55 bh 52 if result is not None:
56 bh 6 self.end_dialog(wxID_OK, str(result))
57     else:
58     self.end_dialog(wxID_CANCEL, None)
59    
60     def OnCancel(self, event):
61     self.end_dialog(wxID_CANCEL, None)
62    
63     def end_dialog(self, wx_result, result):
64     self.result = result
65     self.EndModal(wx_result)
66    
67     def run_label_dialog(parent, table, shape_index):
68     dialog = LabelDialog(parent, table, shape_index)
69     if dialog.ShowModal() == wxID_OK:
70     return dialog.result
71     else:
72     return None
73    

Properties

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26