From ab9e3e9e72ab163611edaf4f614f1417149f97dd Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 19 Mar 2021 21:02:19 +0300 Subject: [PATCH] fix: show hidden files in QFileDialog too (#228) Fixes #226 --- guiscrcpy/install/finder.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/guiscrcpy/install/finder.py b/guiscrcpy/install/finder.py index 4a429bce..eb68a9b1 100644 --- a/guiscrcpy/install/finder.py +++ b/guiscrcpy/install/finder.py @@ -1,18 +1,21 @@ from qtpy.QtWidgets import QFileDialog +from qtpy.QtCore import QDir def open_exe_name_dialog(parent, appname): options = QFileDialog.Options() - options |= QFileDialog.DontUseNativeDialog - file_name, _ = QFileDialog.getOpenFileName( - parent, - "{} could not be found. Please locate it manually".format(appname), - "", - "Valid {} executable (*);;".format(appname), - options=options, + options |= QDir.AllEntries + options |= QDir.Hidden + + file_dialog = QFileDialog() + file_dialog.setFilter(QDir.AllEntries | QDir.Hidden) + file_dialog.setFileMode(QFileDialog.ExistingFile) + file_dialog.setWindowTitle( + f"{appname} could not be found. Please locate in" "manually" ) - if file_name: - print(file_name) - return file_name + if file_dialog.exec(): + file_name = file_dialog.selectedFiles() + print(file_name[0]) + return file_name[0] else: print("No file is selected. guiscrcpy is likely to fail")