gsdview.utils

Utility functions and classes for GSDView.

Functions

default_workdir() Return the defaut workinhg directory.
foramt_bugreport([exctype, excvalue, ...])
format_platform_info()
geonormalize(x[, angle_range]) Normalize angles to fit expected range
getresource(resource[, package]) Return the resurce path.
isexecutable(cmd) Check if “cmd” actually is an executable program.
isscript(filename) Check if a file is a script.
scriptcmd(scriptname) Return the list of args for starting the script via subprocess.
which(cmd[, env]) Return the full path of the program (cmd) or None.
gsdview.utils.which(cmd, env=None)[source]

Return the full path of the program (cmd) or None.

>>> which('ls')
'/bin/ls'
gsdview.utils.isexecutable(cmd)[source]

Check if “cmd” actually is an executable program.

gsdview.utils.isscript(filename)[source]

Check if a file is a script.

gsdview.utils.scriptcmd(scriptname)[source]

Return the list of args for starting the script via subprocess.

On unix platforms the shebang string is used so almost all scripting languages are recognized.

On windows platforms this function only works with batch files and python scripts.

Note

if the scriptname is not recognized to be a script it is assumed it is a binary executable so the only argument in the returned list will be scriptname itself.

Parameters:scriptname – the filename of the script
Returns:a list of strings containing the command line arguments for startting the program via subprocess
gsdview.utils.default_workdir()[source]

Return the defaut workinhg directory.

gsdview.utils.getresource(resource, package=None)[source]

Return the resurce path.

If package is specified (usually passing __name__ of the called modile) the package resource name is returned.

If no package is specified then it is assumed that resource is located in the common resource directory (e.g. /usr/share/<PROJECTNAME> on UNIX-like systems.

Note

it is safe to use this function also if the package is distributed as a compressed egg or as standalon package generated using pyinstaller.

gsdview.utils.format_platform_info()[source]
gsdview.utils.foramt_bugreport(exctype=None, excvalue=None, tracebackobj=None)[source]

Get GSDView at SourceForge.net. Fast, secure and Free Open Source software downloads

Previous topic

gsdview.qtwindowlistmenu

Next topic

gsdview.widgets

This Page