if not(os.path.exists(filename)):
return
#For some reason my Ubuntu 10.10 crashes here.
- firmwareInstall.InstallFirmware(filename)
+ firmwareInstall.InstallFirmware(self, filename)
- def OnFirstRunWizard(self, e):
+ def OnAddNewMachine(self, e):
self.Hide()
- configWizard.ConfigWizard(True)
+ wasSimple = profile.getPreference('startMode') == 'Simple'
- configWizard.configWizard()
++ configWizard.configWizard(True)
+ isSimple = profile.getPreference('startMode') == 'Simple'
self.Show()
- self.reloadSettingPanels()
+ self.reloadSettingPanels(isSimple != wasSimple)
+ self.updateMachineMenu()
def OnSelectMachine(self, index):
profile.setActiveMachine(index)
if len(removableStorage.getPossibleSDcardDrives()) > 0 and (connectionGroup is None or connectionGroup.getPriority() < 0):
drives = removableStorage.getPossibleSDcardDrives()
if len(drives) > 1:
- dlg = wx.SingleChoiceDialog(self, _("Select SD drive"), _("Multiple removable drives have been found,\nplease select your SD card drive"), map(lambda n: n[0], drives))
- if dlg.ShowModal() != wx.ID_OK:
- dlg.Destroy()
- return
- drive = drives[dlg.GetSelection()]
+ choices = map(lambda n: n[0], drives)
- choices += ("Custom file destination", )
- title = "Multiple removable drives have been found"
++ choices += (_("Custom file destination"), )
++ title = _("Multiple removable drives have been found")
+ else:
- choices = [drives[0][0], "Custom file destination"]
- title = "A removable drive has been found"
++ choices = [drives[0][0], _("Custom file destination")]
++ title = _("A removable drive has been found")
+
- dlg = wx.SingleChoiceDialog(self, "Select destination SD card drive\nYou can also select a custom file to save to", title, choices)
++ dlg = wx.SingleChoiceDialog(self, _("Select destination SD card drive\nYou can also select a custom file to save to"), title, choices)
+ if dlg.ShowModal() != wx.ID_OK:
dlg.Destroy()
+ return
+ try:
+ drive = drives[dlg.GetSelection()]
+ except:
+ drive = None
+ dlg.Destroy()
+
+ if drive is None:
+ self.showSaveGCode()
else:
- drive = drives[0]
- filename = self._scene._objectList[0].getName() + profile.getGCodeExtension()
- threading.Thread(target=self._saveGCode,args=(drive[1] + filename, drive[1])).start()
+ filename = self._scene._objectList[0].getName() + profile.getGCodeExtension()
+ threading.Thread(target=self._saveGCode,args=(drive[1] + filename, drive[1])).start()
elif connectionGroup is not None:
connections = connectionGroup.getAvailableConnections()
if len(connections) < 2:
logThread.daemon = True
logThread.start()
- data = self._process.stdout.read(4096)
- while len(data) > 0:
- self._result._gcodeData.write(data)
- data = self._process.stdout.read(4096)
-
- returnCode = self._process.wait()
- logThread.join()
- self._result.addLog("Slicer process returned : %d" % returnCode)
try:
- with open(os.path.join(profile.getBasePath(), 'engine.log'), "w") as f:
- for line in self._result.getLog():
- f.write(line + "\n")
- except:
- pass
-
- if returnCode == 0:
- pluginError = pluginInfo.runPostProcessingPlugins(self._result, pluginConfig)
- if pluginError is not None:
- print pluginError
- self._result.addLog(pluginError)
- self._result.setFinished(True)
- self._callback(1.0)
- else:
+ data = self._process.stdout.read(4096)
+ while len(data) > 0:
+ self._result._gcodeData.write(data)
+ data = self._process.stdout.read(4096)
+
+ returnCode = self._process.wait()
+ logThread.join()
++ self._result.addLog("Slicer process returned : %d" % returnCode)
+ if returnCode == 0:
+ self._result.setFinished(True)
- plugin_error = pluginInfo.runPostProcessingPlugins(self._result)
++ plugin_error = pluginInfo.runPostProcessingPlugins(self._result, pluginConfig)
+ if plugin_error is not None:
- print plugin_error
+ self._result.addLog(plugin_error)
+ self._callback(1.0)
+ else:
- for line in self._result.getLog():
- print line
+ self._callback(-1.0)
+ self._process = None
+ except MemoryError:
+ self._result.addLog("MemoryError")
self._callback(-1.0)
- self._process = None
++ finally:
++ try:
++ with open(os.path.join(profile.getBasePath(), 'engine.log'), "w") as f:
++ for line in self._result.getLog():
++ f.write(line + "\n")
++ except:
++ pass
def _watchStderr(self, stderr):
objectNr = 0