mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-06-01 18:49:38 +12:00
Don't crash if a typo is made in the exporter's regular expression.
When a regexp error is thrown, cancel the export and show an info dialog with the error message to the user. Fixes #488
This commit is contained in:
parent
baeb5f4653
commit
c7605b5819
|
@ -2,7 +2,7 @@
|
||||||
# --!-- coding: utf8 --!--
|
# --!-- coding: utf8 --!--
|
||||||
import re
|
import re
|
||||||
from PyQt5.QtGui import QFont, QTextCharFormat
|
from PyQt5.QtGui import QFont, QTextCharFormat
|
||||||
from PyQt5.QtWidgets import QPlainTextEdit, qApp, QFrame, QFileDialog
|
from PyQt5.QtWidgets import QPlainTextEdit, qApp, QFrame, QFileDialog, QMessageBox
|
||||||
|
|
||||||
from manuskript.exporter.basic import basicFormat
|
from manuskript.exporter.basic import basicFormat
|
||||||
from manuskript.functions import mainWindow
|
from manuskript.functions import mainWindow
|
||||||
|
@ -41,7 +41,12 @@ class plainText(basicFormat):
|
||||||
|
|
||||||
def output(self, settingsWidget):
|
def output(self, settingsWidget):
|
||||||
settings = settingsWidget.getSettings()
|
settings = settingsWidget.getSettings()
|
||||||
return self.concatenate(mainWindow().mdlOutline.rootItem, settings)
|
try:
|
||||||
|
return self.concatenate(mainWindow().mdlOutline.rootItem, settings)
|
||||||
|
except re.error as e:
|
||||||
|
QMessageBox.warning(mainWindow().dialog, qApp.translate("Export", "Error"),
|
||||||
|
qApp.translate("Export", "Error processing regular expression : \n{}").format(str(e)))
|
||||||
|
return ""
|
||||||
|
|
||||||
def getExportFilename(self, settingsWidget, varName=None, filter=None):
|
def getExportFilename(self, settingsWidget, varName=None, filter=None):
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue