Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Michiel Cottaar
fslpy
Commits
71495e2c
Commit
71495e2c
authored
9 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
FSLDIR check can be skipped via command line flag
parent
835ab183
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/__init__.py
+31
-16
31 additions, 16 deletions
fsl/__init__.py
with
31 additions
and
16 deletions
fsl/__init__.py
+
31
−
16
View file @
71495e2c
...
...
@@ -90,17 +90,20 @@ def main(args=None):
fslTool
,
namespace
,
toolArgv
=
_parseTopLevelArgs
(
args
,
allTools
)
# GUI or command-line tool?
if
fslTool
.
interface
is
not
None
:
_runGUITool
(
fslTool
,
toolArgv
)
else
:
_runCLITool
(
fslTool
,
toolArgv
)
if
fslTool
.
interface
is
not
None
:
_runGUITool
(
fslTool
,
namespace
,
toolArgv
)
else
:
_runCLITool
(
fslTool
,
namespace
,
toolArgv
)
def
_runGUITool
(
fslTool
,
toolArgv
):
def
_runGUITool
(
fslTool
,
topLevelArgs
,
toolArgv
):
"""
Runs the given ``FSLTool``, which is assumed to be a GUI tool.
:arg fslTool: The ``FSLTool`` to run - see the :func:`_loadFSLTool`
function.
:arg fslTool:
The ``FSLTool`` to run - see the :func:`_loadFSLTool`
function.
:arg toolArgv: Unparsed tool-specific command line arguments.
:arg topLevelArgs: An ``argparse.Namespace`` object containing parsed
top-level arguments.
:arg toolArgv: Unparsed tool-specific command line arguments.
"""
import
wx
...
...
@@ -160,24 +163,30 @@ def _runGUITool(fslTool, toolArgv):
# which wx.MainLoop is running) can
# start.
time
.
sleep
(
0.01
)
wx
.
CallAfter
(
_fslDirWarning
,
None
,
fslTool
.
toolName
,
'
FSLDIR
'
in
os
.
environ
)
if
not
topLevelArgs
.
skipfslcheck
:
wx
.
CallAfter
(
_fslDirWarning
,
None
,
fslTool
.
toolName
,
'
FSLDIR
'
in
os
.
environ
)
wx
.
CallAfter
(
realBuild
)
threading
.
Thread
(
target
=
buildGUI
).
start
()
app
.
MainLoop
()
def
_runCLITool
(
fslTool
,
toolArgv
):
def
_runCLITool
(
fslTool
,
topLevelArgs
,
toolArgv
):
"""
Runs the given ``FSLTool``, which is assumed to be a command-line (i.e.
non-GUI) tool.
:arg fslTool: The ``FSLTool`` to run - see the :func:`_loadFSLTool`
function.
:arg fslTool: The ``FSLTool`` to run - see the :func:`_loadFSLTool`
function.
:arg topLevelArgs: An ``argparse.Namespace`` object containing parsed
top-level arguments.
:arg toolArgv: Unparsed tool-specific command line arguments.
:arg toolArgv:
Unparsed tool-specific command line arguments.
"""
if
fslTool
.
execute
is
None
:
...
...
@@ -198,8 +207,10 @@ def _runCLITool(fslTool, toolArgv):
if
fslTool
.
init
is
not
None
:
initVal
=
fslTool
.
init
()
if
fslTool
.
context
is
not
None
:
ctx
=
fslTool
.
context
(
namespace
,
initVal
)
if
not
topLevelArgs
.
skipfslcheck
:
_fslDirWarning
(
None
,
fslTool
.
toolName
,
'
FSLDIR
'
in
os
.
environ
)
_fslDirWarning
(
None
,
fslTool
.
toolName
,
'
FSLDIR
'
in
os
.
environ
)
fslTool
.
execute
(
namespace
,
ctx
)
...
...
@@ -358,7 +369,11 @@ def _parseTopLevelArgs(argv, allTools):
parser
.
add_argument
(
'
-V
'
,
'
--version
'
,
action
=
'
store_true
'
,
help
=
'
Print the current fslpy version and exit
'
)
help
=
'
Print the current fslpy version and exit
'
)
parser
.
add_argument
(
'
-s
'
,
'
--skipfslcheck
'
,
action
=
'
store_true
'
,
help
=
'
Skip $FSLDIR check/warning
'
)
parser
.
add_argument
(
'
-n
'
,
'
--noisy
'
,
metavar
=
'
MODULE
'
,
action
=
'
append
'
,
...
...
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