🎨 Using absolute imports
This commit is contained in:
@@ -24,12 +24,13 @@ from time import time
|
||||
from gi.repository import Adw, Gio, GLib, Gtk
|
||||
from PIL import Image
|
||||
|
||||
# TODO use SGDBHelper
|
||||
from . import shared
|
||||
from .create_dialog import create_dialog
|
||||
from .game import Game
|
||||
from .game_cover import GameCover
|
||||
from .save_cover import resize_cover, save_cover
|
||||
from .steamgriddb import SGDBSave
|
||||
from cartridges.game import Game
|
||||
from cartridges.game_cover import GameCover
|
||||
from cartridges.utils.create_dialog import create_dialog
|
||||
from cartridges.utils.save_cover import resize_cover, save_cover
|
||||
from cartridges.utils.steamgriddb import SGDBSave
|
||||
|
||||
|
||||
@Gtk.Template(resource_path="/hu/kramo/Cartridges/gtk/details_window.ui")
|
||||
|
||||
@@ -27,7 +27,7 @@ from time import time
|
||||
from gi.repository import Adw, Gio, Gtk
|
||||
|
||||
from . import shared
|
||||
from .game_cover import GameCover
|
||||
from cartridges.game_cover import GameCover
|
||||
|
||||
|
||||
@Gtk.Template(resource_path="/hu/kramo/Cartridges/gtk/game.ui")
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import logging
|
||||
|
||||
from requests import HTTPError
|
||||
from gi.repository import Adw, Gio, Gtk
|
||||
from requests import HTTPError
|
||||
|
||||
from .task import Task
|
||||
from .create_dialog import create_dialog
|
||||
from .steamgriddb import SGDBAuthError, SGDBError, SGDBHelper
|
||||
from cartridges.utils.create_dialog import create_dialog
|
||||
from cartridges.utils.steamgriddb import SGDBAuthError, SGDBError, SGDBHelper
|
||||
from cartridges.utils.task import Task
|
||||
|
||||
|
||||
class Importer:
|
||||
|
||||
@@ -2,10 +2,10 @@ from functools import cache
|
||||
from sqlite3 import connect
|
||||
from time import time
|
||||
|
||||
from .decorators import replaced_by_path, replaced_by_schema_key
|
||||
from .game import Game
|
||||
from .save_cover import resize_cover, save_cover
|
||||
from .source import Source, SourceIterator
|
||||
from cartridges.game import Game
|
||||
from cartridges.importer.source import Source, SourceIterator
|
||||
from cartridges.utils.decorators import replaced_by_path, replaced_by_schema_key
|
||||
from cartridges.utils.save_cover import resize_cover, save_cover
|
||||
|
||||
|
||||
class LutrisSourceIterator(SourceIterator):
|
||||
|
||||
@@ -23,7 +23,7 @@ from time import time
|
||||
import yaml
|
||||
|
||||
from . import shared
|
||||
from .check_install import check_install
|
||||
from cartridges.utils.check_install import check_install
|
||||
|
||||
|
||||
def bottles_installed(path=None):
|
||||
|
||||
@@ -24,7 +24,7 @@ from pathlib import Path
|
||||
from time import time
|
||||
|
||||
from . import shared
|
||||
from .check_install import check_install
|
||||
from cartridges.utils.check_install import check_install
|
||||
|
||||
|
||||
def heroic_installed(path=None):
|
||||
|
||||
@@ -27,8 +27,8 @@ import requests
|
||||
from gi.repository import GdkPixbuf, Gio
|
||||
|
||||
from . import shared
|
||||
from .check_install import check_install
|
||||
from .save_cover import resize_cover
|
||||
from cartridges.utils.check_install import check_install
|
||||
from cartridges.utils.save_cover import resize_cover
|
||||
|
||||
|
||||
def get_game(task, current_time, row):
|
||||
|
||||
@@ -23,7 +23,7 @@ from sqlite3 import connect
|
||||
from time import time
|
||||
|
||||
from . import shared
|
||||
from .check_install import check_install
|
||||
from cartridges.utils.check_install import check_install
|
||||
|
||||
|
||||
def lutris_installed(path=None):
|
||||
|
||||
@@ -26,7 +26,7 @@ import requests
|
||||
from gi.repository import Gio
|
||||
|
||||
from . import shared
|
||||
from .check_install import check_install
|
||||
from cartridges.utils.check_install import check_install
|
||||
|
||||
|
||||
def update_values_from_data(content, values):
|
||||
|
||||
17
src/main.py
17
src/main.py
@@ -17,9 +17,9 @@
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import sys
|
||||
import os
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
import gi
|
||||
|
||||
@@ -30,11 +30,14 @@ gi.require_version("Adw", "1")
|
||||
from gi.repository import Adw, Gio, GLib, Gtk
|
||||
|
||||
from . import shared
|
||||
from .details_window import DetailsWindow
|
||||
from .preferences import PreferencesWindow
|
||||
from .window import CartridgesWindow
|
||||
from .importer import Importer
|
||||
from .lutris_source import LutrisNativeSource, LutrisFlatpakSource
|
||||
from cartridges.details_window import DetailsWindow
|
||||
from cartridges.importer.importer import Importer
|
||||
from cartridges.importer.sources.lutris_source import (
|
||||
LutrisFlatpakSource,
|
||||
LutrisNativeSource,
|
||||
)
|
||||
from cartridges.preferences import PreferencesWindow
|
||||
from cartridges.window import CartridgesWindow
|
||||
|
||||
|
||||
class CartridgesApplication(Adw.Application):
|
||||
|
||||
@@ -16,35 +16,18 @@ configure_file(
|
||||
install_dir: get_option('bindir')
|
||||
)
|
||||
|
||||
# TODO move to absolute imports = keep real structure, do not flatten
|
||||
|
||||
cartridges_sources = [
|
||||
'__init__.py',
|
||||
'main.py',
|
||||
'window.py',
|
||||
'preferences.py',
|
||||
'details_window.py',
|
||||
'game.py',
|
||||
'game_cover.py',
|
||||
'shared.py',
|
||||
'utils/steamgriddb.py',
|
||||
'utils/save_cover.py',
|
||||
'utils/create_dialog.py',
|
||||
|
||||
# Added
|
||||
'importer/sources/lutris_source.py',
|
||||
'importer/importer.py',
|
||||
'importer/source.py',
|
||||
'utils/decorators.py',
|
||||
'utils/task.py',
|
||||
|
||||
# TODO remove before merge
|
||||
'importers/bottles_importer.py',
|
||||
'importers/heroic_importer.py',
|
||||
'importers/itch_importer.py',
|
||||
'importers/lutris_importer.py',
|
||||
'importers/steam_importer.py',
|
||||
'utils/check_install.py'
|
||||
]
|
||||
|
||||
install_data(cartridges_sources, install_dir: moduledir)
|
||||
install_subdir('importer', install_dir: moduledir)
|
||||
install_subdir('importers', install_dir: moduledir)
|
||||
install_subdir('utils', install_dir: moduledir)
|
||||
install_data(
|
||||
[
|
||||
'main.py',
|
||||
'window.py',
|
||||
'preferences.py',
|
||||
'details_window.py',
|
||||
'game.py',
|
||||
'game_cover.py',
|
||||
'shared.py',
|
||||
],
|
||||
install_dir: moduledir
|
||||
)
|
||||
@@ -25,12 +25,13 @@ from gi.repository import Adw, Gio, GLib, Gtk
|
||||
|
||||
# pylint: disable=unused-import
|
||||
from . import shared
|
||||
from .bottles_importer import bottles_installed
|
||||
from .create_dialog import create_dialog
|
||||
from .heroic_importer import heroic_installed
|
||||
from .itch_importer import itch_installed
|
||||
from .lutris_importer import lutris_cache_exists, lutris_installed
|
||||
from .steam_importer import steam_installed
|
||||
# TODO use the new sources
|
||||
from cartridges.importers.bottles_importer import bottles_installed
|
||||
from cartridges.importers.heroic_importer import heroic_installed
|
||||
from cartridges.importers.itch_importer import itch_installed
|
||||
from cartridges.importers.lutris_importer import lutris_cache_exists, lutris_installed
|
||||
from cartridges.importers.steam_importer import steam_installed
|
||||
from cartridges.utils.create_dialog import create_dialog
|
||||
|
||||
|
||||
@Gtk.Template(resource_path="/hu/kramo/Cartridges/gtk/preferences.ui")
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
# TODO delegate to the sources
|
||||
def check_install(check, locations, setting=None, subdirs=(Path(),)):
|
||||
for location in locations:
|
||||
for subdir in (Path(),) + subdirs:
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
import logging
|
||||
import requests
|
||||
from requests import HTTPError
|
||||
from gi.repository import Gio
|
||||
from requests import HTTPError
|
||||
|
||||
from . import shared
|
||||
from .create_dialog import create_dialog
|
||||
from .save_cover import save_cover, resize_cover
|
||||
from cartridges.utils.create_dialog import create_dialog
|
||||
from cartridges.utils.save_cover import resize_cover, save_cover
|
||||
|
||||
|
||||
class SGDBError(Exception):
|
||||
|
||||
@@ -23,7 +23,7 @@ from datetime import datetime
|
||||
from gi.repository import Adw, Gio, GLib, Gtk
|
||||
|
||||
from . import shared
|
||||
from .game import Game
|
||||
from cartridges.game import Game
|
||||
|
||||
|
||||
@Gtk.Template(resource_path="/hu/kramo/Cartridges/gtk/window.ui")
|
||||
|
||||
Reference in New Issue
Block a user