diff --git a/lutris/game.py b/lutris/game.py index df905a014a..345cf397e7 100644 --- a/lutris/game.py +++ b/lutris/game.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -*- coding:Utf-8 -*- -""" Module that actually runs the games. """ +"""Module that actually runs the games.""" import os import time import shutil diff --git a/lutris/gui/config_dialogs.py b/lutris/gui/config_dialogs.py index 7cba54fb03..b8f5b0de10 100644 --- a/lutris/gui/config_dialogs.py +++ b/lutris/gui/config_dialogs.py @@ -1,4 +1,4 @@ -""" Configuration dialogs """ +"""Configuration dialogs""" from gi.repository import Gtk from lutris.config import LutrisConfig @@ -99,11 +99,11 @@ def build_action_area(self, label, button_callback): self.action_area.pack_start(button, True, True, 0) def on_cancel_clicked(self, widget=None): - """Dialog destroy callback""" + """Dialog destroy callback.""" self.destroy() def on_save(self, _button): - """OK button pressed in the Add Game Dialog""" + """OK button pressed in the Add Game Dialog.""" name = self.name_entry.get_text() self.lutris_config.config["realname"] = name self.lutris_config.config["runner"] = self.runner_name @@ -122,7 +122,7 @@ def on_save(self, _button): class AddGameDialog(Gtk.Dialog, GameDialogCommon): - """Add game dialog class""" + """Add game dialog class.""" def __init__(self, parent, game=None): super(AddGameDialog, self).__init__() @@ -153,7 +153,7 @@ def __init__(self, parent, game=None): self.run() def on_runner_changed(self, widget): - """Action called when runner drop down is changed""" + """Action called when runner drop down is changed.""" runner_index = widget.get_active() current_page = self.notebook.get_current_page() self.clear_tabs() @@ -172,7 +172,7 @@ def on_runner_changed(self, widget): class EditGameConfigDialog(Gtk.Dialog, GameDialogCommon): - """Game config edit dialog""" + """Game config edit dialog.""" def __init__(self, parent, game): super(EditGameConfigDialog, self).__init__() self.parent_window = parent @@ -195,7 +195,7 @@ def __init__(self, parent, game): class RunnerConfigDialog(Gtk.Dialog): - """Runners management dialog""" + """Runners management dialog.""" def __init__(self, runner): Gtk.Dialog.__init__(self) runner_name = runner.__class__.__name__ diff --git a/lutris/gui/lutriswindow.py b/lutris/gui/lutriswindow.py index b09564917b..a8bd8ed395 100644 --- a/lutris/gui/lutriswindow.py +++ b/lutris/gui/lutriswindow.py @@ -1,4 +1,4 @@ -""" Main window for the Lutris interface """ +"""Main window for the Lutris interface.""" # pylint: disable=E0611 import os import subprocess @@ -40,7 +40,7 @@ def load_view(view, games=[], filter_text=None, icon_type=None): class LutrisWindow(object): - """Handler class for main window signals""" + """Handler class for main window signals.""" def __init__(self): ui_filename = os.path.join( @@ -168,7 +168,7 @@ def sync_icons(self): callback=self.on_image_downloaded) def connect_signals(self): - """Connects signals from the view with the main window. + """Connect signals from the view with the main window. This must be called each time the view is rebuilt. """ self.view.connect('game-installed', self.on_game_installed) @@ -177,7 +177,7 @@ def connect_signals(self): self.window.connect("configure-event", self.get_size) def get_icon_type(self, view_type): - """Returns the icon style depending on the type of view""" + """Return the icon style depending on the type of view.""" if view_type == 'icon': icon_type = settings.read_setting('icon_type_iconview') default = settings.ICON_TYPE_ICONVIEW @@ -192,7 +192,7 @@ def get_size(self, widget, _): self.window_size = widget.get_size() def refresh_status(self): - """Refresh status bar""" + """Refresh status bar.""" if self.running_game: if hasattr(self.running_game.game_thread, "pid"): pid = self.running_game.game_thread.pid @@ -215,7 +215,7 @@ def refresh_status(self): return True def about(self, _widget, _data=None): - """Opens the about dialog""" + """Open the about dialog.""" dialogs.AboutDialog() def on_remove_game(self, _widget, _data=None): @@ -231,7 +231,7 @@ def on_game_deleted(self, game_slug, from_library=False): # Callbacks def on_connect(self, *args): - """Callback when a user connects to his account""" + """Callback when a user connects to his account.""" login_dialog = dialogs.ClientLoginDialog() login_dialog.connect('connected', self.on_connect_success) @@ -241,7 +241,7 @@ def on_connect_success(self, dialog, token): self.sync_library() def on_destroy(self, *args): - """Signal for window close""" + """Signal for window close.""" view_type = 'icon' if 'IconView' in str(type(self.view)) else 'list' settings.write_setting('view_type', view_type) width, height = self.window_size @@ -254,11 +254,11 @@ def on_game_installed(self, widget, slug): widget.update_image(slug, is_installed=True) def on_runners_activate(self, _widget, _data=None): - """Callback when manage runners is activated""" + """Callback when manage runners is activated.""" RunnersDialog() def on_preferences_activate(self, _widget, _data=None): - """Callback when preferences is activated""" + """Callback when preferences is activated.""" SystemConfigDialog() def on_show_installed_games_toggled(self, widget, data=None): @@ -280,7 +280,7 @@ def on_search_entry_changed(self, widget): self.view.emit('filter-updated', widget.get_text()) def on_game_clicked(self, *args): - """Launch a game""" + """Launch a game.""" game_slug = self.view.selected_game if game_slug: self.running_game = Game(game_slug) @@ -305,7 +305,7 @@ def set_library_synced(result, error): ) def reset(self, *args): - """Reset the desktop to it's initial state""" + """Reset the desktop to it's initial state.""" if self.running_game: self.running_game.quit_game() self.status_label.set_text("Stopped %s" % self.running_game.name) @@ -328,7 +328,7 @@ def do_add_game(): GLib.idle_add(do_add_game) def add_game(self, _widget, _data=None): - """ Add a new game """ + """Add a new game.""" add_game_dialog = AddGameDialog(self) if add_game_dialog.runner_name and add_game_dialog.slug: self.add_game_to_view(add_game_dialog.slug) @@ -350,7 +350,7 @@ def on_browse_files(self, widget): ) def edit_game_configuration(self, _button): - """Edit game preferences""" + """Edit game preferences.""" game = Game(self.view.selected_game) if game.is_installed: EditGameConfigDialog(self, self.view.selected_game) @@ -372,7 +372,7 @@ def on_viewbtn_toggled(self, widget): self.list_view_menuitem.set_active(view_type == 'list') def switch_view(self, view_type): - """Switches between icon view and list view""" + """Switche between icon view and list view.""" logger.debug("Switching view") self.icon_type = self.get_icon_type(view_type) self.view.destroy() @@ -407,14 +407,14 @@ def on_icon_type_activate(self, menuitem): self.switch_view(self.current_view_type) def create_menu_shortcut(self, *args): - """Adds the game to the system's Games menu""" + """Add the game to the system's Games menu.""" game_slug = slugify(self.view.selected_game) create_launcher(game_slug, menu=True) dialogs.NoticeDialog( "Shortcut added to the Games category of the global menu.") def create_desktop_shortcut(self, *args): - """Adds the game to the system's Games menu""" + """Add the game to the system's Games menu.""" game_slug = slugify(self.view.selected_game) create_launcher(game_slug, desktop=True) dialogs.NoticeDialog('Shortcut created on your desktop.') diff --git a/lutris/gui/widgets.py b/lutris/gui/widgets.py index 535b0b4dbe..cf07603a6b 100644 --- a/lutris/gui/widgets.py +++ b/lutris/gui/widgets.py @@ -27,7 +27,7 @@ def sort_func(store, a_iter, b_iter, _user_data): - """Default sort function""" + """Default sort function.""" a_name = store.get(a_iter, COL_NAME) b_name = store.get(b_iter, COL_NAME) @@ -40,7 +40,7 @@ def sort_func(store, a_iter, b_iter, _user_data): def filter_view(model, _iter, user_data): - """Filter the game list""" + """Filter the game list.""" filter_text = user_data(None) if not filter_text: return True @@ -154,7 +154,7 @@ def fill_store(self, games): self.add_game(game) def add_game(self, game): - """Adds a game into the store """ + """Add a game into the store.""" if not game.name: return pixbuf = get_pixbuf_for_game(game.slug, self.icon_type, @@ -219,7 +219,7 @@ def update_image(self, game_slug, is_installed=False): row[COL_INSTALLED] = is_installed def popup_contextual_menu(self, view, event): - """Contextual menu""" + """Contextual menu.""" if event.button != 3: return try: @@ -235,7 +235,7 @@ def popup_contextual_menu(self, view, event): class GameTreeView(Gtk.TreeView, GameView): - """Show the main list of games""" + """Show the main list of games.""" __gsignals__ = GameView.__gsignals__ def __init__(self, games, filter_text="", icon_type=None): @@ -330,7 +330,7 @@ def set_fluid_columns(self, width): self.set_columns(nb_columns) def on_size_allocate(self, widget, rect): - """ Recalculate the colum spacing based on total widget width """ + """Recalculate the colum spacing based on total widget width.""" width = self.get_parent().get_allocated_width() self.set_fluid_columns(width - 20) self.do_size_allocate(widget, rect) diff --git a/lutris/runners/runner.py b/lutris/runners/runner.py index cd074eda4b..89ae612c12 100644 --- a/lutris/runners/runner.py +++ b/lutris/runners/runner.py @@ -1,5 +1,5 @@ # -*- coding:Utf-8 -*- -"""Generic runner""" +"""Generic runner.""" import os import subprocess import platform @@ -21,7 +21,7 @@ def get_arch(): class Runner(object): - """Generic runner (base class for other runners)""" + """Generic runner (base class for other runners).""" is_watchable = True # Is the game's pid a parent of Lutris ? tarballs = { 'i386': None, @@ -32,7 +32,7 @@ class Runner(object): runner_options = [] def __init__(self, settings=None): - """Initialize runner""" + """Initialize runner.""" self.game = None self.depends = None self.arch = get_arch() @@ -41,12 +41,12 @@ def __init__(self, settings=None): @property def description(self): - """Return the class' docstring as the description""" + """Return the class' docstring as the description.""" return self.__doc__ @description.setter def description(self, value): - """Leave the ability to override the docstring""" + """Leave the ability to override the docstring.""" self.__doc__ = value @property @@ -83,12 +83,12 @@ def system_config(self): @property def default_path(self): - """Return the default path where games are installed""" + """Return the default path where games are installed.""" return self.system_config.get('game_path') @property def browse_dir(self): - """Return the directory shown when the user browse game files""" + """Return the directory shown when the user browse game files.""" return self.get_game_path() @property @@ -101,7 +101,7 @@ def load(self, game): self.game = game def play(self): - """dummy method, must be implemented by derived runnners""" + """Dummy method, must be implemented by derived runnners.""" raise NotImplementedError("Implement the play method in your runner") def check_depends(self): @@ -120,7 +120,7 @@ def check_depends(self): return runner_instance.is_installed() def is_installed(self): - """Return True if runner is installed else False""" + """Return True if runner is installed else False.""" is_installed = False # Check 'get_executable' first if hasattr(self, 'get_executable'): @@ -146,7 +146,7 @@ def get_game_path(self): return self.system_config.get('game_path') def install(self): - """ Install runner using package management systems.""" + """Install runner using package management systems.""" # Prioritize provided tarballs. tarball = self.tarballs.get(self.arch) if tarball: diff --git a/lutris/runners/wine.py b/lutris/runners/wine.py index e068db2cc8..b772aa2ea1 100644 --- a/lutris/runners/wine.py +++ b/lutris/runners/wine.py @@ -87,7 +87,7 @@ def detect_prefix_arch(directory=None): # pylint: disable=C0103 class wine(Runner): - '''Run Windows games with Wine''' + """Run Windows games with Wine.""" executable = 'wine' platform = 'Windows' game_options = [ @@ -233,7 +233,7 @@ def browse_dir(self): @property def local_wine_versions(self): - """ Return the list of downloaded Wine versions """ + """ Return the list of downloaded Wine versions.""" runner_path = WINE_DIR versions = [] # Get list from folder names @@ -249,7 +249,7 @@ def local_wine_versions(self): @property def system_wine_version(self): - """Return the version of Wine installed on the system""" + """Return the version of Wine installed on the system.""" try: version = subprocess.check_output(["wine", "--version"]) except OSError: @@ -264,11 +264,11 @@ def wine_arch(self): @property def wine_version(self): - """Return the Wine version to use""" + """Return the Wine version to use.""" return self.runner_config.get('version') or DEFAULT_WINE def get_executable(self): - """Return the path to the Wine executable""" + """Return the path to the Wine executable.""" path = WINE_DIR custom_path = self.runner_config.get('custom_wine_path', '') version = self.wine_version @@ -327,7 +327,7 @@ def msi_exec(cls, msi_file, quiet=False, prefix=None): return wineexec(msi_args, prefix=prefix) def check_regedit_keys(self, wine_config): - """Resets regedit keys according to config""" + """Reset regedit keys according to config.""" for key in self.reg_keys.keys(): if key in self.runner_config: set_regedit(self.reg_keys[key], key, self.runner_config[key]) @@ -362,7 +362,7 @@ def play(self): return {'command': command} def stop(self): - """The kill command runs wineserver -k""" + """The kill command runs wineserver -k.""" wine_path = self.get_executable() wine_root = os.path.dirname(wine_path) command = os.path.join(wine_root, wine_root, "wineserver") + " -k"