1 |
bh |
535 |
# Copyright (c) 2001, 2003 by Intevation GmbH |
2 |
bh |
28 |
# Authors: |
3 |
|
|
# Bernhard Herzog <[email protected]> |
4 |
frank |
1057 |
# Frank Koormann <[email protected]> |
5 |
bh |
28 |
# |
6 |
|
|
# This program is free software under the GPL (>=v2) |
7 |
|
|
# Read the file COPYING coming with Thuban for details. |
8 |
|
|
|
9 |
|
|
"""Base classes for dialogs""" |
10 |
|
|
|
11 |
|
|
__version__ = "$Revision$" |
12 |
|
|
|
13 |
jonathan |
814 |
from wxPython.wx import * |
14 |
|
|
|
15 |
jonathan |
1198 |
class ThubanFrame(wxFrame): |
16 |
|
|
|
17 |
|
|
def __init__(self, parent, name, title): |
18 |
|
|
wxFrame.__init__(self, parent, -1, title, |
19 |
|
|
style = wxDEFAULT_FRAME_STYLE ) |
20 |
|
|
self.parent = parent |
21 |
|
|
self.name = name |
22 |
|
|
EVT_CLOSE(self, self.OnClose) |
23 |
|
|
|
24 |
|
|
def OnClose(self, event): |
25 |
|
|
if self.parent.dialogs.has_key(self.name): |
26 |
|
|
self.parent.remove_dialog(self.name) |
27 |
|
|
self.Destroy() |
28 |
|
|
|
29 |
jonathan |
814 |
class NonModalDialog(wxDialog): |
30 |
bh |
535 |
def __init__(self, parent, name, title): |
31 |
jonathan |
814 |
wxDialog.__init__(self, parent, -1, title, |
32 |
|
|
style = wxDEFAULT_DIALOG_STYLE |
33 |
|
|
| wxSYSTEM_MENU |
34 |
|
|
| wxMINIMIZE_BOX |
35 |
|
|
| wxMAXIMIZE_BOX |
36 |
frank |
1057 |
| wxRESIZE_BORDER |
37 |
|
|
) |
38 |
bh |
28 |
self.parent = parent |
39 |
|
|
self.name = name |
40 |
|
|
EVT_CLOSE(self, self.OnClose) |
41 |
|
|
|
42 |
|
|
def OnClose(self, event): |
43 |
frank |
1057 |
if self.parent.dialogs.has_key(self.name): |
44 |
|
|
self.parent.remove_dialog(self.name) |
45 |
bh |
28 |
self.Destroy() |
46 |
frank |
1057 |
|
47 |
|
|
class NonModalNonParentDialog(wxDialog): |
48 |
|
|
def __init__(self, parent, name, title): |
49 |
|
|
wxDialog.__init__(self, None, -1, title, |
50 |
|
|
style = wxDEFAULT_DIALOG_STYLE |
51 |
|
|
| wxSYSTEM_MENU |
52 |
|
|
| wxMINIMIZE_BOX |
53 |
|
|
| wxMAXIMIZE_BOX |
54 |
|
|
| wxRESIZE_BORDER |
55 |
|
|
| wxDIALOG_NO_PARENT |
56 |
|
|
) |
57 |
|
|
self.parent = parent |
58 |
|
|
self.name = name |
59 |
|
|
EVT_CLOSE(self, self.OnClose) |
60 |
|
|
|
61 |
|
|
def OnClose(self, event): |
62 |
|
|
if self.parent.dialogs.has_key(self.name): |
63 |
|
|
self.parent.remove_dialog(self.name) |
64 |
|
|
self.Destroy() |