-
Notifications
You must be signed in to change notification settings - Fork 49
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
Refactor #9
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 internalFreeSimpleGUI.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
andpil_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
andsave_window_screenshot_to_disk
returningNone
whenPIL
cannot be imported is deprecated. In a future version, callingsave_element_screenshot_to_disk
orsave_window_screenshot_to_disk
whenPIL
cannot be imported will raise anImportError
.This also fixes a bug where calling
save_element_screenshot_to_disk
orsave_window_screenshot_to_disk
would incidentally overwrite theImage
element class due to use of theglobal
keyword in these methods and importing the nameImage
from PIL whilst markingImage
asglobal
The methods
timer_start
,timer_stop
, andtimer_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 theWindow
class methods of the same name, which are unchanged.Using functions with
CamelCase
names that havesnake_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.