Skip to content

Commit ce8bc43

Browse files
committed
Merge pull request #59 from Eric89GXL/fix-hide-bar
FIX: Fix bar hide in offscreen mode
2 parents 3059573 + 11ac269 commit ce8bc43

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

surfer/tests/test_viz.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22
import os
33
from os.path import join as pjoin
4-
from numpy.testing import assert_raises
4+
from numpy.testing import assert_raises, assert_array_equal
55
from tempfile import mktemp
66
import nibabel as nib
77

@@ -34,6 +34,15 @@ def has_freesurfer():
3434
'Requires FreeSurfer command line tools')
3535

3636

37+
def test_offscreen():
38+
"""Test offscreen rendering
39+
"""
40+
mlab.options.backend = 'auto'
41+
brain = Brain(*std_args, offscreen=True)
42+
shot = brain.screenshot()
43+
assert_array_equal(shot.shape, (800, 800, 3))
44+
45+
3746
def test_image():
3847
"""Test image saving
3948
"""

surfer/viz.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,13 +562,13 @@ def toggle_toolbars(self, show=None):
562562
if hasattr(bars[0], 'isVisible'):
563563
# QT4
564564
show = not bars[0].isVisible()
565-
else:
565+
elif hasattr(bars[0], 'Shown'):
566566
# WX
567567
show = not bars[0].Shown()
568568
for bar in bars:
569569
if hasattr(bar, 'setVisible'):
570570
bar.setVisible(show)
571-
else:
571+
elif hasattr(bar, 'Show'):
572572
bar.Show(show)
573573

574574
def _get_one_brain(self, d, name):

0 commit comments

Comments
 (0)