From cb54c2d8b252d4e4d499d8437dbc19060be8c884 Mon Sep 17 00:00:00 2001 From: Balthasar Reuter Date: Thu, 5 Jul 2018 17:06:33 +0200 Subject: [PATCH] flake8 compliance --- photobooth/Photobooth.py | 4 ++-- photobooth/camera/CameraGphoto2Cffi.py | 20 +++++++++++--------- photobooth/gui/GuiPostprocessor.py | 13 +++++-------- photobooth/gui/__init__.py | 2 +- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/photobooth/Photobooth.py b/photobooth/Photobooth.py index 5f53478..556f5be 100644 --- a/photobooth/Photobooth.py +++ b/photobooth/Photobooth.py @@ -54,8 +54,8 @@ class Photobooth: self._cap = camera self._pic_dims = PictureDimensions(config, self._cap.getPicture().size) - if (config.getBool('Photobooth', 'show_preview') - and self._cap.hasPreview): + if (config.getBool('Photobooth', 'show_preview') and + self._cap.hasPreview): logging.info('Countdown with preview activated') self._show_counter = self.showCountdownPreview else: diff --git a/photobooth/camera/CameraGphoto2Cffi.py b/photobooth/camera/CameraGphoto2Cffi.py index a00d713..4f93e5a 100644 --- a/photobooth/camera/CameraGphoto2Cffi.py +++ b/photobooth/camera/CameraGphoto2Cffi.py @@ -42,8 +42,8 @@ class CameraGphoto2Cffi(Camera): def cleanup(self): - self._cap.config['imgsettings']['imageformat'].set(self._imageformat) - self._cap.config['imgsettings']['imageformatsd'].set(self._imageformatsd) + self._cap.config['imgsettings']['imageformat'].set(self._imgfmt) + self._cap.config['imgsettings']['imageformatsd'].set(self._imgfmtsd) # self._cap.config['settings']['autopoweroff'].set(self._autopoweroff) def _setupCamera(self): @@ -53,16 +53,18 @@ class CameraGphoto2Cffi(Camera): self._cap.supported_operations) # make sure camera format is not set to raw - self._imageformat = self._cap.config['imgsettings']['imageformat'].value - if 'raw' in self._imageformat.lower(): - self._cap.config['imgsettings']['imageformat'].set('Large Fine JPEG') - self._imageformatsd = self._cap.config['imgsettings']['imageformatsd'].value - if 'raw' in self._imageformatsd.lower(): - self._cap.config['imgsettings']['imageformatsd'].set('Large Fine JPEG') + imgfmt = 'Large Fine JPEG' + self._imgfmt = self._cap.config['imgsettings']['imageformat'].value + if 'raw' in self._imgfmt.lower(): + self._cap.config['imgsettings']['imageformat'].set(imgfmt) + self._imgfmtsd = self._cap.config['imgsettings']['imageformatsd'].value + if 'raw' in self._imgfmtsd.lower(): + self._cap.config['imgsettings']['imageformatsd'].set(imgfmt) # make sure autopoweroff is disabled # this doesn't seem to work - # self._autopoweroff = int(self._cap.config['settings']['autopoweroff'].value) + # self._autopoweroff = int( + # self._cap.config['settings']['autopoweroff'].value) # if self._autopoweroff > 0: # self._cap.config['settings']['autopoweroff'].set("0") diff --git a/photobooth/gui/GuiPostprocessor.py b/photobooth/gui/GuiPostprocessor.py index 86e3ac8..e9695c9 100644 --- a/photobooth/gui/GuiPostprocessor.py +++ b/photobooth/gui/GuiPostprocessor.py @@ -17,8 +17,6 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -import queue - from .. import printer from ..util import lookup_and_import @@ -30,13 +28,12 @@ class GuiPostprocessor: super().__init__() self._task_list = [] - self._queue = queue.Queue() if config.getBool('Printer', 'enable'): module = config.get('Printer', 'module') - size = (config.getInt('Printer', 'width'), - config.getInt('Printer', 'height')) - self._task_list.append(PrintPostprocess(module, size)) + paper_size = (config.getInt('Printer', 'width'), + config.getInt('Printer', 'height')) + self._task_list.append(PrintPostprocess(module, paper_size)) def get(self, picture): @@ -92,12 +89,12 @@ class PostprocessItem: class PrintPostprocess(PostprocessTask): - def __init__(self, printer_module, page_size, **kwargs): + def __init__(self, printer_module, paper_size, **kwargs): super().__init__(**kwargs) Printer = lookup_and_import(printer.modules, printer_module, 'printer') - self._printer = Printer(page_size, True) + self._printer = Printer(paper_size, True) def get(self, picture): diff --git a/photobooth/gui/__init__.py b/photobooth/gui/__init__.py index 6d7762d..52da56b 100644 --- a/photobooth/gui/__init__.py +++ b/photobooth/gui/__init__.py @@ -17,7 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -from . import GuiState # noqa +from . import GuiState # noqa # Available gui modules as tuples of (config name, module name, class name) modules = (('PyQt5', 'Qt5Gui', 'PyQt5Gui'), )