mailr10642 - /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 February 04, 2010 - 17:02:
Author: bugman
Date: Thu Feb  4 17:02:03 2010
New Revision: 10642

URL: http://svn.gna.org/viewcvs/relax?rev=10642&view=rev
Log:
Added the copyright and licence text to the 'About relax' widget.


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=10642&r1=10641&r2=10642&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/about.py (original)
+++ branches/bieri_gui/gui_bieri/about.py Thu Feb  4 17:02:03 2010
@@ -23,6 +23,7 @@
 
 # Python module imports.
 from os import sep
+from textwrap import wrap
 import wx
 
 # relax module imports.
@@ -169,6 +170,31 @@
         # The description.
         self.draw_description()
 
+        # The copyright.
+        self.draw_copyright()
+
+        # The licence.
+        self.draw_licence()
+
+
+    def draw_copyright(self):
+        """Draw the copyright statements."""
+
+        # Set the font.
+        font = wx.Font(10, wx.FONTFAMILY_ROMAN, wx.NORMAL, wx.NORMAL)
+        self.dc.SetFont(font)
+
+        # Offset.
+        offset = 270
+
+        # The text extent.
+        x1, y1 = self.dc.GetTextExtent(self.info.copyright[0])
+        x2, y2 = self.dc.GetTextExtent(self.info.copyright[1])
+
+        # Draw the text.
+        self.dc.DrawText(self.info.copyright[0], self.boarder + (self.dim_x 
- x1)/2, offset)
+        self.dc.DrawText(self.info.copyright[1], self.boarder + (self.dim_x 
- x2)/2, offset+y1+3)
+
 
     def draw_description(self):
         """Draw the relax description text."""
@@ -191,6 +217,35 @@
         
self.dc.DrawBitmap(wx.Bitmap(IMAGE_PATH+'ulysses_shadowless_400x168.png'), 
self.boarder, self.boarder, True)
 
 
+    def draw_licence(self):
+        """Draw the relax licence text."""
+
+        # Set the font.
+        font = wx.Font(10, wx.FONTFAMILY_ROMAN, wx.NORMAL, wx.NORMAL)
+        self.dc.SetFont(font)
+
+        # Offset.
+        offset = 325
+
+        # Wrap the text.
+        lines = wrap(self.info.licence, 60)
+
+        # Find the max y extent.
+        max_y = 0
+        for line in lines:
+            x, y = self.dc.GetTextExtent(self.info.desc)
+            if y > max_y:
+                max_y = y
+
+        # Draw.
+        for line in lines:
+            # Draw the text.
+            self.dc.DrawText(line, self.boarder, offset)
+
+            # Update the offset.
+            offset = offset + max_y + 1
+
+
     def draw_title(self):
         """Draw the relax title with name and version."""
 




Related Messages


Powered by MHonArc, Updated Thu Feb 04 17:40:02 2010