Fix linting errors in the main code
This commit is contained in:
@@ -124,10 +124,10 @@ class GuiLipsum(NDialog):
|
||||
@classmethod
|
||||
def getLipsum(cls, parent: QWidget) -> str:
|
||||
"""Pop the dialog and return the lipsum text."""
|
||||
cls = GuiLipsum(parent)
|
||||
cls.exec()
|
||||
text = cls.lipsumText
|
||||
cls.softDelete()
|
||||
dialog = cls(parent)
|
||||
dialog.exec()
|
||||
text = dialog.lipsumText
|
||||
dialog.softDelete()
|
||||
return text
|
||||
|
||||
##
|
||||
|
||||
@@ -26,9 +26,9 @@ from __future__ import annotations
|
||||
import logging
|
||||
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from PyQt6.QtCore import QTimer, pyqtSlot
|
||||
from PyQt6.QtGui import QCloseEvent
|
||||
from PyQt6.QtWidgets import (
|
||||
QAbstractButton, QAbstractItemView, QDialogButtonBox, QFileDialog,
|
||||
QGridLayout, QHBoxLayout, QLabel, QLineEdit, QListWidget, QListWidgetItem,
|
||||
@@ -38,7 +38,6 @@ from PyQt6.QtWidgets import (
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.common import makeFileNameSafe, openExternalPath
|
||||
from novelwriter.constants import nwLabels
|
||||
from novelwriter.core.buildsettings import BuildSettings
|
||||
from novelwriter.core.docbuild import NWBuildDocument
|
||||
from novelwriter.core.item import NWItem
|
||||
from novelwriter.enum import nwBuildFmt
|
||||
@@ -46,6 +45,11 @@ from novelwriter.extensions.modified import NDialog, NIconToolButton
|
||||
from novelwriter.extensions.progressbars import NProgressSimple
|
||||
from novelwriter.types import QtAlignCenter, QtDialogClose, QtRoleAction, QtRoleReject, QtUserRole
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from PyQt6.QtGui import QCloseEvent
|
||||
|
||||
from novelwriter.core.buildsettings import BuildSettings
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ from novelwriter.types import (
|
||||
QtUserRole
|
||||
)
|
||||
|
||||
if TYPE_CHECKING: # pragma: no cover
|
||||
if TYPE_CHECKING:
|
||||
from novelwriter.guimain import GuiMain
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -427,10 +427,10 @@ class GuiManuscript(NToolDialog):
|
||||
|
||||
def _saveSettings(self) -> None:
|
||||
"""Save the user GUI settings."""
|
||||
buildOrder = []
|
||||
for i in range(self.buildList.count()):
|
||||
if item := self.buildList.item(i):
|
||||
buildOrder.append(item.data(self.D_KEY))
|
||||
buildOrder = [
|
||||
item.data(self.D_KEY) for i in range(self.buildList.count())
|
||||
if (item := self.buildList.item(i))
|
||||
]
|
||||
|
||||
current = self.buildList.currentItem()
|
||||
lastBuild = current.data(self.D_KEY) if isinstance(current, QListWidgetItem) else ""
|
||||
@@ -744,7 +744,7 @@ class _PreviewWidget(QTextBrowser):
|
||||
document.setDocumentMargin(CONFIG.textMargin)
|
||||
|
||||
self.setPlaceholderText(self.tr(
|
||||
"Press the \"Preview\" button to generate ..."
|
||||
'Press the "Preview" button to generate ...'
|
||||
))
|
||||
|
||||
self.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOn)
|
||||
|
||||
@@ -55,7 +55,7 @@ from novelwriter.types import (
|
||||
QtUserRole
|
||||
)
|
||||
|
||||
if TYPE_CHECKING: # pragma: no cover
|
||||
if TYPE_CHECKING:
|
||||
from novelwriter.guimain import GuiMain
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -26,8 +26,9 @@ from __future__ import annotations
|
||||
import logging
|
||||
import math
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from PyQt6.QtCore import pyqtSlot
|
||||
from PyQt6.QtGui import QCloseEvent
|
||||
from PyQt6.QtWidgets import (
|
||||
QAbstractItemView, QDialogButtonBox, QFormLayout, QGridLayout, QHBoxLayout,
|
||||
QLabel, QSpinBox, QStackedWidget, QTreeWidget, QTreeWidgetItem,
|
||||
@@ -44,6 +45,9 @@ from novelwriter.extensions.pagedsidebar import NPagedSideBar
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
from novelwriter.types import QtAlignRight, QtDecoration, QtDialogClose
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from PyQt6.QtGui import QCloseEvent
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
||||
@@ -385,7 +385,7 @@ class _OpenProjectPage(QWidget):
|
||||
|
||||
class _ProjectListItem(QStyledItemDelegate):
|
||||
|
||||
__slots__ = ("_pPx", "_hPx", "_tFont", "_dFont", "_dPen", "_icon")
|
||||
__slots__ = ("_dFont", "_dPen", "_hPx", "_icon", "_pPx", "_tFont")
|
||||
|
||||
def __init__(self, parent: QWidget) -> None:
|
||||
super().__init__(parent=parent)
|
||||
|
||||
@@ -47,7 +47,7 @@ from novelwriter.types import (
|
||||
QtDialogClose, QtRoleAction
|
||||
)
|
||||
|
||||
if TYPE_CHECKING: # pragma: no cover
|
||||
if TYPE_CHECKING:
|
||||
from novelwriter.guimain import GuiMain
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -124,7 +124,7 @@ class GuiWritingStats(NToolDialog):
|
||||
self.listBox.setSortingEnabled(True)
|
||||
|
||||
# Word Bar
|
||||
self.barHeight = int(round(0.5*SHARED.theme.fontPixelSize))
|
||||
self.barHeight = round(0.5*SHARED.theme.fontPixelSize)
|
||||
self.barImage = QPixmap(self.barHeight, self.barHeight)
|
||||
self.barImage.fill(self.palette().highlight().color())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user