Skip to content

Duplicate code in library files - potential refactor needed #125

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

Closed
FoamyGuy opened this issue Mar 4, 2021 · 5 comments · Fixed by #126
Closed

Duplicate code in library files - potential refactor needed #125

FoamyGuy opened this issue Mar 4, 2021 · 5 comments · Fixed by #126
Labels
enhancement New feature or request

Comments

@FoamyGuy
Copy link
Contributor

FoamyGuy commented Mar 4, 2021

actions failure with details on duplicated sections is here

We want to avoid having duplicated code if possible. One way to avoid it here will be to make a LabelBase class in __init__.py with the duplicated parts and extend that in the other types of labels.

@FoamyGuy FoamyGuy added the enhancement New feature or request label Mar 4, 2021
@jposada202020
Copy link
Contributor

I I took a look at this yesterday. For simple modules, I had success creating LabelBase, in the init file, then creating new classes the label and bitmap_label as children of display.Group and LabelBase. The setter and the getter needs to be equal in order to use them, however this could be solved using a belonging flag and change the module behavior. However, for some modules although equal, ie background (color and calculation) the way both libraries do some calculations, is different, and calling methods inside them also, complicating things inside LabelBase . A first glance I did not see any "easy" path for this

I see as the possible easy to share in the BaseLabel the following modules

  • anchored_position
  • background_color
  • _get_ascent_descent

Bitmap_label is known to save memory, we would need to keep this feature in doing this change as some people have bitmap_label in their projects to save memory.

@FoamyGuy
Copy link
Contributor Author

FoamyGuy commented Mar 5, 2021

I will work on this some tonight or tomorrow as well.

Unfortunately I think we may need to get this sorted before we can merge the other PRs because this will cause actions to fail currently.

@jposada202020
Copy link
Contributor

@FoamyGuy thanks, Agree, we will work on this, let me know if you want that we do a little brainstorm session.

@FoamyGuy
Copy link
Contributor Author

FoamyGuy commented Mar 5, 2021

@jposada202020 I'm going to be working on this some tonight starting in a little bit. If you are around and still interested in brainstorm session ping me on Discord.

@jposada202020
Copy link
Contributor

@FoamyGuy working in the turning text. Enclosed is a prototype that uses the internal machine of label

https://github.com/jposada202020/sandbox_display_text/blob/0e4257dde2899ad269f30510668780d66536275f/developing_turning_text.py

image

will wait in your findings..

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 a pull request may close this issue.

2 participants