Author: bugman Date: Tue Aug 20 21:13:35 2013 New Revision: 20647 URL: http://svn.gna.org/viewcvs/relax?rev=20647&view=rev Log: The graphics.fetch_icon() function can now return either the absolute or relative path to the icon. This is a partial solution for bug #21042 (https://gna.org/bugs/?21042). Modified: trunk/graphics/__init__.py Modified: trunk/graphics/__init__.py URL: http://svn.gna.org/viewcvs/relax/trunk/graphics/__init__.py?rev=20647&r1=20646&r2=20647&view=diff ============================================================================== --- trunk/graphics/__init__.py (original) +++ trunk/graphics/__init__.py Tue Aug 20 21:13:35 2013 @@ -35,7 +35,7 @@ WIZARD_IMAGE_PATH = status.install_path + sep + 'graphics' + sep + 'wizards' + sep -def fetch_icon(icon=None, size='16x16', format='png'): +def fetch_icon(icon=None, size='16x16', format='png', full_path=True): """Return the path to the specified icon. The icon code consists of two parts separated by the '.' character. These are: @@ -51,6 +51,8 @@ @type size: str @keyword format: The format of the icon, defaulting to PNG images. This can be changed to 'eps.gz' for example, or None for no file ending. @type format: str + @keyword full_path: A flag which if True will cause the absolute path to be returned. If False, the relative path will be returned. + @type full_path: bool @return: The icon path, for example 'oxygen_icons/16x16/actions/document-open.png'. @rtype: str """ @@ -60,7 +62,10 @@ return None # Initialise the path. - path = status.install_path + sep + 'graphics' + sep + path = '' + if full_path: + path += status.install_path + sep + path += 'graphics' + sep # Split up the icon code. elements = icon.split('.')