Skip to content

Commit

Permalink
Format source code by black
Browse files Browse the repository at this point in the history
  • Loading branch information
mlouielu committed Sep 7, 2021
1 parent 2749668 commit 040fdbe
Show file tree
Hide file tree
Showing 17 changed files with 249 additions and 258 deletions.
6 changes: 5 additions & 1 deletion guake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ def vte_version():

from gi.repository import Vte

s = "{}.{}.{}".format(Vte.MAJOR_VERSION, Vte.MINOR_VERSION, Vte.MICRO_VERSION,)
s = "{}.{}.{}".format(
Vte.MAJOR_VERSION,
Vte.MINOR_VERSION,
Vte.MICRO_VERSION,
)
return s


Expand Down
3 changes: 1 addition & 2 deletions guake/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@

class AboutDialog(SimpleGladeApp):

"""The About Guake dialog class
"""
"""The About Guake dialog class"""

def __init__(self):
super().__init__(gladefile("about.glade"), root="aboutdialog")
Expand Down
38 changes: 18 additions & 20 deletions guake/boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,16 @@ def __init__(self, guake, parent_notebook):
self._add_search_box()

def _add_search_box(self):
""" --------------------------------------|
| Revealer |
| |-----------------------------------|
| | Frame |
| | |---------------------------------|
| | | HBox |
| | | |---| |-------| |----| |------| |
| | | | x | | Entry | |Prev| | Next | |
| | | |---| |-------| |----| |------| |
--------------------------------------|
"""--------------------------------------|
| Revealer |
| |-----------------------------------|
| | Frame |
| | |---------------------------------|
| | | HBox |
| | | |---| |-------| |----| |------| |
| | | | x | | Entry | |Prev| | Next | |
| | | |---| |-------| |----| |------| |
--------------------------------------|
"""
self.search_revealer = Gtk.Revealer()
self.search_frame = Gtk.Frame(name="search-frame")
Expand Down Expand Up @@ -127,7 +127,9 @@ def _add_search_box(self):
b"#search-frame border {" b" padding: 5px 5px 5px 5px;" b" border: none;" b"}"
)
Gtk.StyleContext.add_provider_for_screen(
Gdk.Screen.get_default(), css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION,
Gdk.Screen.get_default(),
css_provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION,
)

# Add to revealer
Expand Down Expand Up @@ -202,7 +204,7 @@ def get_root_box(self):

def save_box_layout(self, box, panes: list):
"""Save box layout with pre-order traversal, it should result `panes` with
a full binary tree in list.
a full binary tree in list.
"""
if not box:
panes.append({"type": None, "directory": None})
Expand All @@ -224,8 +226,7 @@ def save_box_layout(self, box, panes: list):
)

def restore_box_layout(self, box, panes: list):
"""Restore box layout by `panes`
"""
"""Restore box layout by `panes`"""
if not panes or not isinstance(panes, list):
return
if not box or not isinstance(box, TerminalBox):
Expand Down Expand Up @@ -392,16 +393,14 @@ def do_search(self, widget):

class TerminalBox(Gtk.Box, TerminalHolder):

"""A box to group the terminal and a scrollbar.
"""
"""A box to group the terminal and a scrollbar."""

def __init__(self):
super().__init__(orientation=Gtk.Orientation.HORIZONTAL)
self.terminal = None

def set_terminal(self, terminal):
"""Packs the terminal widget.
"""
"""Packs the terminal widget."""
if self.terminal is not None:
raise RuntimeError("TerminalBox: terminal already set")
self.terminal = terminal
Expand All @@ -419,8 +418,7 @@ def set_terminal(self, terminal):
self.add_scroll_bar()

def add_scroll_bar(self):
"""Packs the scrollbar.
"""
"""Packs the scrollbar."""
adj = self.terminal.get_vadjustment()
self.scroll = Gtk.VScrollbar(adj)
self.scroll.show()
Expand Down
2 changes: 1 addition & 1 deletion guake/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def get_binaries_from_path(compiled_re):


def shell_quote(text):
""" quote text (filename) for inserting into a shell """
"""quote text (filename) for inserting into a shell"""
return r"\'".join("'%s'" % p for p in text.split("'"))


Expand Down
26 changes: 16 additions & 10 deletions guake/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ def __init__(self, window, current_name):
_("Rename tab"),
window,
Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT, Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT,),
(
Gtk.STOCK_CANCEL,
Gtk.ResponseType.REJECT,
Gtk.STOCK_OK,
Gtk.ResponseType.ACCEPT,
),
)
self.entry = Gtk.Entry()
self.entry.set_text(current_name)
Expand All @@ -35,8 +40,7 @@ def get_text(self):

class PromptQuitDialog(Gtk.MessageDialog):

"""Prompts the user whether to quit/close a tab.
"""
"""Prompts the user whether to quit/close a tab."""

def __init__(self, parent, procs, tabs, notebooks):
super().__init__(
Expand Down Expand Up @@ -72,8 +76,7 @@ def __init__(self, parent, procs, tabs, notebooks):
self.format_secondary_markup("<b>{0}{1}{2}.</b>".format(proc_str, tab_str, notebooks_str))

def quit(self):
"""Run the "are you sure" dialog for quitting Guake
"""
"""Run the "are you sure" dialog for quitting Guake"""
# Stop an open "close tab" dialog from obstructing a quit
response = self.run() == Gtk.ResponseType.YES
self.destroy()
Expand All @@ -93,8 +96,7 @@ def close_tab(self):

class PromptResetColorsDialog(Gtk.MessageDialog):

"""Prompts the user whether to reset tab colors.
"""
"""Prompts the user whether to reset tab colors."""

def __init__(self, parent):
super().__init__(
Expand All @@ -109,8 +111,7 @@ def __init__(self, parent):
self.set_markup(primary_msg)

def reset_tab_custom_colors(self):
"""Run the "are you sure" dialog for resetting tab colors
"""
"""Run the "are you sure" dialog for resetting tab colors"""
# Stop an open "close tab" dialog from obstructing a quit
response = self.run() == Gtk.ResponseType.YES
self.destroy()
Expand All @@ -126,7 +127,12 @@ def __init__(self, terminal, window):
_("Save to..."),
window,
Gtk.FileChooserAction.SAVE,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_SAVE, Gtk.ResponseType.OK,),
(
Gtk.STOCK_CANCEL,
Gtk.ResponseType.CANCEL,
Gtk.STOCK_SAVE,
Gtk.ResponseType.OK,
),
)
self.set_default_response(Gtk.ResponseType.OK)
self.terminal = terminal
Expand Down
6 changes: 5 additions & 1 deletion guake/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ def is_run_from_git_workdir():
r"^\s*File\s\".*\",\sline\s[0-9]+",
r"^\s*File\s\"(.*)\",\sline\s([0-9]+)",
),
("Python pytest report", r"^\s.*\:\:[a-zA-Z0-9\_]+\s", r"^\s*(.*\:\:[a-zA-Z0-9\_]+)\s",),
(
"Python pytest report",
r"^\s.*\:\:[a-zA-Z0-9\_]+\s",
r"^\s*(.*\:\:[a-zA-Z0-9\_]+)\s",
),
(
"line starts by 'ERROR in Filename:line' pattern (GCC/make). File path should exists.",
r"\s.\S[^\s\s].[a-zA-Z0-9\/\_\-\.\ ]+\.?[a-zA-Z0-9]+\:[0-9]+",
Expand Down
9 changes: 3 additions & 6 deletions guake/gsettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ def ontop_toggled(self, settings, key, user_data):
self.guake.window.set_keep_above(settings.get_boolean(key))

def tab_ontop_toggled(self, settings, key, user_data):
""" tab_ontop changed
"""
"""tab_ontop changed"""
self.guake.set_tab_position()

def tabbar_toggled(self, settings, key, user_data):
Expand Down Expand Up @@ -153,8 +152,7 @@ def size_changed(self, settings, key, user_data):
RectCalculator.set_final_window_rect(self.settings, self.guake.window)

def cursor_blink_mode_changed(self, settings, key, user_data):
"""Called when cursor blink mode settings has been changed
"""
"""Called when cursor blink mode settings has been changed"""
terminal = (
self.guake.notebook_manager.get_terminal_by_uuid(user_data.get("terminal_uuid"))
if user_data
Expand All @@ -165,8 +163,7 @@ def cursor_blink_mode_changed(self, settings, key, user_data):
term.set_property("cursor-blink-mode", settings.get_int(key))

def cursor_shape_changed(self, settings, key, user_data):
"""Called when the cursor shape settings has been changed
"""
"""Called when the cursor shape settings has been changed"""
terminal = (
self.guake.notebook_manager.get_terminal_by_uuid(user_data.get("terminal_uuid"))
if user_data
Expand Down
Loading

0 comments on commit 040fdbe

Please sign in to comment.