1 |
# Copyright (c) 2001, 2003 by Intevation GmbH |
2 |
# Authors: |
3 |
# Bernhard Herzog <[email protected]> |
4 |
# Frank Koormann <[email protected]> |
5 |
# |
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 |
from wxPython.wx import wxFrame, wxDEFAULT_FRAME_STYLE, EVT_CLOSE |
14 |
|
15 |
#class NonModalDialog(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 |
# self.parent.remove_dialog(self.name) |
26 |
# self.Destroy() |
27 |
# |
28 |
from wxPython.wx import * |
29 |
|
30 |
class NonModalDialog(wxDialog): |
31 |
def __init__(self, parent, name, title): |
32 |
wxDialog.__init__(self, parent, -1, title, |
33 |
style = wxDEFAULT_DIALOG_STYLE |
34 |
| wxSYSTEM_MENU |
35 |
| wxMINIMIZE_BOX |
36 |
| wxMAXIMIZE_BOX |
37 |
| wxRESIZE_BORDER |
38 |
) |
39 |
self.parent = parent |
40 |
self.name = name |
41 |
EVT_CLOSE(self, self.OnClose) |
42 |
|
43 |
def OnClose(self, event): |
44 |
if self.parent.dialogs.has_key(self.name): |
45 |
self.parent.remove_dialog(self.name) |
46 |
self.Destroy() |
47 |
|
48 |
class NonModalNonParentDialog(wxDialog): |
49 |
def __init__(self, parent, name, title): |
50 |
wxDialog.__init__(self, None, -1, title, |
51 |
style = wxDEFAULT_DIALOG_STYLE |
52 |
| wxSYSTEM_MENU |
53 |
| wxMINIMIZE_BOX |
54 |
| wxMAXIMIZE_BOX |
55 |
| wxRESIZE_BORDER |
56 |
| wxDIALOG_NO_PARENT |
57 |
) |
58 |
self.parent = parent |
59 |
self.name = name |
60 |
EVT_CLOSE(self, self.OnClose) |
61 |
|
62 |
def OnClose(self, event): |
63 |
if self.parent.dialogs.has_key(self.name): |
64 |
self.parent.remove_dialog(self.name) |
65 |
self.Destroy() |