mirror of
https://github.com/lutris/lutris
synced 2024-09-15 22:09:55 +00:00
Clean Flake8 warnings
This commit is contained in:
parent
d929d167c0
commit
49d2bbf1ae
|
@ -34,7 +34,7 @@ from gi.repository import Gio, GLib, Gtk
|
||||||
from lutris import pga
|
from lutris import pga
|
||||||
from lutris.game import Game
|
from lutris.game import Game
|
||||||
from lutris import settings
|
from lutris import settings
|
||||||
from lutris.gui.dialogs import ErrorDialog, InstallOrPlayDialog, GtkBuilderDialog
|
from lutris.gui.dialogs import ErrorDialog, InstallOrPlayDialog
|
||||||
from lutris.gui.dialogs.issue import IssueReportWindow
|
from lutris.gui.dialogs.issue import IssueReportWindow
|
||||||
from lutris.gui.installerwindow import InstallerWindow
|
from lutris.gui.installerwindow import InstallerWindow
|
||||||
from lutris.gui.widgets.status_icon import LutrisStatusIcon
|
from lutris.gui.widgets.status_icon import LutrisStatusIcon
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from lutris import api, pga, runtime, settings
|
from lutris import api, pga, runtime, settings
|
||||||
from lutris.gui.widgets.utils import open_uri
|
|
||||||
from lutris.gui.widgets.log_text_view import LogTextView
|
from lutris.gui.widgets.log_text_view import LogTextView
|
||||||
from lutris.util import datapath
|
from lutris.util import datapath
|
||||||
from lutris.util.log import logger
|
from lutris.util.log import logger
|
||||||
|
|
|
@ -3,7 +3,7 @@ import os
|
||||||
import time
|
import time
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
|
||||||
from gi.repository import Gtk, GObject
|
from gi.repository import Gtk
|
||||||
|
|
||||||
from lutris import api, pga, settings
|
from lutris import api, pga, settings
|
||||||
from lutris.installer import interpreter
|
from lutris.installer import interpreter
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
# pylint: disable=E1101, E0611
|
|
||||||
"""Install a game by following its install script."""
|
"""Install a game by following its install script."""
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
@ -354,7 +353,9 @@ class ScriptInterpreter(CommandsMixin):
|
||||||
def swap_humble_game_files(self):
|
def swap_humble_game_files(self):
|
||||||
"""Replace the user provided file with download links from Humble Bundle"""
|
"""Replace the user provided file with download links from Humble Bundle"""
|
||||||
if not self.humbleid:
|
if not self.humbleid:
|
||||||
raise UnavailableGame("This installer has no Humble Bundle ID ('humbleid' in the game section)")
|
raise UnavailableGame(
|
||||||
|
"This installer has no Humble Bundle ID ('humbleid' in the game section)"
|
||||||
|
)
|
||||||
installer_file_id = self.pop_user_provided_file()
|
installer_file_id = self.pop_user_provided_file()
|
||||||
if not installer_file_id:
|
if not installer_file_id:
|
||||||
raise UnavailableGame("Installer has no user provided file")
|
raise UnavailableGame("Installer has no user provided file")
|
||||||
|
|
|
@ -8,7 +8,7 @@ from lutris import runtime, settings
|
||||||
from lutris.config import LutrisConfig
|
from lutris.config import LutrisConfig
|
||||||
from lutris.runners import import_runner
|
from lutris.runners import import_runner
|
||||||
from lutris.command import MonitoredCommand
|
from lutris.command import MonitoredCommand
|
||||||
from lutris.util import datapath, system
|
from lutris.util import system
|
||||||
from lutris.util.strings import split_arguments
|
from lutris.util.strings import split_arguments
|
||||||
from lutris.util.log import logger
|
from lutris.util.log import logger
|
||||||
from lutris.util.wine.wine import (
|
from lutris.util.wine.wine import (
|
||||||
|
|
|
@ -16,15 +16,31 @@ class dgen(Runner):
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
runner_options = [
|
runner_options = [
|
||||||
{"option": "fullscreen", "type": "bool", "label": "Fullscreen", "default": True},
|
{
|
||||||
{"option": "pal", "type": "bool", "label": "PAL", "default": False, "advanced": True},
|
"option": "fullscreen",
|
||||||
|
"type": "bool",
|
||||||
|
"label": "Fullscreen",
|
||||||
|
"default": True,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"option": "pal",
|
||||||
|
"type": "bool",
|
||||||
|
"label": "PAL",
|
||||||
|
"default": False,
|
||||||
|
"advanced": True,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"option": "region",
|
"option": "region",
|
||||||
"type": "choice",
|
"type": "choice",
|
||||||
"label": "Region",
|
"label": "Region",
|
||||||
"choices": [("America (NTSC)", "U"), ("Japan (NTSC)", "J"), ("Japan (PAL)", "X"),("Europe (PAL)", "E")],
|
"choices": [
|
||||||
|
("America (NTSC)", "U"),
|
||||||
|
("Japan (NTSC)", "J"),
|
||||||
|
("Japan (PAL)", "X"),
|
||||||
|
("Europe (PAL)", "E"),
|
||||||
|
],
|
||||||
"default": "off",
|
"default": "off",
|
||||||
"advanced": True
|
"advanced": True,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
"""libretro runner"""
|
||||||
import os
|
import os
|
||||||
from lutris.runners.runner import Runner
|
from lutris.runners.runner import Runner
|
||||||
from lutris.util.libretro import RetroConfig
|
from lutris.util.libretro import RetroConfig
|
||||||
|
@ -54,7 +55,9 @@ LIBRETRO_CORES = [
|
||||||
("Mednafen PCE FAST (TurboGrafx-16)", "mednafen_pce_fast", "NEC PC Engine (TurboGrafx-16)"),
|
("Mednafen PCE FAST (TurboGrafx-16)", "mednafen_pce_fast", "NEC PC Engine (TurboGrafx-16)"),
|
||||||
("Mednafen PCFX (NEC PC-FX)", "mednafen_pcfx", "NEC PC-FX"),
|
("Mednafen PCFX (NEC PC-FX)", "mednafen_pcfx", "NEC PC-FX"),
|
||||||
("Mednafen Saturn (Sega Saturn)", "mednafen_saturn", "Sega Saturn"),
|
("Mednafen Saturn (Sega Saturn)", "mednafen_saturn", "Sega Saturn"),
|
||||||
("Mednafen SGX (NEC PC Engine SuperGrafx)", "mednafen_supergrafx", "NEC PC Engine (SuperGrafx)"),
|
("Mednafen SGX (NEC PC Engine SuperGrafx)",
|
||||||
|
"mednafen_supergrafx",
|
||||||
|
"NEC PC Engine (SuperGrafx)"),
|
||||||
("Mednafen WSWAN (Bandai WonderSwan)", "mednafen_wswan", "Bandai WonderSwan"),
|
("Mednafen WSWAN (Bandai WonderSwan)", "mednafen_wswan", "Bandai WonderSwan"),
|
||||||
("Mednafen PSX (Sony Playstation)", "mednafen_psx", "Sony PlayStation"),
|
("Mednafen PSX (Sony Playstation)", "mednafen_psx", "Sony PlayStation"),
|
||||||
("Mednafen PSX OpenGL (Sony Playstation)", "mednafen_psx_hw", "Sony PlayStation"),
|
("Mednafen PSX OpenGL (Sony Playstation)", "mednafen_psx_hw", "Sony PlayStation"),
|
||||||
|
|
|
@ -28,7 +28,7 @@ def read_config(steam_data_dir):
|
||||||
"""Read the Steam configuration and return it as an object"""
|
"""Read the Steam configuration and return it as an object"""
|
||||||
|
|
||||||
def get_entry_case_insensitive(config_dict, path):
|
def get_entry_case_insensitive(config_dict, path):
|
||||||
for key, value in config_dict.items():
|
for key, _value in config_dict.items():
|
||||||
if key.lower() == path[0].lower():
|
if key.lower() == path[0].lower():
|
||||||
if len(path) <= 1:
|
if len(path) <= 1:
|
||||||
return config_dict[key]
|
return config_dict[key]
|
||||||
|
@ -42,14 +42,15 @@ def read_config(steam_data_dir):
|
||||||
with open(config_filename, "r") as steam_config_file:
|
with open(config_filename, "r") as steam_config_file:
|
||||||
config = vdf_parse(steam_config_file, {})
|
config = vdf_parse(steam_config_file, {})
|
||||||
try:
|
try:
|
||||||
return get_entry_case_insensitive(config, ["InstallConfigStore", "Software", "Valve", "Steam"])
|
return get_entry_case_insensitive(
|
||||||
|
config,
|
||||||
|
["InstallConfigStore", "Software", "Valve", "Steam"]
|
||||||
|
)
|
||||||
except KeyError as ex:
|
except KeyError as ex:
|
||||||
logger.error("Steam config %s is empty: %s", config_filename, ex)
|
logger.error("Steam config %s is empty: %s", config_filename, ex)
|
||||||
|
|
||||||
|
|
||||||
def get_steamapps_paths_for_platform(platform_name):
|
def get_steamapps_paths_for_platform(platform_name):
|
||||||
"""
|
|
||||||
"""
|
|
||||||
from lutris.runners import winesteam, steam
|
from lutris.runners import winesteam, steam
|
||||||
|
|
||||||
runners = {"linux": steam.steam, "windows": winesteam.winesteam}
|
runners = {"linux": steam.steam, "windows": winesteam.winesteam}
|
||||||
|
|
|
@ -118,11 +118,12 @@ class WinePrefixManager:
|
||||||
except OSError:
|
except OSError:
|
||||||
os.rename(path, old_path)
|
os.rename(path, old_path)
|
||||||
|
|
||||||
# if we want to create a symlink and one is already there, just skip to the next item.
|
# if we want to create a symlink and one is already there, just
|
||||||
# this also makes sure the elif doesn't find a dir (isdir only looks at the target of the symlink).
|
# skip to the next item. this also makes sure the elif doesn't
|
||||||
|
# find a dir (isdir only looks at the target of the symlink).
|
||||||
if restore and os.path.islink(path):
|
if restore and os.path.islink(path):
|
||||||
continue
|
continue
|
||||||
elif restore and not os.path.isdir(path):
|
if restore and not os.path.isdir(path):
|
||||||
src_path = get_xdg_entry(DESKTOP_XDG[i])
|
src_path = get_xdg_entry(DESKTOP_XDG[i])
|
||||||
if not src_path:
|
if not src_path:
|
||||||
logger.error(
|
logger.error(
|
||||||
|
|
|
@ -22,8 +22,8 @@ def get_xdg_entry(directory):
|
||||||
}
|
}
|
||||||
directory = directory.upper()
|
directory = directory.upper()
|
||||||
if directory not in special_dir.keys():
|
if directory not in special_dir.keys():
|
||||||
raise ValueError(directory + " not supported. Only those folders are supported: " +
|
raise ValueError(directory + " not supported. Only those folders are supported: "
|
||||||
", ".join(special_dir.keys()))
|
+ ", ".join(special_dir.keys()))
|
||||||
return GLib.get_user_special_dir(special_dir[directory])
|
return GLib.get_user_special_dir(special_dir[directory])
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,9 +33,9 @@ def get_xdg_basename(game_slug, game_id, base_dir=None):
|
||||||
# When base dir is provided, lookup possible combinations
|
# When base dir is provided, lookup possible combinations
|
||||||
# and return the first match
|
# and return the first match
|
||||||
for path in [
|
for path in [
|
||||||
"{}.desktop".format(game_slug),
|
"{}.desktop".format(game_slug),
|
||||||
"{}-{}.desktop".format(game_slug, game_id),
|
"{}-{}.desktop".format(game_slug, game_id),
|
||||||
"net.lutris.{}-{}.desktop".format(game_slug, game_id),
|
"net.lutris.{}-{}.desktop".format(game_slug, game_id),
|
||||||
]:
|
]:
|
||||||
if system.path_exists(os.path.join(base_dir, path)):
|
if system.path_exists(os.path.join(base_dir, path)):
|
||||||
return path
|
return path
|
||||||
|
@ -109,10 +109,12 @@ def get_menu_launcher_path(game_slug, game_id):
|
||||||
|
|
||||||
|
|
||||||
def desktop_launcher_exists(game_slug, game_id):
|
def desktop_launcher_exists(game_slug, game_id):
|
||||||
|
"""Return True if there is an existing desktop icon for a game"""
|
||||||
return system.path_exists(get_launcher_path(game_slug, game_id))
|
return system.path_exists(get_launcher_path(game_slug, game_id))
|
||||||
|
|
||||||
|
|
||||||
def menu_launcher_exists(game_slug, game_id):
|
def menu_launcher_exists(game_slug, game_id):
|
||||||
|
"""Return True if there is an existing application menu entry for a game"""
|
||||||
return system.path_exists(get_menu_launcher_path(game_slug, game_id))
|
return system.path_exists(get_menu_launcher_path(game_slug, game_id))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue