aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-30 19:40:10 +0100
committerDanilo M. <danix@danix.xyz>2026-10-30 19:40:10 +0100
commit27dc1b71ff62dd4e8d91de239bc5ad70c1bc7428 (patch)
treee5c1cddcf1ad283bc04e9931c379638dd4db8913
parent4de9ea68dfbea7d6d8aa9dc5ea0c4b6328e55dc1 (diff)
downloadupscale-qt-27dc1b71ff62dd4e8d91de239bc5ad70c1bc7428.tar.gz
upscale-qt-27dc1b71ff62dd4e8d91de239bc5ad70c1bc7428.zip
Use theme icons in the toolbar
Freedesktop icon names through QIcon.fromTheme, no bundled files. The label moves to the tooltip with its shortcut and stays the accessible name; a theme without an icon falls back to showing the text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
-rwxr-xr-xupscale-qt26
1 files changed, 15 insertions, 11 deletions
diff --git a/upscale-qt b/upscale-qt
index b9a3bdd..5f22a5c 100755
--- a/upscale-qt
+++ b/upscale-qt
@@ -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)