File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ IPython on itself to then drop the user into an IPython environment.
7
7
import os
8
8
import sys
9
9
from surfer ._commandline import parser
10
+ from distutils .version import LooseVersion
11
+ import importlib
12
+
10
13
11
14
if __name__ == '__main__' :
12
15
is_ipython = False
@@ -49,12 +52,18 @@ if __name__ == '__main__':
49
52
path = os .path .split (__file__ )[0 ]
50
53
load_file = __file__
51
54
import IPython
52
- if IPython .__version__ < '0.11' :
55
+ if LooseVersion ( IPython .__version__ ) < '0.11' :
53
56
flag = '-nobanner '
54
57
flag += '-wthread '
55
58
else :
56
59
flag = '--no-banner '
57
- flag += '--gui=wx -i '
60
+ try :
61
+ gui = 'wx'
62
+ importlib .import_module (gui )
63
+ except ImportError :
64
+ pass
65
+ gui = 'qt'
66
+ flag += '--gui={gui} -i ' .format (gui = gui )
58
67
cmd = 'ipython %s ' % (flag + __file__ +
59
68
' "%s"' % ' ' .join (sys .argv [1 :]))
60
69
os .system (cmd )
@@ -67,7 +76,7 @@ if __name__ == '__main__':
67
76
confkeys = ["size" , "background" , "cortex" ]
68
77
argdict = args .__dict__
69
78
config_opts = dict ([(k , v ) for k , v in argdict .items ()
70
- if k in confkeys and v ])
79
+ if k in confkeys and v ])
71
80
views = args .views
72
81
73
82
# Load up the figure and underlying brain object
You can’t perform that action at this time.
0 commit comments