mailr11989 - /branches/bieri_gui/gui_bieri/about.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on December 28, 2010 - 15:14:
Author: bugman
Date: Tue Dec 28 15:14:30 2010
New Revision: 11989

URL: http://svn.gna.org/viewcvs/relax?rev=11989&view=rev
Log:
The about window base class can now render given HTML text to the DC.


Modified:
    branches/bieri_gui/gui_bieri/about.py

Modified: branches/bieri_gui/gui_bieri/about.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/about.py?rev=11989&r1=11988&r2=11989&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/about.py (original)
+++ branches/bieri_gui/gui_bieri/about.py Tue Dec 28 15:14:30 2010
@@ -26,6 +26,7 @@
 from textwrap import wrap
 import webbrowser
 import wx
+import wx.html
 
 # relax module imports.
 from info import Info_box
@@ -56,7 +57,7 @@
     # Destroy on clicking.
     DESTROY_ON_CLICK = True
 
-    def __init__(self, parent=None, id=-1, title=''):
+    def __init__(self, parent=None, id=-1, title='', html_text=None):
         """Build the dialog."""
 
         # Execute the base class __init__() method.
@@ -79,6 +80,10 @@
         # Create the buffered device context.
         self.create_buffered_dc()
 
+        # Add HTML content.
+        if html_text:
+            self.add_html(html_text)
+
         # Draw everything.
         self.window.Bind(wx.EVT_PAINT, self.generate)
 
@@ -90,6 +95,29 @@
 
         # Center Window
         self.Centre()
+
+
+    def add_html(self, text):
+        """Add the given HTML text to the DC.
+
+        @param text:    The HTML text.
+        @type text:     str
+        """
+
+        # The HTML renderer.
+        self.html = wx.html.HtmlDCRenderer()
+
+        # Set the DC.
+        self.html.SetDC(self.dc, 1.0)
+
+        # Set the size of the HTML object.
+        self.html.SetSize(self.virt_x, self.virt_y)
+
+        # Add the text.
+        self.html.SetHtmlText(text)
+
+        # Render the HTML.
+        self.html.Render(0, 0, known_pagebreaks=[])
 
 
     def create_buffered_dc(self):




Related Messages


Powered by MHonArc, Updated Tue Dec 28 15:40:02 2010