+7
-3
@@ -21,14 +21,17 @@ from nw.config import Config
|
|||||||
__package__ = "novelWriter"
|
__package__ = "novelWriter"
|
||||||
__author__ = "Veronica Berglyd Olsen"
|
__author__ = "Veronica Berglyd Olsen"
|
||||||
__copyright__ = "Copyright 2018–2019, Veronica Berglyd Olsen"
|
__copyright__ = "Copyright 2018–2019, Veronica Berglyd Olsen"
|
||||||
__credits__ = ["Veronica Berglyd Olsen"]
|
|
||||||
__license__ = "GPLv3"
|
__license__ = "GPLv3"
|
||||||
__version__ = "0.1.5"
|
__version__ = "0.1.5"
|
||||||
__date__ = "2019.06.08"
|
__date__ = "2019.06.08"
|
||||||
__maintainer__ = "Veronica Berglyd Olsen"
|
__maintainer__ = "Veronica Berglyd Olsen"
|
||||||
__email__ = "code@vkbo.net"
|
__email__ = "code@vkbo.net"
|
||||||
__status__ = "Pre-Release"
|
__status__ = "Development"
|
||||||
__url__ = "https://github.com/vkbo/novelWriter"
|
__url__ = "https://github.com/vkbo/novelWriter"
|
||||||
|
__credits__ = [
|
||||||
|
"Veronica Berglyd Olsen (developer)",
|
||||||
|
"Marian Lückhof (contributor, tester)"
|
||||||
|
]
|
||||||
|
|
||||||
#
|
#
|
||||||
# Logging
|
# Logging
|
||||||
@@ -82,7 +85,7 @@ def main(sysArgs):
|
|||||||
]
|
]
|
||||||
|
|
||||||
helpMsg = (
|
helpMsg = (
|
||||||
"novelWriter {version} ({status})\n"
|
"{appname} {version} ({status})\n"
|
||||||
"{copyright}\n"
|
"{copyright}\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Usage:\n"
|
"Usage:\n"
|
||||||
@@ -97,6 +100,7 @@ def main(sysArgs):
|
|||||||
" --config Alternative config file.\n"
|
" --config Alternative config file.\n"
|
||||||
" --headless Do not display GUI. Useful for testing scripts.\n"
|
" --headless Do not display GUI. Useful for testing scripts.\n"
|
||||||
).format(
|
).format(
|
||||||
|
appname = __package__,
|
||||||
version = __version__,
|
version = __version__,
|
||||||
status = __status__,
|
status = __status__,
|
||||||
copyright = __copyright__
|
copyright = __copyright__
|
||||||
|
|||||||
+10
-3
@@ -13,7 +13,9 @@
|
|||||||
import logging
|
import logging
|
||||||
import nw
|
import nw
|
||||||
|
|
||||||
|
from PyQt5.QtCore import Qt
|
||||||
from PyQt5.QtWidgets import QTextBrowser
|
from PyQt5.QtWidgets import QTextBrowser
|
||||||
|
from PyQt5.QtGui import QTextOption
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -29,17 +31,22 @@ class GuiDocViewer(QTextBrowser):
|
|||||||
self.theParent = theParent
|
self.theParent = theParent
|
||||||
self.theTheme = theParent.theTheme
|
self.theTheme = theParent.theTheme
|
||||||
|
|
||||||
self.theDoc = self.document()
|
self.theQDoc = self.document()
|
||||||
self.theDoc.setDefaultStyleSheet((
|
self.theQDoc.setDefaultStyleSheet((
|
||||||
"h1, h2, h3, h4 {{"
|
"h1, h2, h3, h4 {{"
|
||||||
" color: rgb({0},{1},{2});"
|
" color: rgb({0},{1},{2});"
|
||||||
"}}"
|
"}}"
|
||||||
).format(
|
).format(
|
||||||
*self.theTheme.colHead
|
*self.theTheme.colHead
|
||||||
))
|
))
|
||||||
self.theDoc.setDocumentMargin(self.mainConf.textMargin[0])
|
self.theQDoc.setDocumentMargin(self.mainConf.textMargin[0])
|
||||||
self.setMinimumWidth(300)
|
self.setMinimumWidth(300)
|
||||||
|
|
||||||
|
theOpt = QTextOption()
|
||||||
|
if self.mainConf.doJustify:
|
||||||
|
theOpt.setAlignment(Qt.AlignJustify)
|
||||||
|
self.theQDoc.setDefaultTextOption(theOpt)
|
||||||
|
|
||||||
logger.debug("DocViewer initialisation complete")
|
logger.debug("DocViewer initialisation complete")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|||||||
+4
-2
@@ -108,10 +108,11 @@ class GuiMainMenu(QMenuBar):
|
|||||||
msgBox.about(self.theParent, "About %s" % nw.__package__, (
|
msgBox.about(self.theParent, "About %s" % nw.__package__, (
|
||||||
"<h3>About {name:s}</h3>"
|
"<h3>About {name:s}</h3>"
|
||||||
"<p>Version: {version:s}<br>Release Date: {date:s}</p>"
|
"<p>Version: {version:s}<br>Release Date: {date:s}</p>"
|
||||||
"<p>{name:s} is a text editor designed for writing novels. "
|
"<p>{name:s} is a markdown-like text editor designed for organising and writing novels. "
|
||||||
"It is written in Python 3 with a Qt5 GUI. The Python and Qt layers are connected with PyQt5</p>"
|
"It is written in Python 3 with a Qt5 GUI. The Python and Qt layers are connected with PyQt5</p>"
|
||||||
"<p>{name:s} is is licensed under GPL v3.0</p>"
|
"<p>{name:s} is is licensed under GPL v3.0</p>"
|
||||||
"<p>{copyright:s}</p>"
|
"<p>{copyright:s}</p>"
|
||||||
|
"<p>Website: <a href='{website:s}'>{website:s}</a></p>"
|
||||||
"<h4>Credits</h4>"
|
"<h4>Credits</h4>"
|
||||||
"<p>{credits:s}</p>"
|
"<p>{credits:s}</p>"
|
||||||
).format(
|
).format(
|
||||||
@@ -119,7 +120,8 @@ class GuiMainMenu(QMenuBar):
|
|||||||
version = nw.__version__,
|
version = nw.__version__,
|
||||||
date = nw.__date__,
|
date = nw.__date__,
|
||||||
copyright = nw.__copyright__,
|
copyright = nw.__copyright__,
|
||||||
credits = "<br>".join(nw.__credits__),
|
website = nw.__url__,
|
||||||
|
credits = "".join([" • %s<br/>" % x for x in nw.__credits__]),
|
||||||
))
|
))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
+7
-1
@@ -316,7 +316,13 @@ class GuiMain(QMainWindow):
|
|||||||
if tHandle is None:
|
if tHandle is None:
|
||||||
tHandle = self.treeView.getSelectedHandle()
|
tHandle = self.treeView.getSelectedHandle()
|
||||||
if tHandle is None:
|
if tHandle is None:
|
||||||
logger.warning("No document selected")
|
logger.warning("No document selected, trying last viewed")
|
||||||
|
tHandle = self.theProject.lastViewed
|
||||||
|
if tHandle is None:
|
||||||
|
logger.warning("No document selected, trying editor document")
|
||||||
|
tHandle = self.theDocument.docHandle
|
||||||
|
if tHandle is None:
|
||||||
|
logger.warning("No document selected, giving up")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
tItem = self.theProject.getItem(tHandle)
|
tItem = self.theProject.getItem(tHandle)
|
||||||
|
|||||||
Reference in New Issue
Block a user