mirror of
https://github.com/ciromattia/kcc
synced 2025-12-20 13:11:47 +00:00
Removing QFileDialog hack
Now when KCC support drag&drop we can return to native dialog.
This commit is contained in:
@@ -546,29 +546,12 @@ class KCCGUI(KCC_ui.Ui_KCC):
|
|||||||
if self.needClean:
|
if self.needClean:
|
||||||
self.needClean = False
|
self.needClean = False
|
||||||
GUI.JobList.clear()
|
GUI.JobList.clear()
|
||||||
# Dirty, dirty way but OS native QFileDialogs don't support directory multiselect
|
dname = QtWidgets.QFileDialog.getExistingDirectory(MW, 'Select directory', self.lastPath)
|
||||||
dirDialog = QtWidgets.QFileDialog(MW, 'Select directory', self.lastPath, 'Directory (*.abcdefg)')
|
if dname != '':
|
||||||
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'):
|
if sys.platform.startswith('win'):
|
||||||
dname = dname.replace('/', '\\')
|
dname = dname.replace('/', '\\')
|
||||||
self.lastPath = os.path.abspath(os.path.join(str(dname), os.pardir))
|
self.lastPath = os.path.abspath(os.path.join(dname, os.pardir))
|
||||||
GUI.JobList.addItem(dname)
|
GUI.JobList.addItem(dname)
|
||||||
MW.setFocus()
|
|
||||||
|
|
||||||
def selectFile(self):
|
def selectFile(self):
|
||||||
if self.needClean:
|
if self.needClean:
|
||||||
|
|||||||
Reference in New Issue
Block a user