X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=Cura%2Fgui%2Futil%2FopenglGui.py;h=c9b0eeebe684408fc0d1573e2f3cf0e14a7879dd;hb=6208201bafdeaf82883181471c6da3a41283cfe7;hp=3d105179dcdf431c79311b8b0252d44c6466cecf;hpb=e3f21ac4a75936a2852b679062d524500bc9ebaf;p=cura.git diff --git a/Cura/gui/util/openglGui.py b/Cura/gui/util/openglGui.py index 3d105179..c9b0eeeb 100644 --- a/Cura/gui/util/openglGui.py +++ b/Cura/gui/util/openglGui.py @@ -10,7 +10,7 @@ import time from wx import glcanvas import OpenGL -OpenGL.ERROR_CHECKING = False +#OpenGL.ERROR_CHECKING = False from OpenGL.GL import * from Cura.util import version @@ -230,6 +230,8 @@ class glGuiPanel(glcanvas.GLCanvas): glFlush() if version.isDevVersion(): renderTime = time.time() - renderStartTime + if renderTime == 0: + renderTime = 0.001 glLoadIdentity() glTranslate(10, self.GetSize().GetHeight() - 30, -1) glColor4f(0.2,0.2,0.2,0.5) @@ -243,6 +245,7 @@ class glGuiPanel(glcanvas.GLCanvas): locationInfo = tb[n] errStr += "\n @ %s:%s:%d" % (os.path.basename(locationInfo[0]), locationInfo[2], locationInfo[1]) if not self._shownError: + traceback.print_exc() wx.CallAfter(wx.MessageBox, errStr, _("3D window error"), wx.OK | wx.ICON_EXCLAMATION) self._shownError = True @@ -285,7 +288,7 @@ class glGuiPanel(glcanvas.GLCanvas): # glVertex2f(0, 0) # glEnd() # glDisable(GL_TEXTURE_2D) - glPopMatrix() + # glPopMatrix() def _OnEraseBackground(self,event): #Workaround for windows background redraw flicker. @@ -707,7 +710,7 @@ class glNotification(glFrame): super(glNotification, self).__init__(parent, pos) glGuiLayoutGrid(self)._alignBottom = False self._label = glLabel(self, "Notification", (0, 0)) - self._buttonEject = glButton(self, 31, "Eject", (1, 0), self.onEject, 25) + self._buttonExtra = glButton(self, 31, "???", (1, 0), self.onExtraButton, 25) self._button = glButton(self, 30, "", (2, 0), self.onClose, 25) self._padding = glLabel(self, "", (0, 1)) self.setHidden(True) @@ -725,18 +728,20 @@ class glNotification(glFrame): self.updateLayout() super(glNotification, self).draw() - def message(self, text, ejectCallback = None): + def message(self, text, extraButtonCallback = None, extraButtonIcon = None, extraButtonTooltip = None): self._anim = animation(self._base, -20, 25, 1) self.setHidden(False) self._label.setLabel(text) - self._buttonEject.setHidden(ejectCallback is None) - self._ejectCallback = ejectCallback + self._buttonExtra.setHidden(extraButtonCallback is None) + self._buttonExtra._imageID = extraButtonIcon + self._buttonExtra._tooltip = extraButtonTooltip + self._extraButtonCallback = extraButtonCallback self._base._queueRefresh() self.updateLayout() - def onEject(self, button): + def onExtraButton(self, button): self.onClose(button) - self._ejectCallback() + self._extraButtonCallback() def onClose(self, button): if self._anim is not None: @@ -1026,7 +1031,7 @@ class glSlider(glGuiControl): else: valueNormalized = 0 glTranslate(0.0,scrollLength/2,0) - if self._focus: + if True: # self._focus: glColor4ub(0,0,0,255) glPushMatrix() glTranslate(-w/2,opengl.glGetStringSize(str(self._minValue))[1]/2,0)