Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
fslpy
Commits
b73f6544
Commit
b73f6544
authored
10 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
It's ugly, but it works. FSLView frame is functional. Will come back to
this later.
parent
e2fb20b2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fsl/fslview/fslviewframe.py
+47
-63
47 additions, 63 deletions
fsl/fslview/fslviewframe.py
fsl/fslview/strings.py
+3
-0
3 additions, 0 deletions
fsl/fslview/strings.py
with
50 additions
and
63 deletions
fsl/fslview/fslviewframe.py
+
47
−
63
View file @
b73f6544
...
...
@@ -76,90 +76,71 @@ class FSLViewFrame(wx.Frame):
self
.
_viewConfigPanels
=
{}
self
.
_makeMenuBar
()
self
.
_configViewContextMenu
()
self
.
_restoreState
(
default
)
self
.
Bind
(
wx
.
EVT_CLOSE
,
self
.
_onClose
)
def
_addViewPanel
(
self
,
panel
,
title
):
def
_addViewPanel
(
self
,
panelCls
):
"""
Adds a view panel to the centre of the frame, and a menu item
allowing the user to configure the view.
"""
panel
=
panelCls
(
self
.
_centrePane
,
self
.
_imageList
,
glContext
=
self
.
_glContext
)
if
panelCls
==
views
.
OrthoPanel
:
title
=
strings
.
orthoTitle
menuText
=
strings
.
configOrtho
if
self
.
_glContext
is
None
:
self
.
_glContext
=
panel
.
xcanvas
.
glContext
elif
panelCls
==
views
.
LightBoxPanel
:
title
=
strings
.
lightBoxTitle
menuText
=
strings
.
configLightBox
if
self
.
_glContext
is
None
:
self
.
_glContext
=
panel
.
canvas
.
glContext
self
.
_viewPanelCount
=
self
.
_viewPanelCount
+
1
title
=
'
{} {}
'
.
format
(
title
,
self
.
_viewPanelCount
)
menuText
=
menuText
.
format
(
title
)
self
.
_viewPanelTitles
[
id
(
panel
)]
=
title
self
.
_centrePane
.
AddPage
(
panel
,
title
)
self
.
_centrePane
.
SetSelection
(
self
.
_centrePane
.
GetPageIndex
(
panel
))
self
.
_centrePane
.
SetSelection
(
self
.
_centrePane
.
GetPageIndex
(
panel
))
configAction
=
self
.
_viewMenu
.
Append
(
wx
.
ID_ANY
,
menuText
)
def
onConfig
(
ev
):
self
.
_addViewConfigPanel
(
panel
,
title
)
def
onDestroy
(
ev
):
ev
.
Skip
()
try
:
self
.
_viewMenu
.
RemoveItem
(
configAction
)
except
wx
.
_core
.
PyDeadObjectError
:
pass
self
.
Bind
(
wx
.
EVT_MENU
,
onConfig
,
configAction
)
panel
.
Bind
(
wx
.
EVT_WINDOW_DESTROY
,
onDestroy
)
def
addOrthoPanel
(
self
):
"""
Adds an :class:`~fsl.fslview.views.orthopanel.OrthoPanel` display
to the central :class:`~wx.aui.AuiNotebook` widget.
"""
panel
=
views
.
OrthoPanel
(
self
.
_centrePane
,
self
.
_imageList
,
glContext
=
self
.
_glContext
)
if
self
.
_glContext
is
None
:
self
.
_glContext
=
panel
.
xcanvas
.
glContext
self
.
_addViewPanel
(
panel
,
strings
.
orthoTitle
)
self
.
_addViewPanel
(
views
.
OrthoPanel
)
def
addLightBoxPanel
(
self
):
"""
Adds a :class:`~fsl.fslview.views.lightboxpanel.LightBoxPanel`
display to the central :class:`~wx.aui.AuiNotebook` widget.
"""
panel
=
views
.
LightBoxPanel
(
self
.
_centrePane
,
self
.
_imageList
,
glContext
=
self
.
_glContext
)
if
self
.
_glContext
is
None
:
self
.
_glContext
=
panel
.
canvas
.
glContext
self
.
_addViewPanel
(
panel
,
strings
.
orthoTitle
)
def
_configViewContextMenu
(
self
):
def
showMenu
(
ev
):
idx
=
ev
.
GetSelection
()
tabCtrl
=
ev
.
GetEventObject
()
mousePos
=
wx
.
GetMousePosition
()
if
idx
==
wx
.
NOT_FOUND
:
return
tabPage
=
tabCtrl
.
GetPage
(
idx
)
panel
=
tabPage
.
window
title
=
self
.
_viewPanelTitles
[
id
(
panel
)]
title
=
'
{} settings
'
.
format
(
title
)
def
showConfigDialog
(
ev
):
self
.
_addViewConfigPanel
(
panel
,
title
)
def
closePanel
(
ev
):
self
.
_centrePane
.
RemovePage
(
idx
)
panel
.
Destroy
()
menu
=
wx
.
Menu
()
configItem
=
wx
.
MenuItem
(
menu
,
wx
.
ID_ANY
,
'
Settings
'
)
closeItem
=
wx
.
MenuItem
(
menu
,
wx
.
ID_ANY
,
'
Close
'
)
menu
.
AppendItem
(
configItem
)
menu
.
AppendItem
(
closeItem
)
menu
.
Bind
(
wx
.
EVT_MENU
,
showConfigDialog
,
configItem
)
menu
.
Bind
(
wx
.
EVT_MENU
,
closePanel
,
closeItem
)
self
.
PopupMenu
(
menu
,
self
.
ScreenToClient
(
mousePos
))
self
.
_centrePane
.
Bind
(
aui
.
EVT__AUINOTEBOOK_TAB_RIGHT_DOWN
,
showMenu
)
"""
self
.
_addViewPanel
(
views
.
LightBoxPanel
)
def
_addViewConfigPanel
(
self
,
viewPanel
,
title
):
"""
Adds the given panel to the :class:`~wx.aui.AuiManager`.
"""
"""
"""
if
id
(
viewPanel
)
in
self
.
_viewConfigPanels
.
keys
():
return
...
...
@@ -180,7 +161,7 @@ class FSLViewFrame(wx.Frame):
.
Caption
(
title
)
.
CaptionVisible
(
True
)
.
BestSize
(
confPanel
.
GetBestSize
())
.
Name
(
'
config
_
{}
'
.
format
(
viewPanel
.
__class__
.
__name__
)))
.
Name
(
'
config
{}
'
.
format
(
title
)))
self
.
_auimgr
.
AddPane
(
confPanel
,
paneInfo
)
self
.
_auimgr
.
Update
()
...
...
@@ -395,6 +376,9 @@ class FSLViewFrame(wx.Frame):
viewMenu
=
wx
.
Menu
()
menuBar
.
Append
(
viewMenu
,
'
View
'
)
self
.
_fileMenu
=
fileMenu
self
.
_viewMenu
=
viewMenu
orthoAction
=
viewMenu
.
Append
(
wx
.
ID_ANY
,
strings
.
orthoTitle
)
lightboxAction
=
viewMenu
.
Append
(
wx
.
ID_ANY
,
strings
.
lightBoxTitle
)
imageDisplayAction
=
viewMenu
.
Append
(
wx
.
ID_ANY
,
...
...
This diff is collapsed.
Click to expand it.
fsl/fslview/strings.py
+
3
−
0
View file @
b73f6544
...
...
@@ -13,3 +13,6 @@ locationTitle = 'Cursor location'
openFile
=
'
Add image file
'
openStd
=
'
Add standard
'
configOrtho
=
'
{} display
'
configLightBox
=
'
{} display
'
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment