fsl.utils.platform
This module provides the Platform
class, which is a container
of information about the current platform we are running on. A single
Platform
instance is created when this module is first imported, and
is available as a module attribute called platform
.
- fsl.utils.platform.WX_UNKNOWN = 0
Identifier for the
Platform.wxFlavour
andPlatform.wxPlatform
properties indicating an unknown/undetermined flavour/platform.
- fsl.utils.platform.WX_PYTHON = 1
Identifier for the
Platform.wxFlavour
property, indicating that we are running standard wx Python.
- fsl.utils.platform.WX_PHOENIX = 2
Identifier for the
Platform.wxFlavour
property, indicating that we are running wx Python/Phoenix.
- fsl.utils.platform.WX_MAC_COCOA = 1
Identifier for the
Platform.wxPlatform
property, indicating that we are running the OSX cocoa wx build.
- fsl.utils.platform.WX_MAC_CARBON = 2
Identifier for the
Platform.wxPlatform
property, indicating that we are running the OSX carbon wx build.
- fsl.utils.platform.WX_GTK = 3
Identifier for the
Platform.wxPlatform
property, indicating that we are running the Linux/GTK wx build.
- class fsl.utils.platform.Platform(*args, **kwargs)[source]
Bases:
Notifier
The
Platform
class contains a handful of properties which contain information about the platform we are running on.Note
The values of the
glVersion
andglRenderer
properties are not automatically set - they will only contain a value if one is assigned to them. FSLeyes does this during startup, in thefsleyes.gl.bootstrap()
function.The operating system name.
True
if we are running in a compiled/frozen application,False
otherwise.The FSL installation location.
The FSL development directory location.
Returns the FSL version as a string, e.g.
'5.0.9'
.True
if we are running with a GUI,False
otherwise.True
if it is possible to create a GUI,False
otherwise.True
if this application is running over an SSH session,False
otherwise.One of
WX_UNKNOWN
,WX_MAC_COCOA
,WX_MAC_CARBON
, orWX_GTK
, indicating the wx platform.One of
WX_UNKNOWN
,WX_PYTHON
orWX_PHOENIX
, indicating the wx flavour.Returns the available OpenGL version, or
None
if it has not been set.Returns the available OpenGL renderer, or
None
if it has not been set.Returns
True
if the OpenGL renderer is software based,False
otherwise, orNone
if the renderer has not yet been set.- property os
The operating system name. Whatever is returned by the built-in
platform.system
function.
- property frozen
True
if we are running in a compiled/frozen application,False
otherwise.
- property haveGui
True
if we are running with a GUI,False
otherwise.This currently equates to testing whether a display is available (see
canHaveGui()
) and whether awx.App
exists. It previously also tested whether an event loop was running, but this is not compatible with execution from IPython/Jupyter notebook, where the event loop is called periodically, and so is not always running.
- property canHaveGui
True
if it is possible to create a GUI,False
otherwise.
- property inSSHSession
True
if this application is running over an SSH session,False
otherwise.
- property inVNCSession
True
if this application is running over a VNC (or similar) session,False
otherwise. Currently, the following remote desktop environments are detected:VNC
x2go
NoMachine
- property wxPlatform
One of
WX_UNKNOWN
,WX_MAC_COCOA
,WX_MAC_CARBON
, orWX_GTK
, indicating the wx platform.
- property wxFlavour
One of
WX_UNKNOWN
,WX_PYTHON
orWX_PHOENIX
, indicating the wx flavour.
- __annotations__ = {}
- __module__ = 'fsl.utils.platform'
- property wsl
Boolean flag indicating whether we are running under Windows Subsystem for Linux.
- property fslwsl
Boolean flag indicating whether FSL is installed in Windows Subsystem for Linux
- property fsldir
The FSL installation location.
Note
The
fsldir
property can be updated - when it is changed, any registered listeners are notified via theNotifier
interface.
- property fsldevdir
The FSL development directory location.
- property fslVersion
Returns the FSL version as a string, e.g.
'5.0.9'
. ReturnsNone
if a FSL installation could not be found.
- property glVersion
Returns the available OpenGL version, or
None
if it has not been set.
- property glRenderer
Returns the available OpenGL renderer, or
None
if it has not been set.
- property glIsSoftwareRenderer
Returns
True
if the OpenGL renderer is software based,False
otherwise, orNone
if the renderer has not yet been set.Note
This check is based on heuristics, ans is not guaranteed to be correct.
- fsl.utils.platform.platform = <fsl.utils.platform.Platform object>
An instance of the
Platform
class. Feel free to create your own instance, but be aware that if you do so you will not be updated of changes to thePlatform.fsldir
property.