Clean up variables and formatting
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user