Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
ded4840
data: Update screenshots
TheEvilSkeleton Jan 15, 2025
d0d35d6
appstream: Add brand colors
TheEvilSkeleton Jan 15, 2025
b9f37e1
appstream: Update developer name
TheEvilSkeleton Jan 15, 2025
7d55049
appstream: Use sentence case for summary
TheEvilSkeleton Jan 15, 2025
1f1dc75
appstream: Add screenshot captions
TheEvilSkeleton Jan 15, 2025
02f669b
bottle-row: Rename to BottleRow
TheEvilSkeleton Jan 12, 2025
5f238b7
new-bottle-dialog: Rename to NewBottleDialog
TheEvilSkeleton Jan 12, 2025
870bdd9
check-row: Rename to CheckRow
TheEvilSkeleton Jan 12, 2025
f08dc05
component-entry-row: Rename files and class name
TheEvilSkeleton Jan 12, 2025
458e293
dependency-entry-row: Rename files and class name
TheEvilSkeleton Jan 12, 2025
ac5d0cb
bottle-details-view: Rename files and class name
TheEvilSkeleton Jan 12, 2025
fb234ae
bottle-details-page: Rename files and class name
TheEvilSkeleton Jan 12, 2025
55ef374
details-preferences-page: Rename files and class name
TheEvilSkeleton Jan 12, 2025
10fc8bb
details-task-manager-view: Rename files and class name
TheEvilSkeleton Jan 12, 2025
2014a98
details-versioning-page: Rename files and class name
TheEvilSkeleton Jan 12, 2025
98534f3
bottle-picker-dialog: Rename files
TheEvilSkeleton Jan 12, 2025
65f7350
crash-report-dialog: Rename files
TheEvilSkeleton Jan 12, 2025
b88a4fc
details-dependencies-view: Rename files and class name
TheEvilSkeleton Jan 12, 2025
e4d8c02
details-installers-view: Rename files and class name
TheEvilSkeleton Jan 12, 2025
a5fcad3
dependencies-check-dialog: Rename files
TheEvilSkeleton Jan 12, 2025
6cda10f
display-dialog: Rename files
TheEvilSkeleton Jan 12, 2025
8fbea93
dll-overrides-dialog: Rename files
TheEvilSkeleton Jan 12, 2025
8e17eec
drives-dialog: Rename files
TheEvilSkeleton Jan 12, 2025
4f46b2c
duplicate-dialog: Rename files
TheEvilSkeleton Jan 12, 2025
a762b68
exclusion-patterns-dialog: Rename files
TheEvilSkeleton Jan 12, 2025
b266d17
gamescope-dialog: Rename files
TheEvilSkeleton Jan 12, 2025
508e626
exclusion-pattern-row: Rename files and class name
TheEvilSkeleton Jan 12, 2025
854c31a
fsr-dialog: Rename files and add to POTFILES
TheEvilSkeleton Jan 12, 2025
9451be7
importer-view: Rename files
TheEvilSkeleton Jan 12, 2025
5043948
importer-row: Rename files and class name
TheEvilSkeleton Jan 12, 2025
54988cc
installer-row: Rename files and class name
TheEvilSkeleton Jan 13, 2025
f2a84b4
library-view: Rename files and add to POTFILES
TheEvilSkeleton Jan 13, 2025
5558984
bottles-list-view: Rename files and class name
TheEvilSkeleton Jan 13, 2025
aa2a59d
loading-view: Rename files
TheEvilSkeleton Jan 13, 2025
c5bbdbe
local-resource-row: Rename class name
TheEvilSkeleton Jan 13, 2025
c8f8135
onboard-dialog: Rename files
TheEvilSkeleton Jan 13, 2025
ea587df
program-row: Rename files and class name
TheEvilSkeleton Jan 13, 2025
68f6b26
state-row: Rename files and class name
TheEvilSkeleton Jan 13, 2025
4c17c19
task-row: Rename file and class name
TheEvilSkeleton Jan 13, 2025
f3aa6a7
environment-variables-dialog: Rename files
TheEvilSkeleton Jan 13, 2025
c83e262
installer-dialog: Rename files
TheEvilSkeleton Jan 13, 2025
34d26cd
journal-dialog: Rename files
TheEvilSkeleton Jan 13, 2025
9c5f9d0
launch-options-dialog: Rename files
TheEvilSkeleton Jan 13, 2025
bf1e716
mangohud-dialog: Rename files and add to POTFILES
TheEvilSkeleton Jan 13, 2025
b89bbc5
proton-alert-dialog: Rename files
TheEvilSkeleton Jan 13, 2025
93ae9bb
rename-program-dialog: Rename files and class name
TheEvilSkeleton Jan 13, 2025
4711b81
dialog-run-args: Remove file
TheEvilSkeleton Jan 13, 2025
ba72504
sandbox-dialog: Rename files
TheEvilSkeleton Jan 13, 2025
f6e6db7
upgrade-versioning-dialog: Rename files
TheEvilSkeleton Jan 13, 2025
422bab8
vkbasalt-dialog: Rename files
TheEvilSkeleton Jan 13, 2025
7a16788
vmtouch-dialog: Rename files and add to POTFILES
TheEvilSkeleton Jan 13, 2025
3838cd8
library-entry: Rename files
TheEvilSkeleton Jan 16, 2025
468c6c6
frontend: Move files to root of `frontend/`
TheEvilSkeleton Jan 13, 2025
24019db
chore: Add `pyupgrade` as a pre-commit hook
EmoonX Jan 14, 2025
8e12f6d
chore: Run `pyupgrade` for the entire codebase
TheEvilSkeleton Jan 17, 2025
e733cae
chore: Move autoflake above MyPy
TheEvilSkeleton Jan 17, 2025
fab79a1
backend: Remove connection checks
TheEvilSkeleton Jan 18, 2025
2b64cad
frontend: Get rid of loading view
TheEvilSkeleton Jan 18, 2025
8572573
window: Remove loading-view
TheEvilSkeleton Jan 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,27 @@ repos:
args: ["--autofix", "--no-sort-keys", "--indent", "4"]
- id: check-added-large-files

- repo: https://github.com/asottile/pyupgrade
rev: v3.19.1
hooks:
- id: pyupgrade
args: ["--py312-plus"]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.2
hooks:
- id: ruff
args: [ "--fix" ]
- id: ruff-format

- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
hooks:
- id: autoflake

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
hooks:
- id: mypy
args: ["--pretty"]
additional_dependencies: ["pygobject-stubs", "types-PyYAML", "types-Markdown", "types-requests", "types-pycurl", "types-chardet", "pytest-stub", "types-orjson", "pathvalidate", "requirements-parser", "icoextract", "fvs", "patool", "git+https://gitlab.com/TheEvilSkeleton/vkbasalt-cli.git@main"]

- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
hooks:
- id: autoflake
3 changes: 1 addition & 2 deletions bottles/backend/cabextract.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import shlex
import shutil
import subprocess
from typing import Optional

from bottles.backend.logger import Logger

Expand Down Expand Up @@ -47,7 +46,7 @@ def run(
self,
path: str,
name: str = "",
files: Optional[list] = None,
files: list | None = None,
destination: str = "",
):
if files is None:
Expand Down
3 changes: 1 addition & 2 deletions bottles/backend/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import shutil
import sys
import time
from typing import Optional

import requests

Expand All @@ -38,7 +37,7 @@ class Downloader:
"""

def __init__(
self, url: str, file: str, update_func: Optional[TaskStreamUpdateHandler] = None
self, url: str, file: str, update_func: TaskStreamUpdateHandler | None = None
):
self.start_time = None
self.url = url
Expand Down
5 changes: 2 additions & 3 deletions bottles/backend/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import os
import shutil
from pathlib import Path
from typing import Dict
from bottles.backend.utils import yaml, json


Expand Down Expand Up @@ -82,12 +81,12 @@ class TrdyPaths:
vmtouch_available = shutil.which("vmtouch") or False
base_version = ""
if os.path.isfile("/app/manifest.json"):
with open("/app/manifest.json", mode="r", encoding="utf-8") as file:
with open("/app/manifest.json", encoding="utf-8") as file:
base_version = (
json.load(file) # type: ignore
.get("base-version", "")
.removeprefix("stable-")
)

# encoding detection correction, following windows defaults
locale_encodings: Dict[str, str] = {"ja_JP": "cp932", "zh_CN": "gbk"}
locale_encodings: dict[str, str] = {"ja_JP": "cp932", "zh_CN": "gbk"}
15 changes: 5 additions & 10 deletions bottles/backend/managers/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import shutil
import tarfile
from functools import lru_cache
from typing import Optional

import pycurl

Expand All @@ -45,10 +44,9 @@

# noinspection PyTypeChecker
class ComponentManager:
def __init__(self, manager, offline: bool = False):
def __init__(self, manager):
self.__manager = manager
self.__repo = manager.repository_manager.get_repo("components", offline)
self.__utils_conn = manager.utils_conn
self.__repo = manager.repository_manager.get_repo("components")

@lru_cache
def get_component(self, name: str, plain: bool = False) -> dict:
Expand All @@ -59,9 +57,6 @@ def fetch_catalog(self) -> dict:
Fetch all components from the Bottles repository, mark the installed
ones and return a dict with the catalog.
"""
if not self.__utils_conn.check_connection():
return {}

