diff --git a/photobooth/camera/PictureDimensions.py b/photobooth/camera/PictureDimensions.py index 8ed94f8..cce5bde 100644 --- a/photobooth/camera/PictureDimensions.py +++ b/photobooth/camera/PictureDimensions.py @@ -33,6 +33,8 @@ class PictureDimensions: self._min_distance = (config.getInt('Picture', 'min_dist_x'), config.getInt('Picture', 'min_dist_y')) + self._skip_last = config.getBool('Picture', 'skip_last') + self.computeThumbnailDimensions() def computeThumbnailDimensions(self): @@ -64,7 +66,13 @@ class PictureDimensions: @property def totalNumPictures(self): - return self._num_pictures[0] * self._num_pictures[1] + return max(self._num_pictures[0] * self._num_pictures[1] - + int(self._skip_last), 1) + + @property + def skipLast(self): + + return self._skip_last @property def captureSize(self): diff --git a/photobooth/gui/Qt5Gui/Frames.py b/photobooth/gui/Qt5Gui/Frames.py index ab868ff..c421e6f 100644 --- a/photobooth/gui/Qt5Gui/Frames.py +++ b/photobooth/gui/Qt5Gui/Frames.py @@ -103,15 +103,17 @@ class IdleMessage(QtWidgets.QFrame): class GreeterMessage(QtWidgets.QFrame): - def __init__(self, num_x, num_y, countdown_action): + def __init__(self, num_x, num_y, skip_last, countdown_action): super().__init__() self.setObjectName('GreeterMessage') self._text_title = 'Get ready!' self._text_button = 'Start countdown' - if num_x * num_y > 1: - self._text_label = ('for {} pictures...'.format(num_x * num_y)) + + num_pictures = max(num_x * num_y - int(skip_last), 1) + if num_pictures > 1: + self._text_label = ('for {} pictures...'.format(num_pictures)) else: self._text_label = '' @@ -686,7 +688,7 @@ class Settings(QtWidgets.QFrame): def file_dialog(): dialog = QtWidgets.QFileDialog.getOpenFileName bg.setText(dialog(self, 'Select file', os.path.expanduser('~'), - 'Images (*.jpg *.png)')[0]) + 'Images (*.jpg *.png)')[0]) dir_button = QtWidgets.QPushButton('Select directory') dir_button.clicked.connect(directory_dialog) diff --git a/photobooth/gui/Qt5Gui/PyQt5Gui.py b/photobooth/gui/Qt5Gui/PyQt5Gui.py index 03836b5..5dd3bfd 100644 --- a/photobooth/gui/Qt5Gui/PyQt5Gui.py +++ b/photobooth/gui/Qt5Gui/PyQt5Gui.py @@ -179,10 +179,11 @@ class PyQt5Gui(GuiSkeleton): num_pic = (self._cfg.getInt('Picture', 'num_x'), self._cfg.getInt('Picture', 'num_y')) + skip_last = self._cfg.getBool('Picture', 'skip_last') greeter_time = self._cfg.getInt('Photobooth', 'greeter_time') * 1000 self._setWidget(Frames.GreeterMessage( - *num_pic, + *num_pic, skip_last, lambda: self._comm.send(Workers.MASTER, GuiEvent('countdown')))) QtCore.QTimer.singleShot( greeter_time,