|
@@ 248-263 (lines=16) @@
|
| 245 |
|
def save_as(self): |
| 246 |
|
self._save_as() |
| 247 |
|
|
| 248 |
|
def _save_as(self): |
| 249 |
|
path, ok = QFileDialog.getSaveFileName(self.modeler, caption="Save OPC UA XML", filter="XML Files (*.xml *.XML)") |
| 250 |
|
if ok: |
| 251 |
|
if os.path.isfile(path): |
| 252 |
|
reply = QMessageBox.question( |
| 253 |
|
self.modeler, |
| 254 |
|
"OPC UA Modeler", |
| 255 |
|
"File already exit, do you really want to save to this file?", |
| 256 |
|
QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel |
| 257 |
|
) |
| 258 |
|
if reply != QMessageBox.Yes: |
| 259 |
|
return |
| 260 |
|
if self._last_model_dir != os.path.dirname(path): |
| 261 |
|
self._last_model_dir = os.path.dirname(path) |
| 262 |
|
self.settings.setValue("last_model_dir", self._last_model_dir) |
| 263 |
|
self._model_mgr.save_model(path) |
| 264 |
|
|
| 265 |
|
@trycatchslot |
| 266 |
|
def save(self): |
|
@@ 223-233 (lines=11) @@
|
| 220 |
|
self._model_mgr.close_model(force=True) |
| 221 |
|
return True |
| 222 |
|
|
| 223 |
|
@trycatchslot |
| 224 |
|
def open(self): |
| 225 |
|
if not self.try_close_model(): |
| 226 |
|
return |
| 227 |
|
path, ok = QFileDialog.getOpenFileName(self.modeler, caption="Open OPC UA XML", filter="XML Files (*.xml *.XML)", directory=self._last_model_dir) |
| 228 |
|
if not ok: |
| 229 |
|
return |
| 230 |
|
if self._last_model_dir != os.path.dirname(path): |
| 231 |
|
self._last_model_dir = os.path.dirname(path) |
| 232 |
|
self.settings.setValue("last_model_dir", self._last_model_dir) |
| 233 |
|
self._model_mgr.open_model(path) |
| 234 |
|
|
| 235 |
|
@trycatchslot |
| 236 |
|
def import_xml(self): |