safe.utilities.resources module

This module contains utilities for locating application resources (img etc).

safe.utilities.resources.get_ui_class(ui_file)[source]

Get UI Python class from .ui file.

Parameters:ui_file (str) – The file of the ui in safe.gui.ui

Get a standard html footer for wrapping content in.

Returns:A header containing a web page closing content in html - up to and including the body close tag.
Return type:str
safe.utilities.resources.html_header()[source]

Get a standard html header for wrapping content in.

Returns:A header containing a web page preamble in html - up to and including the body open tag.
Return type:str
safe.utilities.resources.resource_url(path)[source]

Get the a local filesystem url to a given resource.

New in version 3.0.

Note that in version 3.0 we removed the use of Qt Resource files in favour of directly accessing on-disk resources.

Parameters:path (str) – Path to resource e.g. /home/timlinux/foo/bar.png
Returns:A valid file url e.g. file:///home/timlinux/foo/bar.png
Return type:str
safe.utilities.resources.resources_path(*args)[source]

Get the path to our resources folder.

New in version 3.0.

Note that in version 3.0 we removed the use of Qt Resource files in favour of directly accessing on-disk resources.

:param args List of path elements e.g. [‘img’, ‘logos’, ‘image.png’] :type args: list

Returns:Absolute path to the resources folder.
Return type:str