Added buttons to rebuild index and timeline view
This commit is contained in:
+18
-7
@@ -22,9 +22,6 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
|
|
||||||
WIN_WIDTH = 0
|
|
||||||
WIN_HEIGHT = 1
|
|
||||||
|
|
||||||
CNF_STR = 0
|
CNF_STR = 0
|
||||||
CNF_INT = 1
|
CNF_INT = 1
|
||||||
CNF_BOOL = 2
|
CNF_BOOL = 2
|
||||||
@@ -58,6 +55,9 @@ class Config:
|
|||||||
self.mainPanePos = [300, 800]
|
self.mainPanePos = [300, 800]
|
||||||
self.docPanePos = [400, 400]
|
self.docPanePos = [400, 400]
|
||||||
|
|
||||||
|
## Dialogs
|
||||||
|
self.dlgTimeLine = [600, 400]
|
||||||
|
|
||||||
## Project
|
## Project
|
||||||
self.autoSaveProj = 60
|
self.autoSaveProj = 60
|
||||||
self.autoSaveDoc = 30
|
self.autoSaveDoc = 30
|
||||||
@@ -143,6 +143,7 @@ class Config:
|
|||||||
self.treeColWidth = self._parseLine(cnfParse, cnfSec, "treecols", self.CNF_LIST, self.treeColWidth)
|
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.mainPanePos = self._parseLine(cnfParse, cnfSec, "mainpane", self.CNF_LIST, self.mainPanePos)
|
||||||
self.docPanePos = self._parseLine(cnfParse, cnfSec, "docpane", self.CNF_LIST, self.docPanePos)
|
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
|
## Project
|
||||||
cnfSec = "Project"
|
cnfSec = "Project"
|
||||||
@@ -192,6 +193,7 @@ class Config:
|
|||||||
cnfParse.set(cnfSec,"treecols", self._packList(self.treeColWidth))
|
cnfParse.set(cnfSec,"treecols", self._packList(self.treeColWidth))
|
||||||
cnfParse.set(cnfSec,"mainpane", self._packList(self.mainPanePos))
|
cnfParse.set(cnfSec,"mainpane", self._packList(self.mainPanePos))
|
||||||
cnfParse.set(cnfSec,"docpane", self._packList(self.docPanePos))
|
cnfParse.set(cnfSec,"docpane", self._packList(self.docPanePos))
|
||||||
|
cnfParse.set(cnfSec,"timeline", self._packList(self.dlgTimeLine))
|
||||||
|
|
||||||
## Project
|
## Project
|
||||||
cnfSec = "Project"
|
cnfSec = "Project"
|
||||||
@@ -254,11 +256,20 @@ class Config:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def setWinSize(self, newWidth, newHeight):
|
def setWinSize(self, newWidth, newHeight):
|
||||||
if abs(self.winGeometry[self.WIN_WIDTH] - newWidth) >= 10:
|
if abs(self.winGeometry[0] - newHeight) > 5:
|
||||||
self.winGeometry[self.WIN_WIDTH] = newWidth
|
self.winGeometry[0] = newWidth
|
||||||
self.confChanged = True
|
self.confChanged = True
|
||||||
if abs(self.winGeometry[self.WIN_HEIGHT] - newHeight) >= 10:
|
if abs(self.winGeometry[1] - newHeight) > 5:
|
||||||
self.winGeometry[self.WIN_HEIGHT] = newHeight
|
self.winGeometry[1] = newHeight
|
||||||
|
self.confChanged = True
|
||||||
|
return True
|
||||||
|
|
||||||
|
def setTLineSize(self, newWidth, newHeight):
|
||||||
|
if abs(self.dlgTimeLine[0] - newHeight) > 5:
|
||||||
|
self.dlgTimeLine[0] = newWidth
|
||||||
|
self.confChanged = True
|
||||||
|
if abs(self.dlgTimeLine[1] - newHeight) > 5:
|
||||||
|
self.dlgTimeLine[1] = newHeight
|
||||||
self.confChanged = True
|
self.confChanged = True
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
+21
-6
@@ -15,7 +15,10 @@ import nw
|
|||||||
|
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
from PyQt5.QtGui import QIcon, QColor, QBrush, QPixmap
|
from PyQt5.QtGui import QIcon, QColor, QBrush, QPixmap
|
||||||
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QTableWidget, QTableWidgetItem, QDialogButtonBox, QLabel
|
from PyQt5.QtWidgets import (
|
||||||
|
QDialog, QVBoxLayout, QHBoxLayout, QTableWidget, QTableWidgetItem,
|
||||||
|
QDialogButtonBox, QLabel, QPushButton
|
||||||
|
)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -35,23 +38,33 @@ class GuiTimeLineView(QDialog):
|
|||||||
self.numCols = 0
|
self.numCols = 0
|
||||||
|
|
||||||
self.outerBox = QVBoxLayout()
|
self.outerBox = QVBoxLayout()
|
||||||
|
self.bottomBox = QHBoxLayout()
|
||||||
|
|
||||||
self.setWindowTitle("Timeline View")
|
self.setWindowTitle("Timeline View")
|
||||||
|
self.setMinimumSize(*self.mainConf.dlgTimeLine)
|
||||||
|
|
||||||
self.mainTable = QTableWidget()
|
self.mainTable = QTableWidget()
|
||||||
self.mainTable.setGridStyle(Qt.NoPen)
|
self.mainTable.setGridStyle(Qt.NoPen)
|
||||||
|
|
||||||
self.setLayout(self.outerBox)
|
|
||||||
|
|
||||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Close)
|
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Close)
|
||||||
self.buttonBox.rejected.connect(self._doClose)
|
self.buttonBox.rejected.connect(self._doClose)
|
||||||
|
|
||||||
|
self.btnRebuild = QPushButton("Rebuild Index")
|
||||||
|
self.btnRebuild.clicked.connect(self.theParent.rebuildIndex)
|
||||||
|
|
||||||
|
self.btnRefresh = QPushButton("Refresh Table")
|
||||||
|
self.btnRefresh.clicked.connect(self._buildNovelList)
|
||||||
|
|
||||||
|
self.setLayout(self.outerBox)
|
||||||
self.outerBox.addWidget(self.mainTable)
|
self.outerBox.addWidget(self.mainTable)
|
||||||
self.outerBox.addWidget(self.buttonBox)
|
self.outerBox.addLayout(self.bottomBox)
|
||||||
|
self.bottomBox.addWidget(self.btnRebuild)
|
||||||
|
self.bottomBox.addWidget(self.btnRefresh)
|
||||||
|
self.bottomBox.addStretch()
|
||||||
|
self.bottomBox.addWidget(self.buttonBox)
|
||||||
|
|
||||||
self._buildNovelList()
|
self._buildNovelList()
|
||||||
|
self.buttonBox.setFocus()
|
||||||
self.setMinimumSize(600,400)
|
|
||||||
|
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
@@ -65,6 +78,7 @@ class GuiTimeLineView(QDialog):
|
|||||||
self.numRows = len(self.theIndex.novelList)
|
self.numRows = len(self.theIndex.novelList)
|
||||||
self.numCols = len(self.theIndex.tagIndex.keys())
|
self.numCols = len(self.theIndex.tagIndex.keys())
|
||||||
|
|
||||||
|
self.mainTable.clear()
|
||||||
self.mainTable.setRowCount(self.numRows)
|
self.mainTable.setRowCount(self.numRows)
|
||||||
self.mainTable.setColumnCount(self.numCols)
|
self.mainTable.setColumnCount(self.numCols)
|
||||||
|
|
||||||
@@ -101,6 +115,7 @@ class GuiTimeLineView(QDialog):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def _doClose(self):
|
def _doClose(self):
|
||||||
|
self.mainConf.setTLineSize(self.width(), self.height())
|
||||||
self.close()
|
self.close()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user