Add config option and set up menu action

This commit is contained in:
Veronica K. B. Olsen
2020-11-24 18:36:08 +01:00
parent 12c2d93968
commit 00f6277eb7
4 changed files with 65 additions and 36 deletions
@@ -1,7 +1,7 @@
<!DOCTYPE html public "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <!DOCTYPE html public "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html> <html>
<body> <body>
<h2>Release 1.0 RC1</h2> <h2>Release Notes for 1.0 RC1</h2>
<p>This is the first release candidate for the upcoming release of novelWriter 1.0.</p> <p>This is the first release candidate for the upcoming release of novelWriter 1.0.</p>
<p>Since the fifth beta release about four weeks ago, not much has been changed in novelWriter. A <p>Since the fifth beta release about four weeks ago, not much has been changed in novelWriter. A
few minor tweaks have been made to the GUI. A number of features and tools are now automatically few minor tweaks have been made to the GUI. A number of features and tools are now automatically
@@ -10,12 +10,12 @@ bugs have been reported or encountered, and I feel its time to move on to the
Most of the minor changes should not be noticeable to most users. However, there are a couple of Most of the minor changes should not be noticeable to most users. However, there are a couple of
noticeable changes.</p> noticeable changes.</p>
<h3>Typewriter Mode</h3> <h3>Typewriter Mode</h3>
<p>"Typewriter Mode" of the editor has been improved. Essentially, this feature is a sort of smart <p>The "Typewriter Mode" of the editor has been improved. Essentially, this feature is a sort of
scroll. It tries to keep the cursor stationary in the vertical direction, and will try to scroll smart scroll. It tries to keep the cursor stationary in the vertical direction, and will try to
the document up when the cursor skips to a new line while typing (or down in case of backspace). scroll the document up when the cursor skips to a new line while typing (or down in case of
This is similar to the way a typewriter scrolls the paper when hitting the return key. It improves backspace). This is similar to the way a typewriter scrolls the paper when hitting the return key.
the writing experience as the current active line will stay at the same eye height level on the It improves the writing experience as the current active line will stay at the same eye height
screen.</p> level on the screen.</p>
<p>Previously, the feature would lock the cursor to a given vertical position defined by the user. <p>Previously, the feature would lock the cursor to a given vertical position defined by the user.
Now, instead, the cursor will remain stationary in the vertical direction at any position the user Now, instead, the cursor will remain stationary in the vertical direction at any position the user
sets it to by mouse click or keyboard navigation. The user can define a minimum distance from the sets it to by mouse click or keyboard navigation. The user can define a minimum distance from the
+5
View File
@@ -91,6 +91,7 @@ class Config:
self.guiFont = "" # Defaults to system default font self.guiFont = "" # Defaults to system default font
self.guiFontSize = 11 self.guiFontSize = 11
self.guiScale = 1.0 # Set automatically by Theme class self.guiScale = 1.0 # Set automatically by Theme class
self.lastNotes = "" # The latest release notes that have been shown
## Sizes ## Sizes
self.winGeometry = [1200, 650] self.winGeometry = [1200, 650]
@@ -380,6 +381,9 @@ class Config:
self.guiFontSize = self._parseLine( self.guiFontSize = self._parseLine(
cnfParse, cnfSec, "guifontsize", self.CNF_INT, self.guiFontSize cnfParse, cnfSec, "guifontsize", self.CNF_INT, self.guiFontSize
) )
self.lastNotes = self._parseLine(
cnfParse, cnfSec, "lastnotes", self.CNF_STR, self.lastNotes
)
## Sizes ## Sizes
cnfSec = "Sizes" cnfSec = "Sizes"
@@ -584,6 +588,7 @@ class Config:
cnfParse.set(cnfSec, "guidark", str(self.guiDark)) cnfParse.set(cnfSec, "guidark", str(self.guiDark))
cnfParse.set(cnfSec, "guifont", str(self.guiFont)) cnfParse.set(cnfSec, "guifont", str(self.guiFont))
cnfParse.set(cnfSec, "guifontsize", str(self.guiFontSize)) cnfParse.set(cnfSec, "guifontsize", str(self.guiFontSize))
cnfParse.set(cnfSec, "lastnotes", str(self.lastNotes))
## Sizes ## Sizes
cnfSec = "Sizes" cnfSec = "Sizes"
+38 -27
View File
@@ -32,8 +32,9 @@ import os
from datetime import datetime from datetime import datetime
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from PyQt5.QtGui import QCursor
from PyQt5.QtWidgets import ( from PyQt5.QtWidgets import (
QDialog, QHBoxLayout, QVBoxLayout, QDialogButtonBox, QTabWidget, qApp, QDialog, QHBoxLayout, QVBoxLayout, QDialogButtonBox, QTabWidget,
QTextBrowser, QLabel QTextBrowser, QLabel
) )
@@ -80,19 +81,19 @@ class GuiAbout(QDialog):
self.pageAbout.setOpenExternalLinks(True) self.pageAbout.setOpenExternalLinks(True)
self.pageAbout.document().setDocumentMargin(self.mainConf.pxInt(16)) self.pageAbout.document().setDocumentMargin(self.mainConf.pxInt(16))
self.pageLicense = QTextBrowser()
self.pageLicense.setOpenExternalLinks(True)
self.pageLicense.document().setDocumentMargin(self.mainConf.pxInt(16))
self.pageNotes = QTextBrowser() self.pageNotes = QTextBrowser()
self.pageNotes.setOpenExternalLinks(True) self.pageNotes.setOpenExternalLinks(True)
self.pageNotes.document().setDocumentMargin(self.mainConf.pxInt(16)) self.pageNotes.document().setDocumentMargin(self.mainConf.pxInt(16))
self.pageLicense = QTextBrowser()
self.pageLicense.setOpenExternalLinks(True)
self.pageLicense.document().setDocumentMargin(self.mainConf.pxInt(16))
# Main Tab Area # Main Tab Area
self.tabBox = QTabWidget() self.tabBox = QTabWidget()
self.tabBox.addTab(self.pageAbout, "About") self.tabBox.addTab(self.pageAbout, "About")
self.tabBox.addTab(self.pageNotes, "Release")
self.tabBox.addTab(self.pageLicense, "License") self.tabBox.addTab(self.pageLicense, "License")
self.tabBox.addTab(self.pageNotes, "Release Notes")
self.innerBox.addWidget(self.tabBox) self.innerBox.addWidget(self.tabBox)
# OK Button # OK Button
@@ -103,15 +104,27 @@ class GuiAbout(QDialog):
self.outerBox.addWidget(self.buttonBox) self.outerBox.addWidget(self.buttonBox)
self.setLayout(self.outerBox) self.setLayout(self.outerBox)
self._setStyleSheet()
self._fillAboutPage()
self._fillLicensePage()
self._fillNotesPage()
logger.debug("GuiAbout initialisation complete") logger.debug("GuiAbout initialisation complete")
return return
def populateGUI(self):
"""Populate tabs with text.
"""
qApp.setOverrideCursor(QCursor(Qt.WaitCursor))
self._setStyleSheet()
self._fillAboutPage()
self._fillNotesPage()
self._fillLicensePage()
qApp.restoreOverrideCursor()
return
def showReleaseNotes(self):
"""Show the release notes.
"""
self.tabBox.setCurrentWidget(self.pageNotes)
return
## ##
# Internal Functions # Internal Functions
## ##
@@ -198,11 +211,22 @@ class GuiAbout(QDialog):
return return
def _fillNotesPage(self):
"""Load the content for the Release Notes page.
"""
docPath = os.path.join(self.mainConf.assetPath, "text", "release_notes.htm")
if os.path.isfile(docPath):
with open(docPath, mode="r", encoding="utf8") as inFile:
helpText = inFile.read()
self.pageNotes.setHtml(helpText)
else:
self.pageNotes.setHtml("Error loading release notes text ...")
return
def _fillLicensePage(self): def _fillLicensePage(self):
"""Load the content for the License page. """Load the content for the License page.
""" """
docName = "gplv3_%s.htm" % self.mainConf.guiLang docPath = os.path.join(self.mainConf.assetPath, "text", "gplv3_en.htm")
docPath = os.path.join(self.mainConf.assetPath, "text", docName)
if os.path.isfile(docPath): if os.path.isfile(docPath):
with open(docPath, mode="r", encoding="utf8") as inFile: with open(docPath, mode="r", encoding="utf8") as inFile:
helpText = inFile.read() helpText = inFile.read()
@@ -211,19 +235,6 @@ class GuiAbout(QDialog):
self.pageLicense.setHtml("Error loading license text ...") self.pageLicense.setHtml("Error loading license text ...")
return return
def _fillNotesPage(self):
"""Load the content for the Release Notes page.
"""
docName = "release_notes_%s.htm" % self.mainConf.guiLang
docPath = os.path.join(self.mainConf.assetPath, "text", docName)
if os.path.isfile(docPath):
with open(docPath, mode="r", encoding="utf8") as inFile:
helpText = inFile.read()
self.pageNotes.setHtml(helpText)
else:
self.pageNotes.setHtml("Error release notes text ...")
return
def _setStyleSheet(self): def _setStyleSheet(self):
"""Set stylesheet for all browser tabs """Set stylesheet for all browser tabs
""" """
@@ -240,8 +251,8 @@ class GuiAbout(QDialog):
hColB = self.theParent.theTheme.colHead[2], hColB = self.theParent.theTheme.colHead[2],
) )
self.pageAbout.document().setDefaultStyleSheet(styleSheet) self.pageAbout.document().setDefaultStyleSheet(styleSheet)
self.pageLicense.document().setDefaultStyleSheet(styleSheet)
self.pageNotes.document().setDefaultStyleSheet(styleSheet) self.pageNotes.document().setDefaultStyleSheet(styleSheet)
self.pageLicense.document().setDefaultStyleSheet(styleSheet)
return return
+15 -2
View File
@@ -238,6 +238,12 @@ class GuiMain(QMainWindow):
if self.mainConf.showGUI: if self.mainConf.showGUI:
self.showProjectLoadDialog() self.showProjectLoadDialog()
# Show the latest release notes, if they haven't been shown before
if self.mainConf.lastNotes != nw.__version__:
if self.mainConf.showGUI:
self.showAboutNWDialog(showNotes=True)
self.mainConf.lastNotes = nw.__version__
logger.debug("novelWriter is ready ...") logger.debug("novelWriter is ready ...")
self.setStatus("novelWriter is ready ...") self.setStatus("novelWriter is ready ...")
@@ -915,11 +921,18 @@ class GuiMain(QMainWindow):
return return
def showAboutNWDialog(self): def showAboutNWDialog(self, showNotes=False):
"""Show the about dialog for novelWriter. """Show the about dialog for novelWriter.
""" """
dlgAbout = GuiAbout(self) dlgAbout = GuiAbout(self)
dlgAbout.exec_() dlgAbout.setModal(True)
dlgAbout.show()
qApp.processEvents()
dlgAbout.populateGUI()
if showNotes:
dlgAbout.showReleaseNotes()
return return
def showAboutQtDialog(self): def showAboutQtDialog(self):