Skip to content

Commit

Permalink
Merge pull request #2466 from vallsv/fix-3d
Browse files Browse the repository at this point in the history
Fix dataviewer when PyOpenGL is not available
  • Loading branch information
payno authored Feb 19, 2019
2 parents 26947f6 + 30e9d40 commit 23e0ab3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 7 additions & 2 deletions silx/gui/data/DataViews.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

__authors__ = ["V. Valls", "P. Knobel"]
__license__ = "MIT"
__date__ = "15/02/2019"
__date__ = "19/02/2019"

_logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -754,6 +754,7 @@ def replaceView(self, modeId, newView):

# replace oldView with new view in dict
self.__views[iview] = newView
return True


class _EmptyView(DataView):
Expand Down Expand Up @@ -1822,5 +1823,9 @@ def __init__(self, parent):
nx3dViews = SelectManyDataView(parent)
nx3dViews.addView(_NXdataVolumeAsStackView(parent))
nx3dViews.addView(_NXdataComplexVolumeAsStackView(parent))
nx3dViews.addView(_NXdataVolumeView(parent))
try:
nx3dViews.addView(_NXdataVolumeView(parent))
except Exception:
_logger.warning("NXdataVolumeView is not available")
_logger.debug("Backtrace", exc_info=True)
self.addView(nx3dViews)
7 changes: 4 additions & 3 deletions silx/gui/data/test/test_dataviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# ###########################################################################*/
__authors__ = ["V. Valls"]
__license__ = "MIT"
__date__ = "23/04/2018"
__date__ = "19/02/2019"

import os
import tempfile
Expand Down Expand Up @@ -237,8 +237,9 @@ def test_replace_view_in_composite(self):
# replace a view that is a child of a composite view
widget = self.create_widget()
view = _DataViewMock(widget)
widget.replaceView(DataViews.NXDATA_INVALID_MODE,
view)
replaced = widget.replaceView(DataViews.NXDATA_INVALID_MODE,
view)
self.assertTrue(replaced)
nxdata_view = widget.getViewFromModeId(DataViews.NXDATA_MODE)
self.assertNotIn(DataViews.NXDATA_INVALID_MODE,
[v.modeId() for v in nxdata_view.availableViews()])
Expand Down

0 comments on commit 23e0ab3

Please sign in to comment.