diff options
| author | Paweł Jastrzębski <[email protected]> | 2014-01-18 11:14:14 +0100 |
|---|---|---|
| committer | Paweł Jastrzębski <[email protected]> | 2014-01-18 11:14:14 +0100 |
| commit | b1e7a88353e19b15473c34d2154804cd6cc3c3bd (patch) | |
| tree | 4c712c8391ea537a007e781887cfea4bc0c16a27 | |
| parent | Linux: Disabling systray icon (diff) | |
| download | kcc-b1e7a88353e19b15473c34d2154804cd6cc3c3bd.tar.gz kcc-b1e7a88353e19b15473c34d2154804cd6cc3c3bd.tar.bz2 kcc-b1e7a88353e19b15473c34d2154804cd6cc3c3bd.zip | |
Removing QFileDialog hack
Now when KCC support drag&drop we can return to native dialog.
| -rw-r--r-- | kcc/KCC_gui.py | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/kcc/KCC_gui.py b/kcc/KCC_gui.py index deff9a6..3af388a 100644 --- a/kcc/KCC_gui.py +++ b/kcc/KCC_gui.py @@ -546,29 +546,12 @@ class KCCGUI(KCC_ui.Ui_KCC): if self.needClean: self.needClean = False GUI.JobList.clear() - # Dirty, dirty way but OS native QFileDialogs don't support directory multiselect - dirDialog = QtWidgets.QFileDialog(MW, 'Select directory', self.lastPath, 'Directory (*.abcdefg)') - dirDialog.setFileMode(dirDialog.Directory) - dirDialog.setOption(dirDialog.ShowDirsOnly, True) - dirDialog.setOption(dirDialog.DontUseNativeDialog, True) - dirDialog.setOption(dirDialog.HideNameFilterDetails, True) - l = dirDialog.findChild(QtWidgets.QListView, "listView") - t = dirDialog.findChild(QtWidgets.QTreeView) - if l: - l.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) - if t: - t.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) - if dirDialog.exec_() == 1: - dnames = dirDialog.selectedFiles() - else: - dnames = "" - for dname in dnames: - if str(dname) != "": - if sys.platform.startswith('win'): - dname = dname.replace('/', '\\') - self.lastPath = os.path.abspath(os.path.join(str(dname), os.pardir)) - GUI.JobList.addItem(dname) - MW.setFocus() + dname = QtWidgets.QFileDialog.getExistingDirectory(MW, 'Select directory', self.lastPath) + if dname != '': + if sys.platform.startswith('win'): + dname = dname.replace('/', '\\') + self.lastPath = os.path.abspath(os.path.join(dname, os.pardir)) + GUI.JobList.addItem(dname) def selectFile(self): if self.needClean: |