[Pkg-privacy-commits] [onionshare] 233/256: Use non-native QFileDialog for file selection as well as directory selection, to have a consistent UI
Ulrike Uhlig
ulrike at moszumanska.debian.org
Fri May 26 12:53:48 UTC 2017
This is an automated email from the git hooks/post-receive script.
ulrike pushed a commit to branch master
in repository onionshare.
commit e828b2f9cdf85b597c3ca244033f2df6b74ae82c
Author: Micah Lee <micah at micahflee.com>
Date: Mon May 22 16:10:55 2017 -0700
Use non-native QFileDialog for file selection as well as directory selection, to have a consistent UI
---
onionshare_gui/file_selection.py | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/onionshare_gui/file_selection.py b/onionshare_gui/file_selection.py
index 0de96e0..f24c61e 100644
--- a/onionshare_gui/file_selection.py
+++ b/onionshare_gui/file_selection.py
@@ -214,11 +214,19 @@ class FileSelection(QtWidgets.QVBoxLayout):
"""
Add files button clicked.
"""
- filenames = QtWidgets.QFileDialog.getOpenFileNames(
- caption=strings._('gui_choose_files', True), options=QtWidgets.QFileDialog.ReadOnly)
- if filenames:
- for filename in filenames[0]:
- self.file_list.add_file(filename)
+ file_dialog = QtWidgets.QFileDialog(caption=strings._('gui_choose_files', True))
+ file_dialog.setFileMode(QtWidgets.QFileDialog.ExistingFiles)
+ file_dialog.setOption(QtWidgets.QFileDialog.DontUseNativeDialog, True)
+ file_dialog.setOption(QtWidgets.QFileDialog.ReadOnly, True)
+ tree_view = file_dialog.findChild(QtWidgets.QTreeView)
+ tree_view.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
+ list_view = file_dialog.findChild(QtWidgets.QListView, "listView")
+ list_view.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
+
+ if file_dialog.exec_() == QtWidgets.QDialog.Accepted:
+ for filename in file_dialog.selectedFiles():
+ self.file_list.add_file(filename)
+
self.update()
def add_dir(self):
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onionshare.git
More information about the Pkg-privacy-commits
mailing list