Skip to content
Permalink
Browse files

[processing] add msg bar links to files when saving/exporting models

  • Loading branch information
nirvn committed Sep 11, 2018
1 parent ac3b37f commit 68b7e799f0520b8a4714d4e5e1d0b43c35c5eaf3
Showing with 11 additions and 6 deletions.
  1. +11 −6 python/plugins/processing/modeler/ModelerDialog.py
@@ -35,6 +35,7 @@
from qgis.PyQt.QtCore import (
Qt,
QCoreApplication,
QDir,
QRectF,
QMimeData,
QPoint,
@@ -44,7 +45,8 @@
QSizeF,
pyqtSignal,
QDataStream,
QIODevice)
QIODevice,
QUrl)
from qgis.PyQt.QtWidgets import (QGraphicsView,
QTreeWidget,
QMessageBox,
@@ -570,7 +572,7 @@ def exportAsImage(self):

img.save(filename)

self.bar.pushMessage("", self.tr("Model was correctly exported as image"), level=Qgis.Success, duration=5)
self.bar.pushMessage("", self.tr("Successfully exported model as image to <a href=\"{}\">{}</a>").format(QUrl.fromLocalFile(filename).toString(), QDir.toNativeSeparators(filename)), level=Qgis.Success, duration=5)
self.repaintModel(controls=True)

def exportAsPdf(self):
@@ -598,7 +600,7 @@ def exportAsPdf(self):
self.scene.render(painter, printerRect, totalRect)
painter.end()

self.bar.pushMessage("", self.tr("Model was correctly exported as PDF"), level=Qgis.Success, duration=5)
self.bar.pushMessage("", self.tr("Successfully exported model as PDF to <a href=\"{}\">{}</a>").format(QUrl.fromLocalFile(filename).toString(), QDir.toNativeSeparators(filename)), level=Qgis.Success, duration=5)
self.repaintModel(controls=True)

def exportAsSvg(self):
@@ -626,7 +628,7 @@ def exportAsSvg(self):
self.scene.render(painter, svgRect, totalRect)
painter.end()

self.bar.pushMessage("", self.tr("Model was correctly exported as SVG"), level=Qgis.Success, duration=5)
self.bar.pushMessage("", self.tr("Successfully exported model as SVG to <a href=\"{}\">{}</a>").format(QUrl.fromLocalFile(filename).toString(), QDir.toNativeSeparators(filename)), level=Qgis.Success, duration=5)
self.repaintModel(controls=True)

def exportAsPython(self):
@@ -643,7 +645,7 @@ def exportAsPython(self):
with codecs.open(filename, 'w', encoding='utf-8') as fout:
fout.write(text)

self.bar.pushMessage("", self.tr("Model was correctly exported as python script"), level=Qgis.Success, duration=5)
self.bar.pushMessage("", self.tr("Successfully exported model as python script to <a href=\"{}\">{}</a>").format(QUrl.fromLocalFile(filename).toString(), QDir.toNativeSeparators(filename)), level=Qgis.Success, duration=5)

def can_save(self):
"""
@@ -686,7 +688,10 @@ def saveModel(self, saveAs):
)
return
self.update_model.emit()
self.bar.pushMessage("", self.tr("Model was correctly saved"), level=Qgis.Success, duration=5)
if saveAs:
self.bar.pushMessage("", self.tr("Model was correctly saved to <a href=\"{}\">{}</a>").format(QUrl.fromLocalFile(filename).toString(), QDir.toNativeSeparators(filename)), level=Qgis.Success, duration=5)
else:
self.bar.pushMessage("", self.tr("Model was correctly saved"), level=Qgis.Success, duration=5)

self.hasChanged = False

0 comments on commit 68b7e79

Please sign in to comment.
You can’t perform that action at this time.