X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=Cura%2Fgui%2FsceneView.py;h=d609cd08d9ed314166c494628c2b35f17fdbc8e8;hb=e5058baad12c29b5d02ee8188fa9850989fc2a72;hp=728a6f353942fb8347ca07554842f5edbc9cf95f;hpb=0886f23b7fdb21ee1dbf551414dabcda977b6126;p=cura.git diff --git a/Cura/gui/sceneView.py b/Cura/gui/sceneView.py index 728a6f35..d609cd08 100644 --- a/Cura/gui/sceneView.py +++ b/Cura/gui/sceneView.py @@ -250,6 +250,9 @@ class SceneView(openglGui.glGuiPanel): def showPrintWindow(self): if self._gcodeFilename is None: return + if profile.getMachineSetting('gcode_flavor') == 'UltiGCode': + wx.MessageBox(_("USB printing on the Ultimaker2 is not supported."), _("USB Printing Error"), wx.OK | wx.ICON_WARNING) + return self._usbPrintMonitor.loadFile(self._gcodeFilename, self._slicer.getID()) if self._gcodeFilename == self._slicer.getGCodeFilename(): self._slicer.submitSliceInfoOnline() @@ -375,7 +378,20 @@ class SceneView(openglGui.glGuiPanel): def OnScaleMax(self, button): if self._selectedObj is None: return - self._selectedObj.scaleUpTo(self._machineSize - numpy.array(profile.calculateObjectSizeOffsets() + [0.0], numpy.float32) * 2 - numpy.array([1,1,1], numpy.float32)) + machine = profile.getMachineSetting('machine_type') + self._selectedObj.setPosition(numpy.array([0.0, 0.0])) + self._scene.pushFree() + #self.sceneUpdated() + if machine == "ultimaker2": + #This is bad and Jaime should feel bad! + self._selectedObj.setPosition(numpy.array([0.0,-10.0])) + self._selectedObj.scaleUpTo(self._machineSize - numpy.array(profile.calculateObjectSizeOffsets() + [0.0], numpy.float32) * 2 - numpy.array([1,1,1], numpy.float32)) + self._selectedObj.setPosition(numpy.array([0.0,0.0])) + self._scene.pushFree() + else: + self._selectedObj.setPosition(numpy.array([0.0, 0.0])) + self._scene.pushFree() + self._selectedObj.scaleUpTo(self._machineSize - numpy.array(profile.calculateObjectSizeOffsets() + [0.0], numpy.float32) * 2 - numpy.array([1,1,1], numpy.float32)) self._scene.pushFree() self._selectObject(self._selectedObj) self.updateProfileToControls() @@ -506,11 +522,16 @@ class SceneView(openglGui.glGuiPanel): self._gcodeVBOs = [] if ready: self.printButton.setProgressBar(None) - cost = self._slicer.getFilamentCost() - if cost is not None: - self.printButton.setBottomText('%s\n%s\n%s' % (self._slicer.getPrintTime(), self._slicer.getFilamentAmount(), cost)) - else: - self.printButton.setBottomText('%s\n%s' % (self._slicer.getPrintTime(), self._slicer.getFilamentAmount())) + text = '%s' % (self._slicer.getPrintTime()) + for e in xrange(0, int(profile.getMachineSetting('extruder_amount'))): + amount = self._slicer.getFilamentAmount(e) + if amount is None: + continue + text += '\n%s' % (amount) + cost = self._slicer.getFilamentCost(e) + if cost is not None: + text += '\n%s' % (cost) + self.printButton.setBottomText(text) self._gcode = gcodeInterpreter.gcode() self._gcodeFilename = self._slicer.getGCodeFilename() else: @@ -1277,6 +1298,7 @@ void main(void) glVertex3f(-size[0] / 2, -size[1] / 2+10, 0) glEnd() + #Cornerpoints for big blue square v0 = [ size[0] / 2, size[1] / 2, size[2]] v1 = [ size[0] / 2,-size[1] / 2, size[2]] v2 = [-size[0] / 2, size[1] / 2, size[2]] @@ -1298,6 +1320,7 @@ void main(void) glDrawArrays(GL_QUADS, 12, 8) glDisableClientState(GL_VERTEX_ARRAY) + #Draw checkerboard sx = self._machineSize[0] sy = self._machineSize[1] for x in xrange(-int(sx/20)-1, int(sx / 20) + 1): @@ -1310,17 +1333,67 @@ void main(void) y1 = max(min(y1, sy/2), -sy/2) x2 = max(min(x2, sx/2), -sx/2) y2 = max(min(y2, sy/2), -sy/2) + #Black or "white" checker if (x & 1) == (y & 1): glColor4ub(5, 171, 231, 127) else: glColor4ub(5 * 8 / 10, 171 * 8 / 10, 231 * 8 / 10, 128) glBegin(GL_QUADS) - glVertex3f(x1, y1, -0.02) + glVertex3f(x1, y1, -0.02) #Draw bit below z0 to prevent zfighting. glVertex3f(x2, y1, -0.02) glVertex3f(x2, y2, -0.02) glVertex3f(x1, y2, -0.02) glEnd() + if machine == 'ultimaker2': + + glColor4ub(127, 127, 127, 200) + #if UM2, draw bat-area zone for head. THe head can't stop there, because its bat-area. + #UpperRight + clipWidth = 25 + clipHeight = 10 + posX = sx / 2 - clipWidth + posY = sy / 2 - clipHeight + glBegin(GL_QUADS) + glVertex3f(posX, posY, 0.1) + glVertex3f(posX+clipWidth, posY, 0.1) + glVertex3f(posX+clipWidth, posY+clipHeight, 0.1) + glVertex3f(posX, posY+clipHeight, 0.1) + glEnd() + #UpperLeft + clipWidth = 25 + clipHeight = 10 + posX = -sx / 2 + posY = sy / 2 - clipHeight + glBegin(GL_QUADS) + glVertex3f(posX, posY, 0.1) + glVertex3f(posX+clipWidth, posY, 0.1) + glVertex3f(posX+clipWidth, posY+clipHeight, 0.1) + glVertex3f(posX, posY+clipHeight, 0.1) + glEnd() + #LowerRight + clipWidth = 25 + clipHeight = 10 + posX = sx / 2 - clipWidth + posY = -sy / 2 + glBegin(GL_QUADS) + glVertex3f(posX, posY, 0.1) + glVertex3f(posX+clipWidth, posY, 0.1) + glVertex3f(posX+clipWidth, posY+clipHeight, 0.1) + glVertex3f(posX, posY+clipHeight, 0.1) + glEnd() + #LowerLeft + clipWidth = 25 + clipHeight = 10 + posX = -sx / 2 + posY = -sy / 2 + glBegin(GL_QUADS) + glVertex3f(posX, posY, 0.1) + glVertex3f(posX+clipWidth, posY, 0.1) + glVertex3f(posX+clipWidth, posY+clipHeight, 0.1) + glVertex3f(posX, posY+clipHeight, 0.1) + glEnd() + glDisable(GL_BLEND) glDisable(GL_CULL_FACE)