]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/samples/pydocview/PyDocViewDemo.py
fix building/running of tex2rtf
[wxWidgets.git] / wxPython / samples / pydocview / PyDocViewDemo.py
index c8983937445239ee22611e28205ebe0a193bd9dd..a2a6d56684a12e3f3627badc94e4faef5728c90e 100644 (file)
@@ -7,11 +7,12 @@
 # Created:      5/15/03
 # CVS-ID:       $Id$
 # Copyright:    (c) 2003-2005 ActiveGrid, Inc.
-# License:      ASL 2.0  http://apache.org/licenses/LICENSE-2.0
+# License:      wxWindows License
 #----------------------------------------------------------------------------
 
 
 import sys
+import os.path
 import wx
 import wx.lib.docview as docview
 import wx.lib.pydocview as pydocview
@@ -26,13 +27,15 @@ _ = wx.GetTranslation
 
 class TextEditorApplication(pydocview.DocApp):
 
-
+    SPLASH = "splash.png"
+    
     def OnInit(self):
         # Call the super - this is important!!!
         pydocview.DocApp.OnInit(self)
 
         # Show the splash dialog while everything is loading up
-        self.ShowSplash("splash.jpg")
+        if os.path.exists(TextEditorApplication.SPLASH):
+            self.ShowSplash(TextEditorApplication.SPLASH)
 
         # Set the name and the icon
         self.SetAppName(_("wxPython PyDocView Demo"))
@@ -58,11 +61,14 @@ class TextEditorApplication(pydocview.DocApp):
         # Install services - these can install menu and toolbar items
         textService           = self.InstallService(TextEditor.TextService())
         findService           = self.InstallService(FindService.FindService())
-        optionsService        = self.InstallService(pydocview.DocOptionsService())
+        optionsService        = self.InstallService(pydocview.DocOptionsService(supportedModes=wx.lib.docview.DOC_MDI))
         windowMenuService     = self.InstallService(pydocview.WindowMenuService())
         filePropertiesService = self.InstallService(pydocview.FilePropertiesService())
-        aboutService          = self.InstallService(pydocview.AboutService(image=wx.Image("splash.jpg")))
-
+        if os.path.exists(TextEditorApplication.SPLASH):
+            aboutService      = self.InstallService(pydocview.AboutService(image=wx.Image(TextEditorApplication.SPLASH)))
+        else:
+            aboutService      = self.InstallService(pydocview.AboutService())
+            
         # Install the TextEditor's option panel into the OptionsService
         optionsService.AddOptionsPanel(TextEditor.TextOptionsPanel)
 
@@ -77,10 +83,14 @@ class TextEditorApplication(pydocview.DocApp):
             textTemplate.CreateDocument('', docview.DOC_NEW).OnNewDocument()
 
         # Close the splash dialog
-        self.CloseSplash()
+        if os.path.exists(TextEditorApplication.SPLASH):
+            self.CloseSplash()
         
         # Show the tips dialog
-        wx.CallAfter(self.ShowTip, wx.GetApp().GetTopWindow(), wx.CreateFileTipProvider("tips.txt", 0))
+        if os.path.exists("tips.txt"):
+            wx.CallAfter(self.ShowTip, wx.GetApp().GetTopWindow(), wx.CreateFileTipProvider("tips.txt", 0))
+
+        wx.UpdateUIEvent.SetUpdateInterval(1000)  # Overhead of updating menus was too much.  Change to update every N milliseconds.
 
         # Tell the framework that everything is great
         return True