Added a options state class for timeline view GUI

This commit is contained in:
Veronica K. B. Olsen
2019-10-21 18:59:03 +02:00
parent e8de021abc
commit 3aa07e9b33
4 changed files with 45 additions and 21 deletions
+39 -2
View File
@@ -13,6 +13,7 @@
import logging
import nw
from os import path
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QIcon, QColor, QPixmap
from PyQt5.QtWidgets import (
@@ -20,6 +21,9 @@ from PyQt5.QtWidgets import (
QDialogButtonBox, QLabel, QPushButton, QHeaderView
)
from nw.tools.optlaststate import OptLastState
from nw.constants import nwFiles
logger = logging.getLogger(__name__)
class GuiTimeLineView(QDialog):
@@ -33,6 +37,9 @@ class GuiTimeLineView(QDialog):
self.theProject = theProject
self.theParent = theParent
self.theIndex = theIndex
self.optState = TimeLineLastState(self.theProject,nwFiles.TLINE_OPT)
self.optState.loadSettings()
self.theMatrix = {}
self.numRows = 0
self.numCols = 0
@@ -41,7 +48,12 @@ class GuiTimeLineView(QDialog):
self.bottomBox = QHBoxLayout()
self.setWindowTitle("Timeline View")
self.setMinimumSize(*self.mainConf.dlgTimeLine)
self.setMinimumWidth(700)
self.setMinimumHeight(400)
self.resize(
self.optState.getSetting("winWidth"),
self.optState.getSetting("winHeight")
)
self.mainTable = QTableWidget()
self.mainTable.setGridStyle(Qt.NoPen)
@@ -123,8 +135,33 @@ class GuiTimeLineView(QDialog):
return
def _doClose(self):
self.mainConf.setTLineSize(self.width(), self.height())
logger.verbose("GuiTimeLineView close button clicked")
winWidth = self.width()
winHeight = self.height()
self.optState.setSetting("winWidth", winWidth)
self.optState.setSetting("winHeight",winHeight)
self.optState.saveSettings()
self.close()
return
# END Class GuiTimeLineView
class TimeLineLastState(OptLastState):
def __init__(self, theProject, theFile):
OptLastState.__init__(self, theProject, theFile)
self.theState = {
"winWidth" : 700,
"winHeight" : 400,
}
self.stringOpt = ()
self.boolOpt = ()
self.intOpt = ("winWidth","winHeight")
return
# END Class TimeLineLastState
+5 -5
View File
@@ -54,11 +54,11 @@ class GuiMain(QMainWindow):
logger.info("Starting %s" % nw.__package__)
logger.debug("Initialising GUI ...")
self.mainConf = nw.CONFIG
self.theTheme = Theme(self)
self.theProject = NWProject(self)
self.theIndex = NWIndex(self.theProject, self)
self.hasProject = False
self.mainConf = nw.CONFIG
self.theTheme = Theme(self)
self.theProject = NWProject(self)
self.theIndex = NWIndex(self.theProject, self)
self.hasProject = False
logger.info("Qt5 Version: %s (%d)" % (self.mainConf.verQtString, self.mainConf.verQtValue))
logger.info("PyQt5 Version: %s (%d)" % (self.mainConf.verPyQtString, self.mainConf.verPyQtValue))