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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 374 - (show annotations)
Mon Jan 27 14:20:02 2003 UTC (22 years, 1 month ago) by jan
Original Path: trunk/thuban/Thuban/UI/labeldialog.py
File MIME type: text/x-python
File size: 2152 byte(s)
Replace user string by _() for i18n.

1 # 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 from Thuban import _
13
14 from controls import SelectableRecordListCtrl
15
16 class LabelListCtrl(SelectableRecordListCtrl):
17
18 def __init__(self, parent, id, table, shape):
19 SelectableRecordListCtrl.__init__(self, parent, id)
20 self.fill_list(table, shape)
21
22
23 class LabelDialog(wxDialog):
24
25 def __init__(self, parent, table, shape_index):
26 wxDialog.__init__(self, parent, -1, _("Label Values"),
27 wxDefaultPosition,
28 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 top_box.Add(self.list, 1, wxEXPAND|wxALL, 4)
38
39 box = wxBoxSizer(wxHORIZONTAL)
40 box.Add(wxButton(self, wxID_OK, _("OK")), 0, wxALL, 4)
41 box.Add(wxButton(self, wxID_CANCEL, _("Cancel")), 0, wxALL, 4)
42 top_box.Add(box, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 10)
43
44 EVT_BUTTON(self, wxID_OK, self.OnOK)
45 EVT_BUTTON(self, wxID_CANCEL, self.OnCancel)
46
47 self.SetAutoLayout(true)
48 self.SetSizer(top_box)
49 top_box.Fit(self)
50 top_box.SetSizeHints(self)
51
52 def OnOK(self, event):
53 result = self.list.GetValue()
54 if result is not None:
55 self.end_dialog(wxID_OK, str(result))
56 else:
57 self.end_dialog(wxID_CANCEL, None)
58
59 def OnCancel(self, event):
60 self.end_dialog(wxID_CANCEL, None)
61
62 def end_dialog(self, wx_result, result):
63 self.result = result
64 self.EndModal(wx_result)
65
66 def run_label_dialog(parent, table, shape_index):
67 dialog = LabelDialog(parent, table, shape_index)
68 if dialog.ShowModal() == wxID_OK:
69 return dialog.result
70 else:
71 return None
72

Properties

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26