chiark / gitweb /
Add notification popup.
authordaid303 <daid303@gmail.com>
Thu, 11 Apr 2013 08:19:43 +0000 (10:19 +0200)
committerdaid303 <daid303@gmail.com>
Thu, 11 Apr 2013 08:19:43 +0000 (10:19 +0200)
Cura/gui/mainWindow.py
Cura/gui/sceneView.py
Cura/gui/util/openglGui.py
Cura/resources/images/glButtons.png

index 36102017fc296936eed787826421fe04e7bf61ed..e862950014b0bf592eee3f89f6b02f6c48cb9a64 100644 (file)
@@ -449,14 +449,17 @@ class normalSettingsPanel(configBase.configPanelBase):
 
                #Plugin page
                self.pluginPanel = pluginPanel.pluginPanel(self.nb)
-               if len(self.pluginPanel.pluginList) > 0:
+               if len(self.pluginPanel.pluginList) > 0 and False:
                        self.nb.AddPage(self.pluginPanel, "Plugins")
                else:
                        self.pluginPanel.Show(False)
 
                #Alteration page
                self.alterationPanel = alterationPanel.alterationPanel(self.nb)
-               self.nb.AddPage(self.alterationPanel, "Start/End-GCode")
+               if False:
+                       self.nb.AddPage(self.alterationPanel, "Start/End-GCode")
+               else:
+                       self.alterationPanel.Show(False)
 
                self.Bind(wx.EVT_SIZE, self.OnSize)
 
index 9dea6ff4fa8c43e60b29e3b9b73b3c04ca0d784c..eb5e2cf094dcfa381bd9dacbe972972aa6565f30 100644 (file)
@@ -91,6 +91,8 @@ class SceneView(openglGui.glGuiPanel):
                openglGui.glLabel(self.scaleForm, 'Uniform scale', (0,8))
                self.scaleUniform = openglGui.glCheckbox(self.scaleForm, True, (1,8), None)
 
+               self.notification = openglGui.glNotification(self, (0, 0))
+
                self._slicer = sliceEngine.Slicer(self._updateSliceProgress)
                self._sceneUpdateTimer = wx.Timer(self)
                self.Bind(wx.EVT_TIMER, lambda e : self._slicer.runSlicer(self._scene), self._sceneUpdateTimer)
@@ -167,7 +169,7 @@ class SceneView(openglGui.glGuiPanel):
        def OnLayFlat(self, button):
                if self._selectedObj is None:
                        return
              pass
/             pass
 
        def OnScaleReset(self, button):
                if self._selectedObj is None:
index 2b1ddd3f648eb8b74da0609445baa4fd4092122e..f522311349fd458fe2e8e0f63d0d28233091b700 100644 (file)
@@ -251,6 +251,7 @@ class glGuiPanel(glcanvas.GLCanvas):
                glLoadIdentity()
 
                self._container.draw()
+
                glBindTexture(GL_TEXTURE_2D, self._glRobotTexture)
                glEnable(GL_TEXTURE_2D)
                glPushMatrix()
@@ -367,7 +368,8 @@ class glGuiLayoutGrid(object):
                return self._size
 
 class glButton(glGuiControl):
-       def __init__(self, parent, imageID, tooltip, pos, callback):
+       def __init__(self, parent, imageID, tooltip, pos, callback, size = None):
+               self._buttonSize = size
                super(glButton, self).__init__(parent, pos)
                self._tooltip = tooltip
                self._parent = parent
@@ -399,6 +401,8 @@ class glButton(glGuiControl):
                return self._selected
 
        def getMinSize(self):
+               if self._buttonSize is not None:
+                       return self._buttonSize, self._buttonSize
                return self._base._buttonSize, self._base._buttonSize
 
        def _getPixelPos(self):
@@ -411,7 +415,7 @@ class glButton(glGuiControl):
 
                cx = (self._imageID % 4) / 4
                cy = int(self._imageID / 4) / 4
-               bs = self._base._buttonSize
+               bs = self.getMinSize()[0]
                pos = self._getPixelPos()
 
                glBindTexture(GL_TEXTURE_2D, self._base._glButtonsTexture)
@@ -610,7 +614,7 @@ class glFrame(glGuiContainer):
 
                size = self._layout.getLayoutSize()
                glColor4ub(255,255,255,255)
-               opengl.glDrawStretchedQuad(pos[0], pos[1], size[0], size[1], bs/2, 0)
+               opengl.glDrawStretchedQuad(pos[0], pos[1], size[0], size[1], bs*0.75, 0)
                #Draw the controls on the frame
                super(glFrame, self).draw()
 
@@ -635,11 +639,52 @@ class glFrame(glGuiContainer):
                        return True
                return False
 
+class glNotification(glFrame):
+       def __init__(self, parent, pos):
+               self._anim = None
+               super(glNotification, self).__init__(parent, pos)
+               glGuiLayoutGrid(self)._alignBottom = False
+               self._label = glLabel(self, "Notification", (0, 0))
+               self._button = glButton(self, 30, "", (1, 0), self.onClose, 25)
+               self._padding = glLabel(self, "", (0, 1))
+               self.setHidden(True)
+
+       def setSize(self, x, y, w, h):
+               w, h = self._layout.getLayoutSize()
+               baseSize = self._base.GetSizeTuple()
+               if self._anim is not None:
+                       super(glNotification, self).setSize(baseSize[0] / 2 - w / 2, baseSize[1] - self._anim.getPosition() - self._base._buttonSize * 0.2, 1, 1)
+               else:
+                       super(glNotification, self).setSize(baseSize[0] / 2 - w / 2, baseSize[1] - self._base._buttonSize * 0.2, 1, 1)
+
+       def draw(self):
+               self.setSize(0,0,0,0)
+               self.updateLayout()
+               super(glNotification, self).draw()
+
+       def message(self, text):
+               if self._anim is not None:
+                       self._anim = animation(self._base, self._anim.getPosition(), 25, 1)
+               else:
+                       self._anim = animation(self._base, -20, 25, 1)
+               self.setHidden(False)
+               self._label.setLabel(text)
+               self.updateLayout()
+
+       def onClose(self, button):
+               if self._anim is not None:
+                       self._anim = animation(self._base, self._anim.getPosition(), -20, 1)
+               else:
+                       self._anim = animation(self._base, 25, -20, 1)
+
 class glLabel(glGuiControl):
        def __init__(self, parent, label, pos):
                self._label = label
                super(glLabel, self).__init__(parent, pos)
 
+       def setLabel(self, label):
+               self._label = label
+
        def getMinSize(self):
                w, h = opengl.glGetStringSize(self._label)
                return w + 10, h + 4
index de4ac15c90df95e9db41c6a1e5e5810c24f8ae3d..96b7373db337a848ed25c828fe7c92bd50f121c8 100644 (file)
Binary files a/Cura/resources/images/glButtons.png and b/Cura/resources/images/glButtons.png differ