Block
- Update logic for placing right aligned text to resolve I#65. Right aligned text now appears both right aligned and visually aligned with right side of text block.
Development Environment
- switch from pipenv to plain
requirements.txt - update dependencies to follow waveshare repo:
gpiozerolgpiospidev
- add
init_devel_environment.shto create virtual environment, install requirements, and optionally add jupyter kernel.
Screen
- add
module_cleanupmethod for final shutdown of screen- this method needs to be called prior to final exit
- see I#315 for more details]
Block
- explicitly remove all mutables from default value assignments in methods
- no changes to public/private methods
Layout
- explicitly remove all mutables from default value assignments in methods
- deepcopy the user supplied layout into new property:
_master_layout- resolves issue #51
_layoutcontains the calculated layout with all of the areas and absolute coordinates_master_layoutcontains the user-supplied raw layout with relative positions
- small internal changes to
resolutionmethod
requirements
- remove unneeded requests requirement
Documentation
- Rewrite and reformat documentation
- Split modules into independent documents
Block
- Add
pillow_paletteargument; True: map color names to RGB standard HTML color values, False (default) map color names to WaveShare values.- WaveShare 7 color panels use different "ORANGE" and "GREEN" values from the standard HTML color values.
- Blocks now default to
fill='BLACKandbkground='WHITE'instead offill=0andbkground=255 - Fill and bkground colors appropriately map to match the block color mode
- Resetting font size for
TextBlockobjects now update the font size without redefining the font path
Screen
colors2paletteuses WaveShare R, O, Y, B, G, Blk, W values by default
Layout
- Improve logic for determining block color mode
Screen
-
Add "RGB" as valid value for
modeproperty- This is auto-detected for all 7 Color Screens
-
Add method
reduce_paletteto reduce all of the colors in an image to a set palette -
Add method
colors2paletteto produce a palette that can be used with thereduce_palettemethod- The default is a 7-color palette of w3 colors: 'RED', 'ORANGE', 'YELLOW', 'GREEN', 'BLUE', 'WHITE', 'BLACK'
-
Update
list_compatible_modulesmodule function to show supported mode
Layout
- Add
modeproperty to__init__- Supports "1", "RGB", "L"
- Mode property validates value against
constants.MODESand throwsAttributeError - API Change in
Layoutclass: add public methodset_blockto create or update a single block - API Change in
Layoutclass: add public methodupdate_block_propsto allow changing the layout settings for a block- the block must be updated using
update_contentsafter the properties are changed
- the block must be updated using
- API Change in
Layoutclass: allLayout.layoutdictionaries must now contain the keytypethat indicates the block type: (TextBlock,ImageBlock,DrawBlock). Failure to include this key will raise aKeyError.
Block
Blocksuperclass for all block classes now supports "RGB" mode- All classes support the following for
fill,bkgroundandoutline- RGB tuples:
(128, 128, 128) - hex
0x808080 - integers:
8421504 - colormap colors:
"gray"- (seeImageColor.getcolor)
- RGB tuples:
- add option to mirror screen:
Screen(mirror=True) - Screen() now handles kwargs on init and maps them to properties
TextBlock
- add option to stop text wrapping (textwrap=False)
- changed test string used for calculating maximum characters per line to include digits: 9QqMm
- this results in all calculated font sizes being slightly smaller, but fitting better in most cases
ImageBlock
- add static method
remove_transparency(im, bg_colour=(255, 255, 255))toImageBlock- removes alpha/transparency chanels from PNG and similar images and replaces with bg_color
- add propery
remove_alpha=Trueto remove transparency/alpha on PNG images by default
Screen
- when SPI is not enabled,
writeEPDreturnsFileNotFoundErrorinstead ofScreenError- this makes it easier to provide useful feedback to users when SPI is not setup
- handle exeptions when writing to EPD
Add new Block type "DrawBlock" and Layout support
Block
-
add class "DrawBlock" for drawing
ImageDrawbasic shapes- DrawBlock blocks are useful for creating horizontal and vertical rules in Layout displays
- supported shapes:
ellipse,rounded_rectangle,rectangle - DrawBlock shapes can be horizontally (center, left, right) and vertically (center, top, bottom) aligned
- all formatting paramaters can be used when drawing supported shapes
-
add option to add a border around each block type
Blockobjects accept the kwargborder_configto add borders around the top, bottom, left and right sides- see
-
update docstrings
-
add dummy
update()method toBlockparent class for completness
Layout
- Layouts now support ImageBlock, TextBlock and DrawBlock objects
- DrawBlock objects are included similar to Text and Image blocks, but MUST include the key "type"
- 'type': 'DrawBlock'
- As of epdlib v0.6, all layout sections MUST include the key "type"
- Layout v0.5 attempts to guess the appropriate block type; this will be removed in v0.6
- DrawBlock objects are included similar to Text and Image blocks, but MUST include the key "type"
- Small changes in logging output to decrease verbosity and make verbose output easier to follow
Fix issue #15 - "unknown module" when display = "HD" and no vcom value set
Add option to force all blocks in a layout to 1bit mode. TT Fonts are rendered with anti-aliasing in all modes except for 1bit mode. Anti-aliased fonts display poorly on 1bit screens with extremely jagged edges.
Layout
Layoutobjects now support boolean propertyforce_onebit- When set to
Trueall blocks are forced tomode = '1'
- When set to
rewrite of Screen module to fix unclosed SPI file handles
Screen
initEPD()method is now depricated and no longer needed; this can be removed from the code- displays are automatically woken prior to write/clear and put to sleep after write/clear
- at your own risk, use
writeEPD(sleep=True)to keep display awake after write. For non-IT8951 boards, you must manually callepd.sleep()prior to the next write/clear event to ensure the SPI file handle is properly closed.
writeEPD()andclearEPD()methods now handle all init, write and sleep operations automatically- it is no longer necessary to call
- added convenience static method
list_compatible()to print list of non-IT8951 boards
rework of Block and Layout modules to fix padding and text scaling
Block
- parent
Blockclass now consumes any unknownkwargs- this makes it much easier to pass any values from a
Layout.layoutobj.
- this makes it much easier to pass any values from a
- rewrite of text scaling to provide a cleaner image and crisper font rendering
- add
alignargument toBlock.TextBlockfor aligning text - fixed various padding issues (again)
- Switched to using
multiline_text()method of ImageDraw for better leading and line spacing
Layout
- Remove scale_x, scale_y from layouts
- this feature was not as useful as it appeared and is a pain to maintain
- update private methods:
_set_imagenow_set_blocks- removed
_check_keys _scalefontminor updates
- default values for expected/necessary
LayoutandBlockkwargs are now stored inconstants.layout_defaults - add property
mode"L" when any block is 8bit "1" when all blocks are 1bit
Screen
- now supports IT8951 based panels
Screen.epdobject is now supplied as a string, not an object- use
epdlib.Screen.list_compatible_modules()to show compatible waveshare_epd panels - use
Screen(epd='HD', vcom=[your IT8951 vcom (see ribon cable)]for IT8951 based panels
- use
Screen.writeEPD()now supports partial refresh on IT8951 panels for partial refresh of black & white pixels- use
writeEPD(image, partial=True) - partial refresh does not affect gray pixels
- use
Block
- now supports 8 bit grayscale images, text and background on IT8951 based panels
- previously 8 bit images were downscaled to dithered 1 bit images; this is still the case on 1 bit panels
- use
Block.mode = "L"for 8 bit support within a block
- now supports 8 bit fill and background on IT8951 panels
- use
Block.background=[0-255]andBlock.fill=[0-255]0 is black, 255 is fully white
- use
- padding now fully supported in all block types
- previosuly only worked properly on
ImageBlockobjects
- previosuly only worked properly on
Layout
- now supports the following features when specified in the layout dictionary:
'fill': 0-255specify text fill (8 bit gray 0 is black)'bkground: 0-255specify background color (8 bit gray 0 is black)'mode': "L"/"1"specify block image mode "L" 8 bit, "1" 1 bit
Screen.Screen()
- add property: rotation(
int): rotate the output image by 0, 90, -90 or 180 degrees
Layout.Layout()
- fix typos in example layout docstrings