dabo Commit
Revision 3190
Date: 2007-06-21 13:19:55 -0700 (Thu, 21 Jun 2007)
Author: Paul
Trac: http://svn.dabodev.com/trac/dabo/changeset/3190

Changed:
U   trunk/dabo/ui/uiwx/__init__.py
A   trunk/dabo/ui/uiwx/dPdfWindow.py

Log:
Added a very thin wrapper around wx.lib.pdfwin.PDFWindow for Dabo, called 
dPdfWindow.

I think that in the future, there will be a cross-platform control for 
displaying
PDF files, but I need to get this into my current application now, so I've just
left the API as defined in wx, but most of the method signatures are close 
enough
to how we would have done it anyway, and it is mostly method-driven instead of
property-driven, so I think this is "good enough".



Diff:
Modified: trunk/dabo/ui/uiwx/__init__.py
===================================================================
--- trunk/dabo/ui/uiwx/__init__.py      2007-06-21 19:46:41 UTC (rev 3189)
+++ trunk/dabo/ui/uiwx/__init__.py      2007-06-21 20:19:55 UTC (rev 3190)
@@ -95,6 +95,7 @@
 from dForm import dBorderlessForm
 from dFormMain import dFormMain
 from dGauge import dGauge
+from dGlWindow import dGlWindow
 from dGrid import dGrid
 from dGrid import dColumn
 from dGridSizer import dGridSizer
@@ -122,6 +123,7 @@
 from dPageFrame import dPageSelect
 from dPageFrameNoTabs import dPageFrameNoTabs
 from dPage import dPage
+from dPdfWindow import dPdfWindow
 from dSizer import dSizer
 from dBorderSizer import dBorderSizer
 from dSlider import dSlider
@@ -139,11 +141,6 @@
 import dUICursors as dUICursors
 import dShell
 
-try:
-       from dGlWindow import dGlWindow
-except ImportError:
-       dabo.infoLog.write(_("PyOpenGL not present, so dGlWindow is not 
loaded."))
-
 # dDockForm is not available with wxPython < 2.7
 if wx.VERSION >= (2, 7):
        from dDockForm import dDockForm

Added: trunk/dabo/ui/uiwx/dPdfWindow.py
===================================================================
--- trunk/dabo/ui/uiwx/dPdfWindow.py                            (rev 0)
+++ trunk/dabo/ui/uiwx/dPdfWindow.py    2007-06-21 20:19:55 UTC (rev 3190)
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+import wx
+import dabo
+
+if __name__ == "__main__":
+       dabo.ui.loadUI("wx")
+
+import dControlMixin as cm
+from dabo.dLocalize import _
+import dabo.dEvents as dEvents
+from dabo.ui import makeDynamicProperty
+
+try:
+       import wx.lib.pdfwin as pdfwin
+       PDFWindow = pdfwin.PDFWindow
+except ImportError:
+       class Dummy(object):
+               _dummy = True
+       PDFWindow = Dummy
+
+
+class dPdfWindow(cm.dControlMixin, PDFWindow):
+       """Displays a PDF file on Windows using Adobe Acrobat Reader in a panel.
+
+       See wx.lib.pdfwin.PDFWindow for the API.
+       """
+       def __init__(self, parent, properties=None, attProperties=None, *args, 
**kwargs):
+               if hasattr(PDFWindow, "_dummy"):
+                       raise ImportError, "wx.lib.pdfwin couldn't be imported, 
so dPdfWindow cannot instantiate."
+
+               self._baseClass = dPdfWindow
+               preClass = pdfwin.PDFWindow
+               cm.dControlMixin.__init__(self, preClass, parent, properties, 
attProperties, 
+                               *args, **kwargs)
+       
+
+
+class _dPdfWindow_test(dPdfWindow):
+       pass
+
+
+if __name__ == "__main__":
+       import test
+       test.Test().runTest(_dPdfWindow_test)
+




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/dabo-dev/[EMAIL PROTECTED]

Reply via email to