diff --git a/qtapputils/widgets/path.py b/qtapputils/widgets/path.py index eb6cb51..83dbc0f 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)) @@ -91,7 +94,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)