Skip to content

Commit 2b9f17a

Browse files
committed
fix more API changes
1 parent c69c27d commit 2b9f17a

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog of Cura-DuetRRFPlugin
22

3+
## v0.0.19: 2018-10-05
4+
* fix more Cura 3.5 incompatibilities
5+
36
## v0.0.18: 2018-10-05
47
* fix Cura 3.5 incompatibility
58
* bump API code

DuetRRFOutputDevice.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
from UM.i18n import i18nCatalog
2424
catalog = i18nCatalog("cura")
2525

26+
from cura.CuraApplication import CuraApplication
27+
2628

2729
from enum import Enum
2830
class OutputStage(Enum):
@@ -119,15 +121,15 @@ def requestWrite(self, node, fileName=None, *args, **kwargs):
119121
fileName = "%s.gcode" % Application.getInstance().getPrintInformation().jobName
120122
self._fileName = fileName
121123

122-
path = QUrl.fromLocalFile(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'UploadFilename.qml'))
123-
self._component = QQmlComponent(Application.getInstance()._engine, path)
124-
Logger.log("d", self._name_id + " | Errors:", self._component.errors())
125-
self._context = QQmlContext(Application.getInstance()._engine.rootContext())
126-
self._context.setContextProperty("manager", self)
127-
self._dialog = self._component.create(self._context)
124+
path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'UploadFilename.qml')
125+
self._dialog = CuraApplication.getInstance().createQmlComponent(path, {"manager": self})
126+
if dialog is None:
127+
Logger.log("e", "QQmlComponent status %s", self._component.status())
128+
Logger.log("e", "QQmlComponent errorString %s", self._component.errorString())
129+
raise RuntimeError(self._component.errorString())
128130
self._dialog.textChanged.connect(self.onFilenameChanged)
129131
self._dialog.accepted.connect(self.onFilenameAccepted)
130-
self._dialog.open()
132+
self._dialog.show()
131133
self._dialog.findChild(QObject, "nameField").setProperty('text', self._fileName)
132134
self._dialog.findChild(QObject, "nameField").select(0, len(self._fileName) - 6)
133135
self._dialog.findChild(QObject, "nameField").setProperty('focus', True)
@@ -256,7 +258,8 @@ def onSimulationPrintStarted(self):
256258

257259
Logger.log("d", self._name_id + " | Simulation print started for file " + self._fileName)
258260

259-
self.onCheckStatus()
261+
# give it some to start the simulation
262+
QTimer.singleShot(15000, self.onCheckStatus)
260263

261264
def onCheckStatus(self):
262265
if self._stage != OutputStage.writing:

DuetRRFPlugin.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from UM.Message import Message
99
from UM.Logger import Logger
1010

11-
from UM.Application import Application
1211
from UM.Preferences import Preferences
1312
from UM.Extension import Extension
1413
from UM.PluginRegistry import PluginRegistry
@@ -18,6 +17,8 @@
1817
from UM.i18n import i18nCatalog
1918
catalog = i18nCatalog("cura")
2019

20+
from cura.CuraApplication import CuraApplication
21+
2122

2223
class DuetRRFPlugin(QObject, Extension, OutputDevicePlugin):
2324
def __init__(self, parent=None):
@@ -46,11 +47,8 @@ def stop(self):
4647
manager.removeOutputDevice(name + "-upload")
4748

4849
def _createDialog(self, qml):
49-
path = QUrl.fromLocalFile(os.path.join(os.path.dirname(os.path.abspath(__file__)), qml))
50-
self._component = QQmlComponent(Application.getInstance()._engine, path)
51-
self._context = QQmlContext(Application.getInstance()._engine.rootContext())
52-
self._context.setContextProperty("manager", self)
53-
dialog = self._component.create(self._context)
50+
path = os.path.join(os.path.dirname(os.path.abspath(__file__)), qml)
51+
dialog = CuraApplication.getInstance().createQmlComponent(path, {"manager": self})
5452
if dialog is None:
5553
Logger.log("e", "QQmlComponent status %s", self._component.status())
5654
Logger.log("e", "QQmlComponent errorString %s", self._component.errorString())

plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "DuetRRF",
33
"author": "Thomas Kriechbaumer",
44
"description": "Upload and Print to DuetWifi / DuetEthernet / Duet Maestro with RepRapFirmware.",
5-
"version": "0.0.18",
5+
"version": "0.0.19",
66
"minimum_cura_version": "3.5",
77
"maximum_cura_version": "3.5",
88
"api": 5

0 commit comments

Comments
 (0)