mailr17344 - /trunk/graphics/__init__.py


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

Header


Content

Posted by edward on August 27, 2012 - 12:25:
Author: bugman
Date: Mon Aug 27 12:25:29 2012
New Revision: 17344

URL: http://svn.gna.org/viewcvs/relax?rev=17344&view=rev
Log:
Modified the graphics.fetch_icon function to return different file formats.

This will be used for the relax manual where eps.gz files are required.


Modified:
    trunk/graphics/__init__.py

Modified: trunk/graphics/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/graphics/__init__.py?rev=17344&r1=17343&r2=17344&view=diff
==============================================================================
--- trunk/graphics/__init__.py (original)
+++ trunk/graphics/__init__.py Mon Aug 27 12:25:29 2012
@@ -36,7 +36,7 @@
 WIZARD_IMAGE_PATH = status.install_path + sep + 'graphics' + sep + 'wizards' 
+ sep
 
 
-def fetch_icon(icon=None, size='16x16'):
+def fetch_icon(icon=None, size='16x16', format='png'):
     """Return the path to the specified icon.
 
     The icon code consists of two parts separated by the '.' character.  
These are:
@@ -46,12 +46,14 @@
 
     To specify the 'graphics/oxygen_icons/16x16/actions/document-open.png' 
icon, the icon code string would therefore be 'oxygen.actions.document-open'.
 
-    @keyword icon:  The special icon code.
-    @type icon:     str
-    @keyword size:  The icon size to fetch.
-    @type size:     str
-    @return:        The icon path, for example 
'oxygen_icons/16x16/actions/document-open.png'.
-    @rtype:         str
+    @keyword icon:      The special icon code.
+    @type icon:         str
+    @keyword size:      The icon size to fetch.
+    @type size:         str
+    @keyword format:    The format of the icon, defaulting to PNG images.  
This can be changed to 'eps.gz' for example.
+    @type format:       str
+    @return:            The icon path, for example 
'oxygen_icons/16x16/actions/document-open.png'.
+    @rtype:             str
     """
 
     # No icon.
@@ -80,7 +82,12 @@
         path += elements[1] + sep
 
     # The file.
-    path += "%s.png" % elements[-1]
+    if format == 'png':
+        path += "%s.png" % elements[-1]
+    elif format == 'eps.gz':
+        path += "%s.eps.gz" % elements[-1]
+    else:
+        raise RelaxError("The icon format '%s' is unknown." % format)
 
     # Return the path.
     return path




Related Messages


Powered by MHonArc, Updated Mon Aug 27 16:40:02 2012