Skip to content

Commit

Permalink
Merge branch 'main' into picker-spaces-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkobrombin authored Oct 9, 2024
2 parents 5e39c75 + 424af7a commit 9cf071c
Show file tree
Hide file tree
Showing 41 changed files with 2,894 additions and 2,854 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/sonar.yml

This file was deleted.

6 changes: 4 additions & 2 deletions .github/workflows/update-manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
env:
PR_BRANCH: pr/ci-manifest/${{ github.ref_name }}
FEDC_ARGS: --update --require-important-update --commit-only --never-fork "bottles-repository/com.usebottles.bottles.yml"
UPDATE_PYTHON: false

jobs:
update-manifest:
Expand All @@ -36,7 +37,7 @@ jobs:
git config user.name "github-actions[bot]"
pur -r requirements.txt
pur -r requirements.dev.txt
req2flatpak --requirements-file requirements.txt --yaml --target-platforms 311-x86_64 -o com.usebottles.bottles.pypi-deps.yaml
req2flatpak --requirements-file requirements.txt --yaml --target-platforms 312-x86_64 -o com.usebottles.bottles.pypi-deps.yaml
git diff ${{ github.ref_name }} --exit-code requirements.txt requirements.dev.txt com.usebottles.bottles.pypi-deps.yaml
updated=$?
if [ $updated -ne 0 ]; then
Expand All @@ -49,6 +50,7 @@ jobs:
run: |
remove_important_update_only=$(sed 's/--require-important-update//g' <<< '${{ env.FEDC_ARGS }}')
echo "FEDC_ARGS=$remove_important_update_only" >> $GITHUB_ENV
echo "UPDATE_PYTHON=true" >> $GITHUB_ENV
- uses: docker://ghcr.io/flathub/flatpak-external-data-checker:latest
env:
Expand All @@ -69,7 +71,7 @@ jobs:
git push -f --set-upstream origin ${{ env.PR_BRANCH }}
git diff ${{ github.ref_name }} --exit-code com.usebottles.bottles.yml
updated=$?
if [ $updated -ne 0 ]; then
if [ $updated -ne 0 ] || [ "${{ env.UPDATE_PYTHON }}" = true ]; then
gh pr create --title ":robot:: Update manifest (important)" --body ":wrench: One or more modules marked as 'important' have been updated." --head ${{ env.PR_BRANCH }} --base ${{ github.ref_name }}
exit 0
fi
Expand Down
3 changes: 2 additions & 1 deletion bottles/backend/managers/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,8 @@ def get_programs(self, config: BottleConfig) -> List[dict]:
"path": _program.get("path"),
"folder": _program.get("folder", program_folder),
"icon": "com.usebottles.bottles-program",
"script": _program.get("script"),
"pre_script": _program.get("pre_script"),
"post_script": _program.get("post_script"),
"dxvk": _program.get("dxvk"),
"vkd3d": _program.get("vkd3d"),
"dxvk_nvapi": _program.get("dxvk_nvapi"),
Expand Down
32 changes: 14 additions & 18 deletions bottles/backend/managers/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(self, get_index=True):
self.aborted_connections = 0
SignalManager.connect(Signals.ForceStopNetworking, self.__stop_index)

self.__check_locals()
self.__check_personals()
if get_index:
self.__get_index()

Expand All @@ -66,32 +66,28 @@ def get_repo(self, name: str, offline: bool = False):

logging.error(f"Repository {name} not found")

def __check_locals(self):
_locals = {}
def __check_personals(self):
_personals = {}

if "LOCAL_COMPONENTS" in os.environ:
_locals["components"] = os.environ["LOCAL_COMPONENTS"]
if "PERSONAL_COMPONENTS" in os.environ:
_personals["components"] = os.environ["PERSONAL_COMPONENTS"]

if "LOCAL_DEPENDENCIES" in os.environ:
_locals["dependencies"] = os.environ["LOCAL_DEPENDENCIES"]
if "PERSONAL_DEPENDENCIES" in os.environ:
_personals["dependencies"] = os.environ["PERSONAL_DEPENDENCIES"]

if "LOCAL_INSTALLERS" in os.environ:
_locals["installers"] = os.environ["LOCAL_INSTALLERS"]
if "PERSONAL_INSTALLERS" in os.environ:
_personals["installers"] = os.environ["PERSONAL_INSTALLERS"]

if not _locals:
if not _personals:
return

for repo in self.__repositories:
if repo not in _locals:
if repo not in _personals:
continue

_path = _locals[repo]

if os.path.exists(_path):
self.__repositories[repo]["url"] = f"file://{_path}/"
logging.info(f"Using local {repo} repository at {_path}")
else:
logging.error(f"Local {repo} path does not exist: {_path}")
_url = _personals[repo]
self.__repositories[repo]["url"] = _url
logging.info(f"Using personal {repo} repository at {_url}")

