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

Improved handling of pen width and opacity in viewer #448

Merged
merged 6 commits into from
Apr 7, 2022

Conversation

abey79
Copy link
Owner

@abey79 abey79 commented Apr 4, 2022

Description

This PR improves the viewer so it honours the pen width and opacity (vp_color's alpha channel) when present. The UI is updated to reflect that the choosable pen width/opacity are now default value, used when they are undefined. It also adds options to override the pen width/opacity from the properties and use the default value instead.

Done:

  • The viewer now honors pen width and opacity
  • The corresponding menu items have now been renamed "Default pen opacity" and "Default pen width"
  • Added an "Override" menu item to both menu to override pen width/opacity from properties
  • Fixed rendering inconsistence (integer coordinate for vert/horiz line) with the rulers and test_text_block_render()
  • API (breaking change): engine renamed pen_width/pen_opacity property to default_pen_width/default_pen_opacity
  • API (breaking change): renamed parameters of vpype_viewer.render_image()

TODO:

  • add test for override pen width/opacity
  • honour opacity by default (might break tests?)

Fixes #377
Fixes #375

Checklist

  • feature/fix implemented
  • code formatting ok (black and isort)
  • mypy returns no error
  • tests added/updated and pytest succeeds
  • documentation added/updated
    • command docstring and option/argument help
    • README.md updated (Feature Overview)
    • CHANGELOG.md updated
    • added new command to reference.rst
    • RTD doc updated and building with no error (make clean && make html in docs/)

abey79 added 2 commits April 2, 2022 14:59
- The viewer now honors pen width and opacity
- The corresponding menu items have now been renamed "Default pen opacity" and "Default pen width"
- Added an "Override" menu item to both menu to override pen width/opacity from properties
- API (breaking change): engine renamed `pen_width`/`pen_opacity` property to `default_pen_width`/`default_pen_opacity`
- API (breaking change): renamed parameters of `vpype_viewer.render_image()`
@codecov
Copy link

codecov bot commented Apr 4, 2022

Codecov Report

Merging #448 (b67c563) into master (cd95e2d) will increase coverage by 0.04%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #448      +/-   ##
==========================================
+ Coverage   94.34%   94.38%   +0.04%     
==========================================
  Files          60       60              
  Lines        5355     5396      +41     
  Branches      783      786       +3     
==========================================
+ Hits         5052     5093      +41     
  Misses        185      185              
  Partials      118      118              
Impacted Files Coverage Δ
vpype/io.py 84.57% <ø> (ø)
tests/test_text.py 100.00% <100.00%> (ø)
tests/test_viewer.py 100.00% <100.00%> (ø)
vpype_viewer/_painters.py 99.65% <100.00%> (ø)
vpype_viewer/engine.py 96.76% <100.00%> (+0.27%) ⬆️
vpype_viewer/image/__init__.py 100.00% <100.00%> (ø)

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 cd95e2d...b67c563. Read the comment docs.

abey79 added 4 commits April 5, 2022 12:52
… offset by 0.5 pixel in order to be aligned with the pixel grid and avoid rounding errors.
- Added viewer test with metadata
- updated deps
@sonarqubecloud
Copy link

sonarqubecloud bot commented Apr 5, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@abey79 abey79 merged commit 0e01b45 into master Apr 7, 2022
@abey79 abey79 deleted the viewer-improve-pen-width-377 branch April 7, 2022 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant