diff --git a/fsl/data/strings.py b/fsl/data/strings.py index 9db04c5ec802a3d6fd3ff0598fb553831e6d1510..7646319250a42e48ae64688fb4722c9e36716267 100644 --- a/fsl/data/strings.py +++ b/fsl/data/strings.py @@ -146,6 +146,7 @@ titles = TypeDict({ 'HistogramControlPanel' : 'Histogram control', 'ClusterPanel' : 'Cluster browser', 'OverlayInfoPanel' : 'Overlay information', + 'ShellPanel' : 'Python shell', 'LookupTablePanel.loadLut' : 'Select a lookup table file', 'LookupTablePanel.labelExists' : 'Label already exists', @@ -172,6 +173,7 @@ actions = TypeDict({ 'CanvasPanel.toggleLookupTablePanel' : 'Lookup tables', 'CanvasPanel.toggleClusterPanel' : 'Cluster browser', 'CanvasPanel.toggleOverlayInfo' : 'Overlay information', + 'CanvasPanel.toggleShell' : 'Python shell', 'OrthoPanel.toggleOrthoToolBar' : 'View properties', 'OrthoPanel.toggleProfileToolBar' : 'Edit toolbar', diff --git a/fsl/fslview/controls/__init__.py b/fsl/fslview/controls/__init__.py index 39ad296b6424c216047f0c963f55f8e7251e4225..e2f22af9fda41aed7ad087ccd631df239887b8d5 100644 --- a/fsl/fslview/controls/__init__.py +++ b/fsl/fslview/controls/__init__.py @@ -17,6 +17,7 @@ from histogramcontrolpanel import HistogramControlPanel from clusterpanel import ClusterPanel from canvassettingspanel import CanvasSettingsPanel from overlayinfopanel import OverlayInfoPanel +from shellpanel import ShellPanel from orthotoolbar import OrthoToolBar from orthoprofiletoolbar import OrthoProfileToolBar diff --git a/fsl/fslview/controls/shellpanel.py b/fsl/fslview/controls/shellpanel.py new file mode 100644 index 0000000000000000000000000000000000000000..acee824316bb0c270ee78014e74ba1eb2c10cfe6 --- /dev/null +++ b/fsl/fslview/controls/shellpanel.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python +# +# shellpanel.py - +# +# Author: Paul McCarthy <pauldmccarthy@gmail.com> +# + +import wx + +import wx.py.shell as wxshell + +import fsl.fslview.panel as fslpanel + + +class ShellPanel(fslpanel.FSLViewPanel): + + def __init__(self, parent, overlayList, displayCtx, sceneOpts): + fslpanel.FSLViewPanel.__init__(self, parent, overlayList, displayCtx) + + lcls = { + 'displayCtx' : displayCtx, + 'overlayList' : overlayList, + 'sceneOpts' : sceneOpts, + } + + shell = wxshell.Shell( + self, + introText='\nFSLEyes python shell\n' + 'Available variables are:\n' + ' - overlayList\n' + ' - displayCtx\n' + ' - sceneOpts\n\n', + locals=lcls) + + font = shell.GetFont() + + shell.SetFont(font.Larger()) + + sizer = wx.BoxSizer(wx.HORIZONTAL) + self.SetSizer(sizer) + + sizer.Add(shell, flag=wx.EXPAND, proportion=1) + + + def destroy(self): + fslpanel.FSLViewPanel.destroy(self) diff --git a/fsl/fslview/views/canvaspanel.py b/fsl/fslview/views/canvaspanel.py index 7a1903fd07437f84d24824a5879b37060e36ac09..4a7284676852b7e5a16d500cad038f0d20f54333 100644 --- a/fsl/fslview/views/canvaspanel.py +++ b/fsl/fslview/views/canvaspanel.py @@ -85,7 +85,11 @@ class CanvasPanel(viewpanel.ViewPanel): location=wx.TOP)), ('toggleLookupTablePanel', lambda *a: self.togglePanel( fslcontrols.LookupTablePanel, - location=wx.TOP))] + location=wx.TOP)), + ('toggleShell', lambda *a: self.togglePanel( + fslcontrols.ShellPanel, + self.getSceneOptions(), + location=wx.BOTTOM))] actionz = collections.OrderedDict(actionz + extraActions.items()) viewpanel.ViewPanel.__init__(