Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor #9

Merged
merged 23 commits into from
May 25, 2024
Merged

Refactor #9

merged 23 commits into from
May 25, 2024

Conversation

spyoungtech
Copy link
Owner

@spyoungtech spyoungtech commented May 24, 2024

A significant refactor of the large FreeSimpleGUI module. This is just a first step we're taking towards making FreeSimpleGUI more maintainable and approachable for contributors. There's still a lot of work to do, but this change cuts the main module size in half, making it quite a bit easier for LSPs and Intellisense to keep up with changes. Elements are now tucked neatly away into their own modules within the new elements subpackage.

All names are imported back into the main package, so this change is non-breaking.

We also moved the main module back to __init__.py instead of the internal FreeSimpleGUI.py module. This avoids a bug introduced by the initial refactor by which changes to global state (which is unfortunately used extensively) may not take effect properly in some cases.

Other minor changes and deprecations:

  • The globals pil_imported and pil_import_attempted are no longer used internally. Attempting to access these globals will produce a deprecation warning.

  • The behavior of the methods save_element_screenshot_to_disk and save_window_screenshot_to_disk returning None when PIL cannot be imported is deprecated. In a future version, calling save_element_screenshot_to_disk or save_window_screenshot_to_disk when PIL cannot be imported will raise an ImportError.

  • This also fixes a bug where calling save_element_screenshot_to_disk or save_window_screenshot_to_disk would incidentally overwrite the Image element class due to use of the global keyword in these methods and importing the name Image from PIL whilst marking Image as global

  • The methods timer_start, timer_stop, and timer_stop_usec are deprecated and will be removed in a future version. (code timing is not FreeSimpleGUI's wheelhouse, and these implementations are flawed in any case). Not to be confused with the Window class methods of the same name, which are unchanged.

  • Using functions with CamelCase names that have snake_case function name replacements is deprecated and those camel-cased function aliases may be removed in a future version. Using these names will produce a deprecation warning.

@spyoungtech spyoungtech merged commit 2b37047 into main May 25, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant