From 2c2e0f20d54a6b213bd79938d13c428945daaa83 Mon Sep 17 00:00:00 2001 From: Rus_Nor <9205347374@mail.ru> Date: Sun, 10 Dec 2023 20:19:24 +0300 Subject: [PATCH] fix start app --- data/scripts/sw_deps | 23 ++++++++++--------- data/scripts/sw_main | 45 +++++++++++++++++++++++++++++++++----- data/scripts/sw_menu.glade | 2 +- data/scripts/sw_runlib | 42 +++-------------------------------- 4 files changed, 57 insertions(+), 55 deletions(-) diff --git a/data/scripts/sw_deps b/data/scripts/sw_deps index 5f6e01c..f592715 100755 --- a/data/scripts/sw_deps +++ b/data/scripts/sw_deps @@ -11,7 +11,8 @@ if [ -x "$(command -v nala)" ]; then sudo dpkg --add-architecture i386 2>/dev/null || echo 'Pass' && sudo nala update 2>/dev/null || echo 'Passed' && - for deps in zstd imagemagick vulkan-tools wine xdg-user-dirs gir1.2-vte-2.91 htop python3-xlib python3-gi-cairo python3-opengl python3-numpy python3-pil python3-six ; do + for deps in zstd imagemagick vulkan-tools wine xdg-user-dirs gir1.2-vte-2.91 \ + htop python3-xlib python3-gi-cairo python3-opengl python3-numpy python3-pil python3-six python3-psutil ; do if [ "`sudo nala list --installed $deps 2>/dev/null | grep $deps`" == "" ]; then sudo nala install $deps -y || echo "$deps __________Passed" @@ -30,7 +31,8 @@ elif [ -x "$(command -v apt)" ]; then sudo dpkg --add-architecture i386 2>/dev/null || echo 'Pass' && sudo apt update -y 2>/dev/null || echo 'Passed' && - for deps in zstd imagemagick vulkan-tools wine xdg-user-dirs gir1.2-vte-2.91 htop python3-xlib python3-gi-cairo python3-opengl python3-numpy python3-pil python3-six ; do + for deps in zstd imagemagick vulkan-tools wine xdg-user-dirs gir1.2-vte-2.91 \ + htop python3-xlib python3-gi-cairo python3-opengl python3-numpy python3-pil python3-six python3-psutil ; do if [ "`sudo apt list --installed $deps 2>/dev/null | cut -d '/' -f1 | tail -n1`" != "$deps" ]; then sudo apt install $deps -y 2>/dev/null || echo "$deps __________Passed" @@ -47,7 +49,7 @@ elif [ -x "$(command -v epm)" ]; then sudo epmu -y 2>/dev/null || echo 'Passed' && for deps in zstd squashfuse ImageMagick vulkan-tools i586-wine xdg-user-dirs vte3 libvte3-gir libgtk+3-gir htop python3-xlib \ - python3-module-pefile python3-module-cairocffi python3-module-OpenGL python3-module-numpy python3-module-Pillow python3-module-six ; do + python3-module-pefile python3-module-cairocffi python3-module-OpenGL python3-module-numpy python3-module-Pillow python3-module-six python3-module-psutil ; do if [ "`sudo epm list --installed $deps 2>/dev/null | grep $deps`" == "" ]; then sudo epmi $deps -y 2>/dev/null || echo "$deps __________Passed" @@ -63,7 +65,8 @@ elif [ -x "$(command -v eopkg)" ]; then sudo eopkg ur -y 2>/dev/null || echo 'Passed' && - for deps in zstd squashfuse imagemagick vulkan-tools wine wine-32bit xdg-user-dirs libvte htop python-xlib python-cairo python-opengl python-numexpr python-pillow python-six ; do + for deps in zstd squashfuse imagemagick vulkan-tools wine wine-32bit xdg-user-dirs \ + libvte htop python-xlib python-cairo python-opengl python-numexpr python-pillow python-six python-psutil ; do if [ "`sudo eopkg li $deps 2>/dev/null | cut -d '/' -f1 | tail -n1`" != "$deps" ]; then sudo eopkg it $deps -y 2>/dev/null || echo "$deps __________Passed" @@ -84,7 +87,7 @@ elif [ -x "$(command -v dnf)" ]; then fi for deps in zstd ImageMagick vulkan-tools xdg-user-dirs ibus-gtk2.i686 htop python3-xlib python3-gobject rubygem-vte3 python3-cairo python3-pyopengl python3-numpy \ - python3-pillow python3-six lib64vte-gir2.91.x86_64 libvte-gir2.91.i686 vte291.x86_64 vte291.i686 ; do + python3-pillow python3-six python3-psutil lib64vte-gir2.91.x86_64 libvte-gir2.91.i686 vte291.x86_64 vte291.i686 ; do if [ "`sudo dnf list $deps | grep @`" == "" ]; then sudo dnf install $deps -y || echo "$deps ______________________Passed" @@ -100,8 +103,8 @@ elif [ -x "$(command -v zypper)" ]; then sudo zypper ref || echo 'Passed' && - for deps in zstd ImageMagick vulkan-tools xdg-user-dirs wine typelib-1_0-Vte-2_91 vte-tools libvte-2_91-0 python310-xlib python310-gobject-Gdk python310-matplotlib-gtk3 \ - python310-gobject-cairo python310-opengl python310-numpy python310-Pillow python310-six ; do + for deps in zstd ImageMagick vulkan-tools xdg-user-dirs wine typelib-1_0-Vte-2_91 vte-tools libvte-2_91-0 python312-xlib python312-gobject-Gdk python312-matplotlib-gtk3 \ + python312-gobject-cairo python312-opengl python312-numpy python312-Pillow python312-six python312-psutil ; do if [ "`sudo zypper search -i $deps | grep $deps`" == "" ]; then sudo zypper in --no-confirm $deps || echo "$deps ______________Passed" @@ -117,7 +120,7 @@ elif [ -x "$(command -v pacman)" ]; then sudo pacman -Sy -y || echo 'Passed' && - for deps in zstd imagemagick vulkan-tools xdg-user-dirs htop vte3 python-xlib python-gobject python-cairo python-opengl python-pillow python-numpy python-six ; do + for deps in zstd imagemagick vulkan-tools xdg-user-dirs htop vte3 python-xlib python-gobject python-cairo python-opengl python-pillow python-numpy python-six python-psutil ; do if [ "`pacman -Qs $deps | grep -w $deps | tail -n1`" == "" ]; then sudo pacman -S $deps --noconfirm || echo "$deps _______________Passed" @@ -139,7 +142,7 @@ elif [ -x "$(command -v xbps-install)" ]; then sudo xbps-install -S || echo 'Passed' && - for deps in zstd ImageMagick Vulkan-Tools xdg-user-dirs wine wine-32bit htop python3-xlib python3-cairo python3-PyOpenGL python3-numpy python3-Pillow python3-six ; do + for deps in zstd ImageMagick Vulkan-Tools xdg-user-dirs wine wine-32bit htop python3-xlib python3-cairo python3-PyOpenGL python3-numpy python3-Pillow python3-six python3-psutil ; do if [ "`xbps-query -l | awk '{ print $2 }' | xargs -n1 xbps-uhelper getpkgname | grep -w $deps`" == "" ]; then sudo xbps-install -y $deps || echo "$deps ______________Passed" @@ -156,7 +159,7 @@ elif [ -x "$(command -v emerge)" ]; then sudo emerge --sync || echo 'Passed' && for deps in app-arch/zstd media-gfx/imagemagick dev-util/vulkan-tools app-emulation/wine-vanilla x11-misc/xdg-user-dirs dev-python/pyopengl gui-libs/vte \ - dev-python/numpy dev-python/xlib dev-python/pycairo dev-python/pillow dev-python/six app-arch/lz4 sys-fs/squashfs-tools sys-fs/squashfuse ; do + dev-python/numpy dev-python/xlib dev-python/pycairo dev-python/pillow dev-python/six dev-python/psutil app-arch/lz4 sys-fs/squashfs-tools sys-fs/squashfuse ; do if [ "`qlist -I $deps | grep -w $deps | tail -n1`" == "" ]; then sudo emerge --noreplace --with-bdeps=y --jobs=2 $deps || echo "$deps ______________Passed" diff --git a/data/scripts/sw_main b/data/scripts/sw_main index d1b1f3f..0748b97 100755 --- a/data/scripts/sw_main +++ b/data/scripts/sw_main @@ -1,12 +1,13 @@ #!/usr/bin/env python3 -################################___SCRIPTS_V383___: +################################___SCRIPTS_V384___: import os import sys from pathlib import Path import subprocess from subprocess import * +import psutil import gi gi.require_version('Gtk', '3.0') @@ -485,7 +486,8 @@ def echo_func_name(func_name): else: sw_fsh.write_text(fshread[0] + '\n' + fshread[1] + '\n' + func) - proc_fsh = Popen(f"{sw_fsh} {app_path}", shell=True, start_new_session=True, stdout=PIPE, stderr=sys.stderr, encoding='UTF-8') + proc_fsh = run(f"{sw_fsh} {app_path}", shell=True, start_new_session=True, + stderr=sys.stderr, encoding='UTF-8') ################################___MENU_BUTTONS___: @@ -919,9 +921,42 @@ def pid_name_print_all(bar): ################################___RUN_APPLICATION___: +def find_process(app_suffix): + '''___Return a list of processes matching name___''' + + procs = psutil.Process(os.getpid()).children(recursive=True) + for p in procs: + try: + ls = p.as_dict(attrs=['name']) + except: + pass + else: + n = ls['name'] + if app_suffix.lower() in n.lower(): + print(n) + return True + + return False + +def wait_exe_proc(bar, app_suffix): + '''___Waiting for the executing process to close the menu___''' + + found = find_process(app_suffix) + if found: + bar.set_show_text(False) + bar.set_fraction(0.0) + bar.set_visible(False) + window.close() + return False + + bar.set_visible(True) + bar.pulse() + return True + def on_btn_start(self): app_name = get_arg(get_out()) + app_suffix = get_suffix() if app_name == 'StartWine': i = _("Oops! Nothing to run...") @@ -952,21 +987,21 @@ def on_btn_start(self): thread_opengl.start() if progressbar_lock.acquire(False): - GLib.timeout_add(60, progress) + GLib.timeout_add(100, wait_exe_proc, progressbar, app_suffix) else: if str(vulkan_dri) == str('llvmpipe') and str(vulkan_dri2) == str('llvmpipe'): Thread(target=run_opengl).start() if progressbar_lock.acquire(False): - GLib.timeout_add(60, progress) + GLib.timeout_add(100, wait_exe_proc, progressbar, app_suffix) else: thread_vulkan = Thread(target=run_vulkan) thread_vulkan.start() if progressbar_lock.acquire(False): - GLib.timeout_add(60, progress) + GLib.timeout_add(100, wait_exe_proc, progressbar, app_suffix) def run_vulkan(): diff --git a/data/scripts/sw_menu.glade b/data/scripts/sw_menu.glade index 71c5599..d974345 100755 --- a/data/scripts/sw_menu.glade +++ b/data/scripts/sw_menu.glade @@ -5619,7 +5619,7 @@ Example: -d3d11 False StartWine -3.8.3 +3.8.4 center diff --git a/data/scripts/sw_runlib b/data/scripts/sw_runlib index 0343bdc..f012ebd 100755 --- a/data/scripts/sw_runlib +++ b/data/scripts/sw_runlib @@ -7,12 +7,12 @@ export START_WINE_PATH="$(pwd)" ############################### VERSION #################################### -export SW_VER="383" +export SW_VER="384" export GE_VER="8-25" export SP_VER="8.0.4" -export STAG_VER="8.20" +export STAG_VER="8.21" export LUTRIS_VER="7.2-2" -export LUTRIS_GE_VER="8-24" +export LUTRIS_GE_VER="8-25" export UTILS_VER="v2.3" ##############################...LOCALE...###################################### @@ -832,42 +832,6 @@ if [ ! -f "${START_WINE_PATH}/data/pfx/pfx_default/drive_c/windows/system32/star fi fi -############################# GE_PROTON DOWNLOAD ########################### - -if [ "${SW_DOWNLOAD_GE}" == 1 ]; then - - if [ ! -f "${START_WINE_PATH}/data/wine/wine_proton_ge/bin/wine" ]; then - - try_remove "${START_WINE_PATH}/data/tmp/GE-Proton"${GE_VER}".tar.gz" && - try_remove "${START_WINE_PATH}/data/tmp/GE-Proton"${GE_VER}"" - - export FTP_URL="https://github.com/GloriousEggroll/proton-ge-custom/releases/download/GE-Proton"${GE_VER}"/GE-Proton"${GE_VER}".tar.gz" - crier=`$CRIER -d "${FTP_URL}" "${START_WINE_PATH}/data/tmp/GE-Proton"${GE_VER}".tar.gz"` && - crier=`$CRIER -tar "${START_WINE_PATH}/data/tmp/GE-Proton"${GE_VER}".tar.gz" "${START_WINE_PATH}/data/tmp"` && - try_copy "${START_WINE_PATH}/data/tmp/GE-Proton"${GE_VER}"/files" "${START_WINE_PATH}/data/wine/wine_proton_ge" - - for link_dir in bin lib lib64 share ; do - try_link "${START_WINE_PATH}/data/wine/wine_proton_ge/files/${link_dir}" "${START_WINE_PATH}/data/wine/wine_proton_ge" - done - - if [ ! -f "${START_WINE_PATH}/data/wine/wine_proton_ge/version" ]; then - echo "GE-${GE_VER}" > "${START_WINE_PATH}/data/wine/wine_proton_ge/version" - echo "${GE_VER}" >> "${START_WINE_PATH}/data/wine/wine_proton_ge/version" - fi - - try_remove "${START_WINE_PATH}/data/tmp/GE-Proton"${GE_VER}".tar.gz" - try_remove "${START_WINE_PATH}/data/tmp/GE-Proton"${GE_VER}"" - - chmod -R 775 "${START_WINE_PATH}/data/wine/wine_proton_ge" - - if [ -f "${START_WINE_PATH}/data/wine/${SW_USE_WINE}/bin/cabextract" ]; then - try_remove "${START_WINE_PATH}/data/wine/${SW_USE_WINE}/bin/cabextract" - fi - - fi - -fi - ############################## RUN VULKAN ################################## RUN_VULKAN () {