From b667b6355558817edf326ac4d062b43b5794a82b Mon Sep 17 00:00:00 2001 From: daid Date: Thu, 6 Feb 2014 14:37:07 +0100 Subject: [PATCH] Fix the exception when there is no engine result and one opens the layer view. --- Cura/gui/tools/youmagineGui.py | 1 + Cura/gui/util/engineResultView.py | 2 +- Cura/gui/util/openglGui.py | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Cura/gui/tools/youmagineGui.py b/Cura/gui/tools/youmagineGui.py index b6304850..fd36e5d7 100644 --- a/Cura/gui/tools/youmagineGui.py +++ b/Cura/gui/tools/youmagineGui.py @@ -88,6 +88,7 @@ class youmagineManager(object): if self._getAuthorizationWindow.abort: wx.CallAfter(self._getAuthorizationWindow.Destroy) return + #TODO: Bug, this should not be called from a python thread but a wx.Timer (wx.TheClipboard does not function from threads on Linux) clipboard = getClipboardText() if len(clipboard) == 20: if clipboard != lastTriedClipboard and re.match('[a-zA-Z0-9]*', clipboard): diff --git a/Cura/gui/util/engineResultView.py b/Cura/gui/util/engineResultView.py index 9fa2ff26..67ceb53d 100644 --- a/Cura/gui/util/engineResultView.py +++ b/Cura/gui/util/engineResultView.py @@ -71,7 +71,7 @@ class engineResultView(object): glLineWidth(2) layerNr = self.layerSelect.getValue() - if layerNr == self.layerSelect.getMaxValue(): + if layerNr == self.layerSelect.getMaxValue() and result is not None: layerNr = max(layerNr, len(result._polygons)) viewZ = (layerNr - 1) * profile.getProfileSettingFloat('layer_height') + profile.getProfileSettingFloat('bottom_thickness') self._parent._viewTarget[2] = viewZ diff --git a/Cura/gui/util/openglGui.py b/Cura/gui/util/openglGui.py index 62588dcc..dbba4a8a 100644 --- a/Cura/gui/util/openglGui.py +++ b/Cura/gui/util/openglGui.py @@ -237,6 +237,8 @@ class glGuiPanel(glcanvas.GLCanvas): openglHelpers.glDrawStringLeft("fps:%d" % (1 / renderTime)) self.SwapBuffers() except: + # When an exception happens, catch it and show a message box. If the exception is not caught the draw function bugs out. + # Only show this exception once so we do not overload the user with popups. errStr = _("An error has occurred during the 3D view drawing.") tb = traceback.extract_tb(sys.exc_info()[2]) errStr += "\n%s: '%s'" % (str(sys.exc_info()[0].__name__), str(sys.exc_info()[1])) -- 2.30.2