]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/wxFileHistory.py
corrected Unicode conversion when replacing shared library extension with ".rsrc"
[wxWidgets.git] / wxPython / demo / wxFileHistory.py
index bb90041bf789ab036d6cd739f3e463c4edda6bcd..ebedc59f4141f9dd6ad39737aa2fff74674ef08f 100644 (file)
@@ -8,7 +8,7 @@ text = """\
 Right-click on the panel to get a menu.  This menu will be managed by
 a wxFileHistory object and so the files you select will automatically
 be added to the end of the menu and will be selectable the next time
 Right-click on the panel to get a menu.  This menu will be managed by
 a wxFileHistory object and so the files you select will automatically
 be added to the end of the menu and will be selectable the next time
-the menu is viewed.  The filename selcted, either via the Open menu
+the menu is viewed.  The filename selected, either via the Open menu
 item, or from the history, will be displayed in the log window below.
 """
 
 item, or from the history, will be displayed in the log window below.
 """
 
@@ -21,22 +21,23 @@ class TestPanel(wxPanel):
         box = wxBoxSizer(wxVERTICAL)
 
         # Make and layout the controls
         box = wxBoxSizer(wxVERTICAL)
 
         # Make and layout the controls
-        bf = wxFont(14, wxSWISS, wxNORMAL, wxBOLD)
-        nf = wxFont(11, wxSWISS, wxNORMAL, wxNORMAL)
+        fs = self.GetFont().GetPointSize()
+        bf = wxFont(fs+4, wxSWISS, wxNORMAL, wxBOLD)
+        nf = wxFont(fs+2, wxSWISS, wxNORMAL, wxNORMAL)
 
         t = wxStaticText(self, -1, "wxFileHistory")
         t.SetFont(bf)
         box.Add(t, 0, wxCENTER|wxALL, 5)
 
         box.Add(wxStaticLine(self, -1), 0, wxEXPAND)
 
         t = wxStaticText(self, -1, "wxFileHistory")
         t.SetFont(bf)
         box.Add(t, 0, wxCENTER|wxALL, 5)
 
         box.Add(wxStaticLine(self, -1), 0, wxEXPAND)
-        box.Add(10,20)
+        box.Add((10,20))
 
         t = wxStaticText(self, -1, text)
         t.SetFont(nf)
         box.Add(t, 0, wxCENTER|wxALL, 5)
 
         self.SetSizer(box)
 
         t = wxStaticText(self, -1, text)
         t.SetFont(nf)
         box.Add(t, 0, wxCENTER|wxALL, 5)
 
         self.SetSizer(box)
-        self.SetAutoLayout(true)
+        self.SetAutoLayout(True)
 
         # Make a menu
         self.menu = m = wxMenu()
 
         # Make a menu
         self.menu = m = wxMenu()
@@ -45,10 +46,10 @@ class TestPanel(wxPanel):
         m.Append(wxID_CLOSE,   "&Close")
         m.Append(wxID_SAVE,    "&Save")
         m.Append(wxID_SAVEAS,  "Save &as...")
         m.Append(wxID_CLOSE,   "&Close")
         m.Append(wxID_SAVE,    "&Save")
         m.Append(wxID_SAVEAS,  "Save &as...")
-        m.Enable(wxID_NEW, false)
-        m.Enable(wxID_CLOSE, false)
-        m.Enable(wxID_SAVE, false)
-        m.Enable(wxID_SAVEAS, false)
+        m.Enable(wxID_NEW, False)
+        m.Enable(wxID_CLOSE, False)
+        m.Enable(wxID_SAVE, False)
+        m.Enable(wxID_SAVEAS, False)
 
         # and a file history
         self.filehistory = wxFileHistory()
 
         # and a file history
         self.filehistory = wxFileHistory()
@@ -58,10 +59,10 @@ class TestPanel(wxPanel):
         EVT_RIGHT_UP(self, self.OnRightClick)
         EVT_MENU(self, wxID_OPEN, self.OnFileOpenDialog)
         EVT_MENU_RANGE(self, wxID_FILE1, wxID_FILE9, self.OnFileHistory)
         EVT_RIGHT_UP(self, self.OnRightClick)
         EVT_MENU(self, wxID_OPEN, self.OnFileOpenDialog)
         EVT_MENU_RANGE(self, wxID_FILE1, wxID_FILE9, self.OnFileHistory)
+        EVT_WINDOW_DESTROY(self, self.Cleanup)
 
 
 
 
-
-    def __del__(self):
+    def Cleanup(self, *args):
         del self.filehistory
         self.menu.Destroy()
 
         del self.filehistory
         self.menu.Destroy()
 
@@ -73,6 +74,7 @@ class TestPanel(wxPanel):
     def OnFileOpenDialog(self, evt):
         dlg = wxFileDialog(self,
                            defaultDir = os.getcwd(),
     def OnFileOpenDialog(self, evt):
         dlg = wxFileDialog(self,
                            defaultDir = os.getcwd(),
+                           wildcard = "All Files|*",
                            style = wxOPEN | wxCHANGE_DIR)
         if dlg.ShowModal() == wxID_OK:
             path = dlg.GetPath()
                            style = wxOPEN | wxCHANGE_DIR)
         if dlg.ShowModal() == wxID_OK:
             path = dlg.GetPath()
@@ -114,3 +116,9 @@ list appended to a menu, such as the File menu.
 
 </body></html>
 """
 
 </body></html>
 """
+
+if __name__ == '__main__':
+    import sys,os
+    import run
+    run.main(['', os.path.basename(sys.argv[0])])
+