|
23 | 23 | from UM.i18n import i18nCatalog |
24 | 24 | catalog = i18nCatalog("cura") |
25 | 25 |
|
| 26 | +from cura.CuraApplication import CuraApplication |
| 27 | + |
26 | 28 |
|
27 | 29 | from enum import Enum |
28 | 30 | class OutputStage(Enum): |
@@ -119,15 +121,15 @@ def requestWrite(self, node, fileName=None, *args, **kwargs): |
119 | 121 | fileName = "%s.gcode" % Application.getInstance().getPrintInformation().jobName |
120 | 122 | self._fileName = fileName |
121 | 123 |
|
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()) |
128 | 130 | self._dialog.textChanged.connect(self.onFilenameChanged) |
129 | 131 | self._dialog.accepted.connect(self.onFilenameAccepted) |
130 | | - self._dialog.open() |
| 132 | + self._dialog.show() |
131 | 133 | self._dialog.findChild(QObject, "nameField").setProperty('text', self._fileName) |
132 | 134 | self._dialog.findChild(QObject, "nameField").select(0, len(self._fileName) - 6) |
133 | 135 | self._dialog.findChild(QObject, "nameField").setProperty('focus', True) |
@@ -256,7 +258,8 @@ def onSimulationPrintStarted(self): |
256 | 258 |
|
257 | 259 | Logger.log("d", self._name_id + " | Simulation print started for file " + self._fileName) |
258 | 260 |
|
259 | | - self.onCheckStatus() |
| 261 | + # give it some to start the simulation |
| 262 | + QTimer.singleShot(15000, self.onCheckStatus) |
260 | 263 |
|
261 | 264 | def onCheckStatus(self): |
262 | 265 | if self._stage != OutputStage.writing: |
|
0 commit comments