Skip to content

Commit

Permalink
Add an option in the config to start in fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
anxuae committed Feb 26, 2018
1 parent 1411581 commit 576d398
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ other configuration may work fine. All hardware buttons and lights are optional.
Hardware:
^^^^^^^^^

* 1 Raspberry Pi Model B+
* 1 Raspberry Pi 2 Model B (or higher)
* 1 Camera (Pi Camera v2.1 8 MP 1080p or any camera `compatible with gphoto2
<http://www.gphoto.org/proj/libgphoto2/support.php>`_)
* 2 push buttons
* 2 LED
* 2 resistor of 100 Ohm
* 2 LEDs
* 2 resistors of 100 Ohm

Software:
^^^^^^^^^
Expand Down Expand Up @@ -139,7 +139,7 @@ Below is the default configuration file:
debounce_delay = 0.3
[WINDOW]
# (width, height) of the display monitor
# (width, height) of the display monitor or 'fullscreen'
size = (800, 480)
# Blinking background when picture is taken
Expand Down
2 changes: 1 addition & 1 deletion pibooth/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"text_color": ((0, 0, 0), "Footer text RGB color"),
},
"WINDOW": {
"size": ((800, 480), "(Width, Height) of the display monitor"),
"size": ((800, 480), "(Width, Height) of the display monitor or 'fullscreen'"),
"flash": (True, "Blinking background when picture is taken"),
"preview_delay": (3, "How long is the preview in seconds"),
"preview_countdown": (True, "Show a countdown timer during the preview"),
Expand Down
14 changes: 11 additions & 3 deletions pibooth/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,21 @@ class PtbWindow(object):
"""

def __init__(self, title, size, use_buffer):
self.__size = size
if isinstance(size, str) and size.lower() == 'fullscreen':
self.__size = (800, 480)
elif isinstance(size, (tuple, list)):
self.__size = size
else:
raise TypeError("Invalid size '{}' ({})".format(size, type(size)))

# Save the desktop mode, shall be done before `setmode` (SDL 1.2.10, and pygame 1.8.0)
info = pygame.display.Info()

pygame.display.set_caption(title)
self.surface = pygame.display.set_mode(size, pygame.RESIZABLE)
self.display_size = (info.current_w, info.current_h)
self.is_fullscreen = False
self.use_buffer = use_buffer
self.display_size = (info.current_w, info.current_h)
self.surface = pygame.display.set_mode(self.__size, pygame.RESIZABLE)

self._buffered_images = {}
self._current_background = None
Expand All @@ -33,6 +38,9 @@ def __init__(self, title, size, use_buffer):
'right': self._right_pos,
'left': self._left_pos}

if isinstance(size, str) and size.lower() == 'fullscreen':
self.toggle_fullscreen()

def _clear(self):
"""Clear the window content.
"""
Expand Down

0 comments on commit 576d398

Please sign in to comment.