mirror of
https://github.com/lutris/lutris
synced 2024-09-19 07:41:33 +00:00
Get rid of platforms module
This commit is contained in:
parent
fd362d9065
commit
de7beb0172
|
@ -3,7 +3,7 @@ from gettext import gettext as _
|
|||
|
||||
from gi.repository import GLib, GObject, Gtk, Pango
|
||||
|
||||
from lutris import platforms, runners, services
|
||||
from lutris import runners, services
|
||||
from lutris.database import categories as categories_db
|
||||
from lutris.database import games as games_db
|
||||
from lutris.game import Game
|
||||
|
@ -275,7 +275,7 @@ class LutrisSidebar(Gtk.ListBox):
|
|||
def on_realize(self, widget):
|
||||
self.active_platforms = games_db.get_used_platforms()
|
||||
self.runners = sorted(runners.__all__)
|
||||
self.platforms = sorted(platforms.__all__)
|
||||
self.platforms = sorted(runners.get_platforms())
|
||||
self.categories = categories_db.get_categories()
|
||||
|
||||
self.add(
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
"""Generic platform functions."""
|
||||
# Standard Library
|
||||
from collections import defaultdict
|
||||
from lutris import runners
|
||||
|
||||
# gets populated by _init_platforms()
|
||||
__all__ = defaultdict(list)
|
||||
|
||||
|
||||
def _init_platforms():
|
||||
for runner_name in runners.__all__:
|
||||
runner = runners.import_runner(runner_name)()
|
||||
for platform in runner.platforms:
|
||||
__all__[platform].append(runner_name)
|
||||
|
||||
|
||||
_init_platforms()
|
|
@ -1,4 +1,5 @@
|
|||
"""Runner loaders"""
|
||||
from collections import defaultdict
|
||||
|
||||
__all__ = [
|
||||
# Native
|
||||
|
@ -112,4 +113,14 @@ def get_runner_names():
|
|||
}
|
||||
|
||||
|
||||
def get_platforms():
|
||||
"""Return a dictionary of all supported platforms with their runners"""
|
||||
platforms = defaultdict(list)
|
||||
for runner_name in __all__:
|
||||
runner = import_runner(runner_name)()
|
||||
for platform in runner.platforms:
|
||||
platforms[platform].append(runner_name)
|
||||
return platforms
|
||||
|
||||
|
||||
RUNNER_NAMES = {} # This needs to be initialized at startup with get_runner_names
|
||||
|
|
Loading…
Reference in a new issue