diff --git a/pyproject.toml b/pyproject.toml index b568f63..ae97cf2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,7 @@ indent-width = 4 [tool.ruff.lint] select = ["E", "F", "W", "N", "D", "Q", "PL", "R", "C", "B", "C4", "G", "PT", "RET", "RUF", "SIM", "UP"] -ignore = ["D212", "D203", "D400", "RET505", "D100", "PLR0915", "RET504", "PLE1205", "UP015", "PLC2401", "PLR0913"] +ignore = ["D212", "D203", "D400", "RET505", "D100", "PLR0915", "RET504", "PLE1205", "UP015", "PLC2401", "PLR0913", "PT001"] [tool.ruff.format] quote-style = "double" diff --git a/typstwriter/editor.py b/typstwriter/editor.py index 4174252..f7c39be 100644 --- a/typstwriter/editor.py +++ b/typstwriter/editor.py @@ -388,7 +388,8 @@ def load(self, path): self.isloaded = True self.changed_on_disk = False - self.filesystemwatcher.removePaths(self.filesystemwatcher.files()) + if self.filesystemwatcher.files(): + self.filesystemwatcher.removePaths(self.filesystemwatcher.files()) self.filesystemwatcher.addPath(path) self.savestatechanged.emit(self.issaved) @@ -407,7 +408,7 @@ def load(self, path): def write(self): """Write file to disk.""" - logger.info("Saving to: {!r}.", self.path) + logger.debug("Saving to: {!r}.", self.path) try: with open(self.path, "w") as f: @@ -514,24 +515,26 @@ def show_error(self, msg): """Show an error page.""" self.edit.deleteLater() - self.gridLayout = QtWidgets.QGridLayout() + self.HLayout = QtWidgets.QHBoxLayout() + self.verticalLayout.addLayout(self.HLayout) self.label_w = QtWidgets.QLabel() if QtGui.QIcon.hasThemeIcon("data-warning"): self.label_w.setPixmap(QtGui.QIcon.fromTheme("data-warning").pixmap(64)) else: self.label_w.setPixmap(QtGui.QPixmap(util.icon_path("warning.svg"))) - self.label_t = QtWidgets.QLabel("

" + msg + "

") - - self.gridLayout.addWidget(self.label_w, 0, 1) - self.gridLayout.addWidget(self.label_t, 0, 2) - self.gridLayout.setColumnStretch(0, 1) - self.gridLayout.setColumnStretch(1, 0) - self.gridLayout.setColumnStretch(2, 0) - self.gridLayout.setColumnStretch(3, 1) + self.label_t = QtWidgets.QLabel(msg) + font = self.label_t.font() + font.setPointSize(font.pointSize() * 2) + font.setBold(True) + self.label_t.setFont(font) + self.label_t.setWordWrap(True) - self.verticalLayout.addLayout(self.gridLayout) + self.HLayout.addStretch() + self.HLayout.addWidget(self.label_w, alignment=QtCore.Qt.AlignmentFlag.AlignRight) + self.HLayout.addWidget(self.label_t, alignment=QtCore.Qt.AlignmentFlag.AlignLeft) + self.HLayout.addStretch() class FileChangedWarning(QtWidgets.QFrame): @@ -555,6 +558,7 @@ def __init__(self, path): self.label_text = QtWidgets.QLabel() self.label_text.setText(f"The file '{path!r}' has been changed on disk.") + self.label_text.setWordWrap(True) self.horizontalLayout.addWidget(self.label_text) icon = QtGui.QIcon.fromTheme(QtGui.QIcon.ViewRefresh, QtGui.QIcon(util.icon_path("reload.svg"))) diff --git a/typstwriter/icons/typstwriter.png b/typstwriter/icons/typstwriter.png deleted file mode 100644 index fccee46..0000000 Binary files a/typstwriter/icons/typstwriter.png and /dev/null differ diff --git a/typstwriter/icons/typstwriter.svg b/typstwriter/icons/typstwriter.svg new file mode 100644 index 0000000..5a79bc9 --- /dev/null +++ b/typstwriter/icons/typstwriter.svg @@ -0,0 +1,436 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/typstwriter/mainwindow.py b/typstwriter/mainwindow.py index 3db26c2..bab0759 100644 --- a/typstwriter/mainwindow.py +++ b/typstwriter/mainwindow.py @@ -30,7 +30,7 @@ def __init__(self): self.setWindowTitle("Typstwriter") self.setObjectName("MainWindow") - self.setWindowIcon(QtGui.QIcon(util.icon_path("typstwriter.png"))) + self.setWindowIcon(QtGui.QIcon(util.icon_path("typstwriter.svg"))) # Actions self.actions = actions.Actions(self)