From 502115f9e20c3b35d3648a2d9777cdd7bb3538e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20Gosselin?= Date: Fri, 29 Aug 2025 16:21:34 -0400 Subject: [PATCH 1/3] Pass filters to save file name dialog --- qtapputils/widgets/path.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qtapputils/widgets/path.py b/qtapputils/widgets/path.py index eb6cb51..92b24c5 100644 --- a/qtapputils/widgets/path.py +++ b/qtapputils/widgets/path.py @@ -91,7 +91,7 @@ def browse_path(self): self, self._caption, self.directory(), self.filters) elif self._path_type == 'getSaveFileName': path, ext = QFileDialog.getSaveFileName( - self, self._caption, self.directory()) + self, self._caption, self.directory(), self.filters) if path: self.set_path(path) From ac8d3af50e722d39dae228c6c534302a4dff3671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20Gosselin?= Date: Mon, 1 Sep 2025 11:50:05 -0400 Subject: [PATCH 2/3] Minor code improvements --- qtapputils/widgets/path.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qtapputils/widgets/path.py b/qtapputils/widgets/path.py index 92b24c5..d0e80c8 100644 --- a/qtapputils/widgets/path.py +++ b/qtapputils/widgets/path.py @@ -31,7 +31,7 @@ def __init__(self, parent: QWidget = None, path: str = '', filters: str = None, gettext: Callable = None): super().__init__(parent) - _ = lambda x: x if gettext is None else gettext + _ = gettext if gettext else lambda x: x if path_type == 'getExistingDirectory': self._caption = _('Select Existing Directory') elif path_type == 'getOpenFileName': @@ -75,6 +75,9 @@ def path(self): def set_path(self, path: str): """Set the path to the specified value.""" + if path != self.path: + return + self.path_lineedit.setText(path) self.path_lineedit.setToolTip(path) self.set_directory(osp.dirname(path)) From 5861baa0e90cd72e1227349684bc29318b59399c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20Gosselin?= Date: Mon, 1 Sep 2025 11:59:23 -0400 Subject: [PATCH 3/3] Fix minor typo --- qtapputils/widgets/path.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qtapputils/widgets/path.py b/qtapputils/widgets/path.py index d0e80c8..83dbc0f 100644 --- a/qtapputils/widgets/path.py +++ b/qtapputils/widgets/path.py @@ -75,7 +75,7 @@ def path(self): def set_path(self, path: str): """Set the path to the specified value.""" - if path != self.path: + if path == self.path: return self.path_lineedit.setText(path)