Skip to content

Commit

Permalink
Open doc on first launch of a release
Browse files Browse the repository at this point in the history
  • Loading branch information
fraca7 committed Aug 23, 2020
1 parent cafd76b commit 025e25f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
1 change: 0 additions & 1 deletion TODO
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@
* Codesign mac OS binary
* Common subexpr elimination
* Optimization pass
* Include doc in bundles, open on first launch

4 changes: 4 additions & 0 deletions src/dsrlib/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ def appSite():
# FIXME
return 'https://www.example.com/'

@staticmethod
def documentationUrl():
return 'https://dsremap.readthedocs.io/en/release-%d.%d.%d/' % Meta.appVersion()

@staticmethod
def dataPath(*args):
path = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.AppDataLocation)
Expand Down
9 changes: 9 additions & 0 deletions src/dsrlib/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

from PyQt5 import QtCore

from dsrlib.meta import Meta


class Settings(QtCore.QSettings):
@contextlib.contextmanager
Expand Down Expand Up @@ -67,6 +69,13 @@ def setFirmwareUploaded(self):
with self.grouped('Settings'):
self.setBooleanValue('firmwareUploaded', True)

def isFirstVersionLaunch(self):
with self.grouped('Versions'):
key = 'v%d_%d_%d' % Meta.appVersion()
ret = self.booleanValue(key, True)
self.setBooleanValue(key, False)
return ret

# Depending on the platform, some versions of QSettings fuck up the types

def setBooleanValue(self, name, value):
Expand Down
4 changes: 4 additions & 0 deletions src/dsrlib/ui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ def __init__(self):
self.raise_()
self.show()

settings = Settings()
if settings.isFirstVersionLaunch():
QtGui.QDesktopServices.openUrl(QtCore.QUrl(Meta.documentationUrl()))

self.check()

def history(self):
Expand Down

0 comments on commit 025e25f

Please sign in to comment.