Skip to content

Commit

Permalink
Update the pacman choose window so it installs scoop if required, and…
Browse files Browse the repository at this point in the history
… remove scoop options from the installer
  • Loading branch information
marticliment committed Jan 27, 2023
1 parent 224d260 commit 2d36add
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 13 deletions.
8 changes: 4 additions & 4 deletions WingetUI.iss
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ end;
[Tasks]
Name: "startmenuicon"; Description: "Create a shortcut on the start menu"; GroupDescription: "Shortcuts";
Name: "desktopicon"; Description: "Create a shortcut on the desktop"; GroupDescription: "Shortcuts"; Flags: unchecked
Name: "disablescoop"; Description: "Do not install Scoop (recommended for most users)"; GroupDescription: "Scoop Package Manager"; Flags: exclusive
Name: "installscoop"; Description: "Enable and install Scoop (for advanced users)"; GroupDescription: "Scoop Package Manager"; Flags: exclusive unchecked
;Name: "disablescoop"; Description: "Do not install Scoop (recommended for most users)"; GroupDescription: "Scoop Package Manager"; Flags: exclusive
;Name: "installscoop"; Description: "Enable and install Scoop (for advanced users)"; GroupDescription: "Scoop Package Manager"; Flags: exclusive unchecked

[Registry]
Root: HKCU; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "WingetUI"; ValueData: """{app}\WingetUI.exe"" --daemon"; Flags: uninsdeletevalue
Expand All @@ -123,8 +123,8 @@ Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: de

[Run]
Filename: "{app}\remove-old.cmd"; Flags: runhidden
Filename: "{app}\install_scoop.cmd"; Flags: runhidden; Tasks: installscoop
Filename: "{app}\disable_scoop.cmd"; Flags: runhidden; Tasks: disablescoop
;Filename: "{app}\install_scoop.cmd"; Flags: runhidden; Tasks: installscoop
;Filename: "{app}\disable_scoop.cmd"; Flags: runhidden; Tasks: disablescoop
Filename: "{app}\vcredist.exe"; Flags: runhidden; Parameters: "/install /passive /norestart"
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall;

Expand Down
18 changes: 15 additions & 3 deletions wingetui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ def askAboutPackageManagers(self, onclose: object):
pixmap = QPixmap(4, 4)
pixmap.fill(Qt.GlobalColor.transparent)
self.w.setWindowIcon(pixmap)
#self.w.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
#self.w.setAttribute(Qt.WidgetAttribute.WA_StyledBackground)
self.w.setAutoFillBackground(True)
self.w.setWindowFlag(Qt.WindowType.WindowMaximizeButtonHint, False)
self.w.setWindowFlag(Qt.WindowType.WindowMinimizeButtonHint, False)
Expand Down Expand Up @@ -160,10 +158,23 @@ def askAboutPackageManagers(self, onclose: object):
mainLayout.addLayout(blayout)
blayout.addStretch()

def performSelectionAndContinue():
self.w.close()
setSettings("AskedAbout3PackageManagers", True)
setSettings("DisableWinget", not winget.isChecked())
setSettings("DisableScoop", not scoop.isChecked())
setSettings("ScoopEnabledByAssistant", scoop.isChecked())
setSettings("DisableChocolatey", not choco.isChecked())
if scoop.isChecked() and shutil.which("scoop") == None:
os.startfile(os.path.join(realpath, "resources/install_scoop.cmd"))
else:
onclose()


okbutton = QPushButton(_("Apply and start WingetUI"))
okbutton.setFixedSize(190, 30)
okbutton.setObjectName("AccentButton")
okbutton.clicked.connect(lambda: (self.w.close(), onclose(), setSettings("AskedAbout3PackageManagers", True), setSettings("DisableWinget", not winget.isChecked()), setSettings("DisableScoop", not scoop.isChecked()), setSettings("ScoopEnabledByAssistant", scoop.isChecked()), setSettings("DisableChocolatey", not choco.isChecked())))
okbutton.clicked.connect(performSelectionAndContinue)
blayout.addWidget(okbutton)

w = QWidget(self.w)
Expand All @@ -172,6 +183,7 @@ def askAboutPackageManagers(self, onclose: object):
l = QHBoxLayout()
l.addWidget(w)
self.w.setLayout(l)

r = ApplyMica(self.w.winId(), MICAMODE.DARK if isDark() else MICAMODE.LIGHT)
if r != 0:
self.w.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground, False)
Expand Down
2 changes: 1 addition & 1 deletion wingetui/data/contributors.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{
"name": "marticliment",
"link": "https://github.com/marticliment",
"contributions": 896
"contributions": 897
},
{
"name": "ppvnf",
Expand Down
9 changes: 6 additions & 3 deletions wingetui/resources/install_scoop.cmd
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
@echo off
SET wingetuipath=%~dp0..\wingetui.exe
echo This script will install Scoop and the dependencies required by WingetUI.
echo Scoop Installer Assistant - WingetUI
echo This script will install Scoop and its dependencies, since it appears that they are not installed on your machine.
pause
powershell -ExecutionPolicy ByPass -File "%~dp0\install_scoop.ps1"
if %errorlevel% equ 0 (
echo WingetUI needs to be restarted now. This script is now going to restart WingetUI
echo WingetUI will be restarted to continue.
pause
taskkill /im wingetui.exe /f
start /b %wingetuipath%
start /b %wingetuipath% /i
) else (
pause
taskkill /im wingetui.exe /f
start /b %wingetuipath% /i
)
1 change: 0 additions & 1 deletion wingetui/scoopHelpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from random import vonmisesvariate
from PySide6.QtCore import *
import subprocess, os, sys, re
from tools import *
Expand Down
1 change: 0 additions & 1 deletion wingetui/wingetHelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
else:
winget = os.path.join(os.path.join(realpath, "winget-cli"), "winget.exe")


def searchForPackage(signal: Signal, finishSignal: Signal, noretry: bool = False) -> None:
print(f"🟢 Starting winget search, winget on {winget}...")
p = subprocess.Popen(["mode", "400,30&", winget, "search", ""] + common_params ,stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE, cwd=os.getcwd(), env=os.environ.copy(), shell=True)
Expand Down

0 comments on commit 2d36add

Please sign in to comment.