Filenames are set nwFiles now, and deleted some unused file in nw/gui
This commit is contained in:
@@ -43,6 +43,7 @@ class Config:
|
|||||||
self.confFile = None
|
self.confFile = None
|
||||||
self.homePath = None
|
self.homePath = None
|
||||||
self.appPath = None
|
self.appPath = None
|
||||||
|
self.appRoot = None
|
||||||
self.guiPath = None
|
self.guiPath = None
|
||||||
self.themePath = None
|
self.themePath = None
|
||||||
|
|
||||||
@@ -101,6 +102,7 @@ class Config:
|
|||||||
self.confFile = self.appHandle+".conf"
|
self.confFile = self.appHandle+".conf"
|
||||||
self.homePath = path.expanduser("~")
|
self.homePath = path.expanduser("~")
|
||||||
self.appPath = path.dirname(__file__)
|
self.appPath = path.dirname(__file__)
|
||||||
|
self.appRoot = path.join(self.appPath,path.pardir)
|
||||||
self.guiPath = path.join(self.appPath,"gui")
|
self.guiPath = path.join(self.appPath,"gui")
|
||||||
self.themePath = path.join(self.appPath,"themes")
|
self.themePath = path.join(self.appPath,"themes")
|
||||||
|
|
||||||
|
|||||||
+9
-2
@@ -12,6 +12,14 @@
|
|||||||
|
|
||||||
from nw.enum import nwItemClass, nwItemLayout
|
from nw.enum import nwItemClass, nwItemLayout
|
||||||
|
|
||||||
|
class nwFiles():
|
||||||
|
|
||||||
|
APP_ICON = "novelWriter.svg"
|
||||||
|
PROJ_FILE = "nwProject.nwx"
|
||||||
|
PROJ_DICT = "wordlist.txt"
|
||||||
|
|
||||||
|
# END Class nwFiles
|
||||||
|
|
||||||
class nwLabels():
|
class nwLabels():
|
||||||
|
|
||||||
CLASS_NAME = {
|
CLASS_NAME = {
|
||||||
@@ -59,5 +67,4 @@ class nwLabels():
|
|||||||
nwItemLayout.NOTE : "Nt",
|
nwItemLayout.NOTE : "Nt",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# END Class nwLabels
|
||||||
# END nwLabels
|
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
# -*- 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.0.1]
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
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.verbose("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("<a href='%s'>%s</a>" % (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
|
|
||||||
+6
-3
@@ -36,6 +36,7 @@ from nw.project.item import NWItem
|
|||||||
from nw.convert.tokenizer import Tokenizer
|
from nw.convert.tokenizer import Tokenizer
|
||||||
from nw.convert.tohtml import ToHtml
|
from nw.convert.tohtml import ToHtml
|
||||||
from nw.enum import nwItemType, nwAlert
|
from nw.enum import nwItemType, nwAlert
|
||||||
|
from nw.constants import nwFiles
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -53,7 +54,7 @@ class GuiMain(QMainWindow):
|
|||||||
|
|
||||||
self.resize(*self.mainConf.winGeometry)
|
self.resize(*self.mainConf.winGeometry)
|
||||||
self._setWindowTitle()
|
self._setWindowTitle()
|
||||||
self.setWindowIcon(QIcon(path.join(self.mainConf.appPath,"..","novelWriter.svg")))
|
self.setWindowIcon(QIcon(path.join(self.mainConf.appRoot, nwFiles.APP_ICON)))
|
||||||
self.theTheme.loadTheme()
|
self.theTheme.loadTheme()
|
||||||
|
|
||||||
# Main GUI Elements
|
# Main GUI Elements
|
||||||
@@ -255,7 +256,7 @@ class GuiMain(QMainWindow):
|
|||||||
self.theProject.openProject(projFile)
|
self.theProject.openProject(projFile)
|
||||||
self._setWindowTitle(self.theProject.projName)
|
self._setWindowTitle(self.theProject.projName)
|
||||||
self.rebuildTree()
|
self.rebuildTree()
|
||||||
self.docEditor.setPwl(path.join(self.theProject.projMeta,"wordlist.txt"))
|
self.docEditor.setPwl(path.join(self.theProject.projMeta, nwFiles.PROJ_DICT))
|
||||||
self.docEditor.setSpellCheck(self.theProject.spellCheck)
|
self.docEditor.setSpellCheck(self.theProject.spellCheck)
|
||||||
self.mainMenu.updateMenu()
|
self.mainMenu.updateMenu()
|
||||||
|
|
||||||
@@ -394,7 +395,9 @@ class GuiMain(QMainWindow):
|
|||||||
dlgOpt = QFileDialog.Options()
|
dlgOpt = QFileDialog.Options()
|
||||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
dlgOpt |= QFileDialog.DontUseNativeDialog
|
||||||
projFile, _ = QFileDialog.getOpenFileName(
|
projFile, _ = QFileDialog.getOpenFileName(
|
||||||
self,"Open novelWriter Project","","novelWriter Project File (nwProject.nwx);;All Files (*)",options=dlgOpt
|
self, "Open novelWriter Project", "",
|
||||||
|
"novelWriter Project File (%s);;All Files (*)" % nwFiles.PROJ_FILE,
|
||||||
|
options=dlgOpt
|
||||||
)
|
)
|
||||||
if projFile:
|
if projFile:
|
||||||
return projFile
|
return projFile
|
||||||
|
|||||||
@@ -19,10 +19,11 @@ from hashlib import sha256
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
from nw.enum import nwItemType, nwItemClass, nwItemLayout, nwAlert
|
|
||||||
from nw.common import checkString, checkBool, checkInt
|
|
||||||
from nw.project.item import NWItem
|
from nw.project.item import NWItem
|
||||||
from nw.project.status import NWStatus
|
from nw.project.status import NWStatus
|
||||||
|
from nw.enum import nwItemType, nwItemClass, nwItemLayout, nwAlert
|
||||||
|
from nw.common import checkString, checkBool, checkInt
|
||||||
|
from nw.constants import nwFiles
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -143,7 +144,7 @@ class NWProject():
|
|||||||
self.projPath = None
|
self.projPath = None
|
||||||
self.projMeta = None
|
self.projMeta = None
|
||||||
self.projCache = None
|
self.projCache = None
|
||||||
self.projFile = "nwProject.nwx"
|
self.projFile = nwFiles.PROJ_FILE
|
||||||
self.projName = ""
|
self.projName = ""
|
||||||
self.bookTitle = ""
|
self.bookTitle = ""
|
||||||
self.bookAuthors = []
|
self.bookAuthors = []
|
||||||
@@ -168,7 +169,7 @@ class NWProject():
|
|||||||
def openProject(self, fileName):
|
def openProject(self, fileName):
|
||||||
|
|
||||||
if not path.isfile(fileName):
|
if not path.isfile(fileName):
|
||||||
fileName = path.join(fileName, "nwProject.nwx")
|
fileName = path.join(fileName, nwFiles.PROJ_FILE)
|
||||||
if not path.isfile(fileName):
|
if not path.isfile(fileName):
|
||||||
self.makeAlert("File not found: %s" % fileName, nwAlert.ERROR)
|
self.makeAlert("File not found: %s" % fileName, nwAlert.ERROR)
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user