Improve fixes

This commit is contained in:
Ian Paschal 2018-07-09 11:29:25 +02:00
parent c3cd6f8052
commit ac0192f01f
4 changed files with 20 additions and 9 deletions

View File

@ -486,8 +486,8 @@ class CuraEngineBackend(QObject, Backend):
else: else:
# we got a single scenenode # we got a single scenenode
if not source.callDecoration("isGroup"): if not source.callDecoration("isGroup"):
meshData = source.getMeshData(); mesh_data = source.getMeshData()
if meshData and meshData.getVertices() is None: if mesh_data and mesh_data.getVertices() is None:
return return
build_plate_changed.add(source_build_plate_number) build_plate_changed.add(source_build_plate_number)
@ -670,7 +670,11 @@ class CuraEngineBackend(QObject, Backend):
## Creates a new socket connection. ## Creates a new socket connection.
def _createSocket(self, protocol_file: str = None) -> None: def _createSocket(self, protocol_file: str = None) -> None:
if not protocol_file: if not protocol_file:
protocol_file = os.path.abspath(os.path.join(str(PluginRegistry.getInstance().getPluginPath(self.getPluginId())), "Cura.proto")) plugin_path = PluginRegistry.getInstance().getPluginPath(self.getPluginId())
if not plugin_path:
Logger.log("e", "Could not get plugin path!", self.getPluginId())
return
protocol_file = os.path.abspath(os.path.join(plugin_path, "Cura.proto"))
super()._createSocket(protocol_file) super()._createSocket(protocol_file)
self._engine_is_fresh = True self._engine_is_fresh = True

View File

@ -16,7 +16,7 @@ from UM.i18n import i18nCatalog
from UM.Logger import Logger from UM.Logger import Logger
from UM.PluginRegistry import PluginRegistry from UM.PluginRegistry import PluginRegistry
from UM.Qt.Duration import DurationFormat from UM.Qt.Duration import DurationFormat
from typing import cast from typing import cast, Optional
from .SliceInfoJob import SliceInfoJob from .SliceInfoJob import SliceInfoJob
@ -79,9 +79,13 @@ class SliceInfo(QObject, Extension):
return dialog return dialog
@pyqtSlot(result = str) @pyqtSlot(result = str)
def getExampleData(self) -> str: def getExampleData(self) -> Optional[str]:
if self._example_data_content is None: if self._example_data_content is None:
file_path = os.path.join(cast(str, PluginRegistry.getInstance().getPluginPath(self.getPluginId())), "example_data.json") plugin_path = PluginRegistry.getInstance().getPluginPath(self.getPluginId())
if not plugin_path:
Logger.log("e", "Could not get plugin path!", self.getPluginId())
return None
file_path = os.path.join(plugin_path, "example_data.json")
if file_path: if file_path:
with open(file_path, "r", encoding = "utf-8") as f: with open(file_path, "r", encoding = "utf-8") as f:
self._example_data_content = f.read() self._example_data_content = f.read()

View File

@ -234,7 +234,7 @@ class Toolbox(QObject, Extension):
# Apply enabled/disabled state to installed plugins # Apply enabled/disabled state to installed plugins
self.enabledChanged.emit() self.enabledChanged.emit()
def _createDialog(self, qml_name: str) -> QObject: def _createDialog(self, qml_name: str) -> Optional[QObject]:
Logger.log("d", "Toolbox: Creating dialog [%s].", qml_name) Logger.log("d", "Toolbox: Creating dialog [%s].", qml_name)
plugin_path = PluginRegistry.getInstance().getPluginPath(self.getPluginId()) plugin_path = PluginRegistry.getInstance().getPluginPath(self.getPluginId())
if not plugin_path: if not plugin_path:

View File

@ -106,8 +106,11 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
global_stack = CuraApplication.getInstance().getGlobalContainerStack() global_stack = CuraApplication.getInstance().getGlobalContainerStack()
#Create a list from the supported file formats string. #Create a list from the supported file formats string.
if global_stack: if not global_stack:
machine_file_formats = global_stack.getMetaDataEntry("file_formats").split(";") Logger.log("e", "Missing global stack!")
return;
machine_file_formats = global_stack.getMetaDataEntry("file_formats").split(";")
machine_file_formats = [file_type.strip() for file_type in machine_file_formats] machine_file_formats = [file_type.strip() for file_type in machine_file_formats]
#Exception for UM3 firmware version >=4.4: UFP is now supported and should be the preferred file format. #Exception for UM3 firmware version >=4.4: UFP is now supported and should be the preferred file format.
if "application/x-ufp" not in machine_file_formats and self.printerType == "ultimaker3" and Version(self.firmwareVersion) >= Version("4.4"): if "application/x-ufp" not in machine_file_formats and self.printerType == "ultimaker3" and Version(self.firmwareVersion) >= Version("4.4"):