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.homePath = None
|
||||
self.appPath = None
|
||||
self.appRoot = None
|
||||
self.guiPath = None
|
||||
self.themePath = None
|
||||
|
||||
@@ -101,6 +102,7 @@ class Config:
|
||||
self.confFile = self.appHandle+".conf"
|
||||
self.homePath = path.expanduser("~")
|
||||
self.appPath = path.dirname(__file__)
|
||||
self.appRoot = path.join(self.appPath,path.pardir)
|
||||
self.guiPath = path.join(self.appPath,"gui")
|
||||
self.themePath = path.join(self.appPath,"themes")
|
||||
|
||||
|
||||
+9
-2
@@ -12,6 +12,14 @@
|
||||
|
||||
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_NAME = {
|
||||
@@ -59,5 +67,4 @@ class nwLabels():
|
||||
nwItemLayout.NOTE : "Nt",
|
||||
}
|
||||
|
||||
|
||||
# END nwLabels
|
||||
# END Class 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.tohtml import ToHtml
|
||||
from nw.enum import nwItemType, nwAlert
|
||||
from nw.constants import nwFiles
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -53,7 +54,7 @@ class GuiMain(QMainWindow):
|
||||
|
||||
self.resize(*self.mainConf.winGeometry)
|
||||
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()
|
||||
|
||||
# Main GUI Elements
|
||||
@@ -255,7 +256,7 @@ class GuiMain(QMainWindow):
|
||||
self.theProject.openProject(projFile)
|
||||
self._setWindowTitle(self.theProject.projName)
|
||||
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.mainMenu.updateMenu()
|
||||
|
||||
@@ -394,7 +395,9 @@ class GuiMain(QMainWindow):
|
||||
dlgOpt = QFileDialog.Options()
|
||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
||||
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:
|
||||
return projFile
|
||||
|
||||
@@ -19,10 +19,11 @@ from hashlib import sha256
|
||||
from datetime import datetime
|
||||
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.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__)
|
||||
|
||||
@@ -143,7 +144,7 @@ class NWProject():
|
||||
self.projPath = None
|
||||
self.projMeta = None
|
||||
self.projCache = None
|
||||
self.projFile = "nwProject.nwx"
|
||||
self.projFile = nwFiles.PROJ_FILE
|
||||
self.projName = ""
|
||||
self.bookTitle = ""
|
||||
self.bookAuthors = []
|
||||
@@ -168,7 +169,7 @@ class NWProject():
|
||||
def openProject(self, fileName):
|
||||
|
||||
if not path.isfile(fileName):
|
||||
fileName = path.join(fileName, "nwProject.nwx")
|
||||
fileName = path.join(fileName, nwFiles.PROJ_FILE)
|
||||
if not path.isfile(fileName):
|
||||
self.makeAlert("File not found: %s" % fileName, nwAlert.ERROR)
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user