mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Show a save dialog when the save button is clicked in Printer
This commit is contained in:
parent
ff850c5bec
commit
8e1e37e2eb
2 changed files with 33 additions and 1 deletions
|
@ -12,6 +12,8 @@ from UM.Scene.Selection import Selection
|
|||
from PlatformPhysics import PlatformPhysics
|
||||
from BuildVolume import BuildVolume
|
||||
|
||||
from PyQt5.QtCore import pyqtSlot, QUrl
|
||||
|
||||
import os.path
|
||||
|
||||
class PrinterApplication(QtApplication):
|
||||
|
@ -104,7 +106,7 @@ class PrinterApplication(QtApplication):
|
|||
self.getMachineSettings().saveValuesToFile(Resources.getStoragePath(Resources.SettingsLocation, 'ultimaker2.cfg'))
|
||||
|
||||
def registerObjects(self, engine):
|
||||
pass
|
||||
engine.rootContext().setContextProperty('Printer', self)
|
||||
|
||||
def onSelectionChanged(self):
|
||||
if Selection.getCount() > 0:
|
||||
|
@ -115,3 +117,13 @@ class PrinterApplication(QtApplication):
|
|||
else:
|
||||
if self.getController().getActiveTool() and self.getController().getActiveTool().getName() == 'TranslateTool':
|
||||
self.getController().setActiveTool(None)
|
||||
|
||||
@pyqtSlot(QUrl)
|
||||
def saveGCode(self, file):
|
||||
try:
|
||||
gcode = self.getController().getScene().gcode
|
||||
except AttributeError:
|
||||
return
|
||||
|
||||
with open(file.toLocalFile(), 'w') as f:
|
||||
f.write(gcode)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue