]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wxPython/lib/dialogs.py
added slightly more informative failure reporting.
[wxWidgets.git] / wxPython / wxPython / lib / dialogs.py
index e517f105b35f677dbf939f603de06b8745da3f89..dd600ddd27406336d63bdead5848033230e39458 100644 (file)
@@ -5,13 +5,11 @@ import string
 
 
 class wxScrolledMessageDialog(wxDialog):
 
 
 class wxScrolledMessageDialog(wxDialog):
-
-    def __init__(self, parent, msg, caption, pos = None, size = None):
-        if not pos:
-            pos = wxDefaultPosition
-        if not size:
-            size = wxSize(500,300)
+    def __init__(self, parent, msg, caption, pos = wxDefaultPosition, size = (500,300)):
         wxDialog.__init__(self, parent, -1, caption, pos, size)
         wxDialog.__init__(self, parent, -1, caption, pos, size)
+        x, y = pos
+        if x == -1 and y == -1:
+            self.CenterOnScreen(wxBOTH)
         text = wxTextCtrl(self, -1, msg, wxDefaultPosition,
                              wxDefaultSize,
                              wxTE_MULTILINE | wxTE_READONLY)
         text = wxTextCtrl(self, -1, msg, wxDefaultPosition,
                              wxDefaultSize,
                              wxTE_MULTILINE | wxTE_READONLY)
@@ -23,13 +21,11 @@ class wxScrolledMessageDialog(wxDialog):
 
 
 class wxMultipleChoiceDialog(wxDialog):
 
 
 class wxMultipleChoiceDialog(wxDialog):
-
-    def __init__(self, parent, msg, title, lst, pos = None, size = None):
-        if not pos:
-            pos = wxDefaultPosition
-        if not size:
-            size = wxSize(200,200)
+    def __init__(self, parent, msg, title, lst, pos = wxDefaultPosition, size = (200,200)):
         wxDialog.__init__(self, parent, -1, title, pos, size)
         wxDialog.__init__(self, parent, -1, title, pos, size)
+        x, y = pos
+        if x == -1 and y == -1:
+            self.CenterOnScreen(wxBOTH)
         dc = wxClientDC(self)
         height = 0
         for line in string.split(msg,'\n'):
         dc = wxClientDC(self)
         height = 0
         for line in string.split(msg,'\n'):
@@ -48,10 +44,6 @@ class wxMultipleChoiceDialog(wxDialog):
         self.SetAutoLayout(TRUE)
         self.lst = lst
         self.Layout()
         self.SetAutoLayout(TRUE)
         self.lst = lst
         self.Layout()
-        EVT_SIZE(self, self.OnSize)
-
-    def OnSize(self, event):
-        self.Layout()
 
     def GetValue(self):
         return self.lbox.GetSelections()
 
     def GetValue(self):
         return self.lbox.GetSelections()
@@ -63,6 +55,7 @@ class wxMultipleChoiceDialog(wxDialog):
             val.append(self.lst[i])
         return tuple(val)
 
             val.append(self.lst[i])
         return tuple(val)
 
+
 if __name__ == '__main__':
     class MyFrame(wxFrame):
         def __init__(self):
 if __name__ == '__main__':
     class MyFrame(wxFrame):
         def __init__(self):