manuskript/manuskript/exporter/pandoc/plainText.py
Jan Wester 9317dc97d8 Do not reinvent QFileDialog's default suffix
According to issue #608 we were silently overwriting files when there
was a suffix being generated for a chosen export filename when one was
missing to begin with. Unfortunately, this helpful feature avoids all
the conveniences offered by QFileDialog in regards to alerting the user
to overwriting an existing file. Worse still, this feature already
exists in QFileDialog and the native APIs it can rely on.

This patch reimplements QFileDialog.getSaveFileName to allow the use of
the default suffix feature as functions.getSaveFileNameWithSuffix and
removes most of the magic involved with the old solution.
2019-09-07 15:59:45 -06:00

55 lines
1.8 KiB
Python

#!/usr/bin/env python
# --!-- coding: utf8 --!--
from PyQt5.QtWidgets import qApp
from manuskript.exporter.pandoc.abstractPlainText import abstractPlainText
class markdown(abstractPlainText):
name = "Markdown"
description = qApp.translate("Export", """Export to markdown, using pandoc. Allows more formatting options
than the basic manuskript exporter.""")
icon = "text-x-markdown"
exportVarName = "lastPandocMarkdown"
toFormat = "markdown"
exportFilter = "Markdown files (*.md);; Any files (*)"
exportDefaultSuffix = ".md"
class reST(abstractPlainText):
name = "reST"
description = qApp.translate("Export", """reStructuredText is a lightweight markup language.""")
exportVarName = "lastPandocreST"
toFormat = "rst"
icon = "text-plain"
exportFilter = "reST files (*.rst);; Any files (*)"
exportDefaultSuffix = ".rst"
class latex(abstractPlainText):
name = "LaTeX"
description = qApp.translate("Export", """LaTeX is a word processor and document markup language used to create
beautiful documents.""")
exportVarName = "lastPandocLatex"
toFormat = "latex"
icon = "text-x-tex"
exportFilter = "Tex files (*.tex);; Any files (*)"
exportDefaultSuffix = ".tex"
class OPML(abstractPlainText):
name = "OPML"
description = qApp.translate("Export", """The purpose of this format is to provide a way to exchange information
between outliners and Internet services that can be browsed or controlled
through an outliner.""")
exportVarName = "lastPandocOPML"
toFormat = "opml"
icon = "text-x-opml+xml"
exportFilter = "OPML files (*.opml);; Any files (*)"
exportDefaultSuffix = ".opml"