diff options
| -rwxr-xr-x | upscale-qt | 26 |
1 files changed, 15 insertions, 11 deletions
@@ -21,8 +21,8 @@ from dataclasses import dataclass from pathlib import Path from PyQt6.QtCore import QPointF, QProcess, QRectF, QSettings, QTemporaryDir, Qt -from PyQt6.QtGui import (QAction, QColor, QImage, QImageReader, QKeySequence, - QPainter, QPen) +from PyQt6.QtGui import (QAction, QColor, QIcon, QImage, QImageReader, + QKeySequence, QPainter, QPen) from PyQt6.QtWidgets import (QApplication, QComboBox, QDialog, QDialogButtonBox, QFileDialog, QFormLayout, QLineEdit, QMainWindow, QMessageBox, QWidget) @@ -230,21 +230,25 @@ class Main(QMainWindow): tb = self.addToolBar('main') tb.setMovable(False) - def act(text, slot, key=None): - a = QAction(text, self) + def act(text, icon, slot, key=None): + # freedesktop names; a theme without the icon shows the text + a = QAction(QIcon.fromTheme(icon), text, self) a.triggered.connect(slot) if key is not None: a.setShortcut(key) + a.setToolTip(f'{text} ({a.shortcut().toString()})') tb.addAction(a) return a - self.a_open = act('Open', self.open_dialog, QKeySequence.StandardKey.Open) + self.a_open = act('Open', 'document-open', self.open_dialog, + QKeySequence.StandardKey.Open) tb.addWidget(self.models) - self.a_up = act('Upscale', self.upscale, 'Ctrl+U') - self.a_save = act('Save As', self.save_as, QKeySequence.StandardKey.SaveAs) - self.a_over = act('Overwrite', self.overwrite) - self.a_clear = act('Clear', self.clear, 'Ctrl+W') - act('Settings', self.settings) + self.a_up = act('Upscale', 'zoom-in', self.upscale, 'Ctrl+U') + self.a_save = act('Save As', 'document-save-as', self.save_as, + QKeySequence.StandardKey.SaveAs) + self.a_over = act('Overwrite', 'document-save', self.overwrite) + self.a_clear = act('Clear', 'edit-clear', self.clear, 'Ctrl+W') + act('Settings', 'preferences-system', self.settings) self.proc = QProcess(self) self.proc.finished.connect(self.proc_done) @@ -282,7 +286,7 @@ class Main(QMainWindow): self.a_open.setEnabled(not busy) self.models.setEnabled(not busy) self.a_up.setEnabled(job is not None and not busy and self.models.count() > 0) - self.a_up.setToolTip('Upscale' if self.models.count() else + self.a_up.setToolTip('Upscale (Ctrl+U)' if self.models.count() else f'No models in {self.get("upscalers_dir")}, see Settings') self.a_save.setEnabled(done and not busy) self.a_over.setEnabled(done and not busy) |
