def test_init_mock_phat_black(tkinter, PIL): """Test initialisation of InkyMockPHAT with 'black' colour choice.""" from inky import InkyMockPHAT InkyMockPHAT('black')
args = parser.parse_args() if args.mock: import sys sys.path.insert(0, '../library') from inky import InkyMockPHAT as InkyPHAT from inky import InkyMockWHAT as InkyWHAT else: from inky import InkyWHAT, InkyPHAT colour = args.colour # Set up the correct display and scaling factors if args.type == "phat": inky_display = InkyPHAT(colour) elif args.type == "what": inky_display = InkyWHAT(colour) inky_display.set_border(inky_display.BLACK) # Pick the correct logo image to show depending on display type/colour if args.type == "phat": if colour == 'black': img = Image.open("phat/resources/InkypHAT-212x104-bw.png") else: img = Image.open("phat/resources/InkypHAT-212x104.png") elif args.type == "what": if colour == 'black': img = Image.open("what/resources/InkywHAT-400x300-bw.png")
def test_mock_phat_no_pil(tkinter): """Test initialisation of InkyMockPHAT without PIL.""" from inky import InkyMockPHAT with pytest.raises(ImportError): InkyMockPHAT('black')
help="ePaper display colour") parser.add_argument('--name', '-n', type=str, required=True, help="Your name") args = parser.parse_args() if args.mock: from inky import InkyMockPHAT as InkyPHAT from inky import InkyMockWHAT as InkyWHAT else: from inky import InkyWHAT, InkyPHAT, InkyPHAT_SSD1608 colour = args.colour # Set up the correct display and scaling factors if args.type == "phat": inky_display = InkyPHAT(colour) scale_size = 1 padding = 0 elif args.type == "phatssd1608": inky_display = InkyPHAT_SSD1608(colour) scale_size = 1 padding = 0 elif args.type == "what": inky_display = InkyWHAT(colour) scale_size = 2.20 padding = 15 else: from inky.auto import auto inky_display = auto() scale_size = 1 padding = 0
args = parser.parse_args() if args.mock: import sys sys.path.insert(0, '../library') from inky import InkyMockPHAT as InkyPHAT from inky import InkyMockWHAT as InkyWHAT else: from inky import InkyWHAT, InkyPHAT colour = args.colour # Set up the correct display and scaling factors if args.type == "phat": inky_display = InkyPHAT(colour) scale_size = 1 padding = 0 elif args.type == "what": inky_display = InkyWHAT(colour) scale_size = 2.20 padding = 15 # inky_display.set_rotation(180) inky_display.set_border(inky_display.RED) # Create a new canvas to draw on img = Image.new("P", (inky_display.WIDTH, inky_display.HEIGHT)) draw = ImageDraw.Draw(img)