diff --git a/nw/__init__.py b/nw/__init__.py index f3e8954b..5dbaab41 100644 --- a/nw/__init__.py +++ b/nw/__init__.py @@ -10,8 +10,9 @@ """ -import logging +import sys import getopt +import logging from os import path, remove, rename from PyQt5.QtWidgets import QApplication @@ -196,6 +197,6 @@ def main(sysArgs): else: nwApp = QApplication([__package__]) nwGUI = GuiMain() - exit(nwApp.exec_()) + sys.exit(nwApp.exec_()) return diff --git a/nw/config.py b/nw/config.py index e07852c6..ef042f9f 100644 --- a/nw/config.py +++ b/nw/config.py @@ -156,13 +156,13 @@ class Config: self.confFile = self.appHandle+".conf" self.homePath = path.expanduser("~") self.lastPath = self.homePath - self.appPath = path.dirname(__file__) + self.appPath = getattr(sys, "_MEIPASS", path.abspath(path.dirname(__file__))) self.appRoot = path.join(self.appPath,path.pardir) self.helpPath = path.join(self.appRoot,"help","en_GB") self.guiPath = path.join(self.appPath,"gui") self.themeRoot = path.join(self.appPath,"themes") - self.themePath = path.join(self.themeRoot) - self.appIcon = path.join(self.appRoot, nwFiles.APP_ICON) + self.graphPath = path.join(self.appPath,"graphics") + self.appIcon = path.join(self.graphPath, nwFiles.APP_ICON) # If config folder does not exist, make it. # This assumes that the os config folder itself exists. diff --git a/novelWriter.svg b/nw/graphics/novelWriter.svg similarity index 100% rename from novelWriter.svg rename to nw/graphics/novelWriter.svg diff --git a/nw/gui/configeditor.py b/nw/gui/configeditor.py index 30f600fb..dfb50d1f 100644 --- a/nw/gui/configeditor.py +++ b/nw/gui/configeditor.py @@ -43,7 +43,7 @@ class GuiConfigEditor(QDialog): self.setWindowTitle("Preferences") - self.gradPath = path.abspath(path.join(self.mainConf.appPath,"graphics","gear.svg")) + self.gradPath = path.abspath(path.join(self.mainConf.graphPath,"gear.svg")) self.svgGradient = QSvgWidget(path.join(self.gradPath)) self.svgGradient.setFixedSize(QSize(64,64)) diff --git a/nw/gui/export.py b/nw/gui/export.py index f0b92250..1b33ade6 100644 --- a/nw/gui/export.py +++ b/nw/gui/export.py @@ -55,7 +55,7 @@ class GuiExport(QDialog): self.setWindowTitle("Export Project") self.setLayout(self.outerBox) - self.gradPath = path.abspath(path.join(self.mainConf.appPath,"graphics","export.svg")) + self.gradPath = path.abspath(path.join(self.mainConf.graphPath,"export.svg")) self.svgGradient = QSvgWidget(self.gradPath) self.svgGradient.setFixedSize(QSize(64,64)) diff --git a/nw/gui/itemeditor.py b/nw/gui/itemeditor.py index 52019bf9..d5ae459d 100644 --- a/nw/gui/itemeditor.py +++ b/nw/gui/itemeditor.py @@ -41,7 +41,7 @@ class GuiItemEditor(QDialog): self.setWindowTitle("Item Settings") - self.gradPath = path.abspath(path.join(self.mainConf.appPath,"graphics","gear.svg")) + self.gradPath = path.abspath(path.join(self.mainConf.graphPath,"gear.svg")) self.svgGradient = QSvgWidget(self.gradPath) self.svgGradient.setFixedSize(QSize(64,64)) diff --git a/nw/gui/projecteditor.py b/nw/gui/projecteditor.py index 7bcc4d62..bd42cdb5 100644 --- a/nw/gui/projecteditor.py +++ b/nw/gui/projecteditor.py @@ -43,7 +43,7 @@ class GuiProjectEditor(QDialog): self.setWindowTitle("Project Settings") self.setLayout(self.outerBox) - self.gradPath = path.abspath(path.join(self.mainConf.appPath,"graphics","gear.svg")) + self.gradPath = path.abspath(path.join(self.mainConf.graphPath,"gear.svg")) self.svgGradient = QSvgWidget(self.gradPath) self.svgGradient.setFixedSize(QSize(64,64))