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

Diff of /branches/WIP-pyshapelib-bramz/Thuban/UI/dialogs.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1057 by frank, Tue May 27 11:30:02 2003 UTC revision 2700 by dpinte, Mon Sep 18 14:27:02 2006 UTC
# Line 10  Line 10 
10    
11  __version__ = "$Revision$"  __version__ = "$Revision$"
12    
13  from wxPython.wx import wxFrame, wxDEFAULT_FRAME_STYLE, EVT_CLOSE  import wx
14    
15  #class NonModalDialog(wxFrame):  class ThubanFrame(wx.Frame):
 #  
 #    def __init__(self, parent, name, title):  
 #        wxFrame.__init__(self, parent, -1, title,  
 #            style = wxDEFAULT_FRAME_STYLE )  
 #        self.parent = parent  
 #        self.name = name  
 #        EVT_CLOSE(self, self.OnClose)  
 #  
 #    def OnClose(self, event):  
 #        self.parent.remove_dialog(self.name)  
 #        self.Destroy()  
 #  
 from wxPython.wx import *  
16    
 class NonModalDialog(wxDialog):  
17      def __init__(self, parent, name, title):      def __init__(self, parent, name, title):
18          wxDialog.__init__(self, parent, -1, title,          wx.Frame.__init__(self, parent, -1, title,
19              style = wxDEFAULT_DIALOG_STYLE              style = wx.DEFAULT_FRAME_STYLE )
20                    | wxSYSTEM_MENU          self.parent = parent
21                    | wxMINIMIZE_BOX          self.name = name
22                    | wxMAXIMIZE_BOX          self.Bind(wx.EVT_CLOSE, self.OnClose)
23                    | wxRESIZE_BORDER          self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
24    
25        def OnClose(self, event):
26            # FIXME: Shouldn't this really be in OnDestroy?
27            if self.parent.dialogs.has_key(self.name):
28                self.parent.remove_dialog(self.name)
29            self.Destroy()
30    
31        def OnDestroy(self, event):
32            """Implement in derived classes for resource cleanup, etc."""
33    
34    
35    class NonModalDialog(wx.Dialog):
36        def __init__(self, parent, name, title):
37            wx.Dialog.__init__(self, parent, -1, title,
38                style = wx.DEFAULT_DIALOG_STYLE
39                      | wx.SYSTEM_MENU
40                      | wx.MINIMIZE_BOX
41                      | wx.MAXIMIZE_BOX
42                      | wx.RESIZE_BORDER
43              )              )
44          self.parent = parent          self.parent = parent
45          self.name = name          self.name = name
46          EVT_CLOSE(self, self.OnClose)          self.Bind(wx.EVT_CLOSE, self.OnClose)
47    
48      def OnClose(self, event):      def OnClose(self, event):
49          if self.parent.dialogs.has_key(self.name):          if self.parent.dialogs.has_key(self.name):
50              self.parent.remove_dialog(self.name)              self.parent.remove_dialog(self.name)
51          self.Destroy()          self.Destroy()
52    
53  class NonModalNonParentDialog(wxDialog):  class NonModalNonParentDialog(wx.Dialog):
54      def __init__(self, parent, name, title):      def __init__(self, parent, name, title):
55          wxDialog.__init__(self, None, -1, title,          wx.Dialog.__init__(self, None, -1, title,
56              style = wxDEFAULT_DIALOG_STYLE              style = wx.DEFAULT_DIALOG_STYLE
57                    | wxSYSTEM_MENU                    | wx.SYSTEM_MENU
58                    | wxMINIMIZE_BOX                    | wx.MINIMIZE_BOX
59                    | wxMAXIMIZE_BOX                    | wx.MAXIMIZE_BOX
60                    | wxRESIZE_BORDER                    | wx.RESIZE_BORDER
61                    | wxDIALOG_NO_PARENT                    | wx.DIALOG_NO_PARENT
62              )              )
63          self.parent = parent          self.parent = parent
64          self.name = name          self.name = name
65          EVT_CLOSE(self, self.OnClose)          self.Bind(wx.EVT_CLOSE, self.OnClose)
66    
67      def OnClose(self, event):      def OnClose(self, event):
68          if self.parent.dialogs.has_key(self.name):          if self.parent.dialogs.has_key(self.name):

Legend:
Removed from v.1057  
changed lines
  Added in v.2700

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26