GUI tests working locally when headless.

This commit is contained in:
Veronica K. B. Olsen
2019-05-17 01:55:37 +02:00
parent 13cb526ff5
commit bc39ec7886
4 changed files with 53 additions and 32 deletions
+10 -9
View File
@@ -282,15 +282,16 @@ class GuiDocTree(QTreeWidget):
def propagateCount(self, tHandle, theCount, nDepth=0):
tItem = self._getTreeItem(tHandle)
tItem.setText(self.C_COUNT,str(theCount))
pItem = tItem.parent()
if pItem is not None:
pCount = 0
for i in range(pItem.childCount()):
pCount += int(pItem.child(i).text(self.C_COUNT))
pHandle = pItem.text(self.C_HANDLE)
if not nDepth > 200 and pHandle != "":
self.propagateCount(pHandle, pCount, nDepth+1)
if tItem is not None:
tItem.setText(self.C_COUNT,str(theCount))
pItem = tItem.parent()
if pItem is not None:
pCount = 0
for i in range(pItem.childCount()):
pCount += int(pItem.child(i).text(self.C_COUNT))
pHandle = pItem.text(self.C_HANDLE)
if not nDepth > 200 and pHandle != "":
self.propagateCount(pHandle, pCount, nDepth+1)
return
def buildTree(self):
+5 -4
View File
@@ -207,7 +207,7 @@ class GuiMain(QMainWindow):
self.stackPane.setCurrentIndex(self.stackDoc)
self.docEditor.setText(self.theDocument.openDocument(tHandle))
self.docEditor.changeWidth()
return
return True
def saveDocument(self):
if self.theDocument.theItem is not None:
@@ -217,7 +217,7 @@ class GuiMain(QMainWindow):
self.theDocument.theItem.setParaCount(self.docEditor.paraCount)
self.theDocument.saveDocument(docHtml)
self.docEditor.setDocumentChanged(False)
return
return True
def _previewDocument(self):
@@ -246,7 +246,7 @@ class GuiMain(QMainWindow):
tHandle = self.treeView.getSelectedHandle()
if tHandle is None:
logger.warning("No item selected")
return
return False
logger.verbose("Opening item %s" % tHandle)
nwItem = self.theProject.getItem(tHandle)
@@ -255,7 +255,8 @@ class GuiMain(QMainWindow):
self.openDocument(tHandle)
else:
logger.verbose("Requested item %s is not a file" % tHandle)
return
return True
def editItem(self):
tHandle = self.treeView.getSelectedHandle()