diff options
author | Youness Alaoui <kakaroto@kakaroto.homelinux.net> | 2015-01-20 19:55:01 +0300 |
---|---|---|
committer | Youness Alaoui <kakaroto@kakaroto.homelinux.net> | 2015-01-20 19:55:01 +0300 |
commit | 28e73ae29968938840fe9e8cfd0f41151a3a4250 (patch) | |
tree | 7c882362b9d4e7ad3233caed96ed32336bac9ec6 | |
parent | e4e9c6f77fd1d146b57c32605c04f5de08f29a89 (diff) | |
parent | 8ec6eea68d54b78d7b947ed714ad8bdf2b916ff5 (diff) |
Merge remote-tracking branch 'origin/master' into AO-build
Conflicts:
Cura/gui/preferencesDialog.py
Cura/util/profile.py
-rw-r--r-- | Cura/gui/aboutWindow.py | 8 | ||||
-rw-r--r-- | Cura/gui/app.py | 25 | ||||
-rw-r--r-- | Cura/gui/configBase.py | 3 | ||||
-rw-r--r-- | Cura/gui/mainWindow.py | 6 | ||||
-rw-r--r-- | Cura/gui/preferencesDialog.py | 5 | ||||
-rw-r--r-- | Cura/gui/printWindow.py | 22 | ||||
-rw-r--r-- | Cura/gui/sceneView.py | 14 | ||||
-rw-r--r-- | Cura/gui/splashScreen.py | 7 | ||||
-rw-r--r-- | Cura/util/machineCom.py | 9 | ||||
-rw-r--r-- | Cura/util/profile.py | 2 |
10 files changed, 65 insertions, 36 deletions
diff --git a/Cura/gui/aboutWindow.py b/Cura/gui/aboutWindow.py index e947392d18..72f76a2125 100644 --- a/Cura/gui/aboutWindow.py +++ b/Cura/gui/aboutWindow.py @@ -4,8 +4,8 @@ import wx import platform class aboutWindow(wx.Frame): - def __init__(self): - super(aboutWindow, self).__init__(None, title="About", style = wx.DEFAULT_DIALOG_STYLE) + def __init__(self, parent): + super(aboutWindow, self).__init__(parent, title="About", style = wx.DEFAULT_DIALOG_STYLE) wx.EVT_CLOSE(self, self.OnClose) @@ -27,7 +27,7 @@ class aboutWindow(wx.Frame): s.Add(wx.StaticText(p, -1, 'Cura LulzBot Edition has been modified and maintained by Aleph Objects, Inc.')) s.Add(wx.StaticText(p, -1, 'for use with LulzBot 3D printers.')) - s.Add(wx.StaticText(p, -1, 'Cura is build with the following components:'), flag=wx.TOP, border=10) + s.Add(wx.StaticText(p, -1, 'Cura is built with the following components:'), flag=wx.TOP, border=10) self.addComponent('Cura', 'Graphical user interface', 'AGPLv3', 'https://github.com/daid/Cura') self.addComponent('CuraEngine', 'GCode Generator', 'AGPLv3', 'https://github.com/Ultimaker/CuraEngine') self.addComponent('Clipper', 'Polygon clipping library', 'Boost', 'http://www.angusj.com/delphi/clipper.php') @@ -43,7 +43,7 @@ class aboutWindow(wx.Frame): self.addComponent('comtypes', 'Library to help with windows taskbar features on Windows 7', 'MIT', 'http://starship.python.net/crew/theller/comtypes/') self.addComponent('EjectMedia', 'Utility to safe-remove SD cards', 'Freeware', 'http://www.uwe-sieber.de/english.html') self.addComponent('Pymclevel', 'Python library for reading Minecraft levels.', 'ISC', 'https://github.com/mcedit/pymclevel') - s.Add(wx.StaticText(p, -1, "Copyright (C) 2014 Aleph Objects, Inc. - Release under terms of the AGPLv3 License"), flag=wx.TOP, border=10) + s.Add(wx.StaticText(p, -1, "Copyright (C) 2014 Aleph Objects, Inc. - Released under terms of the AGPLv3 License"), flag=wx.TOP, border=10) s.Add(wx.StaticText(p, -1, "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License")) #Translations done by: #Dutch: Charlotte Jansen diff --git a/Cura/gui/app.py b/Cura/gui/app.py index a0bfd57a6f..5b86fb008e 100644 --- a/Cura/gui/app.py +++ b/Cura/gui/app.py @@ -5,6 +5,7 @@ import os import platform import shutil import glob +import subprocess import warnings try: @@ -25,7 +26,8 @@ class CuraApp(wx.App): self.splash = None self.loadFiles = files - self.Bind(wx.EVT_ACTIVATE_APP, self.OnActivate) + if platform.system() == "Darwin": + self.Bind(wx.EVT_ACTIVATE_APP, self.OnActivate) if sys.platform.startswith('win'): #Check for an already running instance, if another instance is running load files in there @@ -78,10 +80,9 @@ class CuraApp(wx.App): pass def OnActivate(self, e): - if platform.system() == "Darwin": - if e.GetActive(): - self.GetTopWindow().Raise() - e.Skip() + if e.GetActive(): + self.GetTopWindow().Raise() + e.Skip() def Win32SocketListener(self, port): import socket @@ -162,14 +163,12 @@ class CuraApp(wx.App): wx.CallAfter(self.StupidMacOSWorkaround) def StupidMacOSWorkaround(self): - """ - On MacOS for some magical reason opening new frames does not work until you opened a new modal dialog and closed it. - If we do this from software, then, as if by magic, the bug which prevents opening extra frames is gone. - """ - dlg = wx.Dialog(None) - wx.PostEvent(dlg, wx.CommandEvent(wx.EVT_CLOSE.typeId)) - dlg.ShowModal() - dlg.Destroy() + subprocess.Popen(['osascript', '-e', '''\ + tell application "System Events" + set procName to name of first process whose unix id is %s + end tell + tell application procName to activate + ''' % os.getpid()]) if platform.system() == "Darwin": #Mac magic. Dragons live here. THis sets full screen options. try: diff --git a/Cura/gui/configBase.py b/Cura/gui/configBase.py index 0c211c845c..a9bbbea92c 100644 --- a/Cura/gui/configBase.py +++ b/Cura/gui/configBase.py @@ -160,6 +160,7 @@ class SettingRow(object): self.ctrl.Bind(wx.EVT_TEXT, self.OnSettingChange) flag = wx.EXPAND + self.ctrl.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter) sizer.Add(self.label, (x,y), flag=wx.ALIGN_CENTER_VERTICAL|wx.LEFT,border=10) sizer.Add(self.ctrl, (x,y+1), flag=wx.ALIGN_BOTTOM|flag) sizer.SetRows(x+1) @@ -175,9 +176,11 @@ class SettingRow(object): def OnMouseEnter(self, e): self.label.SetToolTipString(self.setting.getTooltip()) + self.ctrl.SetToolTipString(self.setting.getTooltip()) def OnMouseExit(self, e): self.label.SetToolTipString('') + self.ctrl.SetToolTipString('') e.Skip() def OnSettingChange(self, e): diff --git a/Cura/gui/mainWindow.py b/Cura/gui/mainWindow.py index c4bbe4cbae..be24fe7dbd 100644 --- a/Cura/gui/mainWindow.py +++ b/Cura/gui/mainWindow.py @@ -353,7 +353,6 @@ class mainWindow(wx.Frame): prefDialog.Centre() prefDialog.Show() prefDialog.Raise() - wx.CallAfter(prefDialog.Show) def OnMachineSettings(self, e): prefDialog = preferencesDialog.machineSettingsDialog(self) @@ -572,9 +571,10 @@ class mainWindow(wx.Frame): wx.MessageBox(_("You are running the latest version of Cura!"), _("Awesome!"), wx.ICON_INFORMATION) def OnAbout(self, e): - aboutBox = aboutWindow.aboutWindow() + aboutBox = aboutWindow.aboutWindow(self) aboutBox.Centre() aboutBox.Show() + aboutBox.Raise() def OnClose(self, e): profile.saveProfile(profile.getDefaultProfilePath(), True) @@ -598,7 +598,7 @@ class mainWindow(wx.Frame): #HACK: Set the paint function of the glCanvas to nothing so it won't keep refreshing. Which can keep wxWidgets from quiting. print "Closing down" self.scene.OnPaint = lambda e : e - self.scene._engine.cleanup() + self.scene.cleanup() self.Destroy() def OnQuit(self, e): diff --git a/Cura/gui/preferencesDialog.py b/Cura/gui/preferencesDialog.py index 54bde5a4fa..6148b3b65e 100644 --- a/Cura/gui/preferencesDialog.py +++ b/Cura/gui/preferencesDialog.py @@ -11,7 +11,7 @@ from Cura.util import resources class preferencesDialog(wx.Dialog): def __init__(self, parent): - super(preferencesDialog, self).__init__(None, title="Preferences") + super(preferencesDialog, self).__init__(parent, title="Preferences") wx.EVT_CLOSE(self, self.OnClose) @@ -65,7 +65,7 @@ class preferencesDialog(wx.Dialog): class machineSettingsDialog(wx.Dialog): def __init__(self, parent): - super(machineSettingsDialog, self).__init__(None, title="Machine settings") + super(machineSettingsDialog, self).__init__(parent, title="Machine settings") wx.EVT_CLOSE(self, self.OnClose) @@ -86,6 +86,7 @@ class machineSettingsDialog(wx.Dialog): configBase.SettingRow(left, 'machine_width', index=idx) configBase.SettingRow(left, 'machine_depth', index=idx) configBase.SettingRow(left, 'machine_height', index=idx) + configBase.SettingRow(left, 'extruder_z_offset', index=idx) configBase.SettingRow(left, 'extruder_amount', index=idx) configBase.SettingRow(left, 'has_heated_bed', index=idx) configBase.SettingRow(left, 'machine_center_is_zero', index=idx) diff --git a/Cura/gui/printWindow.py b/Cura/gui/printWindow.py index 35be4a8385..74be922d84 100644 --- a/Cura/gui/printWindow.py +++ b/Cura/gui/printWindow.py @@ -6,10 +6,11 @@ import time import sys import os import ctypes +import subprocess #TODO: This does not belong here! if sys.platform.startswith('win'): - def preventComputerFromSleeping(prevent): + def preventComputerFromSleeping(frame, prevent): """ Function used to prevent the computer from going into sleep mode. :param prevent: True = Prevent the system from going to sleep from this point on. @@ -34,7 +35,7 @@ elif sys.platform.startswith('darwin'): frameworkPath=objc.pathForFramework("/System/Library/Frameworks/IOKit.framework"), globals=globals()) objc.loadBundleFunctions(bundle, globals(), [("IOPMAssertionCreateWithName", b"i@I@o^I")]) - def preventComputerFromSleeping(prevent): + def preventComputerFromSleeping(frame, prevent): if prevent: success, preventComputerFromSleeping.assertionID = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, "Cura is printing", None) if success != kIOReturnSuccess: @@ -44,8 +45,13 @@ elif sys.platform.startswith('darwin'): IOPMAssertionRelease(preventComputerFromSleeping.assertionID) preventComputerFromSleeping.assertionID = None else: - def preventComputerFromSleeping(prevent): - pass + def preventComputerFromSleeping(frame, prevent): + if os.path.isfile("/usr/bin/xdg-screensaver"): + try: + cmd = ['xdg-screensaver', 'suspend' if prevent else 'resume', str(frame.GetHandle())] + subprocess.call(cmd) + except: + pass class printWindowPlugin(wx.Frame): def __init__(self, parent, printerConnection, filename): @@ -252,7 +258,7 @@ class printWindowPlugin(wx.Frame): self._printerConnection.closeActiveConnection() self._printerConnection.removeCallback(self._doPrinterConnectionUpdate) #TODO: When multiple printer windows are open, closing one will enable sleeping again. - preventComputerFromSleeping(False) + preventComputerFromSleeping(self, False) self.Destroy() def OnTermEnterLine(self, e): @@ -355,7 +361,7 @@ class printWindowPlugin(wx.Frame): self.SetTitle(info.replace('\n', ', ')) if connection.isPrinting() != self._isPrinting: self._isPrinting = connection.isPrinting() - preventComputerFromSleeping(self._isPrinting) + preventComputerFromSleeping(self, self._isPrinting) class printWindowBasic(wx.Frame): """ @@ -449,7 +455,7 @@ class printWindowBasic(wx.Frame): self._printerConnection.closeActiveConnection() self._printerConnection.removeCallback(self._doPrinterConnectionUpdate) #TODO: When multiple printer windows are open, closing one will enable sleeping again. - preventComputerFromSleeping(False) + preventComputerFromSleeping(self, False) self.Destroy() def OnConnect(self, e): @@ -499,7 +505,7 @@ class printWindowBasic(wx.Frame): self.statsText.SetLabel(info) if connection.isPrinting() != self._isPrinting: self._isPrinting = connection.isPrinting() - preventComputerFromSleeping(self._isPrinting) + preventComputerFromSleeping(self, self._isPrinting) def _updateButtonStates(self): diff --git a/Cura/gui/sceneView.py b/Cura/gui/sceneView.py index 447b5838f5..48c975d3e6 100644 --- a/Cura/gui/sceneView.py +++ b/Cura/gui/sceneView.py @@ -52,6 +52,7 @@ class SceneView(openglGui.glGuiPanel): self._animView = None self._animZoom = None self._platformMesh = {} + self.glReleaseList = [] self._platformTexture = None self._isSimpleMode = True self._printerConnectionManager = printerConnectionManager.PrinterConnectionManager() @@ -120,6 +121,19 @@ class SceneView(openglGui.glGuiPanel): self.updateToolButtons() self.updateProfileToControls() + def cleanup(self): + # Delete all objects first + self.OnDeleteAll(None) + self._engine.cleanup() + if self._objectShader is not None: + self._objectShader.release() + if self._objectLoadShader is not None: + self._objectLoadShader.release() + if self._objectOverhangShader is not None: + self._objectOverhangShader.release() + for obj in self.glReleaseList: + obj.release() + def loadGCodeFile(self, filename): self.OnDeleteAll(None) #Cheat the engine results to load a GCode file into it. diff --git a/Cura/gui/splashScreen.py b/Cura/gui/splashScreen.py index 27463f5fe2..44bad77acd 100644 --- a/Cura/gui/splashScreen.py +++ b/Cura/gui/splashScreen.py @@ -19,7 +19,8 @@ class splashScreen(wx.SplashScreen): def OnClose(self, e): if self.callback: - # Avoid calling the callback twice - self.callback() - self.callback = None + # Avoid calling the callback twice + self.callback() + self.callback = None wx.CallAfter(self.DoDestroy) + e.Skip() diff --git a/Cura/util/machineCom.py b/Cura/util/machineCom.py index c09adb3698..5fe86611c4 100644 --- a/Cura/util/machineCom.py +++ b/Cura/util/machineCom.py @@ -395,7 +395,10 @@ class MachineCom(object): t = time.time() self._heatupWaitTimeLost = t - self._heatupWaitStartTime self._heatupWaitStartTime = t - elif line.strip() != '' and line.strip() != 'ok' and not line.startswith('Resend:') and not line.startswith('Error:checksum mismatch') and not line.startswith('Error:Line Number is not Last Line Number+1') and line != 'echo:Unknown command:""\n' and self.isOperational(): + elif line.strip() != '' and line.strip() != 'ok' and not line.startswith('Resend:') and \ + not line.startswith('Error:checksum mismatch') and not line.startswith('Error:Line Number is not Last Line Number+1') and \ + not line.startswith('Error:No Checksum with line number') and not line.startswith('Error:No Line Number with checksum') and \ + line != 'echo:Unknown command:""\n' and self.isOperational(): self._callback.mcMessage(line) if self._state == self.STATE_DETECT_BAUDRATE or self._state == self.STATE_DETECT_SERIAL: @@ -616,7 +619,7 @@ class MachineCom(object): self._printSection = 'CUSTOM' self._changeState(self.STATE_PRINTING) self._printStartTime = time.time() - for i in xrange(0, 4): + for i in xrange(0, 2): self._sendNext() def cancelPrint(self): @@ -626,7 +629,7 @@ class MachineCom(object): def setPause(self, pause): if not pause and self.isPaused(): self._changeState(self.STATE_PRINTING) - for i in xrange(0, 6): + for i in xrange(0, 2): self._sendNext() if pause and self.isPrinting(): self._changeState(self.STATE_PAUSED) diff --git a/Cura/util/profile.py b/Cura/util/profile.py index 1db26fe6dd..d843c8da7b 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -509,6 +509,8 @@ setting('extruder_offset_x2', '0.0', float, 'machine', 'hidden').setLabel(_("Off setting('extruder_offset_y2', '0.0', float, 'machine', 'hidden').setLabel(_("Offset Y"), _("The offset of your tertiary extruder compared to the primary.")) setting('extruder_offset_x3', '0.0', float, 'machine', 'hidden').setLabel(_("Offset X"), _("The offset of your forth extruder compared to the primary.")) setting('extruder_offset_y3', '0.0', float, 'machine', 'hidden').setLabel(_("Offset Y"), _("The offset of your forth extruder compared to the primary.")) +setting('extruder_z_offset', '0.0', float, 'machine', 'hidden').setLabel(_("Z-Offset (mm)"), _("This value will be added to the Z coordinate of every line in the output G-Code to compensate for a badly calibrate Z height endstop.")) + setting('steps_per_e', '0', float, 'machine', 'hidden').setLabel(_("E-Steps per 1mm filament"), _("Amount of steps per mm filament extrusion. If set to 0 then this value is ignored and the value in your firmware is used.")) setting('serial_port', 'AUTO', str, 'machine', 'hidden').setLabel(_("Serial port"), _("Serial port to use for communication with the printer")) setting('serial_port_auto', '', str, 'machine', 'hidden') |