Conversation
This should be backwards compatible, because we are aliasing to the original constant names.
Largely search and replace.
| kiva_style |= constants.FontStyle.BOLD | ||
| if "italic" in style: | ||
| kiva_style += constants.ITALIC | ||
| kiva_style |= constants.FontStyle.ITALIC |
There was a problem hiding this comment.
We should perhaps note in the FontStyle declaration that it's used as a bitmask?
| style : join_style | ||
| The line joining style. The available | ||
| styles are JOIN_ROUND, JOIN_BEVEL, JOIN_MITER. | ||
| styles are Join.ROUND, Join.BEVEL, Join.MITER. |
There was a problem hiding this comment.
Should be LineJoin.* instead of Join.*
| style : cap_style | ||
| The line cap style to use. Available styles | ||
| are CAP_ROUND, CAP_BUTT, CAP_SQUARE. | ||
| are Cap.ROUND, Cap.BUTT, Cap.SQUARE. |
There was a problem hiding this comment.
Same here: LineCap.* instead of Cap.*
| if not (mode & DrawMode.STROKE): | ||
| self.state.line_state.line_color[3] = 0.0 | ||
| if mode not in [FILL, EOF_FILL, FILL_STROKE, EOF_FILL_STROKE]: | ||
| if not (mode & (DrawMode.FILL | DrawMode.EOF_FILL)): |
There was a problem hiding this comment.
The word "flag" appears in the docstring for DrawMode, so I guess this is expected?
Perhaps the tension for me is that some of the constants are just enumerations, but others are bit positions in a mask?
| constants.LineJoin.ROUND: blend2d.StrokeJoin.JOIN_ROUND, | ||
| constants.LineJoin.BEVEL: blend2d.StrokeJoin.JOIN_BEVEL, | ||
| constants.LineJoin.MITER: blend2d.StrokeJoin.JOIN_MITER_BEVEL, |
There was a problem hiding this comment.
C++ enumeration naming is leaking on the Blend2D side 😆
| weight = WEIGHT_NORMAL | ||
| style = NORMAL | ||
| weight = FontWeight.NORMAL | ||
| style = FontStyle.NORMAL |
| Note: this is a temporary method that will be removed in Enable 7. | ||
| """ |
There was a problem hiding this comment.
Is this the time to remove the code?
| BOLD, BOLD_ITALIC, DECORATIVE, DEFAULT, ITALIC, MODERN, NORMAL, ROMAN, | ||
| SCRIPT, TELETYPE, WEIGHT_BOLD, WEIGHT_LIGHT, WEIGHT_NORMAL, SWISS, | ||
| BOLD_ITALIC, FontFamily, FontStyle, FontWeight, DECORATIVE, DEFAULT, | ||
| MODERN, ROMAN, SCRIPT, TELETYPE, SWISS, |
There was a problem hiding this comment.
Is it too tedious to switch over to FontFamily.* throughout this file?
| constants.FontStyle.NORMAL: 'regular', | ||
| constants.FontStyle.BOLD: 'bold', | ||
| constants.FontStyle.ITALIC: 'italic', | ||
| constants.FontStyle.BOLD | constants.FontStyle.ITALIC: 'bold italic', |
There was a problem hiding this comment.
Well... constants.BOLD_ITALIC does still exist.
| join = basecore2d.JOIN_MITER | ||
| cap = basecore2d.CAP_ROUND | ||
| join = constants.LineJoin.MITER | ||
| cap = constants.LineCap.ROUND |
There was a problem hiding this comment.
Thanks for correcting this abuse of imports
This is largely backwards compatible, because we are aliasing to the original constant names, but it does remove constant names from
kiva.__init__. People probably shouldn't have been using that instead ofkiva.api, but this should probably be part of a major version bump.