Skip to content

Conversation

@Neradoc
Copy link
Contributor

@Neradoc Neradoc commented Mar 22, 2021

Hi !
I tested running on mac, so here are a few fixes that came from that.

  • On macOS the drives are in /Volumes, and since it doesn't make sense to change it on mac, I just hard coded the path and ignored unix_drive_mount_point.
  • Fixes circuitpython_only for mac and linux. Now correctly only lists board drives if the checkbox is not checked.
  • Fixed an issue with shutil.rmtree choking on extended attributes files on a board, like when a module was installed manually.
  • Ignore hidden .* files in the device's installed libs (like macOS extended attributes).
  • Sort the modules in modules.list_modules() so the list is consistent across uses. Avoids deleting the wrong one in GUI.uninstall_module() because it was not sorted there but was in the UI. Is there a way to get the selected module name from the UI ?

@UnsignedArduino UnsignedArduino self-requested a review March 22, 2021 23:23
@UnsignedArduino UnsignedArduino self-assigned this Mar 22, 2021
@UnsignedArduino UnsignedArduino added the enhancement New feature or request label Mar 22, 2021
@UnsignedArduino
Copy link
Owner

Hey thanks for the PR - really appreciate it 😃

Is there a way to get the selected module name from the UI ?

What do you mean by this? Can you elaborate, please?

Copy link
Owner

@UnsignedArduino UnsignedArduino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good! 👍

@UnsignedArduino UnsignedArduino merged commit 6ceb4ce into UnsignedArduino:main Mar 22, 2021
@Neradoc
Copy link
Contributor Author

Neradoc commented Mar 22, 2021

Is there a way to get the selected module name from the UI ?

What do you mean by this? Can you elaborate, please?

The current code retrieves the position of the currently selected line, and gets the name by using that on the list gotten from list_modules(). But list_modules retrieves the list from disk every time, so if a file was added or removed in the meantime for example, the list of files would not match the UI, the index would point to a different file (or be out of bounds), and the wrong file would be deleted. It's an edge case but better safe than sorry.

I don't know that UI framework, but if it's possible to get the selected module name back from installed_modules_listbox_var or something, it would guarantee that it is the exact one that was selected, no mater what changed underneath. That or caching the value of list_modules() in another variable, to make sure it matches the UI.

@UnsignedArduino
Copy link
Owner

Should be fixed: 949fef9
Shows an error message when I try to delete a non-existent module. Thanks for reporting that edge case 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants