Added overwrite error message that is displayed instead of the actual error. Error message itself is still logged. Closes #34
This commit is contained in:
@@ -33,7 +33,6 @@ chan_r_pin = 27
|
||||
# BOARD pin (BCM pin 22) switches the green channel
|
||||
chan_g_pin = 22
|
||||
|
||||
|
||||
[Printer]
|
||||
# Enable printing (True/False)
|
||||
enable = True
|
||||
@@ -59,6 +58,8 @@ countdown_time = 8
|
||||
display_time = 5
|
||||
# Timeout for postprocessing (shown after review)
|
||||
postprocess_time = 60
|
||||
# Overwrite displayed error message (Leave empty for none)
|
||||
overwrite_error_message =
|
||||
|
||||
[Picture]
|
||||
# Basedir of output pictures
|
||||
|
||||
@@ -588,12 +588,17 @@ class Settings(QtWidgets.QFrame):
|
||||
'postprocess_time'))
|
||||
self.add('Photobooth', 'postprocess_time', postproc_time)
|
||||
|
||||
err_msg = QtWidgets.QLineEdit(
|
||||
self._cfg.get('Photobooth', 'overwrite_error_message'))
|
||||
self.add('Photobooth', 'overwrite_error_message', err_msg)
|
||||
|
||||
layout = QtWidgets.QFormLayout()
|
||||
layout.addRow(_('Show preview during countdown:'), preview)
|
||||
layout.addRow(_('Greeter time before countdown [s]:'), greet_time)
|
||||
layout.addRow(_('Countdown time [s]:'), count_time)
|
||||
layout.addRow(_('Picture display time [s]:'), displ_time)
|
||||
layout.addRow(_('Postprocess timeout [s]:'), postproc_time)
|
||||
layout.addRow(_('Overwrite displayed error message:'), err_msg)
|
||||
|
||||
widget = QtWidgets.QWidget()
|
||||
widget.setLayout(layout)
|
||||
@@ -746,11 +751,32 @@ class Settings(QtWidgets.QFrame):
|
||||
lamp_pin.setValue(self._cfg.getInt('Gpio', 'lamp_pin'))
|
||||
self.add('Gpio', 'lamp_pin', lamp_pin)
|
||||
|
||||
chan_r_pin = QtWidgets.QSpinBox()
|
||||
chan_r_pin.setRange(1, 40)
|
||||
chan_r_pin.setValue(self._cfg.getInt('Gpio', 'chan_r_pin'))
|
||||
self.add('Gpio', 'chan_r_pin', chan_r_pin)
|
||||
|
||||
chan_g_pin = QtWidgets.QSpinBox()
|
||||
chan_g_pin.setRange(1, 40)
|
||||
chan_g_pin.setValue(self._cfg.getInt('Gpio', 'chan_g_pin'))
|
||||
self.add('Gpio', 'chan_g_pin', chan_r_pin)
|
||||
|
||||
chan_b_pin = QtWidgets.QSpinBox()
|
||||
chan_b_pin.setRange(1, 40)
|
||||
chan_b_pin.setValue(self._cfg.getInt('Gpio', 'chan_b_pin'))
|
||||
self.add('Gpio', 'chan_b_pin', chan_b_pin)
|
||||
|
||||
lay_rgb = QtWidgets.QHBoxLayout()
|
||||
lay_rgb.addWidget(chan_r_pin)
|
||||
lay_rgb.addWidget(chan_g_pin)
|
||||
lay_rgb.addWidget(chan_b_pin)
|
||||
|
||||
layout = QtWidgets.QFormLayout()
|
||||
layout.addRow(_('Enable GPIO:'), enable)
|
||||
layout.addRow(_('Exit button pin (BCM numbering):'), exit_pin)
|
||||
layout.addRow(_('Trigger button pin (BCM numbering):'), trig_pin)
|
||||
layout.addRow(_('Idle lamp pin (BCM numbering):'), lamp_pin)
|
||||
layout.addRow(_('RGB LED pins (BCM numbering):'), lay_rgb)
|
||||
|
||||
widget = QtWidgets.QWidget()
|
||||
widget.setLayout(layout)
|
||||
@@ -824,6 +850,8 @@ class Settings(QtWidgets.QFrame):
|
||||
str(self.get('Photobooth', 'display_time').text()))
|
||||
self._cfg.set('Photobooth', 'postprocess_time',
|
||||
str(self.get('Photobooth', 'postprocess_time').text()))
|
||||
self._cfg.set('Photobooth', 'overwrite_error_message',
|
||||
self.get('Photobooth', 'overwrite_error_message').text())
|
||||
|
||||
self._cfg.set('Camera', 'module',
|
||||
camera.modules[self.get('Camera',
|
||||
@@ -856,6 +884,12 @@ class Settings(QtWidgets.QFrame):
|
||||
self._cfg.set('Gpio', 'trigger_pin',
|
||||
self.get('Gpio', 'trigger_pin').text())
|
||||
self._cfg.set('Gpio', 'lamp_pin', self.get('Gpio', 'lamp_pin').text())
|
||||
self._cfg.set('Gpio', 'chan_r_pin',
|
||||
self.get('Gpio', 'chan_r_pin').text())
|
||||
self._cfg.set('Gpio', 'chan_g_pin',
|
||||
self.get('Gpio', 'chan_g_pin').text())
|
||||
self._cfg.set('Gpio', 'chan_b_pin',
|
||||
self.get('Gpio', 'chan_b_pin').text())
|
||||
|
||||
self._cfg.set('Printer', 'enable',
|
||||
str(self.get('Printer', 'enable').isChecked()))
|
||||
|
||||
@@ -146,8 +146,14 @@ class PyQt5Gui(GuiSkeleton):
|
||||
|
||||
logging.error('%s: %s', state.origin, state.message)
|
||||
|
||||
err_msg = self._cfg.get('Photobooth', 'overwrite_error_message')
|
||||
if len(err_msg) > 0:
|
||||
message = err_msg
|
||||
else:
|
||||
message = 'Error: ' + state.message
|
||||
|
||||
reply = QtWidgets.QMessageBox.critical(
|
||||
self._gui, state.origin, 'Error: ' + state.message,
|
||||
self._gui, state.origin, message,
|
||||
QtWidgets.QMessageBox.Retry | QtWidgets.QMessageBox.Cancel,
|
||||
QtWidgets.QMessageBox.Cancel)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user