Clean up variables and formatting

This commit is contained in:
Veronica Berglyd Olsen
2024-01-28 00:28:01 +01:00
parent 97b791511f
commit 8e4e6903b1
41 changed files with 1241 additions and 1248 deletions
+5 -5
View File
@@ -375,9 +375,9 @@ class GuiManuscript(QDialog):
@pyqtSlot()
def _printDocument(self) -> None:
"""Open the print preview dialog."""
thePreview = QPrintPreviewDialog(self)
thePreview.paintRequested.connect(self.docPreview.printPreview)
thePreview.exec_()
preview = QPrintPreviewDialog(self)
preview.paintRequested.connect(self.docPreview.printPreview)
preview.exec_()
return
##
@@ -771,8 +771,8 @@ class _PreviewWidget(QTextBrowser):
self.setHtml(html)
qApp.processEvents()
while self.find("!!tab!!"):
theCursor = self.textCursor()
theCursor.insertText("\t")
cursor = self.textCursor()
cursor.insertText("\t")
self.verticalScrollBar().setValue(sPos)
self._docTime = checkInt(data.get("time"), 0)
+4 -4
View File
@@ -1112,10 +1112,10 @@ class _FormatTab(NScrollableForm):
currFont = QFont()
currFont.setFamily(self.textFont.text())
currFont.setPointSize(self.textSize.value())
theFont, theStatus = QFontDialog.getFont(currFont, self)
if theStatus:
self.textFont.setText(theFont.family())
self.textSize.setValue(theFont.pointSize())
newFont, status = QFontDialog.getFont(currFont, self)
if status:
self.textFont.setText(newFont.family())
self.textSize.setValue(newFont.pointSize())
return
@pyqtSlot(int)
+3 -3
View File
@@ -455,19 +455,19 @@ class _ContentsPage(NFixedPage):
pTotal = 0
tPages = 1
theList = []
entries = []
for _, tLevel, tTitle, wCount in self._data:
pCount = math.ceil(wCount/wpPage)
if dblPages:
pCount += pCount%2
pTotal += pCount
theList.append((tLevel, tTitle, wCount, pCount))
entries.append((tLevel, tTitle, wCount, pCount))
pMax = pTotal - fstPage
self.tocTree.clear()
for tLevel, tTitle, wCount, pCount in theList:
for tLevel, tTitle, wCount, pCount in entries:
newItem = QTreeWidgetItem()
if tPages <= fstPage:
+2 -2
View File
@@ -585,13 +585,13 @@ class GuiWritingStats(QDialog):
newItem.setText(self.C_COUNT, f"{nWords:n}")
if nWords > 0 and listMax > 0:
theBar = self.barImage.scaled(
wBar = self.barImage.scaled(
int(200*min(nWords, histMax)/listMax),
self.barHeight,
Qt.IgnoreAspectRatio,
Qt.FastTransformation
)
newItem.setData(self.C_BAR, Qt.DecorationRole, theBar)
newItem.setData(self.C_BAR, Qt.DecorationRole, wBar)
newItem.setTextAlignment(self.C_LENGTH, Qt.AlignRight)
newItem.setTextAlignment(self.C_IDLE, Qt.AlignRight)