Add a "Check for Updates" dialog (#863)

* Add basic dialog for Updates check
* Add GitHub API call and processing
* Finalise the update dialog
* Improve test coverage
This commit is contained in:
Veronica Berglyd Olsen
2021-08-22 14:33:00 +02:00
committed by GitHub
parent 80911af4d2
commit b5e52b80a3
6 changed files with 250 additions and 20 deletions
+17 -2
View File
@@ -44,7 +44,7 @@ from nw.gui import (
)
from nw.dialogs import (
GuiAbout, GuiDocMerge, GuiDocSplit, GuiItemEditor, GuiPreferences,
GuiProjectLoad, GuiProjectSettings, GuiWordList
GuiProjectLoad, GuiProjectSettings, GuiUpdates, GuiWordList
)
from nw.tools import GuiBuildNovel, GuiProjectWizard, GuiWritingStats
from nw.core import NWProject, NWIndex
@@ -289,7 +289,7 @@ class GuiMain(QMainWindow):
logger.debug("GUI initialisation complete")
if nw.__hexversion__[-2] == "a":
if nw.__hexversion__[-2] == "a" and logger.getEffectiveLevel() > logging.DEBUG:
self.makeAlert(self.tr(
"You are running an untested development version of novelWriter. "
"Please be careful when working on a live project "
@@ -1096,6 +1096,21 @@ class GuiMain(QMainWindow):
msgBox.aboutQt(self, "About Qt")
return
def showUpdatesDialog(self):
"""Show the updates dialog for novelWriter.
"""
dlgUpdate = getGuiItem("GuiUpdates")
if dlgUpdate is None:
dlgUpdate = GuiUpdates(self)
dlgUpdate.setModal(True)
dlgUpdate.show()
dlgUpdate.raise_()
qApp.processEvents()
dlgUpdate.checkLatest()
return
def makeAlert(self, theMessage, theLevel=nwAlert.INFO):
"""Alert both the user and the logger at the same time. Message
can be either a string or an array of strings.