def __curl_progress(self, _download_t, _download_d, _upload_t, _upload_d):
if self.do_get_index:
Expand Down
11 changes: 11 additions & 0 deletions bottles/backend/wine/catalogs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
win_versions = {
"win11": {
"CSDVersion": "",
"CSDVersionHex": "0",
"CurrentBuild": "22000",
"CurrentBuildNumber": "22000",
"CurrentVersion": "10.0",
"CurrentMinorVersionNumber": "0",
"CurrentMajorVersionNumber": "a", # 10
"ProductType": "WinNT",
"ProductName": "Microsoft Windows 11",
},
"win10": {
"CSDVersion": "",
"CSDVersionHex": "0",
Expand Down
10 changes: 9 additions & 1 deletion bottles/backend/wine/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def __init__(
environment: Optional[dict] = None,
move_file: bool = False,
move_upd_fn: callable = None,
pre_script: Optional[str] = None,
post_script: Optional[str] = None,
monitoring: Optional[list] = None,
program_dxvk: Optional[bool] = None,
Expand Down Expand Up @@ -60,6 +61,7 @@ def __init__(
self.terminal = terminal
self.cwd = self.__get_cwd(cwd)
self.environment = environment
self.pre_script = pre_script
self.post_script = post_script
self.monitoring = monitoring
self.use_virt_desktop = program_virt_desktop
Expand Down Expand Up @@ -112,7 +114,8 @@ def run_program(cls, config: BottleConfig, program: dict, terminal: bool = False
exec_path=program.get("path"),
args=program.get("arguments"),
cwd=program.get("folder"),
post_script=program.get("script"),
pre_script=program.get("pre_script"),
post_script=program.get("post_script"),
terminal=terminal,
program_dxvk=program.get("dxvk"),
program_vkd3d=program.get("vkd3d"),
Expand Down Expand Up @@ -199,6 +202,8 @@ def run_cli(self):
terminal=self.terminal,
args=self.args,
environment=self.environment,
pre_script=self.pre_script,
post_script=self.post_script,
cwd=self.cwd,
)
return Result(status=True, data={"output": res})
Expand Down Expand Up @@ -264,6 +269,7 @@ def __launch_exe(self):
cwd=self.cwd,
environment=self.environment,
communicate=True,
pre_script=self.pre_script,
post_script=self.post_script,
)
res = winecmd.run()
Expand Down Expand Up @@ -300,6 +306,8 @@ def __launch_with_starter(self):
terminal=self.terminal,
args=self.args,
environment=self.environment,
pre_script=self.pre_script,
post_script=self.post_script,
cwd=self.cwd,
)
self.__set_monitors()
Expand Down
4 changes: 4 additions & 0 deletions bottles/backend/wine/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def run(
terminal: bool = True,
args: str = "",
environment: Optional[dict] = None,
pre_script: Optional[str] = None,
post_script: Optional[str] = None,
cwd: Optional[str] = None,
):
winepath = WinePath(self.config)
Expand All @@ -37,6 +39,8 @@ def run(
communicate=True,
terminal=terminal,
environment=environment,
pre_script=pre_script,
post_script=post_script,
cwd=cwd,
minimal=False,
action_name="run",
Expand Down
7 changes: 6 additions & 1 deletion bottles/backend/wine/winecommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def __init__(
cwd: Optional[str] = None,
colors: str = "default",
minimal: bool = False, # avoid gamemode/gamescope usage
pre_script: Optional[str] = None,
post_script: Optional[str] = None,
):
_environment = environment.copy()
Expand All @@ -106,7 +107,7 @@ def __init__(
self.arguments = arguments
self.cwd = self._get_cwd(cwd)
self.runner, self.runner_runtime = self._get_runner_info()
self.command = self.get_cmd(command, post_script, environment=_environment)
self.command = self.get_cmd(command, pre_script, post_script, environment=_environment)
self.terminal = terminal
self.env = self.get_env(_environment)
self.communicate = communicate
Expand Down Expand Up @@ -474,6 +475,7 @@ def _get_runner_info(self) -> tuple[str, str]:
def get_cmd(
self,
command,
pre_script: Optional[str] = None,
post_script: Optional[str] = None,
return_steam_cmd: bool = False,
return_clean_cmd: bool = False,
Expand Down Expand Up @@ -588,6 +590,9 @@ def get_cmd(
if post_script is not None:
command = f"{command} ; sh '{post_script}'"

if pre_script is not None:
command = f"sh '{pre_script}' ; {command}"

return command

def _get_gamescope_cmd(self, return_steam_cmd: bool = False) -> str:
Expand Down
4 changes: 4 additions & 0 deletions bottles/backend/wine/wineprogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def launch(
minimal: bool = True,
communicate: bool = False,
environment: Optional[dict] = None,
pre_script: Optional[str] = None,
post_script: Optional[str] = None,
cwd: Optional[str] = None,
action_name: str = "launch",
):
Expand All @@ -68,6 +70,8 @@ def launch(
communicate=communicate,
colors=self.colors,
environment=environment,
pre_script=pre_script,
post_script=post_script,
cwd=cwd,
arguments=program_args,
).run()
Expand Down
9 changes: 6 additions & 3 deletions bottles/frontend/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,8 @@ def run_program(self):
_args = " ".join(self.args.args)
_executable = self.args.executable
_cwd = None
_script = None
_pre_script = None
_post_script = None
_program_dxvk = None
_program_vkd3d = None
_program_dxvk_nvapi = None
Expand Down Expand Up @@ -674,7 +675,8 @@ def run_program(self):
if _keep and _program_args:
_args = _program_args + " " + _args
_cwd = program.get("folder", "")
_script = program.get("script", None)
_pre_script = program.get("pre_script", None)
_post_script = program.get("post_script", None)

_program_dxvk = program.get("dxvk")
_program_vkd3d = program.get("vkd3d")
Expand All @@ -693,7 +695,8 @@ def run_program(self):
exec_path=_executable,
args=_args,
cwd=_cwd,
post_script=_script,
pre_script=_pre_script,
post_script=_post_script,
program_dxvk=_program_dxvk,
program_vkd3d=_program_vkd3d,
program_nvapi=_program_dxvk_nvapi,
Expand Down
39 changes: 35 additions & 4 deletions bottles/frontend/ui/dialog-launch-options.blp
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,46 @@ template LaunchOptionsDialog : .AdwWindow {
tooltip-text: _("e.g.: VAR=value %command% -example1 -example2 -example3=hello");
}

.AdwActionRow action_script {
activatable-widget: "btn_script";
.AdwActionRow action_pre_script {
activatable-widget: "btn_pre_script";
title: _("Pre-run Script");
subtitle: _("Choose a script which should be executed before run.");

Box {
spacing: 6;

Button btn_pre_script_reset {
tooltip-text: _("Reset to Default");
valign: center;
visible: false;
icon-name: "edit-undo-symbolic";

styles [
"flat",
]
}

Button btn_pre_script {
tooltip-text: _("Choose a Script");
valign: center;
icon-name: "document-open-symbolic";

styles [
"flat",
]
}
}
}

.AdwActionRow action_post_script {
activatable-widget: "btn_post_script";
title: _("Post-run Script");
subtitle: _("Choose a script which should be executed after run.");

Box {
spacing: 6;

Button btn_script_reset {
Button btn_post_script_reset {
tooltip-text: _("Reset to Default");
valign: center;
visible: false;
Expand All @@ -66,7 +97,7 @@ template LaunchOptionsDialog : .AdwWindow {
]
}

Button btn_script {
Button btn_post_script {
tooltip-text: _("Choose a Script");
valign: center;
icon-name: "document-open-symbolic";
Expand Down
6 changes: 5 additions & 1 deletion bottles/frontend/ui/new.blp
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ template NewView : .AdwWindow {
}
}

.AdwPreferencesGroup {
.AdwPreferencesGroup {
title: _("Environment");

.AdwActionRow application {
activatable-widget: "check_application";
title: _("_Application");
subtitle: _( "Optimized for productivity software. Can run apps that might need DirectX, but not guaranteed. Includes basic fonts and essential Wine components." );
icon-name: "applications-engineering-symbolic";
use-underline: true;

Expand All @@ -87,6 +88,7 @@ template NewView : .AdwWindow {
.AdwActionRow gaming {
activatable-widget: "check_gaming";
title: _("_Gaming");
subtitle: _( "Optimized for games, game engines, and 3D apps. Includes DirectX, Vulkan, and enhanced performance settings." );
icon-name: "input-gaming-symbolic";
use-underline: true;

Expand All @@ -100,6 +102,7 @@ template NewView : .AdwWindow {
.AdwActionRow custom {
activatable-widget: "check_custom";
title: _("C_ustom");
subtitle: _( "A clean slate. You can customize everything for advanced use cases." );
icon-name: "applications-science-symbolic";
use-underline: true;

Expand Down Expand Up @@ -282,3 +285,4 @@ Popover popover_duplicate {
label: _("This name is unavailable, please try another.");
}
}

Loading

0 comments on commit 9cf071c

Please sign in to comment.