ZeroPhone / ZPUI

Official ZeroPhone UI framework, based on pyLCI
http://zpui.rtfd.org/
Apache License 2.0
78 stars 19 forks source link

Add fit_image_to_screen function in utils #150

Closed LouisPi closed 5 years ago

LouisPi commented 5 years ago

DO NOT ACCEPT YET. Should finish it tonight.

Edit - resizing script should be working, see comment below.

codecov[bot] commented 5 years ago

Codecov Report

Merging #150 into devel will increase coverage by 0.72%. The diff coverage is 92.53%.

Impacted file tree graph

@@            Coverage Diff             @@
##            devel     #150      +/-   ##
==========================================
+ Coverage   39.83%   40.56%   +0.72%     
==========================================
  Files         247      248       +1     
  Lines       19703    19947     +244     
==========================================
+ Hits         7849     8091     +242     
- Misses      11854    11856       +2
Impacted Files Coverage Δ
ui/printer.py 65.78% <100%> (+15.78%) :arrow_up:
ui/utils.py 93.8% <90.47%> (-2.03%) :arrow_down:
ui/tests/test_printer.py 75% <95.45%> (+20.45%) :arrow_up:
ui/overlays.py 97.24% <0%> (-2.76%) :arrow_down:
apps/media_apps/draw/main.py 37.43% <0%> (-1.07%) :arrow_down:
apps/wifi_country/main.py 27.02% <0%> (ø)
ui/base_list_ui.py 76.69% <0%> (+0.25%) :arrow_up:
apps/clock/main.py 21.31% <0%> (+0.47%) :arrow_up:
ui/funcs.py 67.79% <0%> (+1.12%) :arrow_up:
ui/tests/test_listbox.py 84.9% <0%> (+1.23%) :arrow_up:
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 5bf6412...82421fe. Read the comment docs.

LouisPi commented 5 years ago

Definitely not ready yet just thought I would start a pull request. Renaming variables was on my TODO as I realise the names are confusing. The typo is because I originally tried out the new Graphics Printer in an old ZPUI directory I made and had to copy everything over. Deleted the old directory now so that shouldn't happen again. Am thinking of scrapping my current technique for resizing to make an image bigger and utilising some of this (https://gist.github.com/tomvon/ae288482869b495201a0) code.

LouisPi commented 5 years ago

No tests added yet. Variable names might need clearing up to avoid confusion, comments need to be added. I have tested this as well as I can on my screen trying out multiple image sizes. Will try sort any issues listed ASAP. Help on making tests for it would be appreciated =D.

LouisPi commented 5 years ago

TODO - add tests

CRImier commented 5 years ago

Ahha. There's actually a lot of code in GraphicsPrinter by now (which makes it harder to read), and I think apps/other UI elements could make use of that as well, could you maybe make it into a separate function? I.e. fit_image_to_screen(image, o).

LouisPi commented 5 years ago

Okay, I will try add that!

Where do you want it added? In printer.py still?

CRImier commented 5 years ago

That's a good question! I think it'd make sense if that code were in ui/utils.py.

LouisPi commented 5 years ago

Okay thanks.

CRImier commented 5 years ago

Thank you!

LouisPi commented 5 years ago

No problem - you pretty much told me how to do all the tests though =D so thank you as well.

CRImier commented 5 years ago

Well, there's no tutorial for ZP devs on that yet =) Also, it's not something people do a lot, unfortunately.