diff --git a/nw/__init__.py b/nw/__init__.py index 6fac954d..6fd5a257 100644 --- a/nw/__init__.py +++ b/nw/__init__.py @@ -83,12 +83,13 @@ def main(sysArgs): """ # Valid Input Options - shortOpt = "hd:qtl:v" + shortOpt = "hd:Dqtl:v" longOpt = [ "help", "debug=", "verbose", "vverbose", + "debuggui", "quiet", "time", "logfile=", @@ -107,6 +108,7 @@ def main(sysArgs): " -d, --debug Debug level. Valid options are DEBUG, INFO, WARN or ERROR.\n" " --verbose Increase verbosity of debug.\n" " --vverbose Increase verbosity of debug even more.\n" + " -D, --debuggui Shows additional debug GUI elements.\n" " -q, --quiet Disable output to command line. Does not affect log file.\n" " -t, --time Shows time stamp in logging output. Adds milliseconds for verbose.\n" " -l, --logfile Specify log file.\n" @@ -128,6 +130,7 @@ def main(sysArgs): showTime = False confPath = None showGUI = True + debugGUI = False # Parse Options try: @@ -173,6 +176,12 @@ def main(sysArgs): confPath = inArg elif inOpt in ("--headless"): showGUI = False + elif inOpt in ("-D","--debuggui"): + debugGUI = True + + # Set GUI options + CONFIG.showGUI = showGUI + CONFIG.debugGUI = debugGUI # Set Logging if showTime: debugStr = timeStr+debugStr diff --git a/nw/config.py b/nw/config.py index d7ff625b..4a034236 100644 --- a/nw/config.py +++ b/nw/config.py @@ -30,6 +30,8 @@ class Config: # Set Application Variables self.appName = nw.__package__ self.appHandle = nw.__package__.lower() + self.showGUI = True + self.debugGUI = False # Set Paths self.confPath = user_config_dir(self.appHandle) diff --git a/nw/gui/winmain.py b/nw/gui/winmain.py index 59de525a..e4334016 100644 --- a/nw/gui/winmain.py +++ b/nw/gui/winmain.py @@ -211,6 +211,12 @@ class GuiMain(QMainWindow): menuAbout.triggered.connect(self._showAbout) helpMenu.addAction(menuAbout) + if not self.mainConf.debugGUI: + return + + # Debug GUI + debugMenu = menuBar.addMenu("&Debug") + return def _buildTreeToolBar(self): @@ -234,6 +240,7 @@ class GuiMain(QMainWindow): def _closeMain(self): logger.info("Exiting %s" % nw.__package__) + self.mainConf.setWinSize(self.frameGeometry().width(), self.frameGeometry().height()) self.mainConf.saveConfig() return diff --git a/nw/project/project.py b/nw/project/project.py index 1fa354dd..7013a615 100644 --- a/nw/project/project.py +++ b/nw/project/project.py @@ -146,4 +146,15 @@ class NWProject(): self.bookAuthors.append(bookAuthor) return True + # + # Internal Functions + # + + def _makeHandle(self,seed=""): + itemHandle = sha256((str(time())+seed).encode()).hexdigest()[0:13] + # if itemHandle in self.treeLookup.keys(): + # logger.warning("BookTree: Duplicate handle encountered! Retrying ...") + # itemHandle = self.makeHandle(seed+"!") + return itemHandle + # END Class NWProject