Skip to content

Commit

Permalink
Pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
mlouielu committed May 16, 2019
1 parent 046a116 commit 74645dc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
5 changes: 3 additions & 2 deletions guake/gsettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion guake/guake_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
6 changes: 4 additions & 2 deletions guake/prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
17 changes: 8 additions & 9 deletions guake/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 74645dc

Please sign in to comment.