mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Merge branch '3.3'
This commit is contained in:
commit
c7b6bb8188
2 changed files with 34 additions and 6 deletions
|
@ -691,17 +691,29 @@ class CuraApplication(QtApplication):
|
|||
else:
|
||||
self.runWithGUI()
|
||||
|
||||
# Pre-load files if requested
|
||||
for file_name in self.getCommandLineOption("file", []):
|
||||
self._openFile(file_name)
|
||||
for file_name in self._open_file_queue: # Open all the files that were queued up while plug-ins were loading.
|
||||
self._openFile(file_name)
|
||||
|
||||
self.started = True
|
||||
self.initializationFinished.emit()
|
||||
Logger.log("d", "Booting Cura took %s seconds", time.time() - self._boot_loading_time)
|
||||
|
||||
|
||||
# For now use a timer to postpone some things that need to be done after the application and GUI are
|
||||
# initialized, for example opening files because they may show dialogs which can be closed due to incomplete
|
||||
# GUI initialization.
|
||||
self._post_start_timer = QTimer(self)
|
||||
self._post_start_timer.setInterval(700)
|
||||
self._post_start_timer.setSingleShot(True)
|
||||
self._post_start_timer.timeout.connect(self._onPostStart)
|
||||
self._post_start_timer.start()
|
||||
|
||||
|
||||
self.exec_()
|
||||
|
||||
def _onPostStart(self):
|
||||
for file_name in self.getCommandLineOption("file", []):
|
||||
self.callLater(self._openFile, file_name)
|
||||
for file_name in self._open_file_queue: # Open all the files that were queued up while plug-ins were loading.
|
||||
self.callLater(self._openFile, file_name)
|
||||
|
||||
initializationFinished = pyqtSignal()
|
||||
|
||||
## Run Cura without GUI elements and interaction (server mode).
|
||||
|
@ -1548,6 +1560,8 @@ class CuraApplication(QtApplication):
|
|||
def log(self, msg):
|
||||
Logger.log("d", msg)
|
||||
|
||||
openProjectFile = pyqtSignal(QUrl, arguments = ["project_file"]) # Emitted when a project file is about to open.
|
||||
|
||||
@pyqtSlot(QUrl)
|
||||
def readLocalFile(self, file):
|
||||
if not file.isValid():
|
||||
|
@ -1560,6 +1574,10 @@ class CuraApplication(QtApplication):
|
|||
self.deleteAll()
|
||||
break
|
||||
|
||||
if self.checkIsValidProjectFile(file):
|
||||
self.callLater(self.openProjectFile.emit, file)
|
||||
return
|
||||
|
||||
f = file.toLocalFile()
|
||||
extension = os.path.splitext(f)[1]
|
||||
filename = os.path.basename(f)
|
||||
|
|
|
@ -855,6 +855,16 @@ UM.MainWindow
|
|||
id: askOpenAsProjectOrModelsDialog
|
||||
}
|
||||
|
||||
Connections
|
||||
{
|
||||
target: CuraApplication
|
||||
onOpenProjectFile:
|
||||
{
|
||||
askOpenAsProjectOrModelsDialog.fileUrl = project_file;
|
||||
askOpenAsProjectOrModelsDialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
EngineLog
|
||||
{
|
||||
id: engineLog;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue