Don't use __file__

Contributes to CL-1274
This commit is contained in:
Ian 2019-03-01 10:46:41 +01:00
parent cf9a1c0248
commit cac8c85489
4 changed files with 24 additions and 9 deletions

View file

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

View file

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

View file

@ -77,7 +77,10 @@ class LegacyUM3OutputDevice(NetworkedPrinterOutputDevice):
self.setIconName("print")
self._monitor_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../resources/qml/MonitorItem.qml")
self._monitor_view_qml_path = os.path.join(
PluginRegistry.getPluginDirectory(),
"UM3NetworkPrinting", "resources", "qml", "MonitorItem.qml"
)
self._output_controller = LegacyUM3PrinterOutputController(self)

View file

@ -457,8 +457,10 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
self._start_cloud_flow_message = Message(
text = i18n_catalog.i18nc("@info:status", "Send and monitor print jobs from anywhere using your Ultimaker account."),
lifetime = 0,
image_source = QUrl.fromLocalFile(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..",
"resources", "svg", "cloud-flow-start.svg")),
image_source = QUrl.fromLocalFile(os.path.join(
PluginRegistry.getPluginDirectory(),
"UM3NetworkPrinting", "resources", "svg", "cloud-flow-start.svg"
)),
image_caption = i18n_catalog.i18nc("@info:status", "Connect to Ultimaker Cloud"),
option_text = i18n_catalog.i18nc("@action", "Don't ask me again for this printer."),
option_state = False
@ -479,8 +481,10 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
self._cloud_flow_complete_message = Message(
text = i18n_catalog.i18nc("@info:status", "You can now send and monitor print jobs from anywhere using your Ultimaker account."),
lifetime = 30,
image_source = QUrl.fromLocalFile(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..",
"resources", "svg", "cloud-flow-completed.svg")),
image_source = QUrl.fromLocalFile(os.path.join(
PluginRegistry.getPluginDirectory(),
"UM3NetworkPrinting", "resources", "svg", "cloud-flow-completed.svg"
)),
image_caption = i18n_catalog.i18nc("@info:status", "Connected!")
)
# Don't show the review connection link if we're not on the local network