Skip to content

Commit 0092b3e

Browse files
authored
Fix two minor issues (#1843)
2 parents d3c9168 + d01c1e8 commit 0092b3e

File tree

5 files changed

+32
-15
lines changed

5 files changed

+32
-15
lines changed

.github/workflows/test_mac.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212

1313
jobs:
1414
testMac:
15-
runs-on: macos-latest
15+
runs-on: macos-13
1616
steps:
1717
- name: Python Setup
1818
uses: actions/setup-python@v5

novelwriter/gui/doceditor.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
from typing import TYPE_CHECKING
4040

4141
from PyQt5.QtCore import (
42-
pyqtSignal, pyqtSlot, QObject, QPoint, QRegExp, QRegularExpression,
43-
QRunnable, Qt, QTimer
42+
QObject, QPoint, QRegExp, QRegularExpression, QRunnable, Qt, QTimer,
43+
pyqtSignal, pyqtSlot
4444
)
4545
from PyQt5.QtGui import (
4646
QColor, QCursor, QFont, QKeyEvent, QKeySequence, QMouseEvent, QPalette,
@@ -65,7 +65,7 @@
6565
from novelwriter.tools.lipsum import GuiLipsum
6666
from novelwriter.types import (
6767
QtAlignCenterTop, QtAlignJustify, QtAlignLeft, QtAlignLeftTop,
68-
QtAlignRight, QtKeepAnchor, QtModCtrl, QtMouseLeft, QtModeNone, QtModShift,
68+
QtAlignRight, QtKeepAnchor, QtModCtrl, QtModeNone, QtModShift, QtMouseLeft,
6969
QtMoveAnchor, QtMoveLeft, QtMoveRight
7070
)
7171

@@ -334,7 +334,7 @@ def initEditor(self) -> None:
334334
font = QFont()
335335
font.setFamily(CONFIG.textFont)
336336
font.setPointSize(CONFIG.textSize)
337-
self.setFont(font)
337+
self._qDocument.setDefaultFont(font)
338338

339339
# Set default text margins
340340
# Due to cursor visibility, a part of the margin must be

novelwriter/gui/docviewer.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
from enum import Enum
3232

33-
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QPoint, Qt, QUrl
33+
from PyQt5.QtCore import QPoint, Qt, QUrl, pyqtSignal, pyqtSlot
3434
from PyQt5.QtGui import (
3535
QCursor, QFont, QMouseEvent, QPalette, QResizeEvent, QTextCursor,
3636
QTextOption
@@ -44,7 +44,7 @@
4444
from novelwriter.common import cssCol
4545
from novelwriter.constants import nwHeaders, nwUnicode
4646
from novelwriter.core.tohtml import ToHtml
47-
from novelwriter.enum import nwItemType, nwDocAction, nwDocMode
47+
from novelwriter.enum import nwDocAction, nwDocMode, nwItemType
4848
from novelwriter.error import logException
4949
from novelwriter.extensions.eventfilters import WheelEventFilter
5050
from novelwriter.extensions.modified import NIconToolButton
@@ -146,7 +146,7 @@ def initViewer(self) -> None:
146146
font = QFont()
147147
font.setFamily(CONFIG.textFont)
148148
font.setPointSize(CONFIG.textSize)
149-
self.setFont(font)
149+
self.document().setDefaultFont(font)
150150

151151
# Set the widget colours to match syntax theme
152152
mainPalette = self.palette()

novelwriter/tools/manussettings.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727

2828
from typing import TYPE_CHECKING
2929

30-
from PyQt5.QtGui import QFont, QIcon, QSyntaxHighlighter, QTextCharFormat, QTextDocument
3130
from PyQt5.QtCore import QEvent, Qt, pyqtSignal, pyqtSlot
31+
from PyQt5.QtGui import QFont, QIcon, QSyntaxHighlighter, QTextCharFormat, QTextDocument
3232
from PyQt5.QtWidgets import (
33-
QAbstractButton, QAbstractItemView, QDialog, QDialogButtonBox,
34-
QFontDialog, QFrame, QGridLayout, QHBoxLayout, QHeaderView, QLabel,
35-
QLineEdit, QMenu, QPlainTextEdit, QPushButton, QSplitter, QStackedWidget,
36-
QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget
33+
QAbstractButton, QAbstractItemView, QDialog, QDialogButtonBox, QFontDialog,
34+
QFrame, QGridLayout, QHBoxLayout, QHeaderView, QLabel, QLineEdit, QMenu,
35+
QPlainTextEdit, QPushButton, QSplitter, QStackedWidget, QTreeWidget,
36+
QTreeWidgetItem, QVBoxLayout, QWidget
3737
)
3838

3939
from novelwriter import CONFIG, SHARED
@@ -1060,8 +1060,6 @@ class _FormatTab(NScrollableForm):
10601060
def __init__(self, buildMain: GuiBuildSettings, build: BuildSettings) -> None:
10611061
super().__init__(parent=buildMain)
10621062

1063-
self.buildMain = buildMain
1064-
10651063
self._build = build
10661064
self._unitScale = 1.0
10671065

pyproject.toml

+19
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,22 @@ include = ["novelwriter*"]
4646

4747
[project.gui-scripts]
4848
novelwriter = "novelwriter:main"
49+
50+
[tool.isort]
51+
py_version="310"
52+
line_length = 99
53+
wrap_length = 79
54+
multi_line_output = 5
55+
force_grid_wrap = 0
56+
lines_between_types = 1
57+
forced_separate = ["tests.*"]
58+
59+
[tool.flake8]
60+
max-line-length = 99
61+
ignore = ["E133", "E221", "E226", "E228", "E241", "W503", "ANN101", "ANN102", "ANN401"]
62+
per-file-ignores = ["tests/*:ANN"]
63+
exclude = ["docs/*"]
64+
65+
[tool.autopep8]
66+
max_line_length = 99
67+
ignore = ["E133", "E221", "E226", "E228", "E241", "W503"]

0 commit comments

Comments
 (0)