From 8cc740c075322a09c850898397b5a4bab0bb6926 Mon Sep 17 00:00:00 2001 From: Balthasar Reuter Date: Wed, 9 May 2018 23:05:51 +0200 Subject: [PATCH] Add option to hide cursor --- photobooth/defaults.cfg | 2 ++ photobooth/gui/PyQt5Gui.py | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/photobooth/defaults.cfg b/photobooth/defaults.cfg index 6b93fad..f3030ff 100644 --- a/photobooth/defaults.cfg +++ b/photobooth/defaults.cfg @@ -7,6 +7,8 @@ fullscreen = False width = 1024 # Height of Photobooth (if not fullscreen) height = 600 +# Hide cursor +hide_cursor = False [Camera] # Camera module to use (python-gphoto2, gphoto2-cffi, gphoto2-commandline, opencv) diff --git a/photobooth/gui/PyQt5Gui.py b/photobooth/gui/PyQt5Gui.py index e04a2fa..fa5d993 100644 --- a/photobooth/gui/PyQt5Gui.py +++ b/photobooth/gui/PyQt5Gui.py @@ -120,6 +120,8 @@ class PyQt5Gui(Gui): self._p.handleKeypressEvent = lambda event : None self._lastState = self.showStart self._p.setCentralWidget(PyQt5Start(self)) + if QApplication.overrideCursor() != 0: + QApplication.restoreOverrideCursor() def showSettings(self): @@ -134,6 +136,8 @@ class PyQt5Gui(Gui): self._lastState = self.showStartPhotobooth self._transport.send('start') self._p.setCentralWidget(PyQt5WaitMessage('Starting the photobooth...')) + if cfg.getBool('Gui', 'hide_cursor'): + QApplication.setOverrideCursor(Qt.BlankCursor) def showIdle(self): @@ -328,6 +332,9 @@ class PyQt5Settings(QFrame): self._value_widgets['Gui']['module'] = self.createModuleComboBox(modules, cfg.get('Gui', 'module')) self._value_widgets['Gui']['width'] = QLineEdit(cfg.get('Gui', 'width')) self._value_widgets['Gui']['height'] = QLineEdit(cfg.get('Gui', 'height')) + self._value_widgets['Gui']['hide_cursor'] = QCheckBox('Hide cursor') + if cfg.getBool('Gui', 'hide_cursor'): + self._value_widgets['Gui']['hide_cursor'].toggle() layout = QFormLayout() layout.addRow(self._value_widgets['Gui']['fullscreen']) @@ -340,6 +347,8 @@ class PyQt5Settings(QFrame): sublayout_size.addWidget(self._value_widgets['Gui']['height']) layout.addRow(sublayout_size) + layout.addRow(self._value_widgets['Gui']['hide_cursor']) + widget = QGroupBox('Interface settings') widget.setLayout(layout) return widget @@ -510,6 +519,8 @@ class PyQt5Settings(QFrame): cfg.set('Gui', 'module', modules[self._value_widgets['Gui']['module'].currentIndex()][0]) cfg.set('Gui', 'width', self._value_widgets['Gui']['width'].text()) cfg.set('Gui', 'height', self._value_widgets['Gui']['height'].text()) + cfg.set('Gui', 'hide_cursor', str(self._value_widgets['Gui']['hide_cursor'].isChecked())) + cfg.set('Gpio', 'enable', str(self._value_widgets['Gpio']['enable'].isChecked())) cfg.set('Gpio', 'exit_pin', self._value_widgets['Gpio']['exit_pin'].text())