Added open and save status messages to the status bar.
This commit is contained in:
@@ -29,8 +29,8 @@ class GuiDocDetails(QFrame):
|
|||||||
C_FLAGS = 2
|
C_FLAGS = 2
|
||||||
C_HANDLE = 3
|
C_HANDLE = 3
|
||||||
|
|
||||||
def __init__(self, theProject):
|
def __init__(self, theParent, theProject):
|
||||||
QFrame.__init__(self)
|
QFrame.__init__(self, theParent)
|
||||||
|
|
||||||
logger.debug("Initialising DocDetails ...")
|
logger.debug("Initialising DocDetails ...")
|
||||||
self.mainConf = nw.CONFIG
|
self.mainConf = nw.CONFIG
|
||||||
|
|||||||
@@ -62,6 +62,10 @@ class GuiDocTree(QTreeWidget):
|
|||||||
self.setDragEnabled(True)
|
self.setDragEnabled(True)
|
||||||
self.setDragDropMode(QAbstractItemView.InternalMove)
|
self.setDragDropMode(QAbstractItemView.InternalMove)
|
||||||
|
|
||||||
|
# Set Multiple Selection by CTRL
|
||||||
|
self.setSelectionMode(QAbstractItemView.ExtendedSelection)
|
||||||
|
self.setSelectionBehavior(QAbstractItemView.SelectRows)
|
||||||
|
|
||||||
for colN in range(len(self.mainConf.treeColWidth)):
|
for colN in range(len(self.mainConf.treeColWidth)):
|
||||||
self.setColumnWidth(colN,self.mainConf.treeColWidth[colN])
|
self.setColumnWidth(colN,self.mainConf.treeColWidth[colN])
|
||||||
|
|
||||||
|
|||||||
+9
-2
@@ -15,13 +15,14 @@ import nw
|
|||||||
|
|
||||||
from os import path
|
from os import path
|
||||||
from PyQt5.QtWidgets import QStatusBar, QLabel, QFrame
|
from PyQt5.QtWidgets import QStatusBar, QLabel, QFrame
|
||||||
|
from PyQt5.QtGui import QIcon
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class GuiMainStatus(QStatusBar):
|
class GuiMainStatus(QStatusBar):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, theParent):
|
||||||
QStatusBar.__init__(self)
|
QStatusBar.__init__(self, theParent)
|
||||||
|
|
||||||
logger.debug("Initialising GuiMainStatus ...")
|
logger.debug("Initialising GuiMainStatus ...")
|
||||||
|
|
||||||
@@ -41,6 +42,12 @@ class GuiMainStatus(QStatusBar):
|
|||||||
self.setCounts(0,0,0)
|
self.setCounts(0,0,0)
|
||||||
self.setDocHandleCount(None)
|
self.setDocHandleCount(None)
|
||||||
|
|
||||||
|
self.setSizeGripEnabled(True)
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
def setStatus(self, theMessage, timeOut=10.0):
|
||||||
|
self.showMessage(theMessage, int(timeOut*1000))
|
||||||
return
|
return
|
||||||
|
|
||||||
def setCounts(self, cC, wC, pC):
|
def setCounts(self, cC, wC, pC):
|
||||||
|
|||||||
+3
-3
@@ -39,7 +39,7 @@ class GuiMain(QMainWindow):
|
|||||||
|
|
||||||
logger.debug("Initialising GUI ...")
|
logger.debug("Initialising GUI ...")
|
||||||
self.mainConf = nw.CONFIG
|
self.mainConf = nw.CONFIG
|
||||||
self.theProject = NWProject()
|
self.theProject = NWProject(self)
|
||||||
self.theDocument = NWDoc(self.theProject, self)
|
self.theDocument = NWDoc(self.theProject, self)
|
||||||
|
|
||||||
self.resize(*self.mainConf.winGeometry)
|
self.resize(*self.mainConf.winGeometry)
|
||||||
@@ -48,10 +48,10 @@ class GuiMain(QMainWindow):
|
|||||||
|
|
||||||
# Main GUI Elements
|
# Main GUI Elements
|
||||||
self.docEditor = GuiDocEditor(self)
|
self.docEditor = GuiDocEditor(self)
|
||||||
self.docDetails = GuiDocDetails(self.theProject)
|
self.docDetails = GuiDocDetails(self, self.theProject)
|
||||||
self.treeView = GuiDocTree(self, self.theProject)
|
self.treeView = GuiDocTree(self, self.theProject)
|
||||||
self.mainMenu = GuiMainMenu(self, self.theProject)
|
self.mainMenu = GuiMainMenu(self, self.theProject)
|
||||||
self.statusBar = GuiMainStatus()
|
self.statusBar = GuiMainStatus(self)
|
||||||
|
|
||||||
# Assemble Main Window
|
# Assemble Main Window
|
||||||
self.stackPane = QStackedWidget()
|
self.stackPane = QStackedWidget()
|
||||||
|
|||||||
@@ -46,12 +46,14 @@ class NWDoc():
|
|||||||
|
|
||||||
if path.isfile(docPath):
|
if path.isfile(docPath):
|
||||||
with open(docPath,mode="r") as inFile:
|
with open(docPath,mode="r") as inFile:
|
||||||
return inFile.read()
|
theDoc = inFile.read()
|
||||||
else:
|
else:
|
||||||
logger.debug("The requested document does not exist.")
|
logger.debug("The requested document does not exist.")
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
return None
|
self.theParent.statusBar.setStatus("Opened Document: %s" % self.theItem.itemName)
|
||||||
|
|
||||||
|
return theDoc
|
||||||
|
|
||||||
def saveDocument(self, docText):
|
def saveDocument(self, docText):
|
||||||
|
|
||||||
@@ -78,6 +80,8 @@ class NWDoc():
|
|||||||
|
|
||||||
if path.isfile(docTemp): unlink(docTemp)
|
if path.isfile(docTemp): unlink(docTemp)
|
||||||
|
|
||||||
|
self.theParent.statusBar.setStatus("Saved Document: %s" % self.theItem.itemName)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|||||||
@@ -28,10 +28,11 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class NWProject():
|
class NWProject():
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, theParent):
|
||||||
|
|
||||||
# Internal
|
# Internal
|
||||||
self.mainConf = nw.CONFIG
|
self.mainConf = nw.CONFIG
|
||||||
|
self.theParent = theParent
|
||||||
|
|
||||||
# Project Settings
|
# Project Settings
|
||||||
self.projTree = None
|
self.projTree = None
|
||||||
@@ -182,6 +183,7 @@ class NWProject():
|
|||||||
|
|
||||||
self._makeStatusIcons()
|
self._makeStatusIcons()
|
||||||
self.mainConf.setRecent(self.projPath)
|
self.mainConf.setRecent(self.projPath)
|
||||||
|
self.theParent.statusBar.setStatus("Opened Project: %s" % self.projName)
|
||||||
|
|
||||||
self._scanProjectFolder()
|
self._scanProjectFolder()
|
||||||
|
|
||||||
@@ -242,6 +244,7 @@ class NWProject():
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
self.mainConf.setRecent(self.projPath)
|
self.mainConf.setRecent(self.projPath)
|
||||||
|
self.theParent.statusBar.setStatus("Saved Project: %s" % self.projName)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user