mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 14:44:13 -06:00
Handle Open File events on Mac OSX
This commit is contained in:
parent
a47c8f7ef6
commit
ae79139cc4
1 changed files with 15 additions and 4 deletions
|
@ -38,7 +38,7 @@ from . import PrintInformation
|
||||||
from . import CuraActions
|
from . import CuraActions
|
||||||
from . import MultiMaterialDecorator
|
from . import MultiMaterialDecorator
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtSlot, QUrl, Qt, pyqtSignal, pyqtProperty
|
from PyQt5.QtCore import pyqtSlot, QUrl, Qt, pyqtSignal, pyqtProperty, QEvent
|
||||||
from PyQt5.QtGui import QColor, QIcon
|
from PyQt5.QtGui import QColor, QIcon
|
||||||
|
|
||||||
import platform
|
import platform
|
||||||
|
@ -170,12 +170,17 @@ class CuraApplication(QtApplication):
|
||||||
self.closeSplash()
|
self.closeSplash()
|
||||||
|
|
||||||
for file in self.getCommandLineOption("file", []):
|
for file in self.getCommandLineOption("file", []):
|
||||||
job = ReadMeshJob(os.path.abspath(file))
|
self._openFile(file)
|
||||||
job.finished.connect(self._onFileLoaded)
|
|
||||||
job.start()
|
|
||||||
|
|
||||||
self.exec_()
|
self.exec_()
|
||||||
|
|
||||||
|
# Handle Qt events
|
||||||
|
def event(self, event):
|
||||||
|
if event.type() == QEvent.FileOpen:
|
||||||
|
self._openFile(event.file())
|
||||||
|
|
||||||
|
return super().event(event)
|
||||||
|
|
||||||
def registerObjects(self, engine):
|
def registerObjects(self, engine):
|
||||||
engine.rootContext().setContextProperty("Printer", self)
|
engine.rootContext().setContextProperty("Printer", self)
|
||||||
self._print_information = PrintInformation.PrintInformation()
|
self._print_information = PrintInformation.PrintInformation()
|
||||||
|
@ -508,3 +513,9 @@ class CuraApplication(QtApplication):
|
||||||
|
|
||||||
def _reloadMeshFinished(self, job):
|
def _reloadMeshFinished(self, job):
|
||||||
job._node = job.getResult()
|
job._node = job.getResult()
|
||||||
|
|
||||||
|
def _openFile(self, file):
|
||||||
|
job = ReadMeshJob(os.path.abspath(file))
|
||||||
|
job.finished.connect(self._onFileLoaded)
|
||||||
|
job.start()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue