Added a options state class for timeline view GUI
This commit is contained in:
@@ -65,9 +65,6 @@ class Config:
|
||||
self.mainPanePos = [300, 800]
|
||||
self.docPanePos = [400, 400]
|
||||
|
||||
## Dialogs
|
||||
self.dlgTimeLine = [600, 400]
|
||||
|
||||
## Project
|
||||
self.autoSaveProj = 60
|
||||
self.autoSaveDoc = 30
|
||||
@@ -182,7 +179,6 @@ class Config:
|
||||
self.treeColWidth = self._parseLine(cnfParse, cnfSec, "treecols", self.CNF_LIST, self.treeColWidth)
|
||||
self.mainPanePos = self._parseLine(cnfParse, cnfSec, "mainpane", self.CNF_LIST, self.mainPanePos)
|
||||
self.docPanePos = self._parseLine(cnfParse, cnfSec, "docpane", self.CNF_LIST, self.docPanePos)
|
||||
self.dlgTimeLine = self._parseLine(cnfParse, cnfSec, "timeline", self.CNF_LIST, self.dlgTimeLine)
|
||||
|
||||
## Project
|
||||
cnfSec = "Project"
|
||||
@@ -245,7 +241,6 @@ class Config:
|
||||
cnfParse.set(cnfSec,"treecols", self._packList(self.treeColWidth))
|
||||
cnfParse.set(cnfSec,"mainpane", self._packList(self.mainPanePos))
|
||||
cnfParse.set(cnfSec,"docpane", self._packList(self.docPanePos))
|
||||
cnfParse.set(cnfSec,"timeline", self._packList(self.dlgTimeLine))
|
||||
|
||||
## Project
|
||||
cnfSec = "Project"
|
||||
@@ -326,15 +321,6 @@ class Config:
|
||||
self.confChanged = True
|
||||
return True
|
||||
|
||||
def setTLineSize(self, newWidth, newHeight):
|
||||
if abs(self.dlgTimeLine[0] - newWidth) > 5:
|
||||
self.dlgTimeLine[0] = newWidth
|
||||
self.confChanged = True
|
||||
if abs(self.dlgTimeLine[1] - newHeight) > 5:
|
||||
self.dlgTimeLine[1] = newHeight
|
||||
self.confChanged = True
|
||||
return True
|
||||
|
||||
def setTreeColWidths(self, colWidths):
|
||||
self.treeColWidth = colWidths
|
||||
self.confChanged = True
|
||||
|
||||
@@ -26,6 +26,7 @@ class nwFiles():
|
||||
SESS_INFO = "sessionInfo.log"
|
||||
INDEX_FILE = "tagsIndex.json"
|
||||
EXPORT_OPT = "exportOptions.json"
|
||||
TLINE_OPT = "timelineOptions.json"
|
||||
|
||||
# END Class nwFiles
|
||||
|
||||
|
||||
+39
-2
@@ -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
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user