Skip to content
Snippets Groups Projects
Commit 0d2fb970 authored by Paul McCarthy's avatar Paul McCarthy
Browse files

FSLeyes about dialog.

parent 0588bbaf
No related branches found
No related tags found
No related merge requests found
fslpy library, 2014, The University of Oxford (the "Software") FSLeyes, (c) 2016, The University of Oxford (the "Software")
The Software remains the property of the University of Oxford ("the The Software remains the property of the University of Oxford ("the
University"). University").
......
...@@ -19,14 +19,17 @@ into the following categories: ...@@ -19,14 +19,17 @@ into the following categories:
:data:`labels` Labels for miscellaneous things. :data:`labels` Labels for miscellaneous things.
:data:`properties` Display names for ``props.HasProperties`` properties. :data:`properties` Display names for ``props.HasProperties`` properties.
:data:`choices` Display names for ``props.HasProperties`` choice :data:`choices` Display names for ``props.HasProperties`` choice
properties. properties.
:data:`anatomy` Anatomical and orientation labels. :data:`anatomy` Anatomical and orientation labels.
:data:`nifti` Labels for NIFTI header fields. :data:`nifti` Labels for NIFTI header fields.
:data:`feat` FEAT specific names and labels. :data:`feat` FEAT specific names and labels.
:data:`about` Strings used in the *FSLeyes* about dialog.
================== ===================================================== ================== =====================================================
""" """
import textwrap
from fsl.utils.typedict import TypeDict from fsl.utils.typedict import TypeDict
import fsl.data.constants as constants import fsl.data.constants as constants
...@@ -257,6 +260,7 @@ actions = TypeDict({ ...@@ -257,6 +260,7 @@ actions = TypeDict({
'SavePerspectiveAction' : 'Save current perspective', 'SavePerspectiveAction' : 'Save current perspective',
'ClearPerspectiveAction' : 'Clear all perspectives', 'ClearPerspectiveAction' : 'Clear all perspectives',
'DiagnosticReportAction' : 'Diagnostic report', 'DiagnosticReportAction' : 'Diagnostic report',
'AboutAction' : 'About FSLeyes',
'FSLEyesFrame.closeViewPanel' : 'Close', 'FSLEyesFrame.closeViewPanel' : 'Close',
...@@ -900,3 +904,42 @@ tensor = { ...@@ -900,3 +904,42 @@ tensor = {
'l2' : 'Second eigenvalue image', 'l2' : 'Second eigenvalue image',
'l3' : 'Third eigenvalue image', 'l3' : 'Third eigenvalue image',
} }
about = {
'title' : 'About FSLeyes',
'author' : 'Paul McCarthy',
'email' : 'paulmc@fmrib.ox.ac.uk',
'company' : u'\u00A9 FMRIB Centre, Oxford, UK',
'version' : 'FSLeyes version: {}',
'glVersion' : 'OpenGL version: {}',
'glRenderer' : 'OpenGL renderer: {}',
'software' : textwrap.dedent(
"""
FSLeyes was developed at the FMRIB Centre, Nuffield Department of Clinical Neurosciences, Oxford University, United Kingdom.
FSLeyes is a Python application which leverages the following open-source software libraries:
- jinja2 [{}] (http://jinja.pocoo.org)
- matplotlib [{}] (http://www.matplotlib.org)
- nibabel [{}] (http://nipy.org/nibabel)
- numpy [{}] (http://www.numpy.org)
- pillow [{}] (http://python-pillow.org/)
- props [{}] (https://git.fmrib.ox.ac.uk/paulmc/props)
- pyopengl [{}] (http://pyopengl.sourceforge.net)
- pyparsing [{}] (http://pyparsing.wikispaces.com/)
- scipy [{}] (http://www.scipy.org)
- wxPython [{}] (http://www.wxpython.org)
Some of the icons used in FSLeyes are derived from the Freeline icon set, by Enes Dal, available at https://www.iconfinder.com/Enesdal, and released under the Creative Commons (Attribution 3.0 Unported) license.
""").strip(),
# This is a list of all the libraries listed
# in the software string above - the AboutDialog
# dynamically looks up the version number for
# each of them, and inserts them into the above
# string.
'libs' : ['jinja2', 'matplotlib', 'nibabel', 'numpy',
'PIL', 'props', 'OpenGL', 'pyparsing',
'scipy', 'wx'],
}
#!/usr/bin/env python
#
# about.py - The AboutDialog class.
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
"""This module provides the :class:`.AboutDialog` class, a dialog which
displays information about *FSLeyes*.
"""
import os.path as op
import wx
import OpenGL.GL as gl
import fsl.fsleyes.widgets.imagepanel as imagepanel
import fsl.data.strings as strings
import fsl.version as version
class AboutDialog(wx.Dialog):
"""The ``AboutDialog`` is a dialog which displays information about
*FSLeyes*.
"""
def __init__(self, parent):
"""Create an ``AboutDialog``.
:arg parent: ``wx`` parent object.
"""
wx.Dialog.__init__(self, parent, title=strings.about['title'])
# Load the splash screen
splashfile = op.join(op.dirname(__file__),
'icons', 'splash', 'splash.png')
splashbmp = wx.Bitmap(splashfile, wx.BITMAP_TYPE_PNG)
splashimg = splashbmp.ConvertToImage()
# Create all the widgets
splashPanel = imagepanel.ImagePanel(self, splashimg)
authorLabel = wx.StaticText(self)
emailLabel = wx.StaticText(self)
companyLabel = wx.StaticText(self)
versionLabel = wx.StaticText(self)
glVersionLabel = wx.StaticText(self)
glRendererLabel = wx.StaticText(self)
softwareField = wx.TextCtrl( self,
size=(-1, 200),
style=(wx.TE_LEFT |
wx.TE_RICH |
wx.TE_MULTILINE |
wx.TE_READONLY |
wx.TE_AUTO_URL))
closeButton = wx.Button( self, id=wx.ID_CANCEL)
# Set foreground/background colours
objs = [self,
authorLabel,
emailLabel,
companyLabel,
versionLabel,
glVersionLabel,
glRendererLabel,
softwareField]
for obj in objs:
obj.SetBackgroundColour('#000000')
obj.SetForegroundColour('#ffffff')
softwareField.SetDefaultStyle(wx.TextAttr('#ffffff', wx.NullColour))
# Create / retrieve all the content
verStr = version.__version__
glVerStr = gl.glGetString(gl.GL_VERSION)
glRenStr = gl.glGetString(gl.GL_RENDERER)
swlibs = strings.about['libs']
swVersions = []
for lib in swlibs:
try:
mod = __import__(lib)
if lib == 'PIL':
swVer = str(mod.PILLOW_VERSION)
else:
swVer = str(mod.__version__)
except:
swVer = ''
swVersions.append(swVer)
verStr = strings.about['version'] .format(verStr)
glVerStr = strings.about['glVersion'] .format(glVerStr)
glRenStr = strings.about['glRenderer'].format(glRenStr)
swStr = strings.about['software'] .format(*swVersions)
# Tack the license file contents onto
# the end of the software description.
licenseFile = op.join(op.dirname(__file__),
'..', '..', 'LICENSE')
try:
with open(licenseFile, 'rt') as f:
licenseStr = f.read()
except:
licenseStr = ''
swStr = swStr + '\n\n' + licenseStr
swStr = swStr.strip()
# Set the widget content
authorLabel .SetLabel(strings.about['author'])
emailLabel .SetLabel(strings.about['email'])
companyLabel .SetLabel(strings.about['company'])
versionLabel .SetLabel(verStr)
glVersionLabel .SetLabel(glVerStr)
glRendererLabel.SetLabel(glRenStr)
softwareField .SetValue(swStr)
closeButton .SetLabel('Close')
# Arrange the widgets
mainSizer = wx.BoxSizer(wx.VERTICAL)
row1Sizer = wx.BoxSizer(wx.HORIZONTAL)
row2Sizer = wx.BoxSizer(wx.HORIZONTAL)
row3Sizer = wx.BoxSizer(wx.HORIZONTAL)
row4Sizer = wx.BoxSizer(wx.HORIZONTAL)
row1Sizer.Add(versionLabel, flag=wx.EXPAND)
row1Sizer.Add((1, 1), flag=wx.EXPAND, proportion=1)
row1Sizer.Add(authorLabel, flag=wx.EXPAND)
row2Sizer.Add(companyLabel, flag=wx.EXPAND)
row2Sizer.Add((1, 1), flag=wx.EXPAND, proportion=1)
row2Sizer.Add(emailLabel, flag=wx.EXPAND)
row3Sizer.Add(glVersionLabel, flag=wx.EXPAND)
row3Sizer.Add((1, 1), flag=wx.EXPAND, proportion=1)
row4Sizer.Add(glRendererLabel, flag=wx.EXPAND)
row4Sizer.Add((1, 1), flag=wx.EXPAND, proportion=1)
rowargs = {'border' : 3,
'flag' : wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM}
mainSizer.Add(splashPanel)
mainSizer.Add(row1Sizer, **rowargs)
mainSizer.Add(row2Sizer, **rowargs)
mainSizer.Add(row3Sizer, **rowargs)
mainSizer.Add(row4Sizer, **rowargs)
mainSizer.Add(softwareField, flag=wx.EXPAND, proportion=1)
mainSizer.Add(closeButton, flag=wx.EXPAND)
self.SetSizer(mainSizer)
self.Layout()
self.Fit()
...@@ -108,6 +108,7 @@ Finally, some 'global' actions are also provided in this package: ...@@ -108,6 +108,7 @@ Finally, some 'global' actions are also provided in this package:
~fsl.fsleyes.actions.clearperspective ~fsl.fsleyes.actions.clearperspective
~fsl.fsleyes.actions.togglecontrolpanel ~fsl.fsleyes.actions.togglecontrolpanel
~fsl.fsleyes.actions.diagnosticreport ~fsl.fsleyes.actions.diagnosticreport
~fsl.fsleyes.actions.about
""" """
...@@ -135,6 +136,7 @@ import loadperspective ...@@ -135,6 +136,7 @@ import loadperspective
import clearperspective import clearperspective
import togglecontrolpanel import togglecontrolpanel
import diagnosticreport import diagnosticreport
import about
Action = action .Action Action = action .Action
...@@ -153,6 +155,7 @@ LoadPerspectiveAction = loadperspective .LoadPerspectiveAction ...@@ -153,6 +155,7 @@ LoadPerspectiveAction = loadperspective .LoadPerspectiveAction
ClearPerspectiveAction = clearperspective .ClearPerspectiveAction ClearPerspectiveAction = clearperspective .ClearPerspectiveAction
ToggleControlPanelAction = togglecontrolpanel.ToggleControlPanelAction ToggleControlPanelAction = togglecontrolpanel.ToggleControlPanelAction
DiagnosticReportAction = diagnosticreport .DiagnosticReportAction DiagnosticReportAction = diagnosticreport .DiagnosticReportAction
AboutAction = about .AboutAction
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
......
#!/usr/bin/env python
#
# about.py - The AboutAction class.
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
"""This module provides the :class:`.AboutAction` class, an action which
displays an about dialog for *FSLeyes*.
"""
import action
import fsl.fsleyes.about as aboutdlg
class AboutAction(action.Action):
"""The ``AboutAction`` class is an action which displays an
:class:`.AboutDialog`, containing information about *FSLeyes*.
"""
def __init__(self, overlayList, displayCtx, frame):
"""Create an ``AboutAction``.
:arg overlayList: The :class:`.OverlayList`.
:arg displayCtx: The master :class:`.DisplayContext`.
:arg frame: The :class:`.FSLEyesFrame`.
"""
action.Action.__init__(self, self.__showDialog)
self.__frame = frame
self.__overlayList = overlayList
self.__displayCtx = displayCtx
def __showDialog(self):
"""Creates and shows an :class:`.AboutDialog`. """
dlg = aboutdlg.AboutDialog(self.__frame)
dlg.Show()
dlg.CentreOnParent()
fsl/fsleyes/icons/splash/splash.png

242 KiB | W: | H:

fsl/fsleyes/icons/splash/splash.png

241 KiB | W: | H:

fsl/fsleyes/icons/splash/splash.png
fsl/fsleyes/icons/splash/splash.png
fsl/fsleyes/icons/splash/splash.png
fsl/fsleyes/icons/splash/splash.png
  • 2-up
  • Swipe
  • Onion skin
No preview for this file type
...@@ -266,6 +266,15 @@ def diagnosticReport(frame, ctx): ...@@ -266,6 +266,15 @@ def diagnosticReport(frame, ctx):
import fsl.fsleyes.actions as actions import fsl.fsleyes.actions as actions
actions.DiagnosticReportAction(overlayList, displayCtx, frame)() actions.DiagnosticReportAction(overlayList, displayCtx, frame)()
def about(frame, ctx):
"""Set as a ``FSL_ACTION`` (see the :mod:`.tools` documentation).
Creates and calls an :class:`.AboutAction`.
"""
overlayList, displayCtx, _ = ctx
import fsl.fsleyes.actions as actions
actions.AboutAction(overlayList, displayCtx, frame)()
############################################# #############################################
# See the fsl.tools package documentation for # See the fsl.tools package documentation for
...@@ -277,4 +286,5 @@ FSL_TOOLNAME = 'FSLeyes' ...@@ -277,4 +286,5 @@ FSL_TOOLNAME = 'FSLeyes'
FSL_INTERFACE = interface FSL_INTERFACE = interface
FSL_CONTEXT = context FSL_CONTEXT = context
FSL_PARSEARGS = parseArgs FSL_PARSEARGS = parseArgs
FSL_ACTIONS = [(strings.actions['DiagnosticReportAction'], diagnosticReport)] FSL_ACTIONS = [(strings.actions['AboutAction'], about),
(strings.actions['DiagnosticReportAction'], diagnosticReport)]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment