Clean up the Project Settings classes
This commit is contained in:
+2
-2
@@ -3675,8 +3675,8 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../nw/gui/projsettings.py" line="360"/>
|
<location filename="../nw/gui/projsettings.py" line="360"/>
|
||||||
<source>Cannot delete status item that is in use.</source>
|
<source>Cannot delete a status item that is in use.</source>
|
||||||
<translation>Kan ikke slette statusnivåer som er i bruk.</translation>
|
<translation>Kan ikke slette et statusnivå som er i bruk.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../nw/gui/projsettings.py" line="392"/>
|
<location filename="../nw/gui/projsettings.py" line="392"/>
|
||||||
|
|||||||
+1
-1
@@ -3675,7 +3675,7 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../nw/gui/projsettings.py" line="360"/>
|
<location filename="../nw/gui/projsettings.py" line="360"/>
|
||||||
<source>Cannot delete status item that is in use.</source>
|
<source>Cannot delete a status item that is in use.</source>
|
||||||
<translation>Não é possível remover um item de status que estja em uso.</translation>
|
<translation>Não é possível remover um item de status que estja em uso.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
|||||||
+62
-34
@@ -244,10 +244,13 @@ class GuiProjectEditStatus(QWidget):
|
|||||||
self.theParent = theParent
|
self.theParent = theParent
|
||||||
self.theProject = theProject
|
self.theProject = theProject
|
||||||
self.theTheme = theParent.theTheme
|
self.theTheme = theParent.theTheme
|
||||||
|
|
||||||
if isStatus:
|
if isStatus:
|
||||||
self.theStatus = self.theProject.statusItems
|
self.theStatus = self.theProject.statusItems
|
||||||
|
pageLabel = self.tr("Novel File Status Levels")
|
||||||
else:
|
else:
|
||||||
self.theStatus = self.theProject.importItems
|
self.theStatus = self.theProject.importItems
|
||||||
|
pageLabel = self.tr("Note File Importance Levels")
|
||||||
|
|
||||||
self.colData = []
|
self.colData = []
|
||||||
self.colCounts = []
|
self.colCounts = []
|
||||||
@@ -256,9 +259,8 @@ class GuiProjectEditStatus(QWidget):
|
|||||||
|
|
||||||
self.iPx = self.theTheme.baseIconSize
|
self.iPx = self.theTheme.baseIconSize
|
||||||
|
|
||||||
self.outerBox = QVBoxLayout()
|
# The List
|
||||||
self.mainBox = QHBoxLayout()
|
# ========
|
||||||
self.mainForm = QVBoxLayout()
|
|
||||||
|
|
||||||
self.listBox = QListWidget()
|
self.listBox = QListWidget()
|
||||||
self.listBox.setDragDropMode(QAbstractItemView.InternalMove)
|
self.listBox.setDragDropMode(QAbstractItemView.InternalMove)
|
||||||
@@ -268,22 +270,33 @@ class GuiProjectEditStatus(QWidget):
|
|||||||
for iName, iCol, nUse in self.theStatus:
|
for iName, iCol, nUse in self.theStatus:
|
||||||
self._addItem(iName, iCol, iName, nUse)
|
self._addItem(iName, iCol, iName, nUse)
|
||||||
|
|
||||||
|
# The Controls
|
||||||
|
# ============
|
||||||
|
|
||||||
|
self.newButton = QPushButton(self.tr("New"))
|
||||||
|
self.newButton.clicked.connect(self._newItem)
|
||||||
|
|
||||||
|
self.delButton = QPushButton(self.tr("Delete"))
|
||||||
|
self.delButton.clicked.connect(self._delItem)
|
||||||
|
|
||||||
self.editName = QLineEdit()
|
self.editName = QLineEdit()
|
||||||
self.editName.setMaxLength(40)
|
self.editName.setMaxLength(40)
|
||||||
self.editName.setEnabled(False)
|
self.editName.setEnabled(False)
|
||||||
self.newButton = QPushButton(self.tr("New"))
|
self.editName.setPlaceholderText(self.tr("Select item to edit"))
|
||||||
self.delButton = QPushButton(self.tr("Delete"))
|
|
||||||
self.saveButton = QPushButton(self.tr("Save"))
|
|
||||||
self.colPixmap = QPixmap(self.iPx, self.iPx)
|
|
||||||
self.colPixmap.fill(QColor(120, 120, 120))
|
|
||||||
self.colButton = QPushButton(QIcon(self.colPixmap), self.tr("Colour"))
|
|
||||||
self.colButton.setIconSize(self.colPixmap.rect().size())
|
|
||||||
|
|
||||||
self.newButton.clicked.connect(self._newItem)
|
self.colPixmap = QPixmap(self.iPx, self.iPx)
|
||||||
self.delButton.clicked.connect(self._delItem)
|
self.colPixmap.fill(QColor(120, 120, 120))
|
||||||
self.saveButton.clicked.connect(self._saveItem)
|
self.colButton = QPushButton(QIcon(self.colPixmap), self.tr("Colour"))
|
||||||
|
self.colButton.setIconSize(self.colPixmap.rect().size())
|
||||||
self.colButton.clicked.connect(self._selectColour)
|
self.colButton.clicked.connect(self._selectColour)
|
||||||
|
|
||||||
|
self.saveButton = QPushButton(self.tr("Save"))
|
||||||
|
self.saveButton.clicked.connect(self._saveItem)
|
||||||
|
|
||||||
|
# Assemble
|
||||||
|
# ========
|
||||||
|
|
||||||
|
self.mainForm = QVBoxLayout()
|
||||||
self.mainForm.addWidget(self.newButton)
|
self.mainForm.addWidget(self.newButton)
|
||||||
self.mainForm.addWidget(self.delButton)
|
self.mainForm.addWidget(self.delButton)
|
||||||
self.mainForm.addStretch(1)
|
self.mainForm.addStretch(1)
|
||||||
@@ -293,13 +306,12 @@ class GuiProjectEditStatus(QWidget):
|
|||||||
self.mainForm.addStretch(1)
|
self.mainForm.addStretch(1)
|
||||||
self.mainForm.addWidget(self.saveButton)
|
self.mainForm.addWidget(self.saveButton)
|
||||||
|
|
||||||
|
self.mainBox = QHBoxLayout()
|
||||||
self.mainBox.addWidget(self.listBox)
|
self.mainBox.addWidget(self.listBox)
|
||||||
self.mainBox.addLayout(self.mainForm)
|
self.mainBox.addLayout(self.mainForm)
|
||||||
|
|
||||||
if isStatus:
|
self.outerBox = QVBoxLayout()
|
||||||
self.outerBox.addWidget(QLabel("<b>%s</b>" % self.tr("Novel File Status Levels")))
|
self.outerBox.addWidget(QLabel("<b>%s</b>" % pageLabel))
|
||||||
else:
|
|
||||||
self.outerBox.addWidget(QLabel("<b>%s</b>" % self.tr("Note File Importance Levels")))
|
|
||||||
self.outerBox.addLayout(self.mainBox)
|
self.outerBox.addLayout(self.mainBox)
|
||||||
|
|
||||||
self.setLayout(self.outerBox)
|
self.setLayout(self.outerBox)
|
||||||
@@ -307,6 +319,8 @@ class GuiProjectEditStatus(QWidget):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def getNewList(self):
|
def getNewList(self):
|
||||||
|
"""Return list of entries.
|
||||||
|
"""
|
||||||
if self.colChanged:
|
if self.colChanged:
|
||||||
newList = []
|
newList = []
|
||||||
for n in range(self.listBox.count()):
|
for n in range(self.listBox.count()):
|
||||||
@@ -314,6 +328,7 @@ class GuiProjectEditStatus(QWidget):
|
|||||||
nIdx = nItem.data(Qt.UserRole)
|
nIdx = nItem.data(Qt.UserRole)
|
||||||
newList.append(self.colData[nIdx])
|
newList.append(self.colData[nIdx])
|
||||||
return newList
|
return newList
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
##
|
##
|
||||||
@@ -355,7 +370,7 @@ class GuiProjectEditStatus(QWidget):
|
|||||||
self.colChanged = True
|
self.colChanged = True
|
||||||
else:
|
else:
|
||||||
self.theParent.makeAlert(
|
self.theParent.makeAlert(
|
||||||
self.tr("Cannot delete status item that is in use."), nwAlert.ERROR
|
self.tr("Cannot delete a status item that is in use."), nwAlert.ERROR
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -410,6 +425,7 @@ class GuiProjectEditStatus(QWidget):
|
|||||||
self.editName.setEnabled(True)
|
self.editName.setEnabled(True)
|
||||||
self.editName.selectAll()
|
self.editName.selectAll()
|
||||||
self.editName.setFocus()
|
self.editName.setFocus()
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
##
|
##
|
||||||
@@ -425,9 +441,8 @@ class GuiProjectEditStatus(QWidget):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def _rowsMoved(self):
|
def _rowsMoved(self):
|
||||||
"""A row has been moved, so sett the changed flag.
|
"""A row has been moved, so set the changed flag.
|
||||||
"""
|
"""
|
||||||
logger.verbose("A drag move event occurred")
|
|
||||||
self.colChanged = True
|
self.colChanged = True
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -445,12 +460,14 @@ class GuiProjectEditReplace(QWidget):
|
|||||||
self.optState = theProject.optState
|
self.optState = theProject.optState
|
||||||
self.arChanged = False
|
self.arChanged = False
|
||||||
|
|
||||||
self.outerBox = QVBoxLayout()
|
|
||||||
self.bottomBox = QHBoxLayout()
|
|
||||||
|
|
||||||
wCol0 = self.mainConf.pxInt(
|
wCol0 = self.mainConf.pxInt(
|
||||||
self.optState.getInt("GuiProjectSettings", "replaceColW", 100)
|
self.optState.getInt("GuiProjectSettings", "replaceColW", 100)
|
||||||
)
|
)
|
||||||
|
pageLabel = self.tr("Text Replace List for Preview and Export")
|
||||||
|
|
||||||
|
# List Box
|
||||||
|
# ========
|
||||||
|
|
||||||
self.listBox = QTreeWidget()
|
self.listBox = QTreeWidget()
|
||||||
self.listBox.setHeaderLabels([
|
self.listBox.setHeaderLabels([
|
||||||
self.tr("Keyword"),
|
self.tr("Keyword"),
|
||||||
@@ -467,35 +484,45 @@ class GuiProjectEditReplace(QWidget):
|
|||||||
self.listBox.sortByColumn(0, Qt.AscendingOrder)
|
self.listBox.sortByColumn(0, Qt.AscendingOrder)
|
||||||
self.listBox.setSortingEnabled(True)
|
self.listBox.setSortingEnabled(True)
|
||||||
|
|
||||||
self.editKey = QLineEdit()
|
# Controls
|
||||||
self.editValue = QLineEdit()
|
# ========
|
||||||
self.saveButton = QPushButton(self.theTheme.getIcon("done"), "")
|
|
||||||
self.addButton = QPushButton(self.theTheme.getIcon("add"), "")
|
|
||||||
self.delButton = QPushButton(self.theTheme.getIcon("remove"), "")
|
|
||||||
self.saveButton.setToolTip(self.tr("Save entry"))
|
|
||||||
self.addButton.setToolTip(self.tr("Add new entry"))
|
|
||||||
self.delButton.setToolTip(self.tr("Delete selected entry"))
|
|
||||||
|
|
||||||
|
self.editKey = QLineEdit()
|
||||||
|
self.editKey.setPlaceholderText(self.tr("Select item to edit"))
|
||||||
self.editKey.setEnabled(False)
|
self.editKey.setEnabled(False)
|
||||||
self.editKey.setMaxLength(40)
|
self.editKey.setMaxLength(40)
|
||||||
|
|
||||||
|
self.editValue = QLineEdit()
|
||||||
self.editValue.setEnabled(False)
|
self.editValue.setEnabled(False)
|
||||||
self.editValue.setMaxLength(80)
|
self.editValue.setMaxLength(80)
|
||||||
|
|
||||||
|
self.saveButton = QPushButton(self.theTheme.getIcon("done"), "")
|
||||||
|
self.saveButton.setToolTip(self.tr("Save entry"))
|
||||||
self.saveButton.clicked.connect(self._saveEntry)
|
self.saveButton.clicked.connect(self._saveEntry)
|
||||||
|
|
||||||
|
self.addButton = QPushButton(self.theTheme.getIcon("add"), "")
|
||||||
|
self.addButton.setToolTip(self.tr("Add new entry"))
|
||||||
self.addButton.clicked.connect(self._addEntry)
|
self.addButton.clicked.connect(self._addEntry)
|
||||||
|
|
||||||
|
self.delButton = QPushButton(self.theTheme.getIcon("remove"), "")
|
||||||
|
self.delButton.setToolTip(self.tr("Delete selected entry"))
|
||||||
self.delButton.clicked.connect(self._delEntry)
|
self.delButton.clicked.connect(self._delEntry)
|
||||||
|
|
||||||
|
# Assemble
|
||||||
|
# ========
|
||||||
|
|
||||||
|
self.bottomBox = QHBoxLayout()
|
||||||
self.bottomBox.addWidget(self.editKey, 2)
|
self.bottomBox.addWidget(self.editKey, 2)
|
||||||
self.bottomBox.addWidget(self.editValue, 3)
|
self.bottomBox.addWidget(self.editValue, 3)
|
||||||
self.bottomBox.addWidget(self.saveButton)
|
self.bottomBox.addWidget(self.saveButton)
|
||||||
self.bottomBox.addWidget(self.addButton)
|
self.bottomBox.addWidget(self.addButton)
|
||||||
self.bottomBox.addWidget(self.delButton)
|
self.bottomBox.addWidget(self.delButton)
|
||||||
|
|
||||||
self.outerBox.addWidget(
|
self.outerBox = QVBoxLayout()
|
||||||
QLabel("<b>%s</b>" % self.tr("Text Replace List for Preview and Export"))
|
self.outerBox.addWidget(QLabel("<b>%s</b>" % pageLabel))
|
||||||
)
|
|
||||||
self.outerBox.addWidget(self.listBox)
|
self.outerBox.addWidget(self.listBox)
|
||||||
self.outerBox.addLayout(self.bottomBox)
|
self.outerBox.addLayout(self.bottomBox)
|
||||||
|
|
||||||
self.setLayout(self.outerBox)
|
self.setLayout(self.outerBox)
|
||||||
|
|
||||||
return
|
return
|
||||||
@@ -510,6 +537,7 @@ class GuiProjectEditReplace(QWidget):
|
|||||||
aVal = tItem.text(1)
|
aVal = tItem.text(1)
|
||||||
if len(aKey) > 0:
|
if len(aKey) > 0:
|
||||||
newList[aKey] = aVal
|
newList[aKey] = aVal
|
||||||
|
|
||||||
return newList
|
return newList
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|||||||
Reference in New Issue
Block a user