Merge branch '3.3'

This commit is contained in:
Lipu Fei 2018-04-10 11:41:13 +02:00
commit 107c10b860
5 changed files with 14 additions and 8 deletions

View File

@ -1562,8 +1562,8 @@ class CuraApplication(QtApplication):
openProjectFile = pyqtSignal(QUrl, arguments = ["project_file"]) # Emitted when a project file is about to open. openProjectFile = pyqtSignal(QUrl, arguments = ["project_file"]) # Emitted when a project file is about to open.
@pyqtSlot(QUrl) @pyqtSlot(QUrl, bool)
def readLocalFile(self, file): def readLocalFile(self, file, skip_project_file_check = False):
if not file.isValid(): if not file.isValid():
return return
@ -1574,7 +1574,7 @@ class CuraApplication(QtApplication):
self.deleteAll() self.deleteAll()
break break
if self.checkIsValidProjectFile(file): if not skip_project_file_check and self.checkIsValidProjectFile(file):
self.callLater(self.openProjectFile.emit, file) self.callLater(self.openProjectFile.emit, file)
return return

View File

@ -6,6 +6,7 @@ from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkRepl
from UM.Application import Application from UM.Application import Application
from UM.Logger import Logger from UM.Logger import Logger
from UM.PluginError import PluginNotFoundError
from UM.PluginRegistry import PluginRegistry from UM.PluginRegistry import PluginRegistry
from UM.Qt.Bindings.PluginsModel import PluginsModel from UM.Qt.Bindings.PluginsModel import PluginsModel
from UM.Extension import Extension from UM.Extension import Extension
@ -302,10 +303,15 @@ class PluginBrowser(QObject, Extension):
return self._plugins_model return self._plugins_model
def _checkCanUpgrade(self, plugin_id, version): def _checkCanUpgrade(self, plugin_id, version):
if plugin_id not in self._plugin_registry.getInstalledPlugins(): if not self._plugin_registry.isInstalledPlugin(plugin_id):
return False
try:
plugin_object = self._plugin_registry.getPluginObject(plugin_id)
except PluginNotFoundError:
Logger.log("w", "Could not find plugin %s", plugin_id)
return False return False
plugin_object = self._plugin_registry.getPluginObject(plugin_id)
# Scan plugin server data for plugin with the given id: # Scan plugin server data for plugin with the given id:
for plugin in self._plugins_metadata: for plugin in self._plugins_metadata:
if plugin_id == plugin["id"]: if plugin_id == plugin["id"]:

View File

@ -53,7 +53,7 @@ UM.Dialog
UM.Preferences.setValue("cura/choice_on_open_project", "open_as_model") UM.Preferences.setValue("cura/choice_on_open_project", "open_as_model")
} }
CuraApplication.readLocalFile(base.fileUrl) CuraApplication.readLocalFile(base.fileUrl, true)
var meshName = backgroundItem.getMeshName(base.fileUrl.toString()) var meshName = backgroundItem.getMeshName(base.fileUrl.toString())
backgroundItem.hasMesh(decodeURIComponent(meshName)) backgroundItem.hasMesh(decodeURIComponent(meshName))

View File

@ -61,7 +61,7 @@ Menu
} }
else if (toOpenAsModel) else if (toOpenAsModel)
{ {
CuraApplication.readLocalFile(modelData); CuraApplication.readLocalFile(modelData, true);
} }
var meshName = backgroundItem.getMeshName(modelData.toString()) var meshName = backgroundItem.getMeshName(modelData.toString())
backgroundItem.hasMesh(decodeURIComponent(meshName)) backgroundItem.hasMesh(decodeURIComponent(meshName))

View File

@ -42,7 +42,7 @@ UM.Dialog
{ {
for (var i in fileUrls) for (var i in fileUrls)
{ {
CuraApplication.readLocalFile(fileUrls[i]); CuraApplication.readLocalFile(fileUrls[i], true);
} }
var meshName = backgroundItem.getMeshName(fileUrls[0].toString()); var meshName = backgroundItem.getMeshName(fileUrls[0].toString());