Skip to content

Commit

Permalink
fix more API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kriechi committed Oct 5, 2018
1 parent c69c27d commit 2b9f17a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog of Cura-DuetRRFPlugin

## v0.0.19: 2018-10-05
* fix more Cura 3.5 incompatibilities

## v0.0.18: 2018-10-05
* fix Cura 3.5 incompatibility
* bump API code
Expand Down
19 changes: 11 additions & 8 deletions DuetRRFOutputDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
from UM.i18n import i18nCatalog
catalog = i18nCatalog("cura")

from cura.CuraApplication import CuraApplication


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

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

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

self.onCheckStatus()
# give it some to start the simulation
QTimer.singleShot(15000, self.onCheckStatus)

def onCheckStatus(self):
if self._stage != OutputStage.writing:
Expand Down
10 changes: 4 additions & 6 deletions DuetRRFPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from UM.Message import Message
from UM.Logger import Logger

from UM.Application import Application
from UM.Preferences import Preferences
from UM.Extension import Extension
from UM.PluginRegistry import PluginRegistry
Expand All @@ -18,6 +17,8 @@
from UM.i18n import i18nCatalog
catalog = i18nCatalog("cura")

from cura.CuraApplication import CuraApplication


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

def _createDialog(self, qml):
path = QUrl.fromLocalFile(os.path.join(os.path.dirname(os.path.abspath(__file__)), qml))
self._component = QQmlComponent(Application.getInstance()._engine, path)
self._context = QQmlContext(Application.getInstance()._engine.rootContext())
self._context.setContextProperty("manager", self)
dialog = self._component.create(self._context)
path = os.path.join(os.path.dirname(os.path.abspath(__file__)), qml)
dialog = CuraApplication.getInstance().createQmlComponent(path, {"manager": self})
if dialog is None:
Logger.log("e", "QQmlComponent status %s", self._component.status())
Logger.log("e", "QQmlComponent errorString %s", self._component.errorString())
Expand Down
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "DuetRRF",
"author": "Thomas Kriechbaumer",
"description": "Upload and Print to DuetWifi / DuetEthernet / Duet Maestro with RepRapFirmware.",
"version": "0.0.18",
"version": "0.0.19",
"minimum_cura_version": "3.5",
"maximum_cura_version": "3.5",
"api": 5
Expand Down

0 comments on commit 2b9f17a

Please sign in to comment.