diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index b9c82e9a5..34bf9e2d4 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -7,7 +7,10 @@ on: jobs: checks: - runs-on: windows-latest + strategy: + matrix: + os: [windows-latest, ubuntu-latest] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -17,10 +20,34 @@ jobs: python-version: 3.12 cache: pip - - name: Install dependencies + - name: Install Linux dependencies + if: startsWith(matrix.os, 'ubuntu') + run: | + sudo apt-get update + sudo apt-get install --no-install-recommends -y \ + libxkbcommon-x11-0 \ + x11-utils \ + libyaml-dev \ + libegl1-mesa \ + libxcb-icccm4 \ + libxcb-image0 \ + libxcb-keysyms1 \ + libxcb-randr0 \ + libxcb-render-util0 \ + libxcb-xinerama0 \ + libopengl0 \ + libxcb-cursor0 \ + pulseaudio + + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + python -m pip install pytest-xvfb + + - name: Install Windows dependencies + if: startsWith(matrix.os, 'windows') run: | python -m pip install --upgrade pip - pip install -r requirements.txt + python -m pip install -r win_requirements.txt - name: Test with pytest run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e4462ad44..87f476807 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,16 +6,17 @@ on: version: description: 'Release Version' required: true +env: + UID_VERSION: v4.0.6 + ICE_ADAPTER_VERSION: 3.3.9 + BUILD_VERSION: ${{ github.event.inputs.version }} jobs: - release: + build-windows: environment: deploy runs-on: windows-latest - env: - UID_VERSION: v4.0.6 - ICE_ADAPTER_VERSION: 3.3.9 - BUILD_VERSION: ${{ github.event.inputs.version }} - + outputs: + MSI_SUM: ${{ steps.checksum.outputs.MSI_SUM }} steps: - uses: actions/checkout@v4 @@ -28,20 +29,28 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install -r requirements.txt + python -m pip install -r win_requirements.txt + + - name: Test with pytest + run: | + python runtests.py -vv --full-trace - name: Download ICE adapter and UID calculator run: | mkdir build_setup\ice-adapter Invoke-WebRequest -Uri "https://github.com/FAForever/uid/releases/download/$($env:UID_VERSION)/faf-uid.exe" -OutFile ".\\build_setup\\faf-uid.exe" - Invoke-WebRequest -Uri "https://content.faforever.com/build/jre/windows-amd64-21.0.1.tar.gz" -OutFile ".\\windows-amd64-15.0.1.tar.gz" - 7z x windows-amd64-15.0.1.tar.gz - 7z x windows-amd64-15.0.1.tar -obuild_setup/ice-adapter/jre Invoke-WebRequest -Uri "https://github.com/FAForever/java-ice-adapter/releases/download/$($env:ICE_ADAPTER_VERSION)/faf-ice-adapter-$($env:ICE_ADAPTER_VERSION)-win.jar" -OutFile ".\\build_setup\\ice-adapter\\faf-ice-adapter.jar" - - name: Test with pytest + - name: Download JDK and create JRE run: | - python runtests.py -vv --full-trace + Invoke-WebRequest -Uri "https://download.oracle.com/java/21/latest/jdk-21_windows-x64_bin.zip" -OutFile ".\\windows-jdk.zip" + 7z x windows-jdk.zip -ojdk + pushd jdk + mv $(ls) jdk + popd + + $ICE_ADAPTER_JAVA_MODULES=((jdk/jdk/bin/jdeps.exe -s "build_setup/ice-adapter/faf-ice-adapter.jar" | findstr "java" | ForEach-Object { $_.split(" ")[2] }) -join ",") + jdk/jdk/bin/jlink.exe --add-modules "$ICE_ADAPTER_JAVA_MODULES,jdk.crypto.ec,jdk.unsupported" --strip-debug --no-man-pages --no-header-files --compress "zip-6" --output "build_setup/ice-adapter/jre" - name: Build application run: | @@ -52,7 +61,109 @@ jobs: run: | $MSI_SUM = $(Get-FileHash dist/*).hash Write-Host $MSI_SUM - echo "MSI_SUM=$MSI_SUM" >> "$env:GITHUB_ENV" + echo "MSI_SUM=$MSI_SUM" >> "$env:GITHUB_OUTPUT" + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: client-windows + path: dist/* + + build-linux: + runs-on: ubuntu-latest + environment: release + outputs: + TAR_SUM: ${{ steps.checksum.outputs.TAR_SUM }} + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.12 + cache: pip + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install --no-install-recommends -y \ + libxkbcommon-x11-0 \ + x11-utils \ + libyaml-dev \ + libegl1-mesa \ + libxcb-icccm4 \ + libxcb-image0 \ + libxcb-keysyms1 \ + libxcb-randr0 \ + libxcb-render-util0 \ + libxcb-xinerama0 \ + libopengl0 \ + libxcb-cursor0 \ + pulseaudio + + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + python -m pip install pytest-xvfb + + - name: Test with pytest + run: | + python runtests.py -vv --full-trace + + - name: Download ICE adapter and UID calculator + run: | + mkdir -p build_setup/ice-adapter + wget -O build_setup/faf-uid "https://github.com/FAForever/uid/releases/download/$UID_VERSION/faf-uid" + chmod +x build_setup/faf-uid + wget "https://github.com//FAForever/java-ice-adapter/releases/download/$ICE_ADAPTER_VERSION/faf-ice-adapter-$ICE_ADAPTER_VERSION-win.jar" -O "build_setup/ice-adapter/faf-ice-adapter.jar" + + - name: Download JDK and create JRE + run: | + wget -O "jdk.tar.gz" "https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.tar.gz" + + mkdir jdk + tar -xzvf jdk.tar.gz -C jdk --strip-components=1 + + ICE_ADAPTER_JAVA_MODULES=$(jdk/bin/jdeps -s build_setup/ice-adapter/faf-ice-adapter.jar | cut -d' ' -f 3 | grep java | xargs echo | tr ' ' ',') + jdk/bin/jlink --add-modules "$ICE_ADAPTER_JAVA_MODULES,jdk.crypto.ec,jdk.unsupported" --strip-debug --no-man-pages --no-header-files --compress "zip-6" --output "build_setup/ice-adapter/jre" + + - name: Build application + run: | + python3 setup.py build + python3 post_setup.py + tar -C "build" -cvzf "faforever.tar.gz" "faf_python_client" + + - name: Calculate checksum + id: checksum + run: | + TAR_SUM=$(echo faforever.tar.gz -n | sha256sum) + echo $TAR_SUM + echo "TAR_SUM=$TAR_SUM" >> "$GITHUB_OUTPUT" + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: client-linux + path: faforever.tar.gz + + create-release: + needs: [build-windows, build-linux] + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Download Windows artifact + uses: actions/download-artifact@v4 + with: + name: client-windows + path: release-artifacts/ + + - name: Download Linux artifact + uses: actions/download-artifact@v4 + with: + name: client-linux + path: release-artifacts/ - name: Create draft release id: create_release @@ -60,7 +171,7 @@ jobs: with: commit: ${{ github.sha }} tag: ${{ github.event.inputs.version }} - body: "SHA256: ${{ env.MSI_SUM }}" + body: "SHA256 (Windows): ${{ needs.build-windows.outputs.MSI_SUM }}\nSHA256 (Linux): ${{ needs.build-linux.outputs.TAR_SUM }}" draft: true prerelease: true - artifacts: dist/* + artifacts: "release-artifacts/*" diff --git a/conftest.py b/conftest.py deleted file mode 100644 index 01227e12e..000000000 --- a/conftest.py +++ /dev/null @@ -1,46 +0,0 @@ -import os -import sys - -import pytest - -sys.path.insert( - 0, - os.path.abspath( - os.path.join( - os.path.dirname(os.path.realpath(__file__)), "src", - ), - ), -) - -__all__ = ('application', 'signal_receiver') - - -@pytest.fixture(scope="module") -def application(qapp, request): - return qapp - - -@pytest.fixture(scope="function") -def signal_receiver(application): - from PyQt6 import QtCore - - class SignalReceiver(QtCore.QObject): - def __init__(self, parent=None): - QtCore.QObject.__init__(self, parent) - self.int_values = [] - self.generic_values = [] - self.string_values = [] - - @QtCore.pyqtSlot() - def generic_slot(self): - self.generic_values.append(None) - - @QtCore.pyqtSlot(str) - def string_slot(self, value): - self.string_values.append(value) - - @QtCore.pyqtSlot(int) - def int_slot(self, value): - self.int_values.append(value) - - return SignalReceiver(application) diff --git a/post_setup.py b/post_setup.py new file mode 100644 index 000000000..cfd6f6c68 --- /dev/null +++ b/post_setup.py @@ -0,0 +1,39 @@ +import pathlib +import sys + + +def remove_some_redundant_qt_files() -> None: + current_dir = pathlib.Path(__file__).parent + build_dir = current_dir / "build" + app_dir, = build_dir.iterdir() + app_qt6 = app_dir / "lib" / "PyQt6" / "Qt6" + + # cx_Freeze copies these into lib directory itself + # and into every plugin directory for some reason + libfiles = [file.name for file in (app_qt6 / "lib").iterdir()] + + # not all of them, but the most obvious and largest ones + redundant_plugins_files = [ + "libffmpegmediaplugin.so", + "libQt6Pdf.so.6", + "libQt6Qml.so.6", + "libQt6QmlModels.so.6", + "libQt6Quick.so.6", + ] + + plugins_dir = app_qt6 / "plugins" + for plugin in plugins_dir.iterdir(): + for file in plugin.iterdir(): + if file.name in libfiles + redundant_plugins_files: + print(f"Removing {file}...") + file.unlink() + + +def main() -> None: + if sys.platform == "win32": + return + remove_some_redundant_qt_files() + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/requirements.txt b/requirements.txt index ad602254f..e8838ad04 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,6 +13,5 @@ pytest pytest-cov pytest-mock pytest-qt -pywin32 semantic_version zstandard diff --git a/res/chat/channel.ui b/res/chat/channel.ui index 90ff0b5d1..03c27a1ed 100644 --- a/res/chat/channel.ui +++ b/res/chat/channel.ui @@ -295,12 +295,12 @@ ChatLineEdit QLineEdit -
chat.chatlineedit
+
src.chat.chatlineedit
ChatterListView QListView -
chat.chatterlistview
+
src.chat.chatterlistview
diff --git a/res/coop/coop.ui b/res/coop/coop.ui index 9476ee23e..a8cd9f48c 100644 --- a/res/coop/coop.ui +++ b/res/coop/coop.ui @@ -371,7 +371,7 @@ p, li { white-space: pre-wrap; } CoopLeaderboardTableView QTableView -
coop.cooptableview
+
src.coop.cooptableview
diff --git a/res/stats/leaderboard.ui b/res/stats/leaderboard.ui index 10949cc38..0e0046e4c 100644 --- a/res/stats/leaderboard.ui +++ b/res/stats/leaderboard.ui @@ -779,12 +779,12 @@ LeaderboardTableView QTableView -
stats.itemviews.leaderboardtableview
+
src.stats.itemviews.leaderboardtableview
LeaderboardLineEdit QLineEdit -
stats.leaderboardlineedit
+
src.stats.leaderboardlineedit
diff --git a/setup.py b/setup.py index 00fec336c..cb86d8965 100644 --- a/setup.py +++ b/setup.py @@ -1,27 +1,19 @@ import os import sys -if sys.platform == "win32": - from cx_Freeze import Executable - from cx_Freeze import setup -else: - from distutils.core import setup +from cx_Freeze import Executable +from cx_Freeze import setup -sys.path.insert(0, "src") +from src.config import version company_name = "FAF Community" product_name = "Forged Alliance Forever" -if sys.platform == "win32": - import config.version as version - - root_dir = os.path.dirname(os.path.abspath(__file__)) - res_dir = os.path.join(root_dir, "res") - build_version = os.getenv("BUILD_VERSION") - build_version = build_version.replace(" ", "") - version.write_version_file(build_version, res_dir) - - msi_version = version.msi_version(build_version) +root_dir = os.path.dirname(os.path.abspath(__file__)) +res_dir = os.path.join(root_dir, "res") +build_version = os.getenv("BUILD_VERSION").replace(" ", "") +version.write_version_file(build_version, res_dir) +msi_version = version.msi_version(build_version) shortcut_table = [ @@ -56,52 +48,52 @@ "all_users": True, } -# base="Win32GUI" should be used only for Windows GUI app -base = "Win32GUI" if sys.platform == "win32" else None - if sys.platform == "win32": - # Dependencies are automatically detected, but it might need fine tuning. - build_exe_options = { - "include_files": [ - "res", - ("build_setup/faf-uid.exe", "natives/faf-uid.exe"), - ("build_setup/ice-adapter", "natives/ice-adapter"), - ], - "include_msvcr": True, - "optimize": 2, - "silent": True, - - # copied from https://github.com/marcelotduarte/cx_Freeze/blob/5e42a97d2da321eae270cdcc65cdc777eb8e8fc4/samples/pyqt6-simplebrowser/setup.py # noqa: E501 - # and unexcluded overexcluded - "excludes": ["tkinter", "unittest", "tcl"], - - "zip_include_packages": ["*"], - "zip_exclude_packages": [], - } - - platform_options = { - "executables": [ - Executable( - "src/__main__.py", - base=base, - target_name="FAForever.exe", - icon="res/faf.ico", - ), - ], - "options": { - "build_exe": build_exe_options, - "bdist_msi": bdist_msi_options, - }, - "version": msi_version, - } - + include_mvcr = True + exe_base = "Win32Gui" + exe_name = "FAForever.exe" else: - from setuptools import find_packages - platform_options = { - "packages": find_packages(), - "version": os.getenv("FAFCLIENT_VERSION"), - } + include_mvcr = False + exe_base = None + exe_name = "FAForever" + + +# Dependencies are automatically detected, but it might need fine tuning. +build_exe_options = { + "include_files": [ + "res", + ("build_setup", "natives"), + ], + "include_msvcr": include_mvcr, + "optimize": 2, + "silent": True, + + # copied from https://github.com/marcelotduarte/cx_Freeze/blob/5e42a97d2da321eae270cdcc65cdc777eb8e8fc4/samples/pyqt6-simplebrowser/setup.py # noqa: E501 + # and unexcluded overexcluded + "excludes": ["tkinter", "unittest", "tcl"], + + "zip_include_packages": ["*"], + "zip_exclude_packages": [], + + "build_exe": "build/faf_python_client", +} + +platform_options = { + "executables": [ + Executable( + "src/__main__.py", + base=exe_base, + target_name=exe_name, + icon="res/faf.ico", + ), + ], + "options": { + "build_exe": build_exe_options, + "bdist_msi": bdist_msi_options, + }, + "version": msi_version, +} setup( name=product_name, diff --git a/src/__main__.py b/src/__main__.py index aa466060c..825ecf30c 100644 --- a/src/__main__.py +++ b/src/__main__.py @@ -1,10 +1,10 @@ -#!/usr/bin/env python3 """ Created on Dec 1, 2011 @author: thygrrr """ +import argparse import os import sys from types import TracebackType @@ -16,9 +16,14 @@ from PyQt6.QtWidgets import QMessageBox from PyQt6.QtWidgets import QStyleFactory -import util -import util.crash -from config import Settings +from src import util +from src.config import Settings +from src.util import crash + +if os.getenv("XDG_SESSION_TYPE") == "wayland": + # clientwindow has FramelessWindowHint flag with custom frame implementation, + # which doesn't work well with 'wayland' + os.environ["QT_QPA_PLATFORM"] = "xcb" # Some linux distros (like Gentoo) make package scripts available # by copying and modifying them. This breaks path to our modules. @@ -33,7 +38,6 @@ path = os.path.realpath(fafclient.__file__) sys.path.insert(0, os.path.dirname(path)) -import argparse cmd_parser = argparse.ArgumentParser( description='FAF client commandline arguments.', @@ -70,7 +74,7 @@ def excepthook( ), ) logger.error("Runtime Info:\n{}".format(util.crash.runtime_info())) - dialog = util.crash.CrashDialog((exc_type, exc_value, traceback_object)) + dialog = crash.CrashDialog((exc_type, exc_value, traceback_object)) answer = dialog.exec() if answer == QDialog.DialogCode.Rejected: @@ -100,7 +104,7 @@ def run_faf(): util.THEME.loadTheme() # Create client singleton and connect - import client + from src import client faf_client = client.instance faf_client.setup() @@ -121,7 +125,7 @@ def set_style(app: QApplication) -> None: if __name__ == '__main__': import logging - import config + from src import config QApplication.setAttribute(Qt.ApplicationAttribute.AA_ShareOpenGLContexts) app = QApplication(["FAF Python Client"] + trailing_args) @@ -155,8 +159,6 @@ def set_style(app: QApplication) -> None: sys.excepthook = excepthook if len(trailing_args) == 0: - # Do the magic - sys.path.extend(['.']) run_faf() else: # Try to interpret the argument as a replay. @@ -164,7 +166,7 @@ def set_style(app: QApplication) -> None: trailing_args[0].lower().endswith(".fafreplay") or trailing_args[0].lower().endswith(".scfareplay") ): - import fa + from src import fa fa.replay(trailing_args[0], True) # Launch as detached process # End of show diff --git a/src/api/ApiAccessors.py b/src/api/ApiAccessors.py index bc17ed6c5..23b16fef0 100644 --- a/src/api/ApiAccessors.py +++ b/src/api/ApiAccessors.py @@ -2,7 +2,7 @@ from PyQt6.QtCore import pyqtSignal -from api.ApiBase import ApiBase +from src.api.ApiBase import ApiBase logger = logging.getLogger(__name__) diff --git a/src/api/ApiBase.py b/src/api/ApiBase.py index d856bdf25..c7c167740 100644 --- a/src/api/ApiBase.py +++ b/src/api/ApiBase.py @@ -13,9 +13,9 @@ from PyQt6.QtNetwork import QNetworkReply from PyQt6.QtNetwork import QNetworkRequest -from config import Settings -from oauth.oauth_flow import OAuth2Flow -from oauth.oauth_flow import OAuth2FlowInstance +from src.config import Settings +from src.oauth.oauth_flow import OAuth2Flow +from src.oauth.oauth_flow import OAuth2FlowInstance logger = logging.getLogger(__name__) diff --git a/src/api/coop_api.py b/src/api/coop_api.py index d1e1cf6c6..3f360e121 100644 --- a/src/api/coop_api.py +++ b/src/api/coop_api.py @@ -1,8 +1,8 @@ -from api.ApiAccessors import DataApiAccessor -from api.models.CoopResult import CoopResult -from api.models.CoopScenario import CoopScenario -from api.parsers.CoopResultParser import CoopResultParser -from api.parsers.CoopScenarioParser import CoopScenarioParser +from src.api.ApiAccessors import DataApiAccessor +from src.api.models.CoopResult import CoopResult +from src.api.models.CoopScenario import CoopScenario +from src.api.parsers.CoopResultParser import CoopResultParser +from src.api.parsers.CoopScenarioParser import CoopScenarioParser class CoopApiAccessor(DataApiAccessor): diff --git a/src/api/featured_mod_api.py b/src/api/featured_mod_api.py index 9d1f67b7c..6e9820b54 100644 --- a/src/api/featured_mod_api.py +++ b/src/api/featured_mod_api.py @@ -1,10 +1,10 @@ import logging -from api.ApiAccessors import DataApiAccessor -from api.models.FeaturedMod import FeaturedMod -from api.models.FeaturedModFile import FeaturedModFile -from api.parsers.FeaturedModFileParser import FeaturedModFileParser -from api.parsers.FeaturedModParser import FeaturedModParser +from src.api.ApiAccessors import DataApiAccessor +from src.api.models.FeaturedMod import FeaturedMod +from src.api.models.FeaturedModFile import FeaturedModFile +from src.api.parsers.FeaturedModFileParser import FeaturedModFileParser +from src.api.parsers.FeaturedModParser import FeaturedModParser logger = logging.getLogger(__name__) diff --git a/src/api/matchmaker_queue_api.py b/src/api/matchmaker_queue_api.py index 576a85a31..7023a9de3 100644 --- a/src/api/matchmaker_queue_api.py +++ b/src/api/matchmaker_queue_api.py @@ -1,6 +1,6 @@ import logging -from api.ApiAccessors import DataApiAccessor +from src.api.ApiAccessors import DataApiAccessor logger = logging.getLogger(__name__) diff --git a/src/api/models/AbstractEntity.py b/src/api/models/AbstractEntity.py index c49e15a4b..501f42169 100644 --- a/src/api/models/AbstractEntity.py +++ b/src/api/models/AbstractEntity.py @@ -1,6 +1,6 @@ from pydantic import Field -from api.models.ConfiguredModel import ConfiguredModel +from src.api.models.ConfiguredModel import ConfiguredModel class AbstractEntity(ConfiguredModel): diff --git a/src/api/models/Achievement.py b/src/api/models/Achievement.py index 0f8f5bba5..7181e8ecd 100644 --- a/src/api/models/Achievement.py +++ b/src/api/models/Achievement.py @@ -1,8 +1,9 @@ from __future__ import annotations -from api.models.AbstractEntity import AbstractEntity from pydantic import Field -from util import StringValuedEnum + +from src.api.models.AbstractEntity import AbstractEntity +from src.util import StringValuedEnum class State(StringValuedEnum): diff --git a/src/api/models/Avatar.py b/src/api/models/Avatar.py index 3ecaa711d..c46b1df0d 100644 --- a/src/api/models/Avatar.py +++ b/src/api/models/Avatar.py @@ -1,4 +1,4 @@ -from api.models.AbstractEntity import AbstractEntity +from src.api.models.AbstractEntity import AbstractEntity class Avatar(AbstractEntity): diff --git a/src/api/models/AvatarAssignment.py b/src/api/models/AvatarAssignment.py index 14386606f..fa4b82196 100644 --- a/src/api/models/AvatarAssignment.py +++ b/src/api/models/AvatarAssignment.py @@ -1,7 +1,8 @@ -from api.models.AbstractEntity import AbstractEntity -from api.models.Avatar import Avatar from pydantic import Field +from src.api.models.AbstractEntity import AbstractEntity +from src.api.models.Avatar import Avatar + class AvatarAssignment(AbstractEntity): expires_at: str | None = Field(alias="expiresAt") diff --git a/src/api/models/CoopMission.py b/src/api/models/CoopMission.py index 09a64acdc..b04c1f84c 100644 --- a/src/api/models/CoopMission.py +++ b/src/api/models/CoopMission.py @@ -1,6 +1,6 @@ from pydantic import Field -from api.models.ConfiguredModel import ConfiguredModel +from src.api.models.ConfiguredModel import ConfiguredModel class CoopMission(ConfiguredModel): diff --git a/src/api/models/CoopResult.py b/src/api/models/CoopResult.py index 8e4d34e02..afed1ad8c 100644 --- a/src/api/models/CoopResult.py +++ b/src/api/models/CoopResult.py @@ -1,7 +1,7 @@ from pydantic import Field -from api.models.ConfiguredModel import ConfiguredModel -from api.models.Game import Game +from src.api.models.ConfiguredModel import ConfiguredModel +from src.api.models.Game import Game class CoopResult(ConfiguredModel): diff --git a/src/api/models/CoopScenario.py b/src/api/models/CoopScenario.py index 5d30ca789..964ba8c64 100644 --- a/src/api/models/CoopScenario.py +++ b/src/api/models/CoopScenario.py @@ -1,7 +1,7 @@ from pydantic import Field -from api.models.ConfiguredModel import ConfiguredModel -from api.models.CoopMission import CoopMission +from src.api.models.ConfiguredModel import ConfiguredModel +from src.api.models.CoopMission import CoopMission class CoopScenario(ConfiguredModel): diff --git a/src/api/models/Event.py b/src/api/models/Event.py index c6f3b8958..ab8abe0f6 100644 --- a/src/api/models/Event.py +++ b/src/api/models/Event.py @@ -1,6 +1,7 @@ -from api.models.ConfiguredModel import ConfiguredModel from pydantic import Field +from src.api.models.ConfiguredModel import ConfiguredModel + class Event(ConfiguredModel): xd: str = Field(alias="id") diff --git a/src/api/models/FeaturedMod.py b/src/api/models/FeaturedMod.py index cff4af044..fc99c0209 100644 --- a/src/api/models/FeaturedMod.py +++ b/src/api/models/FeaturedMod.py @@ -1,6 +1,6 @@ from pydantic import Field -from api.models.ConfiguredModel import ConfiguredModel +from src.api.models.ConfiguredModel import ConfiguredModel class FeaturedMod(ConfiguredModel): diff --git a/src/api/models/FeaturedModFile.py b/src/api/models/FeaturedModFile.py index 154f40b31..c04125bea 100644 --- a/src/api/models/FeaturedModFile.py +++ b/src/api/models/FeaturedModFile.py @@ -1,6 +1,6 @@ from pydantic import Field -from api.models.ConfiguredModel import ConfiguredModel +from src.api.models.ConfiguredModel import ConfiguredModel class FeaturedModFile(ConfiguredModel): diff --git a/src/api/models/Game.py b/src/api/models/Game.py index 00dde8dd1..95390d6a0 100644 --- a/src/api/models/Game.py +++ b/src/api/models/Game.py @@ -1,8 +1,8 @@ from pydantic import Field -from api.models.ConfiguredModel import ConfiguredModel -from api.models.Player import Player -from api.models.PlayerStats import PlayerStats +from src.api.models.ConfiguredModel import ConfiguredModel +from src.api.models.Player import Player +from src.api.models.PlayerStats import PlayerStats class Game(ConfiguredModel): diff --git a/src/api/models/GamePlayerStats.py b/src/api/models/GamePlayerStats.py index 263e0b933..90a496a9e 100644 --- a/src/api/models/GamePlayerStats.py +++ b/src/api/models/GamePlayerStats.py @@ -1,6 +1,7 @@ -from api.models.ConfiguredModel import ConfiguredModel from pydantic import Field +from src.api.models.ConfiguredModel import ConfiguredModel + class GamePlayerStats(ConfiguredModel): xd: str = Field(alias="id") diff --git a/src/api/models/GeneratedMapParams.py b/src/api/models/GeneratedMapParams.py index d77eb15e2..eaecbee03 100644 --- a/src/api/models/GeneratedMapParams.py +++ b/src/api/models/GeneratedMapParams.py @@ -2,10 +2,10 @@ from pydantic import Field -from api.models.ConfiguredModel import ConfiguredModel -from api.models.Map import Map -from api.models.MapType import MapType -from api.models.MapVersion import MapVersion +from src.api.models.ConfiguredModel import ConfiguredModel +from src.api.models.Map import Map +from src.api.models.MapType import MapType +from src.api.models.MapVersion import MapVersion class GeneratedMapParams(ConfiguredModel): diff --git a/src/api/models/Leaderboard.py b/src/api/models/Leaderboard.py index eed847185..59bd92096 100644 --- a/src/api/models/Leaderboard.py +++ b/src/api/models/Leaderboard.py @@ -1,8 +1,9 @@ from __future__ import annotations -from api.models.AbstractEntity import AbstractEntity from pydantic import Field +from src.api.models.AbstractEntity import AbstractEntity + class Leaderboard(AbstractEntity): description: str = Field(alias="descriptionKey") diff --git a/src/api/models/LeaderboardRating.py b/src/api/models/LeaderboardRating.py index 2a960b494..6e25fb559 100644 --- a/src/api/models/LeaderboardRating.py +++ b/src/api/models/LeaderboardRating.py @@ -1,7 +1,8 @@ -from api.models.AbstractEntity import AbstractEntity -from api.models.Leaderboard import Leaderboard from pydantic import Field +from src.api.models.AbstractEntity import AbstractEntity +from src.api.models.Leaderboard import Leaderboard + class LeaderboardRating(AbstractEntity): deviation: float diff --git a/src/api/models/LeaderboardRatingJournal.py b/src/api/models/LeaderboardRatingJournal.py index 372025785..850cb4324 100644 --- a/src/api/models/LeaderboardRatingJournal.py +++ b/src/api/models/LeaderboardRatingJournal.py @@ -1,8 +1,9 @@ -from api.models.ConfiguredModel import ConfiguredModel -from api.models.GamePlayerStats import GamePlayerStats -from api.models.Leaderboard import Leaderboard from pydantic import Field +from src.api.models.ConfiguredModel import ConfiguredModel +from src.api.models.GamePlayerStats import GamePlayerStats +from src.api.models.Leaderboard import Leaderboard + class LeaderboardRatingJournal(ConfiguredModel): create_time: str = Field(alias="createTime") diff --git a/src/api/models/LeagueDivision.py b/src/api/models/LeagueDivision.py index aa83d9699..f0e75b676 100644 --- a/src/api/models/LeagueDivision.py +++ b/src/api/models/LeagueDivision.py @@ -1,7 +1,8 @@ -from api.models.ConfiguredModel import ConfiguredModel -from api.models.LeagueSeason import LeagueSeason from pydantic import Field +from src.api.models.ConfiguredModel import ConfiguredModel +from src.api.models.LeagueSeason import LeagueSeason + class LeagueDivision(ConfiguredModel): xd: str = Field(alias="id") diff --git a/src/api/models/LeagueLeaderboard.py b/src/api/models/LeagueLeaderboard.py index 57e32812a..6de59ee20 100644 --- a/src/api/models/LeagueLeaderboard.py +++ b/src/api/models/LeagueLeaderboard.py @@ -1,6 +1,7 @@ -from api.models.ConfiguredModel import ConfiguredModel from pydantic import Field +from src.api.models.ConfiguredModel import ConfiguredModel + class LeagueLeaderboard(ConfiguredModel): technical_name: str = Field(alias="technicalName") diff --git a/src/api/models/LeagueSeason.py b/src/api/models/LeagueSeason.py index 02a3ba0de..9dd4b6ecb 100644 --- a/src/api/models/LeagueSeason.py +++ b/src/api/models/LeagueSeason.py @@ -1,7 +1,8 @@ -from api.models.ConfiguredModel import ConfiguredModel -from api.models.LeagueLeaderboard import LeagueLeaderboard from pydantic import Field +from src.api.models.ConfiguredModel import ConfiguredModel +from src.api.models.LeagueLeaderboard import LeagueLeaderboard + class LeagueSeason(ConfiguredModel): end_date: str = Field(alias="endDate") diff --git a/src/api/models/LeagueSeasonScore.py b/src/api/models/LeagueSeasonScore.py index 10c61be1e..fbbd1a614 100644 --- a/src/api/models/LeagueSeasonScore.py +++ b/src/api/models/LeagueSeasonScore.py @@ -1,8 +1,9 @@ -from api.models.ConfiguredModel import ConfiguredModel -from api.models.LeagueSeason import LeagueSeason -from api.models.LeagueSubdivision import LeagueSubdivision from pydantic import Field +from src.api.models.ConfiguredModel import ConfiguredModel +from src.api.models.LeagueSeason import LeagueSeason +from src.api.models.LeagueSubdivision import LeagueSubdivision + class LeagueSeasonScore(ConfiguredModel): game_count: int = Field(alias="gameCount") diff --git a/src/api/models/LeagueSubdivision.py b/src/api/models/LeagueSubdivision.py index c2c7847ce..5c12cf960 100644 --- a/src/api/models/LeagueSubdivision.py +++ b/src/api/models/LeagueSubdivision.py @@ -1,7 +1,8 @@ -from api.models.ConfiguredModel import ConfiguredModel -from api.models.LeagueDivision import LeagueDivision from pydantic import Field +from src.api.models.ConfiguredModel import ConfiguredModel +from src.api.models.LeagueDivision import LeagueDivision + class LeagueSubdivision(ConfiguredModel): index: int = Field(alias="subdivisionIndex") diff --git a/src/api/models/Map.py b/src/api/models/Map.py index 6a168acfb..420f31d47 100644 --- a/src/api/models/Map.py +++ b/src/api/models/Map.py @@ -1,10 +1,11 @@ -from api.models.AbstractEntity import AbstractEntity -from api.models.MapType import MapType -from api.models.MapVersion import MapVersion -from api.models.Player import Player -from api.models.ReviewsSummary import ReviewsSummary from pydantic import Field +from src.api.models.AbstractEntity import AbstractEntity +from src.api.models.MapType import MapType +from src.api.models.MapVersion import MapVersion +from src.api.models.Player import Player +from src.api.models.ReviewsSummary import ReviewsSummary + class Map(AbstractEntity): display_name: str = Field(alias="displayName") diff --git a/src/api/models/MapPoolAssignment.py b/src/api/models/MapPoolAssignment.py index a110d0b89..986c3bb05 100644 --- a/src/api/models/MapPoolAssignment.py +++ b/src/api/models/MapPoolAssignment.py @@ -1,10 +1,11 @@ from __future__ import annotations -from api.models.AbstractEntity import AbstractEntity -from api.models.GeneratedMapParams import GeneratedMapParams -from api.models.MapVersion import MapVersion from pydantic import Field +from src.api.models.AbstractEntity import AbstractEntity +from src.api.models.GeneratedMapParams import GeneratedMapParams +from src.api.models.MapVersion import MapVersion + class MapPoolAssignment(AbstractEntity): map_params: GeneratedMapParams | None = Field(None, alias="mapParams") diff --git a/src/api/models/MapVersion.py b/src/api/models/MapVersion.py index 08521a849..fd3ff1f00 100644 --- a/src/api/models/MapVersion.py +++ b/src/api/models/MapVersion.py @@ -4,7 +4,7 @@ from pydantic import Field -from api.models.AbstractEntity import AbstractEntity +from src.api.models.AbstractEntity import AbstractEntity @dataclass diff --git a/src/api/models/Mod.py b/src/api/models/Mod.py index 5dd9ed545..2af47a425 100644 --- a/src/api/models/Mod.py +++ b/src/api/models/Mod.py @@ -1,9 +1,10 @@ -from api.models.AbstractEntity import AbstractEntity -from api.models.ModVersion import ModVersion -from api.models.Player import Player -from api.models.ReviewsSummary import ReviewsSummary from pydantic import Field +from src.api.models.AbstractEntity import AbstractEntity +from src.api.models.ModVersion import ModVersion +from src.api.models.Player import Player +from src.api.models.ReviewsSummary import ReviewsSummary + class Mod(AbstractEntity): display_name: str = Field(alias="displayName") diff --git a/src/api/models/ModVersion.py b/src/api/models/ModVersion.py index cbce8d237..0ae562b36 100644 --- a/src/api/models/ModVersion.py +++ b/src/api/models/ModVersion.py @@ -1,7 +1,7 @@ from pydantic import Field -from api.models.AbstractEntity import AbstractEntity -from api.models.ModType import ModType +from src.api.models.AbstractEntity import AbstractEntity +from src.api.models.ModType import ModType class ModVersion(AbstractEntity): diff --git a/src/api/models/NameRecord.py b/src/api/models/NameRecord.py index 970d627cd..61c11732d 100644 --- a/src/api/models/NameRecord.py +++ b/src/api/models/NameRecord.py @@ -1,6 +1,7 @@ -from api.models.ConfiguredModel import ConfiguredModel from pydantic import Field +from src.api.models.ConfiguredModel import ConfiguredModel + class NameRecord(ConfiguredModel): xd: str = Field(alias="id") diff --git a/src/api/models/Player.py b/src/api/models/Player.py index 37b9a8a6c..e78a1623f 100644 --- a/src/api/models/Player.py +++ b/src/api/models/Player.py @@ -1,10 +1,11 @@ from __future__ import annotations -from api.models.AbstractEntity import AbstractEntity -from api.models.AvatarAssignment import AvatarAssignment -from api.models.NameRecord import NameRecord from pydantic import Field +from src.api.models.AbstractEntity import AbstractEntity +from src.api.models.AvatarAssignment import AvatarAssignment +from src.api.models.NameRecord import NameRecord + class Player(AbstractEntity): login: str diff --git a/src/api/models/PlayerAchievement.py b/src/api/models/PlayerAchievement.py index 479ea3fe4..578b2fa38 100644 --- a/src/api/models/PlayerAchievement.py +++ b/src/api/models/PlayerAchievement.py @@ -1,9 +1,10 @@ -from api.models.AbstractEntity import AbstractEntity -from api.models.Achievement import Achievement -from api.models.Achievement import State -from api.models.Player import Player from pydantic import Field +from src.api.models.AbstractEntity import AbstractEntity +from src.api.models.Achievement import Achievement +from src.api.models.Achievement import State +from src.api.models.Player import Player + class PlayerAchievement(AbstractEntity): current_steps: int | None = Field(alias="currentSteps") diff --git a/src/api/models/PlayerEvent.py b/src/api/models/PlayerEvent.py index 64ee39f6b..c55f6a914 100644 --- a/src/api/models/PlayerEvent.py +++ b/src/api/models/PlayerEvent.py @@ -1,8 +1,9 @@ -from api.models.AbstractEntity import AbstractEntity -from api.models.Event import Event -from api.models.Player import Player from pydantic import Field +from src.api.models.AbstractEntity import AbstractEntity +from src.api.models.Event import Event +from src.api.models.Player import Player + class PlayerEvent(AbstractEntity): current_count: int = Field(alias="currentCount") diff --git a/src/api/models/PlayerStats.py b/src/api/models/PlayerStats.py index ea4ec724f..d0255615f 100644 --- a/src/api/models/PlayerStats.py +++ b/src/api/models/PlayerStats.py @@ -1,7 +1,7 @@ from pydantic import Field -from api.models.ConfiguredModel import ConfiguredModel -from api.models.Player import Player +from src.api.models.ConfiguredModel import ConfiguredModel +from src.api.models.Player import Player class PlayerStats(ConfiguredModel): diff --git a/src/api/models/ReviewsSummary.py b/src/api/models/ReviewsSummary.py index dd7268b6b..4c51ab3e8 100644 --- a/src/api/models/ReviewsSummary.py +++ b/src/api/models/ReviewsSummary.py @@ -1,7 +1,7 @@ from pydantic import Field from pydantic import field_validator -from api.models.ConfiguredModel import ConfiguredModel +from src.api.models.ConfiguredModel import ConfiguredModel class ReviewsSummary(ConfiguredModel): diff --git a/src/api/parsers/CoopResultParser.py b/src/api/parsers/CoopResultParser.py index c9786db25..ef226c98a 100644 --- a/src/api/parsers/CoopResultParser.py +++ b/src/api/parsers/CoopResultParser.py @@ -1,4 +1,4 @@ -from api.models.CoopResult import CoopResult +from src.api.models.CoopResult import CoopResult class CoopResultParser: diff --git a/src/api/parsers/CoopScenarioParser.py b/src/api/parsers/CoopScenarioParser.py index 8f269ce1f..f72b4d1ab 100644 --- a/src/api/parsers/CoopScenarioParser.py +++ b/src/api/parsers/CoopScenarioParser.py @@ -1,4 +1,4 @@ -from api.models.CoopScenario import CoopScenario +from src.api.models.CoopScenario import CoopScenario class CoopScenarioParser: diff --git a/src/api/parsers/FeaturedModFileParser.py b/src/api/parsers/FeaturedModFileParser.py index ef55a1395..3e27b8f72 100644 --- a/src/api/parsers/FeaturedModFileParser.py +++ b/src/api/parsers/FeaturedModFileParser.py @@ -1,4 +1,4 @@ -from api.models.FeaturedModFile import FeaturedModFile +from src.api.models.FeaturedModFile import FeaturedModFile class FeaturedModFileParser: diff --git a/src/api/parsers/FeaturedModParser.py b/src/api/parsers/FeaturedModParser.py index da95bdac8..96225e1e7 100644 --- a/src/api/parsers/FeaturedModParser.py +++ b/src/api/parsers/FeaturedModParser.py @@ -1,4 +1,4 @@ -from api.models.FeaturedMod import FeaturedMod +from src.api.models.FeaturedMod import FeaturedMod class FeaturedModParser: diff --git a/src/api/parsers/GeneratedMapParamsParser.py b/src/api/parsers/GeneratedMapParamsParser.py index 43b50c2b4..878fd8f8a 100644 --- a/src/api/parsers/GeneratedMapParamsParser.py +++ b/src/api/parsers/GeneratedMapParamsParser.py @@ -1,5 +1,5 @@ -from api.models.Map import Map from src.api.models.GeneratedMapParams import GeneratedMapParams +from src.api.models.Map import Map class GeneratedMapParamsParser: diff --git a/src/api/parsers/LeaderboardParser.py b/src/api/parsers/LeaderboardParser.py index 9cbb0f6fc..78a68dfbf 100644 --- a/src/api/parsers/LeaderboardParser.py +++ b/src/api/parsers/LeaderboardParser.py @@ -1,6 +1,6 @@ from operator import methodcaller -from api.models.Leaderboard import Leaderboard +from src.api.models.Leaderboard import Leaderboard class LeaderboardParser: diff --git a/src/api/parsers/LeaderboardRatingJournalParser.py b/src/api/parsers/LeaderboardRatingJournalParser.py index c83037499..9fd7b126c 100644 --- a/src/api/parsers/LeaderboardRatingJournalParser.py +++ b/src/api/parsers/LeaderboardRatingJournalParser.py @@ -1,4 +1,4 @@ -from api.models.LeaderboardRatingJournal import LeaderboardRatingJournal +from src.api.models.LeaderboardRatingJournal import LeaderboardRatingJournal class LeaderboardRatingJournalParser: diff --git a/src/api/parsers/LeaderboardRatingParser.py b/src/api/parsers/LeaderboardRatingParser.py index 2ab1200cb..221c98ea2 100644 --- a/src/api/parsers/LeaderboardRatingParser.py +++ b/src/api/parsers/LeaderboardRatingParser.py @@ -1,4 +1,4 @@ -from api.models.LeaderboardRating import LeaderboardRating +from src.api.models.LeaderboardRating import LeaderboardRating class LeaderboardRatingParser: diff --git a/src/api/parsers/MapParser.py b/src/api/parsers/MapParser.py index f8c063b9c..9cc2e01c2 100644 --- a/src/api/parsers/MapParser.py +++ b/src/api/parsers/MapParser.py @@ -1,5 +1,5 @@ -from api.models.Map import Map -from api.models.MapVersion import MapVersion +from src.api.models.Map import Map +from src.api.models.MapVersion import MapVersion class MapParser: diff --git a/src/api/parsers/MapPoolAssignmentParser.py b/src/api/parsers/MapPoolAssignmentParser.py index 8b2448bff..56fca167a 100644 --- a/src/api/parsers/MapPoolAssignmentParser.py +++ b/src/api/parsers/MapPoolAssignmentParser.py @@ -1,6 +1,6 @@ -from api.models.Map import Map -from api.models.MapPoolAssignment import MapPoolAssignment -from api.parsers.MapParser import MapParser +from src.api.models.Map import Map +from src.api.models.MapPoolAssignment import MapPoolAssignment +from src.api.parsers.MapParser import MapParser class MapPoolAssignmentParser: diff --git a/src/api/parsers/MapVersionParser.py b/src/api/parsers/MapVersionParser.py index f603950d6..64f9c6bf3 100644 --- a/src/api/parsers/MapVersionParser.py +++ b/src/api/parsers/MapVersionParser.py @@ -1,4 +1,4 @@ -from api.models.MapVersion import MapVersion +from src.api.models.MapVersion import MapVersion class MapVersionParser: diff --git a/src/api/parsers/ModParser.py b/src/api/parsers/ModParser.py index b97711728..3d4950f4d 100644 --- a/src/api/parsers/ModParser.py +++ b/src/api/parsers/ModParser.py @@ -1,4 +1,4 @@ -from api.models.Mod import Mod +from src.api.models.Mod import Mod class ModParser: diff --git a/src/api/parsers/ModVersionParser.py b/src/api/parsers/ModVersionParser.py index d572046bd..3399dc656 100644 --- a/src/api/parsers/ModVersionParser.py +++ b/src/api/parsers/ModVersionParser.py @@ -1,4 +1,4 @@ -from api.models.ModVersion import ModVersion +from src.api.models.ModVersion import ModVersion class ModVersionParser: diff --git a/src/api/parsers/PlayerParser.py b/src/api/parsers/PlayerParser.py index cead4158a..15d06495e 100644 --- a/src/api/parsers/PlayerParser.py +++ b/src/api/parsers/PlayerParser.py @@ -1,4 +1,4 @@ -from api.models.Player import Player +from src.api.models.Player import Player class PlayerParser: diff --git a/src/api/parsers/ReviewsSummaryParser.py b/src/api/parsers/ReviewsSummaryParser.py index cabb60c57..17803d4dd 100644 --- a/src/api/parsers/ReviewsSummaryParser.py +++ b/src/api/parsers/ReviewsSummaryParser.py @@ -1,4 +1,4 @@ -from api.models.ReviewsSummary import ReviewsSummary +from src.api.models.ReviewsSummary import ReviewsSummary class ReviewsSummaryParser: diff --git a/src/api/player_api.py b/src/api/player_api.py index 5270ea19d..957152c0f 100644 --- a/src/api/player_api.py +++ b/src/api/player_api.py @@ -2,8 +2,8 @@ from PyQt6.QtCore import pyqtSignal -from api.ApiAccessors import DataApiAccessor -from api.models.Player import Player +from src.api.ApiAccessors import DataApiAccessor +from src.api.models.Player import Player logger = logging.getLogger(__name__) diff --git a/src/api/replaysapi.py b/src/api/replaysapi.py index a9a8e99b7..1ff3cb9d8 100644 --- a/src/api/replaysapi.py +++ b/src/api/replaysapi.py @@ -1,6 +1,6 @@ import logging -from api.ApiAccessors import DataApiAccessor +from src.api.ApiAccessors import DataApiAccessor logger = logging.getLogger(__name__) diff --git a/src/api/sim_mod_updater.py b/src/api/sim_mod_updater.py index 9b5bacbd2..0f4db40b2 100644 --- a/src/api/sim_mod_updater.py +++ b/src/api/sim_mod_updater.py @@ -1,6 +1,6 @@ import logging -from api.ApiAccessors import DataApiAccessor +from src.api.ApiAccessors import DataApiAccessor logger = logging.getLogger(__name__) diff --git a/src/api/stats_api.py b/src/api/stats_api.py index d0a2bd6db..3dcd5e952 100644 --- a/src/api/stats_api.py +++ b/src/api/stats_api.py @@ -5,15 +5,15 @@ from PyQt6.QtCore import Qt from PyQt6.QtCore import pyqtSignal -from api.ApiAccessors import ApiAccessor -from api.ApiAccessors import DataApiAccessor -from api.models.Achievement import Achievement -from api.models.Leaderboard import Leaderboard -from api.models.LeagueSeasonScore import LeagueSeasonScore -from api.models.PlayerAchievement import PlayerAchievement -from api.models.PlayerEvent import PlayerEvent -from api.parsers.LeaderboardParser import LeaderboardParser -from api.parsers.LeaderboardRatingParser import LeaderboardRatingParser +from src.api.ApiAccessors import ApiAccessor +from src.api.ApiAccessors import DataApiAccessor +from src.api.models.Achievement import Achievement +from src.api.models.Leaderboard import Leaderboard +from src.api.models.LeagueSeasonScore import LeagueSeasonScore +from src.api.models.PlayerAchievement import PlayerAchievement +from src.api.models.PlayerEvent import PlayerEvent +from src.api.parsers.LeaderboardParser import LeaderboardParser +from src.api.parsers.LeaderboardRatingParser import LeaderboardRatingParser logger = logging.getLogger(__name__) diff --git a/src/api/vaults_api.py b/src/api/vaults_api.py index 271e7871c..6b8fec1c8 100644 --- a/src/api/vaults_api.py +++ b/src/api/vaults_api.py @@ -1,10 +1,10 @@ import logging from collections.abc import Sequence -from api.ApiAccessors import DataApiAccessor -from api.parsers.MapParser import MapParser -from api.parsers.MapPoolAssignmentParser import MapPoolAssignmentParser -from api.parsers.ModParser import ModParser +from src.api.ApiAccessors import DataApiAccessor +from src.api.parsers.MapParser import MapParser +from src.api.parsers.MapPoolAssignmentParser import MapPoolAssignmentParser +from src.api.parsers.ModParser import ModParser logger = logging.getLogger(__name__) diff --git a/src/chat/__init__.py b/src/chat/__init__.py index 745895151..4f7c6d3fa 100644 --- a/src/chat/__init__.py +++ b/src/chat/__init__.py @@ -1,7 +1,7 @@ # CAVEAT: DO NOT REMOVE! These are promoted widgets and py2exe wouldn't # include them otherwise -from chat.chatlineedit import ChatLineEdit -from chat.chatterlistview import ChatterListView +from src.chat.chatlineedit import ChatLineEdit +from src.chat.chatterlistview import ChatterListView __all__ = ( "ChatLineEdit", diff --git a/src/chat/_avatarWidget.py b/src/chat/_avatarWidget.py index 29b711b3d..498006a9b 100644 --- a/src/chat/_avatarWidget.py +++ b/src/chat/_avatarWidget.py @@ -4,7 +4,7 @@ from PyQt6.QtWidgets import QListWidgetItem from PyQt6.QtWidgets import QPushButton -from downloadManager import DownloadRequest +from src.downloadManager import DownloadRequest class AvatarWidget(QObject): diff --git a/src/chat/channel_autojoiner.py b/src/chat/channel_autojoiner.py index 307d7dd1b..dcf7a4a11 100644 --- a/src/chat/channel_autojoiner.py +++ b/src/chat/channel_autojoiner.py @@ -1,5 +1,5 @@ -from chat.lang import DEFAULT_LANGUAGE_CHANNELS -from util.lang import COUNTRY_TO_LANGUAGE +from src.chat.lang import DEFAULT_LANGUAGE_CHANNELS +from src.util.lang import COUNTRY_TO_LANGUAGE class ChannelAutojoiner: diff --git a/src/chat/channel_tab.py b/src/chat/channel_tab.py index 1208c4cf0..64db4b311 100644 --- a/src/chat/channel_tab.py +++ b/src/chat/channel_tab.py @@ -3,7 +3,7 @@ from PyQt6.QtCore import QTimer from PyQt6.QtMultimedia import QSoundEffect -from chat.chat_widget import TabIcon +from src.chat.chat_widget import TabIcon class TabInfo(IntEnum): diff --git a/src/chat/channel_view.py b/src/chat/channel_view.py index 2d420dd50..f8ab29861 100644 --- a/src/chat/channel_view.py +++ b/src/chat/channel_view.py @@ -6,21 +6,21 @@ from PyQt6.QtCore import pyqtSignal from PyQt6.QtGui import QDesktopServices -from chat.channel_tab import TabInfo -from chat.channel_widget import ChannelWidget -from chat.chatter_menu import ChatterMenu -from chat.chatter_model import ChatterEventFilter -from chat.chatter_model import ChatterFormat -from chat.chatter_model import ChatterItemDelegate -from chat.chatter_model import ChatterLayout -from chat.chatter_model import ChatterLayoutElements -from chat.chatter_model import ChatterModel -from chat.chatter_model import ChatterSortFilterModel -from downloadManager import DownloadRequest -from model.chat.channel import ChannelType -from model.chat.chatline import ChatLineType -from util import irc_escape -from util.gameurl import GameUrl +from src.chat.channel_tab import TabInfo +from src.chat.channel_widget import ChannelWidget +from src.chat.chatter_menu import ChatterMenu +from src.chat.chatter_model import ChatterEventFilter +from src.chat.chatter_model import ChatterFormat +from src.chat.chatter_model import ChatterItemDelegate +from src.chat.chatter_model import ChatterLayout +from src.chat.chatter_model import ChatterLayoutElements +from src.chat.chatter_model import ChatterModel +from src.chat.chatter_model import ChatterSortFilterModel +from src.downloadManager import DownloadRequest +from src.model.chat.channel import ChannelType +from src.model.chat.chatline import ChatLineType +from src.util import irc_escape +from src.util.gameurl import GameUrl class ChannelView: diff --git a/src/chat/channel_widget.py b/src/chat/channel_widget.py index b67cea2e7..ecbbc074a 100644 --- a/src/chat/channel_widget.py +++ b/src/chat/channel_widget.py @@ -8,7 +8,7 @@ from PyQt6.QtGui import QTextCursor from PyQt6.QtGui import QTextDocument -from qt.utils import monkeypatch_method +from src.qt.utils import monkeypatch_method logger = logging.getLogger(__name__) diff --git a/src/chat/chat_announcer.py b/src/chat/chat_announcer.py index e9ad8e6c0..04645d9b2 100644 --- a/src/chat/chat_announcer.py +++ b/src/chat/chat_announcer.py @@ -1,5 +1,7 @@ -from model.chat.channel import ChannelID, ChannelType -from model.chat.chatline import ChatLine, ChatLineType +from src.model.chat.channel import ChannelID +from src.model.chat.channel import ChannelType +from src.model.chat.chatline import ChatLine +from src.model.chat.chatline import ChatLineType class ChatAnnouncer: diff --git a/src/chat/chat_controller.py b/src/chat/chat_controller.py index 0b97ec36f..05be4eae7 100644 --- a/src/chat/chat_controller.py +++ b/src/chat/chat_controller.py @@ -3,14 +3,14 @@ from PyQt6.QtCore import QObject from PyQt6.QtCore import pyqtSignal -from model.chat.channel import Channel -from model.chat.channel import ChannelID -from model.chat.channel import ChannelType -from model.chat.channel import Lines -from model.chat.channelchatter import ChannelChatter -from model.chat.chatline import ChatLine -from model.chat.chatline import ChatLineType -from model.chat.chatter import Chatter +from src.model.chat.channel import Channel +from src.model.chat.channel import ChannelID +from src.model.chat.channel import ChannelType +from src.model.chat.channel import Lines +from src.model.chat.channelchatter import ChannelChatter +from src.model.chat.chatline import ChatLine +from src.model.chat.chatline import ChatLineType +from src.model.chat.chatter import Chatter class ChatController(QObject): diff --git a/src/chat/chat_greeter.py b/src/chat/chat_greeter.py index bcf0b980c..2c21c267c 100644 --- a/src/chat/chat_greeter.py +++ b/src/chat/chat_greeter.py @@ -1,6 +1,7 @@ -from model.chat.channel import ChannelType -from model.chat.chatline import ChatLine, ChatLineType -from util import irc_escape +from src.model.chat.channel import ChannelType +from src.model.chat.chatline import ChatLine +from src.model.chat.chatline import ChatLineType +from src.util import irc_escape class ChatGreeter: diff --git a/src/chat/chat_view.py b/src/chat/chat_view.py index 2bed55bd1..fe2bbdf64 100644 --- a/src/chat/chat_view.py +++ b/src/chat/chat_view.py @@ -1,7 +1,7 @@ -from chat.channel_tab import ChannelTab -from chat.channel_view import ChannelView -from chat.chat_widget import ChatWidget -from model.chat.channel import ChannelType +from src.chat.channel_tab import ChannelTab +from src.chat.channel_view import ChannelView +from src.chat.chat_widget import ChatWidget +from src.model.chat.channel import ChannelType class ChatView: diff --git a/src/chat/chat_widget.py b/src/chat/chat_widget.py index 308b08ded..a20a345be 100644 --- a/src/chat/chat_widget.py +++ b/src/chat/chat_widget.py @@ -5,8 +5,8 @@ from PyQt6.QtWidgets import QApplication from PyQt6.QtWidgets import QTabBar -from model.chat.channel import PARTY_CHANNEL_SUFFIX -from model.chat.channel import ChannelType +from src.model.chat.channel import PARTY_CHANNEL_SUFFIX +from src.model.chat.channel import ChannelType class TabIcon(Enum): diff --git a/src/chat/chatter_menu.py b/src/chat/chatter_menu.py index 5645ea671..0f952bff0 100644 --- a/src/chat/chatter_menu.py +++ b/src/chat/chatter_menu.py @@ -6,15 +6,15 @@ from PyQt6.QtWidgets import QWidget -from chat._avatarWidget import AvatarWidget -from client.aliasviewer import AliasWindow -from client.user import User -from contextmenu.playercontextmenu import PlayerContextMenu -from fa.game_runner import GameRunner -from power import PowerTools +from src.chat._avatarWidget import AvatarWidget +from src.client.aliasviewer import AliasWindow +from src.client.user import User +from src.contextmenu.playercontextmenu import PlayerContextMenu +from src.fa.game_runner import GameRunner +from src.power import PowerTools if TYPE_CHECKING: - from client._clientwindow import ClientWindow + from src.client._clientwindow import ClientWindow logger = logging.getLogger(__name__) diff --git a/src/chat/chatter_model.py b/src/chat/chatter_model.py index 3917bd249..5347a1238 100644 --- a/src/chat/chatter_model.py +++ b/src/chat/chatter_model.py @@ -13,15 +13,15 @@ from PyQt6.QtGui import QColor from PyQt6.QtGui import QIcon -import util -from chat.chatter_model_item import ChatterModelItem -from chat.chatterlistview import ChatterListView -from chat.gameinfo import SensitiveMapInfoChecker -from fa import maps -from model.game import GameState -from model.rating import RatingType -from qt.itemviews.styleditemdelegate import StyledItemDelegate -from qt.models.qtlistmodel import QtListModel +from src import util +from src.chat.chatter_model_item import ChatterModelItem +from src.chat.chatterlistview import ChatterListView +from src.chat.gameinfo import SensitiveMapInfoChecker +from src.fa import maps +from src.model.game import GameState +from src.model.rating import RatingType +from src.qt.itemviews.styleditemdelegate import StyledItemDelegate +from src.qt.models.qtlistmodel import QtListModel class ChatterModel(QtListModel): diff --git a/src/chat/chatter_model_item.py b/src/chat/chatter_model_item.py index 3e980061c..ef3db317c 100644 --- a/src/chat/chatter_model_item.py +++ b/src/chat/chatter_model_item.py @@ -3,8 +3,8 @@ from PyQt6.QtCore import QObject from PyQt6.QtCore import pyqtSignal -from downloadManager import DownloadRequest -from fa import maps +from src.downloadManager import DownloadRequest +from src.fa import maps class ChatterModelItem(QObject): diff --git a/src/chat/gameinfo.py b/src/chat/gameinfo.py index 857525c64..e807143d3 100644 --- a/src/chat/gameinfo.py +++ b/src/chat/gameinfo.py @@ -1,6 +1,6 @@ from PyQt6.QtCore import QObject -from model.game import GameState +from src.model.game import GameState class SensitiveMapInfoChecker(QObject): diff --git a/src/chat/ircconnection.py b/src/chat/ircconnection.py index 9ce80644f..35fbf9fcc 100644 --- a/src/chat/ircconnection.py +++ b/src/chat/ircconnection.py @@ -12,15 +12,15 @@ from PyQt6.QtCore import QObject from PyQt6.QtCore import pyqtSignal -import config -import util -from api.ApiAccessors import UserApiAccessor -from chat.socketadapter import ConnectionFactory -from chat.socketadapter import ReactorForSocketAdapter -from model.chat.channel import ChannelID -from model.chat.channel import ChannelType -from model.chat.chatline import ChatLine -from model.chat.chatline import ChatLineType +from src import config +from src import util +from src.api.ApiAccessors import UserApiAccessor +from src.chat.socketadapter import ConnectionFactory +from src.chat.socketadapter import ReactorForSocketAdapter +from src.model.chat.channel import ChannelID +from src.model.chat.channel import ChannelType +from src.model.chat.chatline import ChatLine +from src.model.chat.chatline import ChatLineType logger = logging.getLogger(__name__) IRC_ELEVATION = '%@~%+&' diff --git a/src/chat/language_channel_config.py b/src/chat/language_channel_config.py index 6f2588152..11ad86973 100644 --- a/src/chat/language_channel_config.py +++ b/src/chat/language_channel_config.py @@ -1,7 +1,7 @@ from PyQt6.QtCore import QAbstractListModel from PyQt6.QtCore import Qt -from chat.lang import LANGUAGE_CHANNELS +from src.chat.lang import LANGUAGE_CHANNELS class ChannelEntry: diff --git a/src/client/__init__.py b/src/client/__init__.py index 1cb67b3b6..fa8ccc0c1 100644 --- a/src/client/__init__.py +++ b/src/client/__init__.py @@ -1,7 +1,7 @@ import logging # Do not remove - promoted widget, py2exe does not include it otherwise -from client.theme_menu import ThemeMenu +from src.client.theme_menu import ThemeMenu from ._clientwindow import ClientWindow diff --git a/src/client/_clientwindow.py b/src/client/_clientwindow.py index fbb0862e8..290336880 100644 --- a/src/client/_clientwindow.py +++ b/src/client/_clientwindow.py @@ -7,78 +7,78 @@ from PyQt6 import QtWidgets from PyQt6.QtNetwork import QNetworkAccessManager -import config -import fa -import notifications as ns -import util -import util.crash -from chat import ChatMVC -from chat._avatarWidget import AvatarWidget -from chat.channel_autojoiner import ChannelAutojoiner -from chat.chat_announcer import ChatAnnouncer -from chat.chat_controller import ChatController -from chat.chat_greeter import ChatGreeter -from chat.chat_view import ChatView -from chat.chatter_model import ChatterLayoutElements -from chat.ircconnection import IrcConnection -from chat.language_channel_config import LanguageChannelConfig -from chat.line_restorer import ChatLineRestorer -from client.aliasviewer import AliasSearchWindow -from client.aliasviewer import AliasWindow -from client.chat_config import ChatConfig -from client.clientstate import ClientState -from client.connection import ConnectionState -from client.connection import Dispatcher -from client.connection import LobbyInfo -from client.connection import ServerConnection -from client.connection import ServerReconnecter -from client.gameannouncer import GameAnnouncer -from client.login import LoginWidget -from client.playercolors import PlayerColors -from client.theme_menu import ThemeMenu -from client.user import User -from client.user import UserRelationController -from client.user import UserRelationModel -from client.user import UserRelations -from client.user import UserRelationTrackers -from connectivity.ConnectivityDialog import ConnectivityDialog -from contextmenu.playercontextmenu import PlayerContextMenu -from coop import CoopWidget -from downloadManager import ImageDownloader -from downloadManager import MapSmallPreviewDownloader -from fa.factions import Factions -from fa.game_runner import GameRunner -from fa.game_session import GameSession -from fa.maps import getUserMapsFolder -from games import GamesWidget -from games.gameitem import GameViewBuilder -from games.gamemodel import GameModel -from games.hostgamewidget import build_launcher -from mapGenerator.mapgenManager import MapGeneratorManager -from model.chat.channel import ChannelID -from model.chat.channel import ChannelType -from model.chat.chat import Chat -from model.chat.chatline import ChatLineMetadataBuilder -from model.gameset import Gameset -from model.gameset import PlayerGameIndex -from model.player import Player -from model.playerset import Playerset -from model.rating import MatchmakerQueueType -from model.rating import RatingType -from news import NewsWidget -from oauth.oauth_flow import OAuth2FlowInstance -from power import PowerTools -from replays import ReplaysWidget -from secondaryServer import SecondaryServer -from stats import StatsWidget -from ui.busy_widget import BusyWidget -from ui.status_logo import StatusLogo -from unitdb.unitdbtab import UnitDBTab -from updater import ClientUpdateTools -from vaults.mapvault.mapvault import MapVault -from vaults.modvault.modvault import ModVault -from vaults.modvault.utils import getModFolder -from vaults.modvault.utils import setModFolder +import src.notifications as ns +from src import config +from src import fa +from src import util +from src.chat import ChatMVC +from src.chat._avatarWidget import AvatarWidget +from src.chat.channel_autojoiner import ChannelAutojoiner +from src.chat.chat_announcer import ChatAnnouncer +from src.chat.chat_controller import ChatController +from src.chat.chat_greeter import ChatGreeter +from src.chat.chat_view import ChatView +from src.chat.chatter_model import ChatterLayoutElements +from src.chat.ircconnection import IrcConnection +from src.chat.language_channel_config import LanguageChannelConfig +from src.chat.line_restorer import ChatLineRestorer +from src.client.aliasviewer import AliasSearchWindow +from src.client.aliasviewer import AliasWindow +from src.client.chat_config import ChatConfig +from src.client.clientstate import ClientState +from src.client.connection import ConnectionState +from src.client.connection import Dispatcher +from src.client.connection import LobbyInfo +from src.client.connection import ServerConnection +from src.client.connection import ServerReconnecter +from src.client.gameannouncer import GameAnnouncer +from src.client.login import LoginWidget +from src.client.playercolors import PlayerColors +from src.client.theme_menu import ThemeMenu +from src.client.user import User +from src.client.user import UserRelationController +from src.client.user import UserRelationModel +from src.client.user import UserRelations +from src.client.user import UserRelationTrackers +from src.connectivity.ConnectivityDialog import ConnectivityDialog +from src.contextmenu.playercontextmenu import PlayerContextMenu +from src.coop import CoopWidget +from src.downloadManager import ImageDownloader +from src.downloadManager import MapSmallPreviewDownloader +from src.fa.factions import Factions +from src.fa.game_runner import GameRunner +from src.fa.game_session import GameSession +from src.fa.maps import getUserMapsFolder +from src.games import GamesWidget +from src.games.gameitem import GameViewBuilder +from src.games.gamemodel import GameModel +from src.games.hostgamewidget import build_launcher +from src.mapGenerator.mapgenManager import MapGeneratorManager +from src.model.chat.channel import ChannelID +from src.model.chat.channel import ChannelType +from src.model.chat.chat import Chat +from src.model.chat.chatline import ChatLineMetadataBuilder +from src.model.gameset import Gameset +from src.model.gameset import PlayerGameIndex +from src.model.player import Player +from src.model.playerset import Playerset +from src.model.rating import MatchmakerQueueType +from src.model.rating import RatingType +from src.news import NewsWidget +from src.oauth.oauth_flow import OAuth2FlowInstance +from src.power import PowerTools +from src.replays import ReplaysWidget +from src.secondaryServer import SecondaryServer +from src.stats import StatsWidget +from src.ui.busy_widget import BusyWidget +from src.ui.status_logo import StatusLogo +from src.unitdb.unitdbtab import UnitDBTab +from src.updater import ClientUpdateTools +from src.util import crash +from src.vaults.mapvault.mapvault import MapVault +from src.vaults.modvault.modvault import ModVault +from src.vaults.modvault.utils import getModFolder +from src.vaults.modvault.utils import setModFolder from .mouse_position import MousePosition @@ -602,11 +602,11 @@ def mouseMoveEvent(self, event): self.rubber_band.setGeometry(desktop) self.rubber_band.show() elif event.globalPosition().x() == 0: - desktop.setRight(desktop.right() / 2.0) + desktop.setRight(round(desktop.right() / 2)) self.rubber_band.setGeometry(desktop) self.rubber_band.show() elif event.globalPosition().x() == desktop.right(): - desktop.setRight(desktop.right() / 2.0) + desktop.setRight(round(desktop.right() / 2)) desktop.moveLeft(desktop.right()) self.rubber_band.setGeometry(desktop) self.rubber_band.show() @@ -1367,7 +1367,7 @@ def show_autojoin_settings_dialog(self): self, 'Set autojoin channels', text_of_autojoin_settings_dialog, - QtWidgets.QLineEdit.Normal, + QtWidgets.QLineEdit.EchoMode.Normal, ';'.join(autojoin_channels_list), ) if ok: @@ -1713,7 +1713,7 @@ def handle_welcome(self, message): self.me.onLogin(self.login, self.id) logger.info("Login success") - util.crash.CRASH_REPORT_USER = self.login + crash.CRASH_REPORT_USER = self.login self.update_options() diff --git a/src/client/aliasviewer.py b/src/client/aliasviewer.py index bcc541d78..d18954592 100644 --- a/src/client/aliasviewer.py +++ b/src/client/aliasviewer.py @@ -5,7 +5,7 @@ from PyQt6.QtCore import Qt from PyQt6.QtCore import QTimer -from api.player_api import PlayerApiConnector +from src.api.player_api import PlayerApiConnector logger = logging.getLogger(__name__) diff --git a/src/client/chat_config.py b/src/client/chat_config.py index ab153652c..34b938ee3 100644 --- a/src/client/chat_config.py +++ b/src/client/chat_config.py @@ -1,7 +1,7 @@ from PyQt6 import QtCore -from chat.chatter_model import ChatterLayoutElements -from client.user import SignallingSet # TODO - move to util +from src.chat.chatter_model import ChatterLayoutElements +from src.client.user import SignallingSet # TODO - move to util def signal_property(public): diff --git a/src/client/connection.py b/src/client/connection.py index 30339ece9..e935d0bba 100644 --- a/src/client/connection.py +++ b/src/client/connection.py @@ -11,11 +11,11 @@ from PyQt6.QtCore import QUrl from PyQt6.QtWebSockets import QWebSocket -import fa -from api.ApiAccessors import UserApiAccessor -from config import Settings -from model.game import Game -from model.game import message_to_game_args +from src import fa +from src.api.ApiAccessors import UserApiAccessor +from src.config import Settings +from src.model.game import Game +from src.model.game import message_to_game_args logger = logging.getLogger(__name__) diff --git a/src/client/gameannouncer.py b/src/client/gameannouncer.py index 5215183da..848b70d48 100644 --- a/src/client/gameannouncer.py +++ b/src/client/gameannouncer.py @@ -2,11 +2,11 @@ from PyQt6.QtCore import QTimer from PyQt6.QtCore import pyqtSignal -from client.playercolors import PlayerColors -from client.user import UserRelations -from fa import maps -from model.game import GameState -from model.gameset import Gameset +from src.client.playercolors import PlayerColors +from src.client.user import UserRelations +from src.fa import maps +from src.model.game import GameState +from src.model.gameset import Gameset class GameAnnouncer(QObject): diff --git a/src/client/login.py b/src/client/login.py index f6b50a28c..8a2a30522 100644 --- a/src/client/login.py +++ b/src/client/login.py @@ -3,11 +3,11 @@ from PyQt6 import QtCore from PyQt6 import QtGui -import config -import util -from config import Settings -from config.production import default_values as main_environment -from config.testing import default_values as testing_environment +from src import config +from src import util +from src.config import Settings +from src.config.production import default_values as main_environment +from src.config.testing import default_values as testing_environment logger = logging.getLogger(__name__) diff --git a/src/client/theme_menu.py b/src/client/theme_menu.py index 065360867..bcf209e79 100644 --- a/src/client/theme_menu.py +++ b/src/client/theme_menu.py @@ -3,8 +3,8 @@ from PyQt6.QtWidgets import QPushButton from PyQt6.QtWidgets import QStyleFactory -import util -from config import Settings +from src import util +from src.config import Settings FormClass, BaseClass = util.THEME.loadUiType("client/change_style.ui") diff --git a/src/config/__init__.py b/src/config/__init__.py index 258749839..6fd8adca5 100644 --- a/src/config/__init__.py +++ b/src/config/__init__.py @@ -9,11 +9,11 @@ from PyQt6 import QtCore -import fafpath -from config import version -from config.develop import default_values as develop_defaults -from config.production import default_values as production_defaults -from config.testing import default_values as testing_defaults +from src import fafpath +from src.config import version +from src.config.develop import default_values as develop_defaults +from src.config.production import default_values as production_defaults +from src.config.testing import default_values as testing_defaults if sys.platform == 'win32': import ctypes diff --git a/src/connectivity/ConnectivityDialog.py b/src/connectivity/ConnectivityDialog.py index 2c3aad6fa..74b5a92c3 100644 --- a/src/connectivity/ConnectivityDialog.py +++ b/src/connectivity/ConnectivityDialog.py @@ -6,10 +6,10 @@ from PyQt6.QtWidgets import QInputDialog from PyQt6.QtWidgets import QTableWidgetItem -import client as clientwindow -from connectivity.IceAdapterClient import IceAdapterClient -from decorators import with_logger -from util import THEME +from src import client as clientwindow +from src.connectivity.IceAdapterClient import IceAdapterClient +from src.decorators import with_logger +from src.util import THEME @with_logger diff --git a/src/connectivity/IceAdapterClient.py b/src/connectivity/IceAdapterClient.py index b51e6b4e0..e34dc7a08 100644 --- a/src/connectivity/IceAdapterClient.py +++ b/src/connectivity/IceAdapterClient.py @@ -2,10 +2,10 @@ from PyQt6.QtCore import pyqtSignal -import client -from client.connection import ConnectionState -from connectivity.JsonRpcTcpClient import JsonRpcTcpClient -from decorators import with_logger +from src import client +from src.client.connection import ConnectionState +from src.connectivity.JsonRpcTcpClient import JsonRpcTcpClient +from src.decorators import with_logger @with_logger diff --git a/src/connectivity/IceAdapterProcess.py b/src/connectivity/IceAdapterProcess.py index d513aeefa..c3339dc6c 100644 --- a/src/connectivity/IceAdapterProcess.py +++ b/src/connectivity/IceAdapterProcess.py @@ -7,9 +7,9 @@ from PyQt6.QtNetwork import QTcpServer from PyQt6.QtWidgets import QMessageBox -import fafpath -from config import Settings -from decorators import with_logger +from src import fafpath +from src.config import Settings +from src.decorators import with_logger @with_logger diff --git a/src/connectivity/IceServersPoller.py b/src/connectivity/IceServersPoller.py index 1e10eb96c..9486bb9f0 100644 --- a/src/connectivity/IceServersPoller.py +++ b/src/connectivity/IceServersPoller.py @@ -1,9 +1,9 @@ from PyQt6.QtCore import QObject from PyQt6.QtCore import pyqtSignal -from api.ApiAccessors import ApiAccessor -from connectivity.IceAdapterClient import IceAdapterClient -from decorators import with_logger +from src.api.ApiAccessors import ApiAccessor +from src.connectivity.IceAdapterClient import IceAdapterClient +from src.decorators import with_logger @with_logger diff --git a/src/connectivity/JsonRpcTcpClient.py b/src/connectivity/JsonRpcTcpClient.py index bf4f86858..a27b8f267 100644 --- a/src/connectivity/JsonRpcTcpClient.py +++ b/src/connectivity/JsonRpcTcpClient.py @@ -5,7 +5,7 @@ from PyQt6.QtNetwork import QAbstractSocket from PyQt6.QtNetwork import QTcpSocket -from decorators import with_logger +from src.decorators import with_logger @with_logger diff --git a/src/contextmenu/playercontextmenu.py b/src/contextmenu/playercontextmenu.py index df6397593..77824cc61 100644 --- a/src/contextmenu/playercontextmenu.py +++ b/src/contextmenu/playercontextmenu.py @@ -11,17 +11,17 @@ from PyQt6.QtWidgets import QMenu from PyQt6.QtWidgets import QWidget -from chat._avatarWidget import AvatarWidget -from client.aliasviewer import AliasWindow -from client.user import User -from fa.game_runner import GameRunner -from model.game import GameState -from model.player import Player -from playercard.playerinfodialog import PlayerInfoDialog -from power import PowerTools +from src.chat._avatarWidget import AvatarWidget +from src.client.aliasviewer import AliasWindow +from src.client.user import User +from src.fa.game_runner import GameRunner +from src.model.game import GameState +from src.model.player import Player +from src.playercard.playerinfodialog import PlayerInfoDialog +from src.power import PowerTools if TYPE_CHECKING: - from client._clientwindow import ClientWindow + from src.client._clientwindow import ClientWindow logger = logging.getLogger(__name__) diff --git a/src/coop/__init__.py b/src/coop/__init__.py index 35041c273..fbd802546 100644 --- a/src/coop/__init__.py +++ b/src/coop/__init__.py @@ -1,6 +1,6 @@ import logging -from coop.cooptableview import CoopLeaderboardTableView +from src.coop.cooptableview import CoopLeaderboardTableView # For use by other modules from ._coopwidget import CoopWidget diff --git a/src/coop/_coopwidget.py b/src/coop/_coopwidget.py index fe47bc4bc..6bd32ab2d 100644 --- a/src/coop/_coopwidget.py +++ b/src/coop/_coopwidget.py @@ -10,27 +10,27 @@ from PyQt6.QtNetwork import QNetworkReply from PyQt6.QtNetwork import QNetworkRequest -import fa -import util -from api.coop_api import CoopApiAccessor -from api.coop_api import CoopResultApiAccessor -from api.models.CoopResult import CoopResult -from api.models.CoopScenario import CoopScenario -from coop.coopmapitem import CoopMapItem -from coop.coopmapitem import CoopMapItemDelegate -from coop.coopmodel import CoopGameFilterModel -from coop.cooptableitemdelegate import CoopLeaderboardItemDelegate -from coop.cooptablemodel import CoopLeaderBoardModel -from fa.replay import replay -from games.gameitem import GameViewBuilder -from games.gamemodel import GameModel -from games.hostgamewidget import GameLauncher -from model.game import Game -from qt.utils import qopen -from ui.busy_widget import BusyWidget +from src import fa +from src import util +from src.api.coop_api import CoopApiAccessor +from src.api.coop_api import CoopResultApiAccessor +from src.api.models.CoopResult import CoopResult +from src.api.models.CoopScenario import CoopScenario +from src.coop.coopmapitem import CoopMapItem +from src.coop.coopmapitem import CoopMapItemDelegate +from src.coop.coopmodel import CoopGameFilterModel +from src.coop.cooptableitemdelegate import CoopLeaderboardItemDelegate +from src.coop.cooptablemodel import CoopLeaderBoardModel +from src.fa.replay import replay +from src.games.gameitem import GameViewBuilder +from src.games.gamemodel import GameModel +from src.games.hostgamewidget import GameLauncher +from src.model.game import Game +from src.qt.utils import qopen +from src.ui.busy_widget import BusyWidget if TYPE_CHECKING: - from client._clientwindow import ClientWindow + from src.client._clientwindow import ClientWindow logger = logging.getLogger(__name__) @@ -228,7 +228,7 @@ def game_double_clicked(self, game: Game) -> None: if game.password_protected: passw, ok = QtWidgets.QInputDialog.getText( self.client, "Passworded game", "Enter password :", - QtWidgets.QLineEdit.Normal, "", + QtWidgets.QLineEdit.EchoMode.Normal, "", ) if ok: self.client.join_game(uid=game.uid, password=passw) diff --git a/src/coop/coopmapitem.py b/src/coop/coopmapitem.py index 2c8b32836..573514bbf 100644 --- a/src/coop/coopmapitem.py +++ b/src/coop/coopmapitem.py @@ -4,8 +4,8 @@ from PyQt6 import QtGui from PyQt6 import QtWidgets -import util -from api.models.CoopMission import CoopMission +from src import util +from src.api.models.CoopMission import CoopMission class CoopMapItemDelegate(QtWidgets.QStyledItemDelegate): diff --git a/src/coop/coopmodel.py b/src/coop/coopmodel.py index fca14bb16..c03d8e9b7 100644 --- a/src/coop/coopmodel.py +++ b/src/coop/coopmodel.py @@ -1,5 +1,5 @@ -from games.gamemodel import GameSortModel -from model.game import GameState +from src.games.gamemodel import GameSortModel +from src.model.game import GameState class CoopGameFilterModel(GameSortModel): diff --git a/src/coop/cooptableitemdelegate.py b/src/coop/cooptableitemdelegate.py index 04b8c2191..9b1d9db51 100644 --- a/src/coop/cooptableitemdelegate.py +++ b/src/coop/cooptableitemdelegate.py @@ -4,8 +4,8 @@ from PyQt6.QtWidgets import QStyle from PyQt6.QtWidgets import QStyleOptionViewItem -from qt.itemviews.tableitemdelegte import TableItemDelegate -from qt.utils import qpainter +from src.qt.itemviews.tableitemdelegte import TableItemDelegate +from src.qt.utils import qpainter class CoopLeaderboardItemDelegate(TableItemDelegate): diff --git a/src/coop/cooptablemodel.py b/src/coop/cooptablemodel.py index 7f155144b..49b5fb506 100644 --- a/src/coop/cooptablemodel.py +++ b/src/coop/cooptablemodel.py @@ -3,7 +3,7 @@ from PyQt6.QtCore import Qt from PyQt6.QtCore import QUrl -from api.models.CoopResult import CoopResult +from src.api.models.CoopResult import CoopResult class CoopLeaderBoardModel(QAbstractTableModel): diff --git a/src/coop/cooptableview.py b/src/coop/cooptableview.py index d77e7ee5b..8fae92da0 100644 --- a/src/coop/cooptableview.py +++ b/src/coop/cooptableview.py @@ -3,7 +3,7 @@ from PyQt6.QtCore import pyqtSignal from PyQt6.QtGui import QMouseEvent -from qt.itemviews.tableview import TableView +from src.qt.itemviews.tableview import TableView class CoopLeaderboardTableView(TableView): diff --git a/src/downloadManager/__init__.py b/src/downloadManager/__init__.py index a9975567f..00335d790 100644 --- a/src/downloadManager/__init__.py +++ b/src/downloadManager/__init__.py @@ -19,8 +19,8 @@ from PyQt6.QtNetwork import QNetworkReply from PyQt6.QtNetwork import QNetworkRequest -from config import Settings -from util import AVATARS_CACHE_DIR +from src.config import Settings +from src.util import AVATARS_CACHE_DIR logger = logging.getLogger(__name__) diff --git a/src/fa/check.py b/src/fa/check.py index d735ccc2f..9b6ba5481 100644 --- a/src/fa/check.py +++ b/src/fa/check.py @@ -5,19 +5,19 @@ from PyQt6 import QtWidgets -import config -import fa -import util -from fa.game_updater.misc import UpdaterResult -from fa.game_updater.updater import Updater -from fa.mods import checkMods -from fa.path import validatePath -from fa.path import writeFAPathLua -from fa.wizards import Wizard -from mapGenerator.mapgenUtils import isGeneratedMap +from src import config +from src import fa +from src import util +from src.fa.game_updater.misc import UpdaterResult +from src.fa.game_updater.updater import Updater +from src.fa.mods import checkMods +from src.fa.path import validatePath +from src.fa.path import writeFAPathLua +from src.fa.wizards import Wizard +from src.mapGenerator.mapgenUtils import isGeneratedMap if TYPE_CHECKING: - from client._clientwindow import ClientWindow + from src.client._clientwindow import ClientWindow logger = logging.getLogger(__name__) @@ -33,7 +33,7 @@ def map_(mapname: str, force: bool = False, silent: bool = False) -> bool: return True if isGeneratedMap(mapname): - import client + from src import client # FIXME: generateMap, downloadMap should also return bool return bool(client.instance.map_generator.generateMap(mapname)) @@ -124,7 +124,7 @@ def check( logger.info( "Updating FA for mod: {}, version {}".format(featured_mod, version), ) - import client # FIXME: forced by circular imports + from src import client # FIXME: forced by circular imports if not path(client.instance): return False diff --git a/src/fa/game_connection.py b/src/fa/game_connection.py index 57a68a294..71087ddec 100644 --- a/src/fa/game_connection.py +++ b/src/fa/game_connection.py @@ -5,7 +5,7 @@ from PyQt6.QtCore import QObject from PyQt6.QtCore import pyqtSignal -from decorators import with_logger +from src.decorators import with_logger @with_logger diff --git a/src/fa/game_process.py b/src/fa/game_process.py index db1bb0285..f078063c9 100644 --- a/src/fa/game_process.py +++ b/src/fa/game_process.py @@ -6,9 +6,9 @@ from PyQt6 import QtCore from PyQt6 import QtWidgets -import config -import util -from model.game import GameState +from src import config +from src import util +from src.model.game import GameState logger = logging.getLogger(__name__) diff --git a/src/fa/game_runner.py b/src/fa/game_runner.py index 0ff0f6a60..568508b5e 100644 --- a/src/fa/game_runner.py +++ b/src/fa/game_runner.py @@ -1,9 +1,9 @@ import logging -import fa -from fa.replay import replay -from model.game import GameState -from util.gameurl import GameUrl +from src import fa +from src.fa.replay import replay +from src.model.game import GameState +from src.util.gameurl import GameUrl logger = logging.getLogger(__name__) diff --git a/src/fa/game_session.py b/src/fa/game_session.py index 39fa1e6d8..88934a6d8 100644 --- a/src/fa/game_session.py +++ b/src/fa/game_session.py @@ -5,12 +5,12 @@ from PyQt6.QtCore import QObject from PyQt6.QtCore import pyqtSignal -import client -from config import setup_file_handler -from connectivity.IceAdapterClient import IceAdapterClient -from connectivity.IceAdapterProcess import IceAdapterProcess -from connectivity.IceServersPoller import IceServersPoller -from fa.game_process import instance as game_process_instance +from src import client +from src.config import setup_file_handler +from src.connectivity.IceAdapterClient import IceAdapterClient +from src.connectivity.IceAdapterProcess import IceAdapterProcess +from src.connectivity.IceServersPoller import IceServersPoller +from src.fa.game_process import instance as game_process_instance logger = logging.getLogger(__name__) # Log to a separate file to not pollute normal log with huge json dumps diff --git a/src/fa/game_updater/patcher.py b/src/fa/game_updater/patcher.py index 18e7ba221..d960306b7 100644 --- a/src/fa/game_updater/patcher.py +++ b/src/fa/game_updater/patcher.py @@ -2,7 +2,7 @@ from PyQt6.QtCore import QFile -from qt.utils import qopen +from src.qt.utils import qopen logger = logging.getLogger(__name__) diff --git a/src/fa/game_updater/updater.py b/src/fa/game_updater/updater.py index 09d90f3c8..47bec5e54 100644 --- a/src/fa/game_updater/updater.py +++ b/src/fa/game_updater/updater.py @@ -20,15 +20,15 @@ from PyQt6.QtGui import QTextCursor from PyQt6.QtWidgets import QDialog -import util -from downloadManager import FileDownload -from fa.game_updater.misc import ProgressInfo -from fa.game_updater.misc import UpdaterResult -from fa.game_updater.misc import clear_log -from fa.game_updater.misc import failure_dialog -from fa.game_updater.misc import log -from fa.game_updater.misc import timestamp -from fa.game_updater.worker import UpdaterWorker +from src import util +from src.downloadManager import FileDownload +from src.fa.game_updater.misc import ProgressInfo +from src.fa.game_updater.misc import UpdaterResult +from src.fa.game_updater.misc import clear_log +from src.fa.game_updater.misc import failure_dialog +from src.fa.game_updater.misc import log +from src.fa.game_updater.misc import timestamp +from src.fa.game_updater.worker import UpdaterWorker logger = logging.getLogger(__name__) diff --git a/src/fa/game_updater/worker.py b/src/fa/game_updater/worker.py index 25b93eb7d..776635f3c 100644 --- a/src/fa/game_updater/worker.py +++ b/src/fa/game_updater/worker.py @@ -10,20 +10,20 @@ from PyQt6.QtCore import pyqtSignal from PyQt6.QtNetwork import QNetworkAccessManager -import util -from api.featured_mod_api import FeaturedModApiConnector -from api.featured_mod_api import FeaturedModFilesApiConnector -from api.models.FeaturedMod import FeaturedMod -from api.models.FeaturedModFile import FeaturedModFile -from config import Settings -from downloadManager import FileDownload -from fa.game_updater.misc import ProgressInfo -from fa.game_updater.misc import UpdaterCancellation -from fa.game_updater.misc import UpdaterFailure -from fa.game_updater.misc import UpdaterResult -from fa.game_updater.misc import log -from fa.game_updater.patcher import FAPatcher -from fa.utils import unpack_movies_and_sounds +from src import util +from src.api.featured_mod_api import FeaturedModApiConnector +from src.api.featured_mod_api import FeaturedModFilesApiConnector +from src.api.models.FeaturedMod import FeaturedMod +from src.api.models.FeaturedModFile import FeaturedModFile +from src.config import Settings +from src.downloadManager import FileDownload +from src.fa.game_updater.misc import ProgressInfo +from src.fa.game_updater.misc import UpdaterCancellation +from src.fa.game_updater.misc import UpdaterFailure +from src.fa.game_updater.misc import UpdaterResult +from src.fa.game_updater.misc import log +from src.fa.game_updater.patcher import FAPatcher +from src.fa.utils import unpack_movies_and_sounds logger = logging.getLogger(__name__) diff --git a/src/fa/maps.py b/src/fa/maps.py index 3ed4b8e38..7c36b108e 100644 --- a/src/fa/maps.py +++ b/src/fa/maps.py @@ -13,13 +13,11 @@ from PyQt6 import QtCore from PyQt6 import QtGui -# module imports -import util -# local imports -from config import Settings -from mapGenerator.mapgenUtils import isGeneratedMap -from model.game import OFFICIAL_MAPS as maps -from vaults.dialogs import downloadVaultAssetNoMsg +from src import util +from src.config import Settings +from src.mapGenerator.mapgenUtils import isGeneratedMap +from src.model.game import OFFICIAL_MAPS as maps +from src.vaults.dialogs import downloadVaultAssetNoMsg logger = logging.getLogger(__name__) diff --git a/src/fa/mods.py b/src/fa/mods.py index 773ba4d1d..e34d52034 100644 --- a/src/fa/mods.py +++ b/src/fa/mods.py @@ -2,11 +2,11 @@ from PyQt6 import QtWidgets -import config -from api.sim_mod_updater import SimModFiles -from vaults.modvault.utils import downloadMod -from vaults.modvault.utils import getInstalledMods -from vaults.modvault.utils import setActiveMods +from src import config +from src.api.sim_mod_updater import SimModFiles +from src.vaults.modvault.utils import downloadMod +from src.vaults.modvault.utils import getInstalledMods +from src.vaults.modvault.utils import setActiveMods logger = logging.getLogger(__name__) diff --git a/src/fa/path.py b/src/fa/path.py index 8c27dcc79..80407f8a0 100644 --- a/src/fa/path.py +++ b/src/fa/path.py @@ -2,8 +2,8 @@ import os import sys -import config -import util +from src import config +from src import util logger = logging.getLogger(__name__) diff --git a/src/fa/play.py b/src/fa/play.py index 1e72aaa8d..c16b7d871 100644 --- a/src/fa/play.py +++ b/src/fa/play.py @@ -1,5 +1,5 @@ -import util -from config import Settings +from src import util +from src.config import Settings from .game_process import instance diff --git a/src/fa/replay.py b/src/fa/replay.py index 9096c9c4d..e84eba6db 100644 --- a/src/fa/replay.py +++ b/src/fa/replay.py @@ -6,13 +6,13 @@ from PyQt6 import QtCore from PyQt6 import QtWidgets -import fa -import util -from fa.check import check -from fa.replayparser import ReplayParser -from qt.utils import qopen -from util.gameurl import GameUrl -from util.gameurl import GameUrlType +from src import fa +from src import util +from src.fa.check import check +from src.fa.replayparser import ReplayParser +from src.qt.utils import qopen +from src.util.gameurl import GameUrl +from src.util.gameurl import GameUrlType logger = logging.getLogger(__name__) diff --git a/src/fa/replayserver.py b/src/fa/replayserver.py index 02eceea7c..259b46a6b 100644 --- a/src/fa/replayserver.py +++ b/src/fa/replayserver.py @@ -9,9 +9,9 @@ from PyQt6 import QtNetwork from PyQt6 import QtWidgets -import fa -import util -from config import Settings +from src import fa +from src import util +from src.config import Settings GPGNET_HOST = "lobby.faforever.com" GPGNET_PORT = 8000 diff --git a/src/fa/utils.py b/src/fa/utils.py index f45e1ef52..edcc19725 100644 --- a/src/fa/utils.py +++ b/src/fa/utils.py @@ -3,8 +3,8 @@ import os import zipfile -from api.models.FeaturedModFile import FeaturedModFile -from util import APPDATA_DIR +from src.api.models.FeaturedModFile import FeaturedModFile +from src.util import APPDATA_DIR logger = logging.getLogger(__name__) diff --git a/src/fa/wizards.py b/src/fa/wizards.py index 2a68b328a..4c5d7924a 100644 --- a/src/fa/wizards.py +++ b/src/fa/wizards.py @@ -6,12 +6,12 @@ from PyQt6 import QtCore from PyQt6 import QtWidgets -import util -from fa.path import typicalForgedAlliancePaths -from fa.path import validatePath +from src import util +from src.fa.path import typicalForgedAlliancePaths +from src.fa.path import validatePath if TYPE_CHECKING: - from client._clientwindow import ClientWindow + from src.client._clientwindow import ClientWindow __author__ = 'Thygrrr' diff --git a/src/fafpath.py b/src/fafpath.py index ece91f082..38114ea67 100644 --- a/src/fafpath.py +++ b/src/fafpath.py @@ -60,4 +60,7 @@ def get_libdir(): def get_java_path(): - return os.path.join(get_libdir(), "ice-adapter", "jre", "bin", "java.exe") + exe = "java" + if sys.platform == "win32": + exe += ".exe" + return os.path.join(get_libdir(), "ice-adapter", "jre", "bin", exe) diff --git a/src/games/_gameswidget.py b/src/games/_gameswidget.py index 1e85e724c..0dbdd7b13 100644 --- a/src/games/_gameswidget.py +++ b/src/games/_gameswidget.py @@ -10,22 +10,22 @@ from PyQt6.QtGui import QColor from PyQt6.QtGui import QCursor -import fa -import util -from api.featured_mod_api import FeaturedModApiConnector -from client.user import User -from config import Settings -from games.automatchframe import MatchmakerQueue -from games.gameitem import GameViewBuilder -from games.gamemodel import CustomGameFilterModel -from games.gamemodel import GameModel -from games.hostgamewidget import GameLauncher -from games.moditem import ModItem -from games.moditem import mod_invisible -from model.chat.channel import PARTY_CHANNEL_SUFFIX +from src import fa +from src import util +from src.api.featured_mod_api import FeaturedModApiConnector +from src.client.user import User +from src.config import Settings +from src.games.automatchframe import MatchmakerQueue +from src.games.gameitem import GameViewBuilder +from src.games.gamemodel import CustomGameFilterModel +from src.games.gamemodel import GameModel +from src.games.hostgamewidget import GameLauncher +from src.games.moditem import ModItem +from src.games.moditem import mod_invisible +from src.model.chat.channel import PARTY_CHANNEL_SUFFIX if TYPE_CHECKING: - from client._clientwindow import ClientWindow + from src.client._clientwindow import ClientWindow logger = logging.getLogger(__name__) @@ -248,7 +248,7 @@ def gameDoubleClicked(self, game): self.client, "Passworded game", "Enter password :", - QtWidgets.QLineEdit.Normal, + QtWidgets.QLineEdit.EchoMode.Normal, "", ) if ok: diff --git a/src/games/automatchframe.py b/src/games/automatchframe.py index 2a2aa75ea..7fe1a56c8 100644 --- a/src/games/automatchframe.py +++ b/src/games/automatchframe.py @@ -8,19 +8,19 @@ from PyQt6 import QtGui from PyQt6 import QtWidgets -import fa -import util -from api.matchmaker_queue_api import MatchmakerQueueApiConnector -from config import Settings -from fa.factions import Factions +from src import fa +from src import util +from src.api.matchmaker_queue_api import MatchmakerQueueApiConnector +from src.config import Settings +from src.fa.factions import Factions FormClass, BaseClass = util.THEME.loadUiType("games/automatchframe.ui") logger = logging.getLogger(__name__) if TYPE_CHECKING: - from client._clientwindow import ClientWindow - from games._gameswidget import GamesWidget + from src.client._clientwindow import ClientWindow + from src.games._gameswidget import GamesWidget class MatchmakerQueue(FormClass, BaseClass): diff --git a/src/games/gameitem.py b/src/games/gameitem.py index d32527bf1..2d4b6e836 100644 --- a/src/games/gameitem.py +++ b/src/games/gameitem.py @@ -6,9 +6,9 @@ from PyQt6 import QtGui from PyQt6 import QtWidgets -import util -from fa import maps -from qt.itemviews.styleditemdelegate import StyledItemDelegate +from src import util +from src.fa import maps +from src.qt.itemviews.styleditemdelegate import StyledItemDelegate class GameView(QtCore.QObject): diff --git a/src/games/gamemodel.py b/src/games/gamemodel.py index 1c6d74dfa..4e92a12a4 100644 --- a/src/games/gamemodel.py +++ b/src/games/gamemodel.py @@ -3,14 +3,14 @@ from PyQt6.QtCore import QSortFilterProxyModel from PyQt6.QtCore import Qt -from client.user import User -from client.user import UserRelations -from downloadManager import MapPreviewDownloader -from games.moditem import mod_invisible -from model.game import Game -from model.game import GameState -from model.gameset import Gameset -from qt.models.qtlistmodel import QtListModel +from src.client.user import User +from src.client.user import UserRelations +from src.downloadManager import MapPreviewDownloader +from src.games.moditem import mod_invisible +from src.model.game import Game +from src.model.game import GameState +from src.model.gameset import Gameset +from src.qt.models.qtlistmodel import QtListModel from .gamemodelitem import GameModelItem diff --git a/src/games/gamemodelitem.py b/src/games/gamemodelitem.py index 1975d8c49..c93b393f1 100644 --- a/src/games/gamemodelitem.py +++ b/src/games/gamemodelitem.py @@ -5,12 +5,12 @@ from PyQt6.QtCore import QObject from PyQt6.QtCore import pyqtSignal -from client.user import User -from client.user import UserRelations -from downloadManager import DownloadRequest -from downloadManager import MapPreviewDownloader -from fa import maps -from model.game import Game +from src.client.user import User +from src.client.user import UserRelations +from src.downloadManager import DownloadRequest +from src.downloadManager import MapPreviewDownloader +from src.fa import maps +from src.model.game import Game class GameModelItem(QObject): diff --git a/src/games/hostgamewidget.py b/src/games/hostgamewidget.py index 107eefc72..c79711209 100644 --- a/src/games/hostgamewidget.py +++ b/src/games/hostgamewidget.py @@ -5,22 +5,24 @@ from PyQt6 import QtCore -import fa.check -import util -import vaults.modvault.utils -from client.user import User -from downloadManager import MapPreviewDownloader -from fa import maps -from games.gameitem import GameViewBuilder -from games.gamemodel import GameModel -from games.mapgenoptionsdialog import MapGenDialog -from model.game import Game -from model.game import GameState -from model.game import GameVisibility -from model.playerset import Playerset +from src import fa +from src import util +from src.client.user import User +from src.downloadManager import MapPreviewDownloader +from src.fa import maps +from src.games.gameitem import GameViewBuilder +from src.games.gamemodel import GameModel +from src.games.mapgenoptionsdialog import MapGenDialog +from src.model.game import Game +from src.model.game import GameState +from src.model.game import GameVisibility +from src.model.playerset import Playerset +from src.vaults.modvault.utils import getActiveMods +from src.vaults.modvault.utils import getInstalledMods +from src.vaults.modvault.utils import setActiveMods if TYPE_CHECKING: - from client._clientwindow import ClientWindow + from src.client._clientwindow import ClientWindow logger = logging.getLogger(__name__) @@ -96,7 +98,7 @@ def _launch_game(self, game, password, mods): ): return - vaults.modvault.utils.setActiveMods(mods, True, False) + setActiveMods(mods, True, False) self._client.host_game( title=game.title, @@ -153,7 +155,7 @@ def setup(self, title, game): self.setupMapList() # this makes it so you can select every non-ui_only mod - for mod in vaults.modvault.utils.getInstalledMods(): + for mod in getInstalledMods(): if mod.ui_only: continue self.mods[mod.totalname] = mod @@ -161,10 +163,7 @@ def setup(self, title, game): names = [ mod.totalname - for mod in vaults.modvault.utils.getActiveMods( - uimods=False, - temporary=False, - ) + for mod in getActiveMods(uimods=False, temporary=False) ] logger.debug("Active Mods detected: {}".format(str(names))) for name in names: @@ -245,7 +244,7 @@ def hosting(self): for moditem in self.modList.selectedItems() ] mods = [self.mods[modstr] for modstr in modnames] - vaults.modvault.utils.setActiveMods(mods, True, False) + setActiveMods(mods, True, False) self.launch.emit(self.game, password, mods) self.done(1) diff --git a/src/games/mapgenoptions.py b/src/games/mapgenoptions.py index d80873fbd..c021d6196 100644 --- a/src/games/mapgenoptions.py +++ b/src/games/mapgenoptions.py @@ -6,7 +6,7 @@ from PyQt6.QtWidgets import QComboBox from PyQt6.QtWidgets import QSpinBox -import config +from src import config class OptionMixin: diff --git a/src/games/mapgenoptionsdialog.py b/src/games/mapgenoptionsdialog.py index e6ac5cedf..be7d27dcf 100644 --- a/src/games/mapgenoptionsdialog.py +++ b/src/games/mapgenoptionsdialog.py @@ -3,20 +3,20 @@ from PyQt6 import QtCore from PyQt6 import QtWidgets -import config -import util -from games.mapgenoptions import ComboBoxOption -from games.mapgenoptions import RangeOption -from games.mapgenoptions import SpinBoxOption -from games.mapgenoptionsvalues import GenerationType -from games.mapgenoptionsvalues import MapStyle -from games.mapgenoptionsvalues import PropStyle -from games.mapgenoptionsvalues import ResourceStyle -from games.mapgenoptionsvalues import Sentinel -from games.mapgenoptionsvalues import TerrainStyle -from games.mapgenoptionsvalues import TerrainSymmetry -from games.mapgenoptionsvalues import TextureStyle -from mapGenerator.mapgenManager import MapGeneratorManager +from src import config +from src import util +from src.games.mapgenoptions import ComboBoxOption +from src.games.mapgenoptions import RangeOption +from src.games.mapgenoptions import SpinBoxOption +from src.games.mapgenoptionsvalues import GenerationType +from src.games.mapgenoptionsvalues import MapStyle +from src.games.mapgenoptionsvalues import PropStyle +from src.games.mapgenoptionsvalues import ResourceStyle +from src.games.mapgenoptionsvalues import Sentinel +from src.games.mapgenoptionsvalues import TerrainStyle +from src.games.mapgenoptionsvalues import TerrainSymmetry +from src.games.mapgenoptionsvalues import TextureStyle +from src.mapGenerator.mapgenManager import MapGeneratorManager FormClass, BaseClass = util.THEME.loadUiType("games/mapgen.ui") diff --git a/src/games/moditem.py b/src/games/moditem.py index 7142083f1..2f9dc4863 100644 --- a/src/games/moditem.py +++ b/src/games/moditem.py @@ -3,9 +3,9 @@ from PyQt6 import QtGui from PyQt6 import QtWidgets -import client -import util -from api.models.FeaturedMod import FeaturedMod +from src import client +from src import util +from src.api.models.FeaturedMod import FeaturedMod # Maps names of featured mods to ModItem objects. mods = {} diff --git a/src/mapGenerator/mapgenManager.py b/src/mapGenerator/mapgenManager.py index baef51ea8..82981cc2c 100644 --- a/src/mapGenerator/mapgenManager.py +++ b/src/mapGenerator/mapgenManager.py @@ -12,12 +12,12 @@ from PyQt6.QtNetwork import QNetworkReply from PyQt6.QtNetwork import QNetworkRequest -import util -from config import Settings -from fa.maps import getUserMapsFolder -from mapGenerator.mapgenProcess import MapGeneratorProcess -from mapGenerator.mapgenUtils import generatedMapPattern -from vaults.dialogs import download_file +from src import util +from src.config import Settings +from src.fa.maps import getUserMapsFolder +from src.mapGenerator.mapgenProcess import MapGeneratorProcess +from src.mapGenerator.mapgenUtils import generatedMapPattern +from src.vaults.dialogs import download_file logger = logging.getLogger(__name__) diff --git a/src/mapGenerator/mapgenProcess.py b/src/mapGenerator/mapgenProcess.py index 116167c86..3643f6d40 100644 --- a/src/mapGenerator/mapgenProcess.py +++ b/src/mapGenerator/mapgenProcess.py @@ -9,8 +9,8 @@ from PyQt6.QtWidgets import QProgressBar from PyQt6.QtWidgets import QProgressDialog -import fafpath -from config import setup_file_handler +from src import fafpath +from src.config import setup_file_handler from . import mapgenUtils diff --git a/src/model/chat/channel.py b/src/model/chat/channel.py index 25c4d0942..7d98ff73d 100644 --- a/src/model/chat/channel.py +++ b/src/model/chat/channel.py @@ -3,8 +3,8 @@ from PyQt6.QtCore import QObject from PyQt6.QtCore import pyqtSignal -from model.modelitem import ModelItem -from model.transaction import transactional +from src.model.modelitem import ModelItem +from src.model.transaction import transactional PARTY_CHANNEL_SUFFIX = "'sParty" diff --git a/src/model/chat/channelchatter.py b/src/model/chat/channelchatter.py index 73cc89175..f23fd3496 100644 --- a/src/model/chat/channelchatter.py +++ b/src/model/chat/channelchatter.py @@ -1,5 +1,5 @@ -from model.modelitem import ModelItem -from model.transaction import transactional +from src.model.modelitem import ModelItem +from src.model.transaction import transactional class ChannelChatter(ModelItem): diff --git a/src/model/chat/channelchatterset.py b/src/model/chat/channelchatterset.py index d1c76e62f..500bfe6b2 100644 --- a/src/model/chat/channelchatterset.py +++ b/src/model/chat/channelchatterset.py @@ -1,5 +1,5 @@ -from model.modelitemset import ModelItemSet -from model.transaction import transactional +from src.model.modelitemset import ModelItemSet +from src.model.transaction import transactional class ChannelChatterset(ModelItemSet): diff --git a/src/model/chat/channelset.py b/src/model/chat/channelset.py index 1fc62394e..9c3ffd32f 100644 --- a/src/model/chat/channelset.py +++ b/src/model/chat/channelset.py @@ -1,6 +1,6 @@ -from model.chat.channel import ChannelType -from model.modelitemset import ModelItemSet -from model.transaction import transactional +from src.model.chat.channel import ChannelType +from src.model.modelitemset import ModelItemSet +from src.model.transaction import transactional class Channelset(ModelItemSet): diff --git a/src/model/chat/chat.py b/src/model/chat/chat.py index 7af356e8a..559b67a96 100644 --- a/src/model/chat/chat.py +++ b/src/model/chat/chat.py @@ -1,10 +1,10 @@ from PyQt6.QtCore import QObject from PyQt6.QtCore import pyqtSignal -from model.chat.channelchatterset import ChannelChatterRelation -from model.chat.channelchatterset import ChannelChatterset -from model.chat.channelset import Channelset -from model.chat.chatterset import Chatterset +from src.model.chat.channelchatterset import ChannelChatterRelation +from src.model.chat.channelchatterset import ChannelChatterset +from src.model.chat.channelset import Channelset +from src.model.chat.chatterset import Chatterset class Chat(QObject): diff --git a/src/model/chat/chatline.py b/src/model/chat/chatline.py index 6116a951c..da0a18f47 100644 --- a/src/model/chat/chatline.py +++ b/src/model/chat/chatline.py @@ -1,7 +1,7 @@ import time from enum import Enum -from util.magic_dict import MagicDict +from src.util.magic_dict import MagicDict # Notices differ from messages in that notices in public channels are visible diff --git a/src/model/chat/chatter.py b/src/model/chat/chatter.py index 7c191108c..25d3ed5e4 100644 --- a/src/model/chat/chatter.py +++ b/src/model/chat/chatter.py @@ -1,7 +1,7 @@ from PyQt6.QtCore import pyqtSignal -from model.modelitem import ModelItem -from model.transaction import transactional +from src.model.modelitem import ModelItem +from src.model.transaction import transactional class Chatter(ModelItem): diff --git a/src/model/chat/chatterset.py b/src/model/chat/chatterset.py index 0686803df..97d2d26f4 100644 --- a/src/model/chat/chatterset.py +++ b/src/model/chat/chatterset.py @@ -1,6 +1,6 @@ -from model.chat.chatter import Chatter -from model.modelitemset import ModelItemSet -from model.transaction import transactional +from src.model.chat.chatter import Chatter +from src.model.modelitemset import ModelItemSet +from src.model.transaction import transactional class Chatterset(ModelItemSet): diff --git a/src/model/game.py b/src/model/game.py index 0a575b869..be0eae2a8 100644 --- a/src/model/game.py +++ b/src/model/game.py @@ -6,11 +6,11 @@ from PyQt6.QtCore import QTimer from PyQt6.QtCore import pyqtSignal -from decorators import with_logger -from model.modelitem import ModelItem -from model.transaction import transactional -from util.gameurl import GameUrl -from util.gameurl import GameUrlType +from src.decorators import with_logger +from src.model.modelitem import ModelItem +from src.model.transaction import transactional +from src.util.gameurl import GameUrl +from src.util.gameurl import GameUrlType class GameState(Enum): diff --git a/src/model/gameset.py b/src/model/gameset.py index acdfc85ff..b91cb3410 100644 --- a/src/model/gameset.py +++ b/src/model/gameset.py @@ -1,9 +1,9 @@ from PyQt6.QtCore import pyqtSignal -from decorators import with_logger -from model import game -from model.modelitemset import ModelItemSet -from model.transaction import transactional +from src.decorators import with_logger +from src.model import game +from src.model.modelitemset import ModelItemSet +from src.model.transaction import transactional @with_logger diff --git a/src/model/ircuser.py b/src/model/ircuser.py index e18ef4289..26b4ecb0c 100644 --- a/src/model/ircuser.py +++ b/src/model/ircuser.py @@ -1,7 +1,7 @@ from PyQt6.QtCore import pyqtSignal -from model.modelitem import ModelItem -from model.transaction import transactional +from src.model.modelitem import ModelItem +from src.model.transaction import transactional class IrcUser(ModelItem): diff --git a/src/model/ircuserset.py b/src/model/ircuserset.py index c39417539..dd49d2c9c 100644 --- a/src/model/ircuserset.py +++ b/src/model/ircuserset.py @@ -1,6 +1,6 @@ -from model.ircuser import IrcUser -from model.modelitemset import ModelItemSet -from model.transaction import transactional +from src.model.ircuser import IrcUser +from src.model.modelitemset import ModelItemSet +from src.model.transaction import transactional class IrcUserset(ModelItemSet): diff --git a/src/model/modelitem.py b/src/model/modelitem.py index d15eec6bd..3d57dcb99 100644 --- a/src/model/modelitem.py +++ b/src/model/modelitem.py @@ -1,7 +1,7 @@ from PyQt6.QtCore import pyqtSignal -from model.qobjectmapping import QObject -from model.transaction import transactional +from src.model.qobjectmapping import QObject +from src.model.transaction import transactional class ModelItem(QObject): diff --git a/src/model/modelitemset.py b/src/model/modelitemset.py index 3aa6fef21..8bf31f97d 100644 --- a/src/model/modelitemset.py +++ b/src/model/modelitemset.py @@ -1,7 +1,7 @@ from PyQt6.QtCore import pyqtSignal -from model.qobjectmapping import QObjectMapping -from model.transaction import transactional +from src.model.qobjectmapping import QObjectMapping +from src.model.transaction import transactional class ModelItemSet(QObjectMapping): diff --git a/src/model/player.py b/src/model/player.py index db76163f8..b367668c3 100644 --- a/src/model/player.py +++ b/src/model/player.py @@ -1,9 +1,9 @@ from PyQt6.QtCore import pyqtSignal -from model.modelitem import ModelItem -from model.rating import Rating -from model.rating import RatingType -from model.transaction import transactional +from src.model.modelitem import ModelItem +from src.model.rating import Rating +from src.model.rating import RatingType +from src.model.transaction import transactional class Player(ModelItem): diff --git a/src/model/playerset.py b/src/model/playerset.py index 96663aadf..cfd00e07e 100644 --- a/src/model/playerset.py +++ b/src/model/playerset.py @@ -1,6 +1,6 @@ -from model.modelitemset import ModelItemSet -from model.player import Player -from model.transaction import transactional +from src.model.modelitemset import ModelItemSet +from src.model.player import Player +from src.model.transaction import transactional class Playerset(ModelItemSet): diff --git a/src/news/_newswidget.py b/src/news/_newswidget.py index d873952bf..80e88f71c 100644 --- a/src/news/_newswidget.py +++ b/src/news/_newswidget.py @@ -9,10 +9,10 @@ from PyQt6.QtGui import QTextDocument from PyQt6.QtNetwork import QNetworkAccessManager -import util -from config import Settings -from downloadManager import Downloader -from downloadManager import DownloadRequest +from src import util +from src.config import Settings +from src.downloadManager import Downloader +from src.downloadManager import DownloadRequest from .newsitem import NewsItem from .newsitem import NewsItemDelegate diff --git a/src/news/newsitem.py b/src/news/newsitem.py index b3c27e240..6ed0fd629 100644 --- a/src/news/newsitem.py +++ b/src/news/newsitem.py @@ -4,7 +4,7 @@ from PyQt6 import QtGui from PyQt6 import QtWidgets -import util +from src import util logger = logging.getLogger(__name__) diff --git a/src/news/newsmanager.py b/src/news/newsmanager.py index b2707933d..3d2c0c17e 100644 --- a/src/news/newsmanager.py +++ b/src/news/newsmanager.py @@ -4,7 +4,7 @@ from PyQt6.QtCore import QObject from PyQt6.QtCore import Qt -import client +from src import client from .wpapi import WPAPI diff --git a/src/news/wpapi.py b/src/news/wpapi.py index 15a6ad780..cb504acda 100644 --- a/src/news/wpapi.py +++ b/src/news/wpapi.py @@ -6,7 +6,7 @@ from PyQt6.QtNetwork import QNetworkReply from PyQt6.QtNetwork import QNetworkRequest -from config import Settings +from src.config import Settings logger = logging.getLogger(__name__) diff --git a/src/notifications/__init__.py b/src/notifications/__init__.py index 4a03a93e2..24b4602da 100644 --- a/src/notifications/__init__.py +++ b/src/notifications/__init__.py @@ -4,14 +4,14 @@ """ from PyQt6 import QtCore -import util -from config import Settings -from fa import maps -from model.game import Game -from model.player import Player -from notifications.ns_dialog import NotificationDialog -from notifications.ns_settings import IngameNotification -from notifications.ns_settings import NsSettingsDialog +from src import util +from src.config import Settings +from src.fa import maps +from src.model.game import Game +from src.model.player import Player +from src.notifications.ns_dialog import NotificationDialog +from src.notifications.ns_settings import IngameNotification +from src.notifications.ns_settings import NsSettingsDialog class Notifications: diff --git a/src/notifications/hook_gamefull.py b/src/notifications/hook_gamefull.py index 845f7a194..295be41d5 100644 --- a/src/notifications/hook_gamefull.py +++ b/src/notifications/hook_gamefull.py @@ -1,8 +1,8 @@ """ Settings for notifications: If a game is full """ -import notifications as ns -from notifications.ns_hook import NsHook +import src.notifications as ns +from src.notifications.ns_hook import NsHook class NsHookGameFull(NsHook): diff --git a/src/notifications/hook_newgame.py b/src/notifications/hook_newgame.py index 2abbba7b9..20f80efc4 100644 --- a/src/notifications/hook_newgame.py +++ b/src/notifications/hook_newgame.py @@ -3,11 +3,11 @@ """ from PyQt6 import QtCore -import config -import notifications as ns -import util -from config import Settings -from notifications.ns_hook import NsHook +import src.notifications as ns +from src import config +from src import util +from src.config import Settings +from src.notifications.ns_hook import NsHook class NsHookNewGame(NsHook): diff --git a/src/notifications/hook_partyinvite.py b/src/notifications/hook_partyinvite.py index a2c0c5fb8..5dc6ae88a 100644 --- a/src/notifications/hook_partyinvite.py +++ b/src/notifications/hook_partyinvite.py @@ -3,10 +3,10 @@ """ from PyQt6 import QtCore -import notifications as ns -import util -from config import Settings -from notifications.ns_hook import NsHook +import src.notifications as ns +from src import util +from src.config import Settings +from src.notifications.ns_hook import NsHook class NsHookPartyInvite(NsHook): diff --git a/src/notifications/hook_useronline.py b/src/notifications/hook_useronline.py index d949bb4c2..c076c05b3 100644 --- a/src/notifications/hook_useronline.py +++ b/src/notifications/hook_useronline.py @@ -3,10 +3,10 @@ """ from PyQt6 import QtCore -import notifications as ns -import util -from config import Settings -from notifications.ns_hook import NsHook +import src.notifications as ns +from src import util +from src.config import Settings +from src.notifications.ns_hook import NsHook class NsHookUserOnline(NsHook): diff --git a/src/notifications/ns_dialog.py b/src/notifications/ns_dialog.py index 2426b2e14..5ff518ec1 100644 --- a/src/notifications/ns_dialog.py +++ b/src/notifications/ns_dialog.py @@ -6,7 +6,7 @@ from PyQt6 import QtCore from PyQt6.QtMultimedia import QSoundEffect -import util +from src import util from .ns_settings import NotificationPosition diff --git a/src/notifications/ns_hook.py b/src/notifications/ns_hook.py index e0da941c5..27bf1a956 100644 --- a/src/notifications/ns_hook.py +++ b/src/notifications/ns_hook.py @@ -9,7 +9,7 @@ """ from PyQt6 import QtWidgets -from config import Settings +from src.config import Settings class NsHook(): diff --git a/src/notifications/ns_settings.py b/src/notifications/ns_settings.py index e4bd94ea2..6400eeef1 100644 --- a/src/notifications/ns_settings.py +++ b/src/notifications/ns_settings.py @@ -8,13 +8,13 @@ from PyQt6 import QtCore from PyQt6 import QtWidgets -import notifications as ns -import util -from config import Settings -from notifications.hook_gamefull import NsHookGameFull -from notifications.hook_newgame import NsHookNewGame -from notifications.hook_partyinvite import NsHookPartyInvite -from notifications.hook_useronline import NsHookUserOnline +import src.notifications as ns +from src import util +from src.config import Settings +from src.notifications.hook_gamefull import NsHookGameFull +from src.notifications.hook_newgame import NsHookNewGame +from src.notifications.hook_partyinvite import NsHookPartyInvite +from src.notifications.hook_useronline import NsHookUserOnline class IngameNotification(Enum): diff --git a/src/oauth/oauth_flow.py b/src/oauth/oauth_flow.py index 4507ef847..ca5244b6c 100644 --- a/src/oauth/oauth_flow.py +++ b/src/oauth/oauth_flow.py @@ -7,8 +7,8 @@ from PyQt6.QtNetworkAuth import QOAuth2AuthorizationCodeFlow from PyQt6.QtNetworkAuth import QOAuthHttpServerReplyHandler -from config import Settings -from decorators import with_logger +from src.config import Settings +from src.decorators import with_logger class OAuthReplyHandler(QOAuthHttpServerReplyHandler): diff --git a/src/playercard/achievements.py b/src/playercard/achievements.py index e1b36a174..dfcab1740 100644 --- a/src/playercard/achievements.py +++ b/src/playercard/achievements.py @@ -15,16 +15,16 @@ from PyQt6.QtWidgets import QSizePolicy from PyQt6.QtWidgets import QWidget -from api.models.Achievement import Achievement -from api.models.Achievement import ProgressType -from api.models.Achievement import State -from api.models.PlayerAchievement import PlayerAchievement -from api.stats_api import AchievementsApiAccessor -from api.stats_api import PlayerAchievementApiAccessor -from downloadManager import DownloadRequest -from downloadManager import ImageDownloader -from util import ACHIEVEMENTS_CACHE_DIR -from util import THEME +from src.api.models.Achievement import Achievement +from src.api.models.Achievement import ProgressType +from src.api.models.Achievement import State +from src.api.models.PlayerAchievement import PlayerAchievement +from src.api.stats_api import AchievementsApiAccessor +from src.api.stats_api import PlayerAchievementApiAccessor +from src.downloadManager import DownloadRequest +from src.downloadManager import ImageDownloader +from src.util import ACHIEVEMENTS_CACHE_DIR +from src.util import THEME FormClass, BaseClass = THEME.loadUiType("player_card/achievement.ui") diff --git a/src/playercard/avatarhandler.py b/src/playercard/avatarhandler.py index 133dbfe4b..829cbe85e 100644 --- a/src/playercard/avatarhandler.py +++ b/src/playercard/avatarhandler.py @@ -5,11 +5,11 @@ from PyQt6.QtWidgets import QListWidget from PyQt6.QtWidgets import QListWidgetItem -import util -from api.models.Avatar import Avatar -from api.models.AvatarAssignment import AvatarAssignment -from downloadManager import DownloadRequest -from downloadManager import ImageDownloader +from src import util +from src.api.models.Avatar import Avatar +from src.api.models.AvatarAssignment import AvatarAssignment +from src.downloadManager import DownloadRequest +from src.downloadManager import ImageDownloader class AvatarHandler: diff --git a/src/playercard/events.py b/src/playercard/events.py index a74c29972..f75f233fa 100644 --- a/src/playercard/events.py +++ b/src/playercard/events.py @@ -1,8 +1,8 @@ from enum import Enum from typing import NamedTuple -from api.models.PlayerEvent import PlayerEvent -from fa.factions import Factions +from src.api.models.PlayerEvent import PlayerEvent +from src.fa.factions import Factions class PlayerEvents(Enum): diff --git a/src/playercard/leagueformatter.py b/src/playercard/leagueformatter.py index ed12937d5..69eb06885 100644 --- a/src/playercard/leagueformatter.py +++ b/src/playercard/leagueformatter.py @@ -3,12 +3,12 @@ from PyQt6.QtCore import QSize from PyQt6.QtGui import QPixmap -import util -from api.models.LeaderboardRating import LeaderboardRating -from api.models.LeagueSeasonScore import LeagueSeasonScore -from api.stats_api import LeagueSeasonScoreApiConnector -from downloadManager import DownloadRequest -from downloadManager import ImageDownloader +from src import util +from src.api.models.LeaderboardRating import LeaderboardRating +from src.api.models.LeagueSeasonScore import LeagueSeasonScore +from src.api.stats_api import LeagueSeasonScoreApiConnector +from src.downloadManager import DownloadRequest +from src.downloadManager import ImageDownloader FormClass, BaseClass = util.THEME.loadUiType("player_card/playerleague.ui") diff --git a/src/playercard/playerinfodialog.py b/src/playercard/playerinfodialog.py index cd2f056d1..9386964b8 100644 --- a/src/playercard/playerinfodialog.py +++ b/src/playercard/playerinfodialog.py @@ -2,22 +2,22 @@ from PyQt6.QtWidgets import QTableWidgetItem -import util -from api.models.AvatarAssignment import AvatarAssignment -from api.models.LeaderboardRating import LeaderboardRating -from api.models.NameRecord import NameRecord -from api.models.Player import Player -from api.models.PlayerEvent import PlayerEvent -from api.player_api import PlayerApiConnector -from api.stats_api import LeaderboardRatingApiConnector -from api.stats_api import LeagueSeasonScoreApiConnector -from api.stats_api import PlayerEventApiAccessor -from downloadManager import ImageDownloader -from playercard.achievements import AchievementsHandler -from playercard.avatarhandler import AvatarHandler -from playercard.leagueformatter import league_formatter_factory -from playercard.ratingtabwidget import RatingTabWidgetController -from playercard.statistics import StatsCharts +from src import util +from src.api.models.AvatarAssignment import AvatarAssignment +from src.api.models.LeaderboardRating import LeaderboardRating +from src.api.models.NameRecord import NameRecord +from src.api.models.Player import Player +from src.api.models.PlayerEvent import PlayerEvent +from src.api.player_api import PlayerApiConnector +from src.api.stats_api import LeaderboardRatingApiConnector +from src.api.stats_api import LeagueSeasonScoreApiConnector +from src.api.stats_api import PlayerEventApiAccessor +from src.downloadManager import ImageDownloader +from src.playercard.achievements import AchievementsHandler +from src.playercard.avatarhandler import AvatarHandler +from src.playercard.leagueformatter import league_formatter_factory +from src.playercard.ratingtabwidget import RatingTabWidgetController +from src.playercard.statistics import StatsCharts FormClass, BaseClass = util.THEME.loadUiType("player_card/playercard.ui") diff --git a/src/playercard/ratingtabwidget.py b/src/playercard/ratingtabwidget.py index 070a23dd0..795b6411e 100644 --- a/src/playercard/ratingtabwidget.py +++ b/src/playercard/ratingtabwidget.py @@ -9,12 +9,12 @@ from PyQt6.QtCore import pyqtSignal from PyQt6.QtWidgets import QTabWidget -from api.models.Leaderboard import Leaderboard -from api.stats_api import LeaderboardApiConnector -from api.stats_api import LeaderboardRatingJournalApiConnector -from model.rating import Rating -from playercard.plot import LineSeries -from playercard.plot import PlotController +from src.api.models.Leaderboard import Leaderboard +from src.api.stats_api import LeaderboardApiConnector +from src.api.stats_api import LeaderboardRatingJournalApiConnector +from src.model.rating import Rating +from src.playercard.plot import LineSeries +from src.playercard.plot import PlotController class LineSeriesParser(QThread): diff --git a/src/playercard/statistics.py b/src/playercard/statistics.py index 7e35ae926..847cd1d52 100644 --- a/src/playercard/statistics.py +++ b/src/playercard/statistics.py @@ -15,12 +15,12 @@ from PyQt6.QtGui import QFont from PyQt6.QtGui import QPainter -from api.models.LeaderboardRating import LeaderboardRating -from api.models.PlayerEvent import PlayerEvent -from playercard.events import BUILT_LOST_METRICS -from playercard.events import EXPERIMENTALS_BUILT_LOST_METRICS -from playercard.events import FACTION_PLAYS_METRICS -from playercard.events import PlayerEventMetric +from src.api.models.LeaderboardRating import LeaderboardRating +from src.api.models.PlayerEvent import PlayerEvent +from src.playercard.events import BUILT_LOST_METRICS +from src.playercard.events import EXPERIMENTALS_BUILT_LOST_METRICS +from src.playercard.events import FACTION_PLAYS_METRICS +from src.playercard.events import PlayerEventMetric class ChartsBuilder: diff --git a/src/power/__init__.py b/src/power/__init__.py index 58ad93557..12638bfa2 100644 --- a/src/power/__init__.py +++ b/src/power/__init__.py @@ -1,5 +1,5 @@ -from power.actions import PowerActions -from power.view import PowerView +from src.power.actions import PowerActions +from src.power.view import PowerView class PowerTools: diff --git a/src/power/view.py b/src/power/view.py index 442e7f895..e4645001d 100644 --- a/src/power/view.py +++ b/src/power/view.py @@ -1,9 +1,9 @@ from PyQt6.QtCore import QObject from PyQt6.QtWidgets import QMessageBox -from power.actions import BanPeriod -from util.select_player_dialog import PlayerCompleter -from util.select_player_dialog import SelectPlayerDialog +from src.power.actions import BanPeriod +from src.util.select_player_dialog import PlayerCompleter +from src.util.select_player_dialog import SelectPlayerDialog class CloseGameDialog(SelectPlayerDialog): diff --git a/src/qt/itemviews/tableitemdelegte.py b/src/qt/itemviews/tableitemdelegte.py index 7ca184bcb..e85ac0996 100644 --- a/src/qt/itemviews/tableitemdelegte.py +++ b/src/qt/itemviews/tableitemdelegte.py @@ -5,8 +5,8 @@ from PyQt6.QtWidgets import QStyleOptionViewItem from PyQt6.QtWidgets import QTableView -from qt.itemviews.styleditemdelegate import StyledItemDelegate -from qt.utils import qpainter +from src.qt.itemviews.styleditemdelegate import StyledItemDelegate +from src.qt.utils import qpainter class TableItemDelegate(StyledItemDelegate): diff --git a/src/qt/itemviews/tableview.py b/src/qt/itemviews/tableview.py index 0816e1a24..90ff0e706 100644 --- a/src/qt/itemviews/tableview.py +++ b/src/qt/itemviews/tableview.py @@ -4,7 +4,7 @@ from PyQt6.QtGui import QWheelEvent from PyQt6.QtWidgets import QTableView -from qt.itemviews.tableheaderview import VerticalHeaderView +from src.qt.itemviews.tableheaderview import VerticalHeaderView class TableView(QTableView): diff --git a/src/replays/_replayswidget.py b/src/replays/_replayswidget.py index 1871abc72..c5fdcc014 100644 --- a/src/replays/_replayswidget.py +++ b/src/replays/_replayswidget.py @@ -3,6 +3,7 @@ import os import time +from pydantic import ValidationError from PyQt6 import QtCore from PyQt6 import QtGui from PyQt6 import QtWidgets @@ -11,23 +12,22 @@ from PyQt6.QtNetwork import QNetworkRequest from PyQt6.QtWidgets import QTreeWidgetItem -import client -import fa -import util -from api.models.Leaderboard import Leaderboard -from api.replaysapi import ReplaysApiConnector -from api.stats_api import LeaderboardApiConnector -from config import Settings -from downloadManager import DownloadRequest -from fa.replay import replay -from model.game import GameState -from pydantic import ValidationError -from replays.models import MetadataModel -from replays.replayitem import ReplayItem -from replays.replayitem import ReplayItemDelegate -from replays.replayToolbox import ReplayToolboxHandler -from util.gameurl import GameUrl -from util.gameurl import GameUrlType +from src import client +from src import fa +from src import util +from src.api.models.Leaderboard import Leaderboard +from src.api.replaysapi import ReplaysApiConnector +from src.api.stats_api import LeaderboardApiConnector +from src.config import Settings +from src.downloadManager import DownloadRequest +from src.fa.replay import replay +from src.model.game import GameState +from src.replays.models import MetadataModel +from src.replays.replayitem import ReplayItem +from src.replays.replayitem import ReplayItemDelegate +from src.replays.replayToolbox import ReplayToolboxHandler +from src.util.gameurl import GameUrl +from src.util.gameurl import GameUrlType logger = logging.getLogger(__name__) diff --git a/src/replays/models.py b/src/replays/models.py index 0ccb3fc07..7422e315d 100644 --- a/src/replays/models.py +++ b/src/replays/models.py @@ -3,17 +3,17 @@ from typing import Any from typing import Callable +from pydantic import BaseModel +from pydantic import Field from PyQt6.QtCore import QObject from PyQt6.QtCore import Qt from PyQt6.QtCore import pyqtSignal from PyQt6.QtGui import QIcon -import util -from api.models.Player import Player -from model.rating import Rating -from pydantic import BaseModel -from pydantic import Field -from qt.models.qtlistmodel import QtListModel +from src import util +from src.api.models.Player import Player +from src.model.rating import Rating +from src.qt.models.qtlistmodel import QtListModel # FIXME - this is what the widget uses so far, we should define this diff --git a/src/replays/replayToolbox.py b/src/replays/replayToolbox.py index 97d0a7b67..0cbe063a2 100644 --- a/src/replays/replayToolbox.py +++ b/src/replays/replayToolbox.py @@ -5,10 +5,10 @@ from PyQt6 import QtGui from PyQt6 import QtWidgets -from config import Settings -from downloadManager import DownloadRequest -from downloadManager import MapLargePreviewDownloader -from util import MAP_PREVIEW_LARGE_DIR +from src.config import Settings +from src.downloadManager import DownloadRequest +from src.downloadManager import MapLargePreviewDownloader +from src.util import MAP_PREVIEW_LARGE_DIR logger = logging.getLogger(__name__) diff --git a/src/replays/replayitem.py b/src/replays/replayitem.py index 4e6966b9d..af8921267 100644 --- a/src/replays/replayitem.py +++ b/src/replays/replayitem.py @@ -9,12 +9,12 @@ from PyQt6 import QtWidgets from PyQt6.QtGui import QAction -import util -from config import Settings -from downloadManager import DownloadRequest -from fa import maps -from games.moditem import mods -from replays.scoreboard import Scoreboard +from src import util +from src.config import Settings +from src.downloadManager import DownloadRequest +from src.fa import maps +from src.games.moditem import mods +from src.replays.scoreboard import Scoreboard class ReplayItemDelegate(QtWidgets.QStyledItemDelegate): diff --git a/src/replays/scoreboard.py b/src/replays/scoreboard.py index 8a24019dc..51dc515ab 100644 --- a/src/replays/scoreboard.py +++ b/src/replays/scoreboard.py @@ -12,11 +12,11 @@ from PyQt6.QtWidgets import QVBoxLayout from PyQt6.QtWidgets import QWidget -from contextmenu.playercontextmenu import PlayerContextMenu -from replays.models import ScoreboardModel -from replays.models import ScoreboardModelItem -from replays.scoreboarditemdelegate import ScoreboardItemDelegate -from replays.scoreboardlistview import ScoreboardListView +from src.contextmenu.playercontextmenu import PlayerContextMenu +from src.replays.models import ScoreboardModel +from src.replays.models import ScoreboardModelItem +from src.replays.scoreboarditemdelegate import ScoreboardItemDelegate +from src.replays.scoreboardlistview import ScoreboardListView class GameResult(Enum): diff --git a/src/replays/scoreboarditemdelegate.py b/src/replays/scoreboarditemdelegate.py index 8b7633542..ed17afc59 100644 --- a/src/replays/scoreboarditemdelegate.py +++ b/src/replays/scoreboarditemdelegate.py @@ -9,10 +9,10 @@ from PyQt6.QtWidgets import QStyledItemDelegate from PyQt6.QtWidgets import QStyleOptionViewItem -from qt.itemviews.styleditemdelegate import StyledItemDelegate -from qt.utils import qpainter -from replays.models import ScoreboardModel -from replays.models import ScoreboardModelItem +from src.qt.itemviews.styleditemdelegate import StyledItemDelegate +from src.qt.utils import qpainter +from src.replays.models import ScoreboardModel +from src.replays.models import ScoreboardModelItem class ScoreboardItemDelegate(StyledItemDelegate): diff --git a/src/replays/scoreboardlistview.py b/src/replays/scoreboardlistview.py index ac10cff99..d7b42ea1d 100644 --- a/src/replays/scoreboardlistview.py +++ b/src/replays/scoreboardlistview.py @@ -3,8 +3,8 @@ from PyQt6.QtGui import QMouseEvent from PyQt6.QtWidgets import QListView -from contextmenu.playercontextmenu import PlayerContextMenu -from replays.scoreboarditemdelegate import ScoreboardModelItem +from src.contextmenu.playercontextmenu import PlayerContextMenu +from src.replays.scoreboarditemdelegate import ScoreboardModelItem class ScoreboardListView(QListView): diff --git a/src/secondaryServer/secondaryserver.py b/src/secondaryServer/secondaryserver.py index 49da8bd26..c5bbf656a 100644 --- a/src/secondaryServer/secondaryserver.py +++ b/src/secondaryServer/secondaryserver.py @@ -4,7 +4,7 @@ from PyQt6 import QtCore from PyQt6 import QtNetwork -from config import Settings +from src.config import Settings logger = logging.getLogger(__name__) diff --git a/src/stats/__init__.py b/src/stats/__init__.py index d20f230c7..cc0a9774e 100644 --- a/src/stats/__init__.py +++ b/src/stats/__init__.py @@ -1,8 +1,8 @@ import logging -from stats.itemviews.leaderboardtableview import LeaderboardTableView -from stats.leaderboardlineedit import LeaderboardLineEdit +from src.stats.itemviews.leaderboardtableview import LeaderboardTableView +from src.stats.leaderboardlineedit import LeaderboardLineEdit from ._statswidget import StatsWidget diff --git a/src/stats/_statswidget.py b/src/stats/_statswidget.py index 39f69d8f4..c86ac7a35 100644 --- a/src/stats/_statswidget.py +++ b/src/stats/_statswidget.py @@ -4,10 +4,10 @@ from PyQt6 import QtCore from PyQt6 import QtWidgets -import util -from api.models.Leaderboard import Leaderboard -from api.stats_api import LeaderboardApiConnector -from ui.busy_widget import BusyWidget +from src import util +from src.api.models.Leaderboard import Leaderboard +from src.api.stats_api import LeaderboardApiConnector +from src.ui.busy_widget import BusyWidget from .leaderboard_widget import LeaderboardWidget diff --git a/src/stats/itemviews/leaderboarditemdelegate.py b/src/stats/itemviews/leaderboarditemdelegate.py index 244476558..2100b2e29 100644 --- a/src/stats/itemviews/leaderboarditemdelegate.py +++ b/src/stats/itemviews/leaderboarditemdelegate.py @@ -4,8 +4,8 @@ from PyQt6.QtGui import QPainter from PyQt6.QtWidgets import QStyleOptionViewItem -from qt.itemviews.tableitemdelegte import TableItemDelegate -from qt.utils import qpainter +from src.qt.itemviews.tableitemdelegte import TableItemDelegate +from src.qt.utils import qpainter class LeaderboardItemDelegate(TableItemDelegate): diff --git a/src/stats/itemviews/leaderboardtableview.py b/src/stats/itemviews/leaderboardtableview.py index 61782c8f8..1671000aa 100644 --- a/src/stats/itemviews/leaderboardtableview.py +++ b/src/stats/itemviews/leaderboardtableview.py @@ -2,7 +2,7 @@ from PyQt6.QtGui import QCursor from PyQt6.QtGui import QMouseEvent -from qt.itemviews.tableview import TableView +from src.qt.itemviews.tableview import TableView class LeaderboardTableView(TableView): diff --git a/src/stats/leaderboard_widget.py b/src/stats/leaderboard_widget.py index f5c58ffe0..840e815e8 100644 --- a/src/stats/leaderboard_widget.py +++ b/src/stats/leaderboard_widget.py @@ -5,17 +5,17 @@ from PyQt6 import QtCore from PyQt6 import QtWidgets -import util -from api.player_api import PlayerApiConnector -from api.stats_api import LeaderboardRatingApiConnector -from config import Settings +from src import util +from src.api.player_api import PlayerApiConnector +from src.api.stats_api import LeaderboardRatingApiConnector +from src.config import Settings from .itemviews.leaderboarditemdelegate import LeaderboardItemDelegate from .models.leaderboardfiltermodel import LeaderboardFilterModel from .models.leaderboardtablemodel import LeaderboardTableModel if TYPE_CHECKING: - from client._clientwindow import ClientWindow + from src.client._clientwindow import ClientWindow FormClass, BaseClass = util.THEME.loadUiType("stats/leaderboard.ui") diff --git a/src/stats/models/leaderboardtablemodel.py b/src/stats/models/leaderboardtablemodel.py index 968eeb563..5b4e3bb37 100644 --- a/src/stats/models/leaderboardtablemodel.py +++ b/src/stats/models/leaderboardtablemodel.py @@ -2,7 +2,7 @@ from PyQt6.QtCore import QModelIndex from PyQt6.QtCore import Qt -from util import utctolocal +from src.util import utctolocal class LeaderboardTableModel(QAbstractTableModel): diff --git a/src/tourneys/_tournamentswidget.py b/src/tourneys/_tournamentswidget.py index 96718dcca..ff524b544 100644 --- a/src/tourneys/_tournamentswidget.py +++ b/src/tourneys/_tournamentswidget.py @@ -2,10 +2,10 @@ from PyQt6 import QtCore from PyQt6 import QtWidgets -import secondaryServer -import util -from tourneys.tourneyitem import TourneyItem -from tourneys.tourneyitem import TourneyItemDelegate +from src import secondaryServer +from src import util +from src.tourneys.tourneyitem import TourneyItem +from src.tourneys.tourneyitem import TourneyItemDelegate FormClass, BaseClass = util.THEME.loadUiType("tournaments/tournaments.ui") diff --git a/src/tourneys/tourneyitem.py b/src/tourneys/tourneyitem.py index abeb4b552..6e1b55b67 100644 --- a/src/tourneys/tourneyitem.py +++ b/src/tourneys/tourneyitem.py @@ -2,7 +2,7 @@ from PyQt6 import QtGui from PyQt6 import QtWidgets -import util +from src import util class TourneyItemDelegate(QtWidgets.QStyledItemDelegate): diff --git a/src/tutorials/_tutorialswidget.py b/src/tutorials/_tutorialswidget.py index f32f94b99..f432e93ac 100644 --- a/src/tutorials/_tutorialswidget.py +++ b/src/tutorials/_tutorialswidget.py @@ -7,10 +7,10 @@ from PyQt6.QtNetwork import QNetworkReply from PyQt6.QtNetwork import QNetworkRequest -import fa -import util -from tutorials.tutorialitem import TutorialItem -from tutorials.tutorialitem import TutorialItemDelegate +from src import fa +from src import util +from src.tutorials.tutorialitem import TutorialItem +from src.tutorials.tutorialitem import TutorialItemDelegate logger = logging.getLogger(__name__) diff --git a/src/tutorials/tutorialitem.py b/src/tutorials/tutorialitem.py index 9e6063275..89bed4604 100644 --- a/src/tutorials/tutorialitem.py +++ b/src/tutorials/tutorialitem.py @@ -3,10 +3,10 @@ from PyQt6 import QtGui from PyQt6 import QtWidgets -import util -from config import Settings -from downloadManager import DownloadRequest -from fa import maps +from src import util +from src.config import Settings +from src.downloadManager import DownloadRequest +from src.fa import maps class TutorialItemDelegate(QtWidgets.QStyledItemDelegate): diff --git a/src/ui/status_logo.py b/src/ui/status_logo.py index 79ad0075d..46c1eb352 100644 --- a/src/ui/status_logo.py +++ b/src/ui/status_logo.py @@ -3,8 +3,8 @@ from PyQt6.QtWidgets import QLabel from PyQt6.QtWidgets import QMenu -import util -from client.clientstate import ClientState +from src import util +from src.client.clientstate import ClientState class StatusLogo(QLabel): diff --git a/src/unitdb/unitdbtab.py b/src/unitdb/unitdbtab.py index 580c86580..88d5f79f8 100644 --- a/src/unitdb/unitdbtab.py +++ b/src/unitdb/unitdbtab.py @@ -1,8 +1,8 @@ from PyQt6.QtCore import QUrl from PyQt6.QtGui import QDesktopServices -import util -from config import Settings +from src import util +from src.config import Settings FormClass, BaseClass = util.THEME.loadUiType("unitdb/unitdb.ui") diff --git a/src/updater/__init__.py b/src/updater/__init__.py index 29714d5d3..c48c886e2 100644 --- a/src/updater/__init__.py +++ b/src/updater/__init__.py @@ -4,12 +4,12 @@ from PyQt6.QtWidgets import QMessageBox from semantic_version import Version -from updater.base import Releases -from updater.base import UpdateChecker -from updater.base import UpdateNotifier -from updater.base import UpdateSettings -from updater.widgets import UpdateDialog -from updater.widgets import UpdateSettingsDialog +from src.updater.base import Releases +from src.updater.base import UpdateChecker +from src.updater.base import UpdateNotifier +from src.updater.base import UpdateSettings +from src.updater.widgets import UpdateDialog +from src.updater.widgets import UpdateSettingsDialog class ClientUpdateTools(QObject): diff --git a/src/updater/base.py b/src/updater/base.py index 51752a33f..715955cac 100644 --- a/src/updater/base.py +++ b/src/updater/base.py @@ -8,8 +8,8 @@ from PyQt6.QtNetwork import QNetworkRequest from semantic_version import Version -from config import Settings -from decorators import with_logger +from src.config import Settings +from src.decorators import with_logger class UpdateChannel(Enum): diff --git a/src/updater/process.py b/src/updater/process.py index a5f4d01f8..03df9919c 100644 --- a/src/updater/process.py +++ b/src/updater/process.py @@ -8,8 +8,8 @@ from PyQt6.QtNetwork import QNetworkReply from PyQt6.QtNetwork import QNetworkRequest -import client -from decorators import with_logger +from src import client +from src.decorators import with_logger @with_logger diff --git a/src/updater/widgets.py b/src/updater/widgets.py index f4a1961fd..9bc0ff68f 100644 --- a/src/updater/widgets.py +++ b/src/updater/widgets.py @@ -1,10 +1,10 @@ from PyQt6.QtWidgets import QLayout -import util -from decorators import with_logger -from updater.base import ReleaseType -from updater.base import UpdateChannel -from updater.process import ClientUpdater +from src import util +from src.decorators import with_logger +from src.updater.base import ReleaseType +from src.updater.base import UpdateChannel +from src.updater.process import ClientUpdater FormClass, BaseClass = util.THEME.loadUiType("client/update.ui") diff --git a/src/util/__init__.py b/src/util/__init__.py index 2265a398c..4f58ff856 100644 --- a/src/util/__init__.py +++ b/src/util/__init__.py @@ -18,13 +18,13 @@ from PyQt6.QtGui import QDesktopServices from PyQt6.QtWidgets import QMessageBox -import fafpath -from config import VERSION as VERSION_STRING -from config import Settings -from config import _settings # Stolen from Config because reasons -from mapGenerator import mapgenUtils -from util.theme import Theme -from util.theme import ThemeSet +from src import fafpath +from src.config import VERSION as VERSION_STRING +from src.config import Settings +from src.config import _settings # Stolen from Config because reasons +from src.mapGenerator import mapgenUtils +from src.util.theme import Theme +from src.util.theme import ThemeSet if sys.platform == 'win32': import win32service @@ -490,10 +490,9 @@ def uniqueID(session): " for smurf protection. This service could not be found.", ) + exe_path = os.path.join(fafpath.get_libdir(), "faf-uid") if sys.platform == 'win32': - exe_path = os.path.join(fafpath.get_libdir(), "faf-uid.exe") - else: # Expect it to be in PATH already - exe_path = "faf-uid" + exe_path += ".exe" try: uid_p = subprocess.Popen( [exe_path, session], diff --git a/src/util/crash.py b/src/util/crash.py index ac8c73d76..8b1e37691 100644 --- a/src/util/crash.py +++ b/src/util/crash.py @@ -5,12 +5,12 @@ from PyQt6.QtCore import QUrl from PyQt6.QtGui import QDesktopServices -import config -import util -from config import Settings -from util import APPDATA_DIR -from util import PERSONAL_DIR -from util import VERSION_STRING +from src import config +from src import util +from src.config import Settings +from src.util import APPDATA_DIR +from src.util import PERSONAL_DIR +from src.util import VERSION_STRING CRASH_REPORT_USER = "pre-login" diff --git a/src/vaults/dialogs.py b/src/vaults/dialogs.py index b892759d6..0bddd41bb 100644 --- a/src/vaults/dialogs.py +++ b/src/vaults/dialogs.py @@ -8,9 +8,9 @@ from PyQt6 import QtNetwork from PyQt6 import QtWidgets -from downloadManager import FileDownload -from downloadManager import ZipDownloadExtract -from util import capitalize +from src.downloadManager import FileDownload +from src.downloadManager import ZipDownloadExtract +from src.util import capitalize logger = logging.getLogger(__name__) diff --git a/src/vaults/mapvault/mapitem.py b/src/vaults/mapvault/mapitem.py index ed4481d2e..b244c6aa0 100644 --- a/src/vaults/mapvault/mapitem.py +++ b/src/vaults/mapvault/mapitem.py @@ -2,14 +2,14 @@ from typing import TYPE_CHECKING -import util -from api.models.Map import Map -from fa import maps -from mapGenerator import mapgenUtils -from vaults.vaultitem import VaultListItem +from src import util +from src.api.models.Map import Map +from src.fa import maps +from src.mapGenerator import mapgenUtils +from src.vaults.vaultitem import VaultListItem if TYPE_CHECKING: - from vaults.mapvault.mapvault import MapVault + from src.vaults.mapvault.mapvault import MapVault class MapListItem(VaultListItem): diff --git a/src/vaults/mapvault/mapvault.py b/src/vaults/mapvault/mapvault.py index 1cdc7450e..f8c49f3f5 100644 --- a/src/vaults/mapvault/mapvault.py +++ b/src/vaults/mapvault/mapvault.py @@ -12,17 +12,17 @@ from PyQt6 import QtCore from PyQt6 import QtWidgets -import util -from api.models.Map import Map -from api.vaults_api import MapApiConnector -from api.vaults_api import MapPoolApiConnector -from fa import maps -from vaults import luaparser -from vaults.mapvault.mapitem import MapListItem -from vaults.vault import Vault +from src import util +from src.api.models.Map import Map +from src.api.vaults_api import MapApiConnector +from src.api.vaults_api import MapPoolApiConnector +from src.fa import maps +from src.vaults import luaparser +from src.vaults.mapvault.mapitem import MapListItem +from src.vaults.vault import Vault if TYPE_CHECKING: - from client._clientwindow import ClientWindow + from src.client._clientwindow import ClientWindow from .mapwidget import MapWidget diff --git a/src/vaults/mapvault/mapwidget.py b/src/vaults/mapvault/mapwidget.py index a9178b2f5..36c0a9cf6 100644 --- a/src/vaults/mapvault/mapwidget.py +++ b/src/vaults/mapvault/mapwidget.py @@ -7,15 +7,15 @@ from PyQt6 import QtGui from PyQt6 import QtWidgets -import util -from downloadManager import DownloadRequest -from downloadManager import MapLargePreviewDownloader -from fa import maps -from mapGenerator import mapgenUtils -from vaults.mapvault.mapitem import MapListItem +from src import util +from src.downloadManager import DownloadRequest +from src.downloadManager import MapLargePreviewDownloader +from src.fa import maps +from src.mapGenerator import mapgenUtils +from src.vaults.mapvault.mapitem import MapListItem if TYPE_CHECKING: - from vaults.mapvault.mapvault import MapVault + from src.vaults.mapvault.mapvault import MapVault FormClass, BaseClass = util.THEME.loadUiType("vaults/mapvault/map.ui") diff --git a/src/vaults/modvault/moditem.py b/src/vaults/modvault/moditem.py index b510b63a9..805982b9a 100644 --- a/src/vaults/modvault/moditem.py +++ b/src/vaults/modvault/moditem.py @@ -4,14 +4,14 @@ import urllib from typing import TYPE_CHECKING -import util -from api.models.Mod import Mod -from api.models.ModVersion import ModType -from vaults.modvault import utils -from vaults.vaultitem import VaultListItem +from src import util +from src.api.models.Mod import Mod +from src.api.models.ModVersion import ModType +from src.vaults.modvault import utils +from src.vaults.vaultitem import VaultListItem if TYPE_CHECKING: - from vaults.modvault.modvault import ModVault + from src.vaults.modvault.modvault import ModVault class ModListItem(VaultListItem): diff --git a/src/vaults/modvault/modvault.py b/src/vaults/modvault/modvault.py index 5b0683add..bbcc045fa 100644 --- a/src/vaults/modvault/modvault.py +++ b/src/vaults/modvault/modvault.py @@ -44,11 +44,11 @@ from PyQt6 import QtCore from PyQt6 import QtWidgets -from api.vaults_api import ModApiConnector -from vaults.modvault import utils -from vaults.modvault.moditem import ModListItem -from vaults.modvault.utils import ModInfo -from vaults.vault import Vault +from src.api.vaults_api import ModApiConnector +from src.vaults.modvault import utils +from src.vaults.modvault.moditem import ModListItem +from src.vaults.modvault.utils import ModInfo +from src.vaults.vault import Vault from .modwidget import ModWidget from .uimodwidget import UIModWidget diff --git a/src/vaults/modvault/modwidget.py b/src/vaults/modvault/modwidget.py index c7dcc8b1b..f7fac2c7d 100644 --- a/src/vaults/modvault/modwidget.py +++ b/src/vaults/modvault/modwidget.py @@ -6,10 +6,10 @@ from PyQt6 import QtGui from PyQt6 import QtWidgets -import util -from api.models.ModType import ModType -from util import strtodate -from vaults.modvault.moditem import ModListItem +from src import util +from src.api.models.ModType import ModType +from src.util import strtodate +from src.vaults.modvault.moditem import ModListItem from .modvault import utils diff --git a/src/vaults/modvault/uimodwidget.py b/src/vaults/modvault/uimodwidget.py index ad3da49b6..553b539a6 100644 --- a/src/vaults/modvault/uimodwidget.py +++ b/src/vaults/modvault/uimodwidget.py @@ -2,8 +2,8 @@ from PyQt6 import QtCore from PyQt6 import QtWidgets -import util -from vaults.modvault import utils +from src import util +from src.vaults.modvault import utils FormClass, BaseClass = util.THEME.loadUiType("vaults/modvault/uimod.ui") diff --git a/src/vaults/modvault/uploadwidget.py b/src/vaults/modvault/uploadwidget.py index e35757d83..65c1376ec 100644 --- a/src/vaults/modvault/uploadwidget.py +++ b/src/vaults/modvault/uploadwidget.py @@ -5,8 +5,8 @@ from PyQt6 import QtCore from PyQt6 import QtWidgets -import util -from vaults.modvault import utils +from src import util +from src.vaults.modvault import utils FormClass, BaseClass = util.THEME.loadUiType("vaults/modvault/upload.ui") diff --git a/src/vaults/modvault/utils.py b/src/vaults/modvault/utils.py index 294741c91..0b458506d 100644 --- a/src/vaults/modvault/utils.py +++ b/src/vaults/modvault/utils.py @@ -8,11 +8,11 @@ from PyQt6 import QtGui from PyQt6 import QtWidgets -import util -from config import Settings -from util import PREFSFILENAME -from vaults import luaparser -from vaults.dialogs import downloadVaultAsset +from src import util +from src.config import Settings +from src.util import PREFSFILENAME +from src.vaults import luaparser +from src.vaults.dialogs import downloadVaultAsset logger = logging.getLogger(__name__) diff --git a/src/vaults/vault.py b/src/vaults/vault.py index 87d69fb28..3ff8422a9 100644 --- a/src/vaults/vault.py +++ b/src/vaults/vault.py @@ -5,13 +5,13 @@ from PyQt6 import QtCore -import util -from ui.busy_widget import BusyWidget -from vaults.vaultitem import VaultItemDelegate -from vaults.vaultitem import VaultListItem +from src import util +from src.ui.busy_widget import BusyWidget +from src.vaults.vaultitem import VaultItemDelegate +from src.vaults.vaultitem import VaultListItem if TYPE_CHECKING: - from client._clientwindow import ClientWindow + from src.client._clientwindow import ClientWindow logger = logging.getLogger(__name__) diff --git a/src/vaults/vaultitem.py b/src/vaults/vaultitem.py index 4e5cbcf00..254824985 100644 --- a/src/vaults/vaultitem.py +++ b/src/vaults/vaultitem.py @@ -8,14 +8,14 @@ from PyQt6.QtWidgets import QStyle from PyQt6.QtWidgets import QStyledItemDelegate -import util -from api.models.Map import Map -from api.models.Mod import Mod -from downloadManager import Downloader -from downloadManager import DownloadRequest +from src import util +from src.api.models.Map import Map +from src.api.models.Mod import Mod +from src.downloadManager import Downloader +from src.downloadManager import DownloadRequest if TYPE_CHECKING: - from vaults.vault import Vault + from src.vaults.vault import Vault class VaultListItem(QListWidgetItem): diff --git a/tests/conftest.py b/tests/conftest.py index 335177a67..61386f5a7 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,14 +1,45 @@ import pytest -from model.game import Game -from model.gameset import Gameset -from model.player import Player -from model.playerset import Playerset +from src.model.game import Game +from src.model.gameset import Gameset +from src.model.player import Player +from src.model.playerset import Playerset + + +@pytest.fixture(scope="module") +def application(qapp, request): + return qapp + + +@pytest.fixture(scope="function") +def signal_receiver(application): + from PyQt6 import QtCore + + class SignalReceiver(QtCore.QObject): + def __init__(self, parent=None): + QtCore.QObject.__init__(self, parent) + self.int_values = [] + self.generic_values = [] + self.string_values = [] + + @QtCore.pyqtSlot() + def generic_slot(self): + self.generic_values.append(None) + + @QtCore.pyqtSlot(str) + def string_slot(self, value): + self.string_values.append(value) + + @QtCore.pyqtSlot(int) + def int_slot(self, value): + self.int_values.append(value) + + return SignalReceiver(application) @pytest.fixture def client_instance(): - from client import instance + from src.client import instance return instance @@ -34,5 +65,5 @@ def gameset(mocker): @pytest.fixture def mouse_position(client_instance): - from client.mouse_position import MousePosition + from src.client.mouse_position import MousePosition return MousePosition(client_instance) diff --git a/tests/fa/test_updater.py b/tests/fa/test_updater.py index 0e9b0757e..406c81033 100644 --- a/tests/fa/test_updater.py +++ b/tests/fa/test_updater.py @@ -6,7 +6,7 @@ from PyQt6 import QtCore from PyQt6 import QtWidgets -from fa.game_updater.updater import UpdaterProgressDialog +from src.fa.game_updater.updater import UpdaterProgressDialog class NoIsFinished(QtCore.QObject): diff --git a/tests/integration_tests/model/test_player_game.py b/tests/integration_tests/model/test_player_game.py index 2f1206ac8..3d3ed9b7e 100644 --- a/tests/integration_tests/model/test_player_game.py +++ b/tests/integration_tests/model/test_player_game.py @@ -1,9 +1,12 @@ import copy -from model.game import Game, GameState, GameVisibility -from model.gameset import Gameset, PlayerGameIndex -from model.player import Player -from model.playerset import Playerset +from src.model.game import Game +from src.model.game import GameState +from src.model.game import GameVisibility +from src.model.gameset import Gameset +from src.model.gameset import PlayerGameIndex +from src.model.player import Player +from src.model.playerset import Playerset GAME_DICT = { "uid": 1, diff --git a/tests/integration_tests/model/test_player_ircuser.py b/tests/integration_tests/model/test_player_ircuser.py index 222495747..6a9f821e1 100644 --- a/tests/integration_tests/model/test_player_ircuser.py +++ b/tests/integration_tests/model/test_player_ircuser.py @@ -1,9 +1,9 @@ import pytest -from model.ircuser import IrcUser -from model.ircuserset import IrcUserset -from model.player import Player -from model.playerset import Playerset +from src.model.ircuser import IrcUser +from src.model.ircuserset import IrcUserset +from src.model.player import Player +from src.model.playerset import Playerset def test_player_change(mocker): diff --git a/tests/unit_tests/client/test_gameurl.py b/tests/unit_tests/client/test_gameurl.py index 5df77e797..b5598a743 100644 --- a/tests/unit_tests/client/test_gameurl.py +++ b/tests/unit_tests/client/test_gameurl.py @@ -1,6 +1,7 @@ import pytest -from util.gameurl import GameUrl, GameUrlType +from src.util.gameurl import GameUrl +from src.util.gameurl import GameUrlType # NOTE - any time url format gets updated, fix below URLs to be correct # in everything except what we test for! diff --git a/tests/unit_tests/client/test_updating.py b/tests/unit_tests/client/test_updating.py index a0c97e64c..276253422 100644 --- a/tests/unit_tests/client/test_updating.py +++ b/tests/unit_tests/client/test_updating.py @@ -1,10 +1,10 @@ import pytest -import config +from src import config def test_client_sends_current_version(qtbot, mocker): - import client + from src import client c = client.instance mocker.patch.object(c.lobby_connection, 'send') mocker.patch.object(c.lobby_connection, 'connected') @@ -22,7 +22,7 @@ def test_client_sends_current_version(qtbot, mocker): reason="Run this manually to test client update downloading", ) def test_client_updater(qtbot): - from client.updater import ClientUpdater + from src.client.updater import ClientUpdater updater = ClientUpdater( "http://content.faforever.com/FAForever-0.10.125.msi", diff --git a/tests/unit_tests/model/chat/test_channel.py b/tests/unit_tests/model/chat/test_channel.py index 150c6cf20..b27e67881 100644 --- a/tests/unit_tests/model/chat/test_channel.py +++ b/tests/unit_tests/model/chat/test_channel.py @@ -1,6 +1,8 @@ import pytest -from model.chat.channel import Channel, ChannelID, ChannelType +from src.model.chat.channel import Channel +from src.model.chat.channel import ChannelID +from src.model.chat.channel import ChannelType @pytest.fixture diff --git a/tests/unit_tests/model/chat/test_channelchatter.py b/tests/unit_tests/model/chat/test_channelchatter.py index 2223b2002..ca60c9140 100644 --- a/tests/unit_tests/model/chat/test_channelchatter.py +++ b/tests/unit_tests/model/chat/test_channelchatter.py @@ -1,6 +1,6 @@ import pytest -from model.chat.channelchatter import ChannelChatter +from src.model.chat.channelchatter import ChannelChatter @pytest.fixture diff --git a/tests/unit_tests/model/chat/test_channelset.py b/tests/unit_tests/model/chat/test_channelset.py index 56122c8be..61a759a41 100644 --- a/tests/unit_tests/model/chat/test_channelset.py +++ b/tests/unit_tests/model/chat/test_channelset.py @@ -1,7 +1,8 @@ import pytest -from model.chat.channel import ChannelID, ChannelType -from model.chat.channelset import Channelset +from src.model.chat.channel import ChannelID +from src.model.chat.channel import ChannelType +from src.model.chat.channelset import Channelset class MockChannels(): diff --git a/tests/unit_tests/model/chat/test_lines.py b/tests/unit_tests/model/chat/test_lines.py index 78a6e70f5..ddbf19548 100644 --- a/tests/unit_tests/model/chat/test_lines.py +++ b/tests/unit_tests/model/chat/test_lines.py @@ -1,6 +1,6 @@ import pytest -from model.chat.channel import Lines +from src.model.chat.channel import Lines def test_lines_dont_care_about_line_internals(): diff --git a/tests/unit_tests/model/test_game.py b/tests/unit_tests/model/test_game.py index e13d23742..db1d3f804 100644 --- a/tests/unit_tests/model/test_game.py +++ b/tests/unit_tests/model/test_game.py @@ -2,7 +2,7 @@ import pytest -from model import game +from src.model import game DEFAULT_DICT = { "uid": 1, diff --git a/tests/unit_tests/model/test_gameset.py b/tests/unit_tests/model/test_gameset.py index 19f18be43..74100885f 100644 --- a/tests/unit_tests/model/test_gameset.py +++ b/tests/unit_tests/model/test_gameset.py @@ -2,7 +2,8 @@ import pytest -from model import game, gameset +from src.model import game +from src.model import gameset DEFAULT_DICT = { "uid": 1, diff --git a/tests/unit_tests/model/test_ircuser.py b/tests/unit_tests/model/test_ircuser.py index de00cda2b..ac69cb4a0 100644 --- a/tests/unit_tests/model/test_ircuser.py +++ b/tests/unit_tests/model/test_ircuser.py @@ -1,4 +1,4 @@ -from model.ircuser import IrcUser +from src.model.ircuser import IrcUser def test_simple_init(): diff --git a/tests/unit_tests/model/test_ircuserset.py b/tests/unit_tests/model/test_ircuserset.py index e0953bd9d..c0d56fad4 100644 --- a/tests/unit_tests/model/test_ircuserset.py +++ b/tests/unit_tests/model/test_ircuserset.py @@ -1,7 +1,7 @@ import pytest -from model.ircuser import IrcUser -from model.ircuserset import IrcUserset +from src.model.ircuser import IrcUser +from src.model.ircuserset import IrcUserset @pytest.fixture diff --git a/tests/unit_tests/model/test_player.py b/tests/unit_tests/model/test_player.py index 8480dd4ab..2138c9385 100644 --- a/tests/unit_tests/model/test_player.py +++ b/tests/unit_tests/model/test_player.py @@ -1,5 +1,5 @@ -from model.player import Player -from model.rating import RatingType +from src.model.player import Player +from src.model.rating import RatingType DEFAULT_DICT = { "id_": 17, diff --git a/tests/unit_tests/model/test_playerset.py b/tests/unit_tests/model/test_playerset.py index 000c19840..db90f3078 100644 --- a/tests/unit_tests/model/test_playerset.py +++ b/tests/unit_tests/model/test_playerset.py @@ -1,7 +1,7 @@ import pytest -from model.player import Player -from model.playerset import Playerset +from src.model.player import Player +from src.model.playerset import Playerset DEFAULT_DICT = { "id_": 17, diff --git a/tests/unit_tests/themes/test_theme.py b/tests/unit_tests/themes/test_theme.py index 0988cdb06..bc28b8476 100644 --- a/tests/unit_tests/themes/test_theme.py +++ b/tests/unit_tests/themes/test_theme.py @@ -1,6 +1,6 @@ from semantic_version import Version -from util import Theme +from src.util import Theme THEME_FILE_FUNS = [ "pixmap", diff --git a/tests/unit_tests/themes/test_themeset.py b/tests/unit_tests/themes/test_themeset.py index c761dcc03..f5d5737ce 100644 --- a/tests/unit_tests/themes/test_themeset.py +++ b/tests/unit_tests/themes/test_themeset.py @@ -1,6 +1,7 @@ +import PyQt6.QtMultimedia from semantic_version import Version -from util import ThemeSet +from src.util import ThemeSet THEME_FILE_FUNS = [ "pixmap", diff --git a/win_requirements.txt b/win_requirements.txt new file mode 100644 index 000000000..bbf6b851d --- /dev/null +++ b/win_requirements.txt @@ -0,0 +1,2 @@ +-r requirements.txt +pywin32