diff --git a/nw/__init__.py b/nw/__init__.py index 6c253bed..da82b5e0 100644 --- a/nw/__init__.py +++ b/nw/__init__.py @@ -31,6 +31,7 @@ __date__ = "2018" __maintainer__ = "Veronica Berglyd Olsen" __email__ = "code@vkbo.net" __status__ = "Development" +__website__ = "https://github.com/vkbo/novelWriter" # # Logging @@ -75,8 +76,9 @@ logger = logging.getLogger(__name__) CONFIG = Config() # Constants -DOCTYPE_DOC = 0 -DOCTYPE_PROJECT = 1 +DOCTYPE_ABOUT = 0 +DOCTYPE_DOC = 1 +DOCTYPE_PROJECT = 2 def main(sysArgs): """ diff --git a/nw/gui/aboutview.py b/nw/gui/aboutview.py new file mode 100644 index 00000000..7d4d97d2 --- /dev/null +++ b/nw/gui/aboutview.py @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -* +"""novelWriter GUI About View + + novelWriter – GUI About View +============================== + Class holding the tab viewing the about information + + File History: + Created: 2018-10-02 [0.1.0] + +""" + +import logging +import nw + +from os import path +from PyQt5.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout, QLabel +from PyQt5.QtSvg import QSvgWidget +from PyQt5.QtCore import Qt, QSize +from PyQt5.QtGui import QFont + +logger = logging.getLogger(__name__) + +class GuiAboutView(QWidget): + + def __init__(self): + QWidget.__init__(self) + + logger.debug("Initialising AboutView ...") + self.mainConf = nw.CONFIG + self.innerBox = QHBoxLayout() + self.outerBox = QVBoxLayout() + + logoPath = path.abspath(path.join(self.mainConf.appPath,"..","novelWriter.svg")) + logger.vverbose("Loading image: %s" % logoPath) + nwLogo = QSvgWidget(logoPath) + nwLogo.setFixedSize(QSize(300,300)) + + nwName = QLabel() + nwName.setText(nw.__package__) + nwName.setAlignment(Qt.AlignCenter) + fnName = QFont() + fnName.setPointSize(22) + fnName.setBold(True) + nwName.setFont(fnName) + + nwVersion = QLabel() + nwVersion.setText("Version %s" % nw.__version__) + nwVersion.setAlignment(Qt.AlignCenter) + + nwCredits = QLabel() + nwCredits.setText("Created By: %s" % ",".join(nw.__credits__)) + nwCredits.setAlignment(Qt.AlignCenter) + + nwWebsite = QLabel() + nwWebsite.setText("%s" % (nw.__website__,nw.__website__)) + nwWebsite.setOpenExternalLinks(True) + nwWebsite.setAlignment(Qt.AlignCenter) + + self.outerBox.addStretch(1) + self.innerBox.addStretch(1) + self.innerBox.addWidget(nwLogo) + self.innerBox.addStretch(1) + self.outerBox.addLayout(self.innerBox) + self.outerBox.addWidget(nwName) + self.outerBox.addWidget(nwVersion) + self.outerBox.addWidget(nwCredits) + self.outerBox.addWidget(nwWebsite) + self.outerBox.addStretch(1) + + self.setLayout(self.outerBox) + + logger.debug("AboutView initialisation complete") + + return + +# END Class GuiAboutView diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index 223bcd17..89bbe59d 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -13,7 +13,6 @@ import logging import nw -from os import path from PyQt5.QtWidgets import QWidget, QTextEdit, QVBoxLayout, QFrame, QSplitter, QToolBar, QAction from PyQt5.QtCore import Qt, QSize from PyQt5.QtGui import QIcon diff --git a/nw/gui/doctabs.py b/nw/gui/doctabs.py index fa1d1260..5cccfc2c 100644 --- a/nw/gui/doctabs.py +++ b/nw/gui/doctabs.py @@ -13,12 +13,12 @@ import logging import nw -from os import path from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QTabWidget, QWidget, QVBoxLayout from nw.gui.doceditor import GuiDocEditor from nw.gui.projecteditor import GuiProjectEditor +from nw.gui.aboutview import GuiAboutView logger = logging.getLogger(__name__) @@ -32,13 +32,21 @@ class GuiDocTabs(QTabWidget): self.tabList = [] self.resize(900,500) + self.setTabsClosable(True) + + self.tabBar().tabCloseRequested.connect(self._doCloseTab) + + self.createTab(None,nw.DOCTYPE_ABOUT) logger.debug("DocTabs initialisation complete") return def createTab(self, theName=None, tabType=None): - if tabType == nw.DOCTYPE_DOC: + if tabType == nw.DOCTYPE_ABOUT: + self._createTabAbout() + return True + elif tabType == nw.DOCTYPE_DOC: self._createTabDoc(theName) return True elif tabType == nw.DOCTYPE_PROJECT: @@ -50,6 +58,12 @@ class GuiDocTabs(QTabWidget): # Internal Functions # + def _createTabAbout(self): + thisTab = GuiAboutView() + self.tabList.append(thisTab) + self.addTab(self.tabList[-1],"About") + return True + def _createTabDoc(self, docName=None): if docName is None: tabName = "New Document" @@ -70,4 +84,12 @@ class GuiDocTabs(QTabWidget): self.addTab(self.tabList[-1],tabName) return True + # + # Signals + # + + def _doCloseTab(self, tabIdx): + logger.verbose("User requested tab %d to be closed." % tabIdx) + return + # END Class GuiDocTabs