Merge pull request #43 from vkbo/improvements
Make the auto-replace list in project settings sorted
This commit is contained in:
@@ -336,6 +336,9 @@ class GuiProjectEditReplace(QWidget):
|
|||||||
newItem = QTreeWidgetItem(["<%s>" % aKey, aVal])
|
newItem = QTreeWidgetItem(["<%s>" % aKey, aVal])
|
||||||
self.listBox.addTopLevelItem(newItem)
|
self.listBox.addTopLevelItem(newItem)
|
||||||
|
|
||||||
|
self.listBox.sortByColumn(0, Qt.AscendingOrder)
|
||||||
|
self.listBox.setSortingEnabled(True)
|
||||||
|
|
||||||
self.editKey = QLineEdit()
|
self.editKey = QLineEdit()
|
||||||
self.editValue = QLineEdit()
|
self.editValue = QLineEdit()
|
||||||
self.saveButton = QPushButton(QIcon.fromTheme("document-save"),"")
|
self.saveButton = QPushButton(QIcon.fromTheme("document-save"),"")
|
||||||
|
|||||||
+1
-1
@@ -55,8 +55,8 @@ class NWItem():
|
|||||||
def packXML(self, xParent):
|
def packXML(self, xParent):
|
||||||
xPack = etree.SubElement(xParent,"item",attrib={
|
xPack = etree.SubElement(xParent,"item",attrib={
|
||||||
"handle" : str(self.itemHandle),
|
"handle" : str(self.itemHandle),
|
||||||
"parent" : str(self.parHandle),
|
|
||||||
"order" : str(self.itemOrder),
|
"order" : str(self.itemOrder),
|
||||||
|
"parent" : str(self.parHandle),
|
||||||
})
|
})
|
||||||
xSub = self._subPack(xPack,"name", text=str(self.itemName))
|
xSub = self._subPack(xPack,"name", text=str(self.itemName))
|
||||||
xSub = self._subPack(xPack,"type", text=str(self.itemType.name))
|
xSub = self._subPack(xPack,"type", text=str(self.itemType.name))
|
||||||
|
|||||||
@@ -288,8 +288,8 @@ class NWProject():
|
|||||||
# Root element and project details
|
# Root element and project details
|
||||||
logger.debug("Writing project meta")
|
logger.debug("Writing project meta")
|
||||||
nwXML = etree.Element("novelWriterXML",attrib={
|
nwXML = etree.Element("novelWriterXML",attrib={
|
||||||
"fileVersion" : "1.0",
|
|
||||||
"appVersion" : str(nw.__version__),
|
"appVersion" : str(nw.__version__),
|
||||||
|
"fileVersion" : "1.0",
|
||||||
"timeStamp" : datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
"timeStamp" : datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -89,9 +89,9 @@ class NWStatus():
|
|||||||
def packEntries(self, xParent):
|
def packEntries(self, xParent):
|
||||||
for n in range(self.theLength):
|
for n in range(self.theLength):
|
||||||
xSub = etree.SubElement(xParent,"entry",attrib={
|
xSub = etree.SubElement(xParent,"entry",attrib={
|
||||||
"red" : str(self.theColours[n][0]),
|
|
||||||
"green" : str(self.theColours[n][1]),
|
|
||||||
"blue" : str(self.theColours[n][2]),
|
"blue" : str(self.theColours[n][2]),
|
||||||
|
"green" : str(self.theColours[n][1]),
|
||||||
|
"red" : str(self.theColours[n][0]),
|
||||||
})
|
})
|
||||||
xSub.text = self.theLabels[n]
|
xSub.text = self.theLabels[n]
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<novelWriterXML appVersion="0.2.0" fileVersion="1.0" timeStamp="2019-06-28 12:43:41">
|
<novelWriterXML appVersion="0.2.0" fileVersion="1.0" timeStamp="2019-08-11 19:41:35">
|
||||||
<project>
|
<project>
|
||||||
<name>Sample Project</name>
|
<name>Sample Project</name>
|
||||||
<title>Sample Project</title>
|
<title>Sample Project</title>
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
<lastWordCount>581</lastWordCount>
|
<lastWordCount>581</lastWordCount>
|
||||||
<autoReplace>
|
<autoReplace>
|
||||||
<A>B</A>
|
<A>B</A>
|
||||||
|
<B>E</B>
|
||||||
<C>D</C>
|
<C>D</C>
|
||||||
</autoReplace>
|
</autoReplace>
|
||||||
<status>
|
<status>
|
||||||
|
|||||||
+2
-2
@@ -327,7 +327,7 @@ def testProjectEditor(qtbot, nwTempGUI, nwRef):
|
|||||||
|
|
||||||
projEdit.tabReplace.listBox.clearSelection()
|
projEdit.tabReplace.listBox.clearSelection()
|
||||||
qtbot.mouseClick(projEdit.tabReplace.addButton, Qt.LeftButton)
|
qtbot.mouseClick(projEdit.tabReplace.addButton, Qt.LeftButton)
|
||||||
projEdit.tabReplace.listBox.topLevelItem(1).setSelected(True)
|
projEdit.tabReplace.listBox.topLevelItem(0).setSelected(True)
|
||||||
for c in "Delete":
|
for c in "Delete":
|
||||||
qtbot.keyClick(projEdit.tabReplace.editKey, c, delay=keyDelay)
|
qtbot.keyClick(projEdit.tabReplace.editKey, c, delay=keyDelay)
|
||||||
for c in "This Stuff":
|
for c in "This Stuff":
|
||||||
@@ -335,7 +335,7 @@ def testProjectEditor(qtbot, nwTempGUI, nwRef):
|
|||||||
qtbot.mouseClick(projEdit.tabReplace.saveButton, Qt.LeftButton)
|
qtbot.mouseClick(projEdit.tabReplace.saveButton, Qt.LeftButton)
|
||||||
|
|
||||||
projEdit.tabReplace.listBox.clearSelection()
|
projEdit.tabReplace.listBox.clearSelection()
|
||||||
projEdit.tabReplace.listBox.topLevelItem(1).setSelected(True)
|
projEdit.tabReplace.listBox.topLevelItem(0).setSelected(True)
|
||||||
qtbot.mouseClick(projEdit.tabReplace.delButton, Qt.LeftButton)
|
qtbot.mouseClick(projEdit.tabReplace.delButton, Qt.LeftButton)
|
||||||
|
|
||||||
projEdit._doSave()
|
projEdit._doSave()
|
||||||
|
|||||||
Reference in New Issue
Block a user