/[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 2734 - (hide annotations)
Thu Mar 1 12:42:59 2007 UTC (18 years ago) by bramz
File MIME type: text/x-python
File size: 2206 byte(s)
made a copy
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 dpinte 2700 import wx
11 bh 6
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 dpinte 2700 class LabelDialog(wx.Dialog):
24 bh 6
25     def __init__(self, parent, table, shape_index):
26 dpinte 2700 wx.Dialog.__init__(self, parent, -1, _("Label Values"),
27     wx.DefaultPosition,
28     style = wx.RESIZE_BORDER|wx.CAPTION|wx.DIALOG_MODAL)
29 bh 6
30     self.parent = parent
31     self.dialog_layout(table, shape_index)
32 dpinte 2700
33 bh 6 def dialog_layout(self, table, shape_index):
34 dpinte 2700 top_box = wx.BoxSizer(wx.VERTICAL)
35 bh 6
36     self.list = LabelListCtrl(self, -1, table, shape_index)
37 dpinte 2700 self.list.SetSize(wx.Size(305,200))
38     top_box.Add(self.list, 1, wx.EXPAND|wx.ALL, 4)
39 bh 6
40 dpinte 2700 box = wx.BoxSizer(wx.HORIZONTAL)
41     box.Add(wx.Button(self, wx.ID_OK, _("OK")), 0, wx.ALL, 4)
42     box.Add(wx.Button(self, wx.ID_CANCEL, _("Cancel")), 0, wx.ALL, 4)
43     top_box.Add(box, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 10)
44 bh 6
45 dpinte 2700 self.Bind(wx.EVT_BUTTON, self.OnOK, id=wx.ID_OK)
46     self.Bind(wx.EVT_BUTTON, self.OnCancel, id=wx.ID_CANCEL)
47 bh 6
48 jan 1035 self.SetAutoLayout(True)
49 bh 6 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 dpinte 2700 self.end_dialog(wx.ID_OK, str(result))
57 bh 6 else:
58 dpinte 2700 self.end_dialog(wx.ID_CANCEL, None)
59 bh 6
60     def OnCancel(self, event):
61 dpinte 2700 self.end_dialog(wx.ID_CANCEL, None)
62 bh 6
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 dpinte 2700 if dialog.ShowModal() == wx.ID_OK:
70 bh 6 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