mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-04 11:14:21 +08:00
Pass the "add to recent" as an input var to dialogs that open projects
This way it is clear before to the dialog whether it should add the file to the recent files list, before the dialog opens. CURA-7996
This commit is contained in:
parent
b54f792561
commit
f8a9e7f2d2
@ -1733,7 +1733,7 @@ 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.
|
||||
openProjectFile = pyqtSignal(QUrl, bool, arguments = ["project_file", "add_to_recent_files"]) # Emitted when a project file is about to open.
|
||||
|
||||
@pyqtSlot(QUrl, str, bool)
|
||||
@pyqtSlot(QUrl, str)
|
||||
@ -1773,7 +1773,7 @@ class CuraApplication(QtApplication):
|
||||
|
||||
if is_project_file and project_mode == "always_ask":
|
||||
# present a dialog asking to open as project or import models
|
||||
self.callLater(self.openProjectFile.emit, file)
|
||||
self.callLater(self.openProjectFile.emit, file, add_to_recent_files)
|
||||
return
|
||||
|
||||
# Either the file is a model file or we want to load only models from project. Continue to load models.
|
||||
|
@ -691,6 +691,9 @@ UM.MainWindow
|
||||
|
||||
function handleOpenFiles(selectedMultipleFiles, hasProjectFile, fileUrlList, projectFileUrlList)
|
||||
{
|
||||
// Make sure the files opened through the openFilesIncludingProjectDialog are added to the recent files list
|
||||
openFilesIncludingProjectsDialog.addtoRecent = true;
|
||||
|
||||
// we only allow opening one project file
|
||||
if (selectedMultipleFiles && hasProjectFile)
|
||||
{
|
||||
@ -717,6 +720,7 @@ UM.MainWindow
|
||||
{
|
||||
// ask whether to open as project or as models
|
||||
askOpenAsProjectOrModelsDialog.fileUrl = projectFile;
|
||||
askOpenAsProjectOrModelsDialog.addToRecent = true;
|
||||
askOpenAsProjectOrModelsDialog.show();
|
||||
}
|
||||
}
|
||||
@ -776,6 +780,7 @@ UM.MainWindow
|
||||
onOpenProjectFile:
|
||||
{
|
||||
askOpenAsProjectOrModelsDialog.fileUrl = project_file;
|
||||
askOpenAsProjectOrModelsDialog.addToRecent = add_to_recent_files;
|
||||
askOpenAsProjectOrModelsDialog.show();
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ UM.Dialog
|
||||
modality: Qt.WindowModal
|
||||
|
||||
property var fileUrl
|
||||
property var addToRecent: true
|
||||
|
||||
// load the entire project
|
||||
function loadProjectFile() {
|
||||
@ -37,8 +38,7 @@ UM.Dialog
|
||||
UM.Preferences.setValue("cura/choice_on_open_project", "open_as_project")
|
||||
}
|
||||
|
||||
var addToRecent = UM.WorkspaceFileHandler.getAddToRecentFilesHint(base.fileUrl);
|
||||
UM.WorkspaceFileHandler.readLocalFile(base.fileUrl, addToRecent);
|
||||
UM.WorkspaceFileHandler.readLocalFile(base.fileUrl, base.addToRecent);
|
||||
|
||||
base.hide()
|
||||
}
|
||||
@ -50,8 +50,7 @@ UM.Dialog
|
||||
UM.Preferences.setValue("cura/choice_on_open_project", "open_as_model")
|
||||
}
|
||||
|
||||
var addToRecent = UM.WorkspaceFileHandler.getAddToRecentFilesHint(base.fileUrl);
|
||||
CuraApplication.readLocalFile(base.fileUrl, "open_as_model", addToRecent)
|
||||
CuraApplication.readLocalFile(base.fileUrl, "open_as_model", base.addToRecent)
|
||||
|
||||
base.hide()
|
||||
}
|
||||
|
@ -28,19 +28,19 @@ UM.Dialog
|
||||
modality: Qt.WindowModal
|
||||
|
||||
property var fileUrls: []
|
||||
property var addToRecent: true
|
||||
property int spacerHeight: 10 * screenScaleFactor
|
||||
|
||||
function loadProjectFile(projectFile)
|
||||
{
|
||||
var addToRecent = UM.WorkspaceFileHandler.getAddToRecentFilesHint(projectFile);
|
||||
UM.WorkspaceFileHandler.readLocalFile(projectFile, addToRecent);
|
||||
UM.WorkspaceFileHandler.readLocalFile(projectFile, base.addToRecent);
|
||||
}
|
||||
|
||||
function loadModelFiles(fileUrls)
|
||||
{
|
||||
for (var i in fileUrls)
|
||||
{
|
||||
CuraApplication.readLocalFile(fileUrls[i], "open_as_model");
|
||||
CuraApplication.readLocalFile(fileUrls[i], "open_as_model", base.addToRecent);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user