-
Notifications
You must be signed in to change notification settings - Fork 2
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
using decorators to avoid code replication #115
Comments
In 92dc29b I introduced the The decorator itself can be found at: PZero/pzero/helpers/helper_functions.py Line 286 in 92dc29b
The first usage of this decorator can be found at: Line 208 in 92dc29b
@r-monti14 please go ahead using the decorator in all functions in two_d_lines.py and three_d_surfaces.py, following the same pattern as above. In addition to avoiding code repetition, this will solve #114 and similar issues. |
After adding the decorater and removing the functions that are already described in the decorater, the error is still there. The window freezes. |
The decorator works with those tools that do not need a final input to interrupt the function. |
With 7a98c74 I have updated both @r-monti14 please use these as a reference for all other functions in We will think about the interactive tools |
With f6d562f I have added the decorators at all the functions in two_d_lines.py (except Draw line, Edit line, Split line-point, Extend line and Measure). |
Great! Have you tested all of them? |
I did a quick test with all of them. I am not sure if the Snap line works correctly, but I will test everything again in detail. |
Yes thanks. Actually I think it would be a good idea to use freezing everywhere, also in functions used to open or import data. |
Avoiding code replication is generally achieved by using classes. However, this solution is not optimal when dealing with functions, simply defined as:
In this case we might consider using decorators following this pattern:
I will test this to unify freezing and unfreezing the GUI in functions of
two_d_lines.py
.The text was updated successfully, but these errors were encountered: