Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Workflow buttons: Fix icon filetype filter string

Freya Lupen8f12b60d58b9
diff --git a/plugins/python/workflow_buttons/buttons_settings_dialog.py b/plugins/python/workflow_buttons/buttons_settings_dialog.py
index 4055774e7a..72b4f36db5 100644
--- a/plugins/python/workflow_buttons/buttons_settings_dialog.py
+++ b/plugins/python/workflow_buttons/buttons_settings_dialog.py
@@ -4,7 +4,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from PyQt5.QtCore import QSize
-from PyQt5.QtGui import QIcon, QPixmap, QColor, QPen, QBrush, QPainter
+from PyQt5.QtGui import QIcon, QPixmap, QColor, QPen, QBrush, QPainter, QImageReader
from PyQt5.QtWidgets import (QDialog, QVBoxLayout, QHBoxLayout, QWidget, QScrollArea, QPushButton,
QToolButton, QLabel, QLineEdit, QComboBox, QDialogButtonBox,
QFileDialog, QFrame, QWidget, QSizePolicy)
@@ -441,7 +441,12 @@ class ButtonsSettingsDialog(QDialog):
if self.selectedButtonID < 1:
return
dialog = QFileDialog(self)
- dialog.setNameFilter(i18n("Icon files (*.png, *.svg)"))
+ formatList = []
+ for formatBytes in QImageReader.supportedImageFormats():
+ formatList.append(f"*.{str(formatBytes, 'utf-8')}")
+ formatsString = " ".join(formatList)
+ # The format string cannot be translated, only the description
+ dialog.setNameFilter(i18n("Icon files ") + "(" + formatsString + ")")
if dialog.exec_():
selectedFile = dialog.selectedFiles()[0]
@@ -567,7 +572,7 @@ class ButtonsSettingsDialog(QDialog):
if self.selectedButtonID < 1:
return
dialog = QFileDialog(self)
- dialog.setNameFilter(i18n("Script files (*.py)"))
+ dialog.setNameFilter(i18n("Script files ") + "(*.py)")
if dialog.exec_():
selectedFile = dialog.selectedFiles()[0]