Skip to content

Commit

Permalink
various fixes for reported bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
paddywwoof committed Aug 6, 2024
1 parent 1bbc527 commit 796ee85
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/picframe/config/configuration_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ viewer:
display_w: null # width of display surface (null->None will use max returned by hardware)
display_h: null # height of display surface
display_power: 0 # default=0. choices={0, 1}, 0 will use legacy `vcgencmd` and 1 will use `xset` to blank the display
use_glx: False # default=False. Set to True on linux with xserver running
use_glx: False # default=False. Set to True on linux with xserver running. NB use_sdl2 might need to be False for this to work.
use_sdl2: True # default=True. pysdl2 can use display without xserver, it is installed as a dependency of pi3d

mat_images: 0.01 # default=0.01, True, automatically mat all images. False, don't automatically mat any images. Real value, auto-mat all images with aspect ratio difference > than value
mat_type: null # default=null, A string containing the mat types to choose from when matting images. It can consist of any or
Expand Down
3 changes: 2 additions & 1 deletion src/picframe/interface_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,5 @@ def __init__(
t.start()

def stop(self):
self.shutdown()
t = threading.Thread(target=self.shutdown, daemon=True)
t.start()
2 changes: 1 addition & 1 deletion src/picframe/interface_mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ def on_message(self, client, userdata, message): # noqa: C901

# stop loops and end program
elif message.topic == self.__device_id + "/stop":
self.__controller.keep_looping = False
self.__controller.stop()

def publish_state(self, image=None, image_attr=None):
"""
Expand Down
7 changes: 4 additions & 3 deletions src/picframe/viewer_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def __init__(self, config):
self.__display_w = None if config['display_w'] is None else int(config['display_w'])
self.__display_h = None if config['display_h'] is None else int(config['display_h'])
self.__display_power = int(config['display_power'])
self.__use_sdl2 = config['use_sdl2']
self.__use_glx = config['use_glx']
self.__alpha = 0.0 # alpha - proportion front image to back
self.__delta_alpha = 1.0
Expand Down Expand Up @@ -314,12 +315,12 @@ def __tex_load(self, pics, size=None): # noqa: C901
(w, h) = (round(size[0] / sc_b / self.__blur_zoom), round(size[1] / sc_b / self.__blur_zoom))
(x, y) = (round(0.5 * (im.size[0] - w)), round(0.5 * (im.size[1] - h)))
box = (x, y, x + w, y + h)
blr_sz = (int(x * 512 / size[0]) for x in size)
blr_sz = [int(x * 512 / size[0]) for x in size]
im_b = im.resize(size, resample=0, box=box).resize(blr_sz)
im_b = im_b.filter(ImageFilter.GaussianBlur(self.__blur_amount))
im_b = im_b.resize(size, resample=Image.BICUBIC)
im_b.putalpha(round(255 * self.__edge_alpha)) # to apply the same EDGE_ALPHA as the no blur method.
im = im.resize((int(x * sc_f) for x in im.size), resample=Image.BICUBIC)
im = im.resize([int(x * sc_f) for x in im.size], resample=Image.BICUBIC)
"""resize can use Image.LANCZOS (alias for Image.ANTIALIAS) for resampling
for better rendering of high-contranst diagonal lines. NB downscaled large
images are rescaled near the start of this try block if w or h > max_dimension
Expand Down Expand Up @@ -430,7 +431,7 @@ def slideshow_start(self):
self.__display = pi3d.Display.create(x=self.__display_x, y=self.__display_y,
w=self.__display_w, h=self.__display_h, frames_per_second=self.__fps,
display_config=pi3d.DISPLAY_CONFIG_HIDE_CURSOR,
background=self.__background, use_glx=self.__use_glx)
background=self.__background, use_glx=self.__use_glx, use_sdl2=self.__use_sdl2)
camera = pi3d.Camera(is_3d=False)
shader = pi3d.Shader(self.__shader)
self.__slide = pi3d.Sprite(camera=camera, w=self.__display.width, h=self.__display.height, z=5.0)
Expand Down

0 comments on commit 796ee85

Please sign in to comment.