diff --git a/guake/gsettings.py b/guake/gsettings.py index 2f60afa0e..766a3d451 100644 --- a/guake/gsettings.py +++ b/guake/gsettings.py @@ -72,8 +72,9 @@ def __init__(self, guake_inst): settings.style.onChangedValue('cursor-blink-mode', self.cursor_blink_mode_changed) settings.style.onChangedValue('cursor-shape', self.cursor_shape_changed) settings.general.onChangedValue('background-image-file', self.background_image_file_changed) - settings.general.onChangedValue('background-image-layout-mode', - self.background_image_layout_mode_changed) + settings.general.onChangedValue( + 'background-image-layout-mode', self.background_image_layout_mode_changed + ) settings.general.onChangedValue('use-scrollbar', self.scrollbar_toggled) settings.general.onChangedValue('history-size', self.history_size_changed) diff --git a/guake/guake_app.py b/guake/guake_app.py index 45555ef14..5fc9d7239 100644 --- a/guake/guake_app.py +++ b/guake/guake_app.py @@ -735,7 +735,9 @@ def load_config(self): self.settings.general, 'quick-open-command-line' ) self.settings.general.triggerOnChangedValue(self.settings.general, 'background-image-file') - self.settings.general.triggerOnChangedValue(self.settings.general, 'background-image-layout-mode') + self.settings.general.triggerOnChangedValue( + self.settings.general, 'background-image-layout-mode' + ) self.settings.style.triggerOnChangedValue(self.settings.style, 'cursor-shape') self.settings.styleFont.triggerOnChangedValue(self.settings.styleFont, 'style') self.settings.styleFont.triggerOnChangedValue(self.settings.styleFont, 'palette') diff --git a/guake/prefs.py b/guake/prefs.py index 63e5c91c6..8cb7cf712 100644 --- a/guake/prefs.py +++ b/guake/prefs.py @@ -634,8 +634,10 @@ def on_font_style_font_set(self, fbtn): self.settings.styleFont.set_string('style', fbtn.get_font_name()) def on_background_image_file_chooser_file_changed(self, fc): - self.settings.general.set_string('background-image-file', - fc.get_filename() if fc.get_filename() else '') + self.settings.general.set_string( + 'background-image-file', + fc.get_filename() if fc.get_filename() else '' + ) def on_background_image_file_remove_clicked(self, btn): filechooser = self.prefDlg.get_widget('background_image_filechooser') diff --git a/guake/utils.py b/guake/utils.py index 630c11704..89aeb5fd8 100644 --- a/guake/utils.py +++ b/guake/utils.py @@ -323,6 +323,7 @@ class ImageLayoutMode(enum.IntEnum): class BackgroundImageManager: + def __init__(self, window, filename=None, layout_mode=ImageLayoutMode.SCALE): self.window = window self.bg_surface = self.load_from_file(filename) if filename else None @@ -352,9 +353,7 @@ def load_from_file(self, filename): raise FileNotFoundError('Background file not found: %s' % (filename)) img = Gtk.Image.new_from_file(filename) pixbuf = img.get_pixbuf() - surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, - pixbuf.get_width(), - pixbuf.get_height()) + surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, pixbuf.get_width(), pixbuf.get_height()) cr = cairo.Context(surface) Gdk.cairo_set_source_pixbuf(cr, pixbuf, 0, 0) cr.set_operator(cairo.OPERATOR_SOURCE) @@ -414,9 +413,9 @@ def draw(self, widget, cr): # Step 1. Get target surface # (paint background image into widget size surface by layout mode) - surface = self.render_target(widget.get_allocated_width(), - widget.get_allocated_height(), - self.layout_mode) + surface = self.render_target( + widget.get_allocated_width(), widget.get_allocated_height(), self.layout_mode + ) cr.save() # Step 2. Paint target surface to context (in our case, the RootTerminalBox) @@ -433,9 +432,9 @@ def draw(self, widget, cr): # so we paint our child (again, in lifecycle view) into a similar surface. # child = widget.get_child() - child_surface = cr.get_target().create_similar(cairo.CONTENT_COLOR_ALPHA, - child.get_allocated_width(), - child.get_allocated_height()) + child_surface = cr.get_target().create_similar( + cairo.CONTENT_COLOR_ALPHA, child.get_allocated_width(), child.get_allocated_height() + ) child_cr = cairo.Context(child_surface) # Re-paint child draw into child context (which using child_surface as target)