Skip to content

Commit

Permalink
Fix fix flag PYFORMS_DIALOGS_OPTIONS
Browse files Browse the repository at this point in the history
  • Loading branch information
UmSenhorQualquer committed Mar 11, 2019
1 parent a0ed4bc commit bef2a29
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
5 changes: 4 additions & 1 deletion pyforms_gui/controls/control_dir.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ def init_form(self):


def click(self):
value = QFileDialog.getExistingDirectory(self.parent, self._label, options=conf.PYFORMS_DIALOGS_OPTIONS)
if conf.PYFORMS_DIALOGS_OPTIONS:
value = QFileDialog.getExistingDirectory(self.parent, self._label, options=conf.PYFORMS_DIALOGS_OPTIONS)
else:
value = QFileDialog.getExistingDirectory(self.parent, self._label)

if value and len(value)>0:
self.value = value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,11 +487,17 @@ def __open_import_win_evt(self):
def __export(self):
"""Export annotations to a file."""

filename, ffilter = QFileDialog.getSaveFileName(parent=self,
caption="Export annotations file",
directory="untitled.csv",
filter="CSV Files (*.csv);;CSV Matrix Files (*.csv)",
options=conf.PYFORMS_DIALOGS_OPTIONS)
if conf.PYFORMS_DIALOGS_OPTIONS:
filename, ffilter = QFileDialog.getSaveFileName(parent=self,
caption="Export annotations file",
directory="untitled.csv",
filter="CSV Files (*.csv);;CSV Matrix Files (*.csv)",
options=conf.PYFORMS_DIALOGS_OPTIONS)
else:
filename, ffilter = QFileDialog.getSaveFileName(parent=self,
caption="Export annotations file",
directory="untitled.csv",
filter="CSV Files (*.csv);;CSV Matrix Files (*.csv)")

filename = str(filename)
ffilter = str(ffilter)
Expand Down
7 changes: 6 additions & 1 deletion pyforms_gui/controls/control_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ def click(self):
if self.use_save_dialog:
value, _ = QFileDialog.getSaveFileName(self.parent, self._label, self.value)
else:
value = QFileDialog.getOpenFileName(self.parent, self._label, self.value, options=conf.PYFORMS_DIALOGS_OPTIONS)
if conf.PYFORMS_DIALOGS_OPTIONS:
value = QFileDialog.getOpenFileName(self.parent, self._label, self.value,
options=conf.PYFORMS_DIALOGS_OPTIONS)
else:
value = QFileDialog.getOpenFileName(self.parent, self._label, self.value)


if _api.USED_API == _api.QT_API_PYQT5:
value = value[0]
Expand Down

0 comments on commit bef2a29

Please sign in to comment.