diff options
author | nickthetait <tait@alephobjects.com> | 2015-11-17 22:52:32 +0300 |
---|---|---|
committer | nickthetait <tait@alephobjects.com> | 2015-11-17 22:58:55 +0300 |
commit | 94821569294a65e9101897617a1e2a6be02caab7 (patch) | |
tree | 5dc7d06fefc0e5a08ba0800de9caee205dcecf45 | |
parent | cd0404748e21259c8f21d9c98fb32283fb22f3ce (diff) |
Prevent infinite loop
Changing width/height previously resulted in "RuntimeError: maximum recursion depth exceeded"s which gave very strange behavior.
-rw-r--r-- | Cura/gui/tools/imageToMesh.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Cura/gui/tools/imageToMesh.py b/Cura/gui/tools/imageToMesh.py index 2863a1cac1..5d6237fe8c 100644 --- a/Cura/gui/tools/imageToMesh.py +++ b/Cura/gui/tools/imageToMesh.py @@ -84,7 +84,10 @@ class convertImageDialog(wx.Dialog): except ValueError: return h = w / self.aspectRatio - self.depthInput.SetValue(str(h)) + new_h = str(h) + old_h = str(self.depthInput.GetValue()) + if new_h != old_h: + self.depthInput.SetValue(new_h) def OnDepthEnter(self, e): try: @@ -92,7 +95,10 @@ class convertImageDialog(wx.Dialog): except ValueError: return w = h * self.aspectRatio - self.widthInput.SetValue(str(w)) + new_w = str(w) + old_w = str(self.widthInput.GetValue()) + if new_w != old_w: + self.widthInput.SetValue(new_w) def convertImage(filename, height=20.0, width=100.0, blur=0, invert=False, baseHeight=1.0): image = wx.Image(filename) |