Skip to content

Commit

Permalink
Merge pull request #94 from DCC-EX:87-feature-request-show-files-whil…
Browse files Browse the repository at this point in the history
…e-browsing-for-a-folder

Select files, validate config file folder
  • Loading branch information
peteGSX authored Aug 7, 2023
2 parents f5ac09b + 3645e63 commit 8de421f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
34 changes: 22 additions & 12 deletions ex_installer/select_version_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,15 @@ def set_next_config(self):

def browse_configdir(self):
"""
Opens a directory browser dialogue to select the folder containing config files
Opens a file browser dialogue to allow user to select a config file to use
Uses directory of this file to set the config directory
This is a workaround for "askdirectory()" not showing files, which is confusing for users
"""
directory = ctk.filedialog.askdirectory()
if directory:
select_file = ctk.filedialog.askopenfilename()
if select_file:
directory = os.path.dirname(select_file)
self.config_path.set(directory)
self.config_option.set(1)
self.set_next_config()
Expand All @@ -320,16 +325,21 @@ def validate_config_dir(self):
- Contains at least the specified minimum config files
"""
if self.config_path.get():
config_files = fm.get_config_files(self.config_path.get(), pd[self.product]["minimum_config_files"])
if config_files:
self.next_back.enable_next()
else:
file_names = ", ".join(pd[self.product]["minimum_config_files"])
self.process_error(("Selected configuration directory is missing the required files: " +
f"{file_names}"))
if os.path.realpath(self.config_path.get()) == os.path.realpath(self.product_dir):
self.process_error("You cannot use EX-Installer's own generated files as these will be overwritten")
self.next_back.disable_next()
self.log.error("Config dir %s missing minimum config files %s", self.config_path.get(),
config_files)
self.log.error(f"EX-Installer repository folder location chosen: {self.product_dir}")
else:
config_files = fm.get_config_files(self.config_path.get(), pd[self.product]["minimum_config_files"])
if config_files:
self.next_back.enable_next()
else:
file_names = ", ".join(pd[self.product]["minimum_config_files"])
self.process_error(("Selected configuration directory is missing the required files: " +
f"{file_names}"))
self.next_back.disable_next()
self.log.error("Config dir %s missing minimum config files %s", self.config_path.get(),
config_files)
else:
self.next_back.disable_next()

Expand Down
4 changes: 3 additions & 1 deletion ex_installer/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
read by the application build process to embed in the application details
"""

ex_installer_version = "0.0.14"
ex_installer_version = "0.0.15"

"""
Version history:
0.0.15 - Update config directory browse to shows files as well as folders
- Validate user is not using EX-Installer generated config files
0.0.14 - Add timeout for Arduino CLI threads, default 5 minutes
- Split compile/upload process out to show output of each phase
- Add support for EX-Turntable
Expand Down

0 comments on commit 8de421f

Please sign in to comment.