Added a basic test of the GUI

This commit is contained in:
Veronica K. B. Olsen
2019-05-16 23:20:44 +02:00
parent 63c3182a0e
commit 66f6494894
11 changed files with 176 additions and 50 deletions
+13 -9
View File
@@ -15,7 +15,7 @@ import getopt
from os import path, remove, rename
from PyQt5.QtWidgets import QApplication
from nw.main import NovelWriter
from nw.gui.winmain import GuiMain
from nw.config import Config
__package__ = "novelWriter"
@@ -78,7 +78,7 @@ def main(sysArgs):
"logfile=",
"version",
"config=",
"headless",
"testmode",
]
helpMsg = (
@@ -111,7 +111,7 @@ def main(sysArgs):
toStd = True
showTime = False
confPath = None
showGUI = True
testMode = False
debugGUI = False
# Parse Options
@@ -143,15 +143,15 @@ def main(sysArgs):
showTime = True
elif inOpt in ("--config"):
confPath = inArg
elif inOpt in ("--headless"):
showGUI = False
elif inOpt in ("--testmode"):
testMode = True
elif inOpt in ("-D","--debuggui"):
debugLevel = logging.DEBUG
debugStr = "{name:>20}:{lineno:<4d} {levelname:8} {message:}"
debugGUI = True
# Set Config Options
CONFIG.showGUI = showGUI
CONFIG.showGUI = not testMode
CONFIG.debugGUI = debugGUI
# Set Logging
@@ -179,8 +179,12 @@ def main(sysArgs):
CONFIG.initConfig(confPath)
nwApp = QApplication([])
nwGUI = NovelWriter()
exit(nwApp.exec_())
if testMode:
nwGUI = GuiMain()
return nwGUI
else:
nwApp = QApplication([])
nwGUI = GuiMain()
exit(nwApp.exec_())
return
+1 -1
View File
@@ -170,7 +170,7 @@ class GuiMain(QMainWindow):
if self.saveProject():
self.theProject.newProject()
self.treeView.buildTree()
return
return True
def openProject(self, projFile=None):
if projFile is None:
-29
View File
@@ -1,29 +0,0 @@
# -*- coding: utf-8 -*-
"""novelWriter Main Class
novelWriter Main Class
==========================
Sets up the main GUI and holds action and event functions
File History:
Created: 2018-09-22 [0.0.1]
"""
import logging
import nw
from nw.gui.winmain import GuiMain
logger = logging.getLogger(__name__)
class NovelWriter():
def __init__(self):
super().__init__()
self.winMain = GuiMain()
return
# END Class NovelWriter