catalog = {
"runtimes": {},
"wine": {},
Expand Down Expand Up @@ -131,7 +126,7 @@ def download(
file: str,
rename: str = "",
checksum: str = "",
func: Optional[TaskStreamUpdateHandler] = None,
func: TaskStreamUpdateHandler | None = None,
) -> bool:
"""Download a component from the Bottles repository."""

Expand Down Expand Up @@ -274,7 +269,7 @@ def extract(name: str, component: str, archive: str) -> bool:
root_dir = tar.getnames()[0]
tar.extractall(path)
tar.close()
except (tarfile.TarError, IOError, EOFError):
except (tarfile.TarError, OSError, EOFError):
with contextlib.suppress(FileNotFoundError):
os.remove(os.path.join(Paths.temp, archive))
with contextlib.suppress(FileNotFoundError):
Expand All @@ -301,7 +296,7 @@ def install(
self,
component_type: str,
component_name: str,
func: Optional[TaskStreamUpdateHandler] = None,
func: TaskStreamUpdateHandler | None = None,
):
"""
This function is used to install a component. It automatically
Expand Down
13 changes: 6 additions & 7 deletions bottles/backend/managers/conf.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import os
from configparser import ConfigParser
from typing import Optional

from bottles.backend.utils import yaml, json


class ConfigManager(object):
class ConfigManager:
def __init__(
self,
config_file: Optional[str] = None,
config_file: str | None = None,
config_type: str = "ini",
config_string: Optional[str] = None,
config_string: str | None = None,
):
self.config_file = config_file
self.config_string = config_string
Expand Down Expand Up @@ -44,10 +43,10 @@ def read(self):
# noinspection PyProtectedMember
res = config._sections
elif self.config_type == "json":
with open(self.config_file, "r") as f:
with open(self.config_file) as f:
res = json.load(f)
elif self.config_type == "yaml" or self.config_type == "yml":
with open(self.config_file, "r") as f:
with open(self.config_file) as f:
res = yaml.load(f)
else:
raise ValueError("Invalid configuration type")
Expand Down Expand Up @@ -94,7 +93,7 @@ def write_ini(self):
with open(self.config_file, "w") as f:
config.write(f)

def write_dict(self, config_file: Optional[str] = None):
def write_dict(self, config_file: str | None = None):
if self.config_file is None and config_file is None:
raise ValueError("No config path specified")
elif self.config_file is None and config_file is not None:
Expand Down
2 changes: 1 addition & 1 deletion bottles/backend/managers/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(self):

def __get_data(self):
try:
with open(self.__p_data, "r") as s:
with open(self.__p_data) as s:
self.__data = yaml.load(s)
if self.__data is None:
raise AttributeError
Expand Down
11 changes: 5 additions & 6 deletions bottles/backend/managers/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@


class DependencyManager:
def __init__(self, manager, offline: bool = False):
def __init__(self, manager):
self.__manager = manager
self.__repo = manager.repository_manager.get_repo("dependencies", offline)
self.__utils_conn = manager.utils_conn
self.__repo = manager.repository_manager.get_repo("dependencies")

@lru_cache
def get_dependency(self, name: str, plain: bool = False) -> str | dict | bool:
Expand All @@ -59,8 +58,6 @@ def fetch_catalog(self) -> dict:
and return these as a dictionary. It also returns an empty dictionary
if there are no dependencies or fails to fetch them.
"""
if not self.__utils_conn.check_connection():
return {}

catalog = {}
index = self.__repo.catalog
Expand Down Expand Up @@ -91,7 +88,9 @@ def install(self, config: BottleConfig, dependency: list) -> Result:
task_id = TaskManager.add(Task(title=dependency[0]))

logging.info(
"Installing dependency [%s] in bottle [%s]." % (dependency[0], config.Name),
"Installing dependency [{}] in bottle [{}].".format(
dependency[0], config.Name
),
)
manifest = self.get_dependency(dependency[0])
if not manifest:
Expand Down
2 changes: 1 addition & 1 deletion bottles/backend/managers/epicgamesstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def get_installed_games(config: BottleConfig) -> list:
if dat_path is None:
return []

with open(dat_path, "r") as dat:
with open(dat_path) as dat:
data = json.load(dat)

for game in data["InstallationList"]:
Expand Down
10 changes: 3 additions & 7 deletions bottles/backend/managers/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import subprocess
import uuid
from functools import lru_cache
from typing import Optional

import markdown
import pycurl
Expand All @@ -37,10 +36,9 @@


class InstallerManager:
def __init__(self, manager, offline: bool = False):
def __init__(self, manager):
self.__manager = manager
self.__repo = manager.repository_manager.get_repo("installers", offline)
self.__utils_conn = manager.utils_conn
self.__repo = manager.repository_manager.get_repo("installers")
self.__component_manager = manager.component_manager
self.__local_resources = {}

Expand Down Expand Up @@ -69,8 +67,6 @@ def fetch_catalog(self) -> dict:
"""Fetch the installers catalog from the repository"""
catalog = {}
index = self.__repo.catalog
if not self.__utils_conn.check_connection():
return {}

for installer in index.items():
catalog[installer[0]] = installer[1]
Expand Down Expand Up @@ -358,7 +354,7 @@ def install(
installer: dict,
step_fn: callable,
is_final: bool = True,
local_resources: Optional[dict] = None,
local_resources: dict | None = None,
):
manifest = self.get_installer(installer[0])
_config = config
Expand Down
5 changes: 2 additions & 3 deletions bottles/backend/managers/journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import shutil
import uuid
from datetime import datetime, timedelta
from typing import Optional

from bottles.backend.globals import Paths
from bottles.backend.utils import yaml
Expand Down Expand Up @@ -52,7 +51,7 @@ def __get_journal() -> dict:
with open(JournalManager.path, "w") as f:
yaml.dump({}, f)

with open(JournalManager.path, "r") as f:
with open(JournalManager.path) as f:
try:
journal = yaml.load(f)
except yaml.YAMLError:
Expand Down Expand Up @@ -100,7 +99,7 @@ def __clean_old():
JournalManager.__save_journal(journal)

@staticmethod
def __save_journal(journal: Optional[dict] = None):
def __save_journal(journal: dict | None = None):
"""Save the journal to the journal file."""
if journal is None:
journal = JournalManager.__get_journal()
Expand Down
2 changes: 1 addition & 1 deletion bottles/backend/managers/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def load_library(self, silent=False):
self.__library = {}
self.save_library()
else:
with open(self.library_path, "r") as library_file:
with open(self.library_path) as library_file:
self.__library = yaml.load(library_file)

if self.__library is None:
Expand Down
Loading
Loading