Don't try to get the plugin path when there's no plugin registry

i.e. in tests
Contributes to CL-1274
This commit is contained in:
Ian Paschal 2019-03-04 14:27:35 +01:00
parent a74717ca3c
commit 88fc7d0fba
3 changed files with 21 additions and 17 deletions

View File

@ -84,10 +84,11 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice):
self._account = api_client.account self._account = api_client.account
# We use the Cura Connect monitor tab to get most functionality right away. # We use the Cura Connect monitor tab to get most functionality right away.
self._monitor_view_qml_path = os.path.join( if PluginRegistry.getInstance() is not None:
PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting"), self._monitor_view_qml_path = os.path.join(
"resources", "qml", "MonitorStage.qml" PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting"),
) "resources", "qml", "MonitorStage.qml"
)
# Trigger the printersChanged signal when the private signal is triggered. # Trigger the printersChanged signal when the private signal is triggered.
self.printersChanged.connect(self._clusterPrintersChanged) self.printersChanged.connect(self._clusterPrintersChanged)

View File

@ -65,10 +65,11 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
self._print_jobs = [] # type: List[UM3PrintJobOutputModel] self._print_jobs = [] # type: List[UM3PrintJobOutputModel]
self._received_print_jobs = False # type: bool self._received_print_jobs = False # type: bool
self._monitor_view_qml_path = os.path.join( if PluginRegistry.getInstance() is not None:
PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting"), self._monitor_view_qml_path = os.path.join(
"resources", "qml", "MonitorStage.qml" PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting"),
) "resources", "qml", "MonitorStage.qml"
)
# Trigger the printersChanged signal when the private signal is triggered # Trigger the printersChanged signal when the private signal is triggered
self.printersChanged.connect(self._clusterPrintersChanged) self.printersChanged.connect(self._clusterPrintersChanged)
@ -129,11 +130,12 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
def _spawnPrinterSelectionDialog(self): def _spawnPrinterSelectionDialog(self):
if self._printer_selection_dialog is None: if self._printer_selection_dialog is None:
path = os.path.join( if PluginRegistry.getInstance() is not None:
PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting"), path = os.path.join(
"resources", "qml", "PrintWindow.qml" PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting"),
) "resources", "qml", "PrintWindow.qml"
self._printer_selection_dialog = self._application.createQmlComponent(path, {"OutputDevice": self}) )
self._printer_selection_dialog = self._application.createQmlComponent(path, {"OutputDevice": self})
if self._printer_selection_dialog is not None: if self._printer_selection_dialog is not None:
self._printer_selection_dialog.show() self._printer_selection_dialog.show()

View File

@ -77,10 +77,11 @@ class LegacyUM3OutputDevice(NetworkedPrinterOutputDevice):
self.setIconName("print") self.setIconName("print")
self._monitor_view_qml_path = os.path.join( if PluginRegistry.getInstance() is not None:
PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting"), self._monitor_view_qml_path = os.path.join(
"resources", "qml", "MonitorStage.qml" PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting"),
) "resources", "qml", "MonitorStage.qml"
)
self._output_controller = LegacyUM3PrinterOutputController(self) self._output_controller = LegacyUM3PrinterOutputController(self)