Skip to content

Commit

Permalink
Merge pull request #626 from panther7/625-need-restart
Browse files Browse the repository at this point in the history
Handle need restart after installation for winget
  • Loading branch information
marticliment authored Jan 23, 2023
2 parents 3d63ba9 + 60aeb57 commit 4f146de
Show file tree
Hide file tree
Showing 9 changed files with 1,838 additions and 1,801 deletions.
3,367 changes: 1,701 additions & 1,666 deletions media/customcolor_icon.ai

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions wingetui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self):
titlewidget = QHBoxLayout()
titlewidget.addStretch()
icon = QLabel()
icon.setPixmap(QPixmap(realpath+"/resources/icon.png").scaledToWidth(128, Qt.TransformationMode.SmoothTransformation))
icon.setPixmap(QPixmap(getMedia("icon", autoIconMode = False)).scaledToWidth(128, Qt.TransformationMode.SmoothTransformation))
text = QLabel("WingetUI")
text.setStyleSheet(f"font-family: \"{globals.dispfont}\";font-weight: bold; color: {'white' if isDark() else 'black'};font-size: 50pt;")
titlewidget.addWidget(icon)
Expand Down Expand Up @@ -285,7 +285,7 @@ def loadMainUI(self):
globals.trayIcon = QSystemTrayIcon()
self.trayIcon = globals.trayIcon
globals.app = self
self.trayIcon.setIcon(QIcon(realpath+"/resources/icon.png"))
self.trayIcon.setIcon(QIcon(getMedia("icon", autoIconMode = False)))
self.trayIcon.setToolTip("WingetUI")
self.trayIcon.setVisible(True)

Expand Down
4 changes: 3 additions & 1 deletion wingetui/chocoHelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,10 @@ def uninstallAssistant(p: subprocess.Popen, closeAndInform: Signal, infoSignal:
p.wait()
cprint(output)
outputCode = p.returncode
if outputCode in (1605, 1614, 1641, 3010):
if outputCode in (1605, 1614, 1641):
outputCode = 0
elif outputCode == 3010:
outputCode = 3
closeAndInform.emit(outputCode, output)


Expand Down
2 changes: 1 addition & 1 deletion wingetui/mainWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(self):
self.setWindowTitle("WingetUI")
self.setMinimumSize(700, 560)
self.setObjectName("micawin")
self.setWindowIcon(QIcon(realpath+"/resources/icon.png"))
self.setWindowIcon(QIcon(getMedia("icon", autoIconMode = False)))
self.resize(QSize(1100, 700))
try:
rs = getSettingsValue("OldWindowGeometry").split(",")
Expand Down
Binary file added wingetui/resources/notif_restart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added wingetui/resources/restart_color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
227 changes: 112 additions & 115 deletions wingetui/storeEngine.py

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions wingetui/tools.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from ast import Attribute
import shutil
import winreg
import io
Expand All @@ -7,11 +6,11 @@
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
from win32mica import ApplyMica, MICAMODE
from urllib.request import urlopen
from versions import *
from languages import *
from external.blurwindow import GlobalBlur
from pathlib import Path

import globals

Expand Down Expand Up @@ -241,16 +240,18 @@ def ApplyMenuBlur(hwnd: int, window: QWidget, smallCorners: bool = False, avoidO
#QtWin.extendFrameIntoClientArea(window, -1, -1, -1, -1)


def getPath(s):
return os.path.join(os.path.join(realpath, "resources"), s).replace("\\", "/")
def getPath(s: str) -> str:
return str(Path(f"{realpath}/resources/{s}").resolve()).replace("\\", "/")

def getIconMode() -> str:
return "white" if isDark() else "black"

def getMedia(m: str) -> str:
filename = getPath(m+"_"+getIconMode()+".png")
if not os.path.exists(filename):
filename = getPath(m+".png")
def getMedia(m: str, autoIconMode = True) -> str:
filename = ""
if autoIconMode == True:
filename = getPath(f"{m}_{getIconMode()}.png")
if not filename or not os.path.exists(filename):
filename = getPath(f"{m}.png")
return filename

def getint(s: str, fallback: int) -> int:
Expand Down
18 changes: 10 additions & 8 deletions wingetui/wingetHelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def searchForUpdates(signal: Signal, finishSignal: Signal, noretry: bool = False
verSeparator = len(l.split("Version")[0])
newVerSeparator = len(l.split("Available")[0])
counter += 1

if p.returncode != 0 and not noretry:
time.sleep(1)
print(p.returncode)
Expand Down Expand Up @@ -354,10 +354,9 @@ def getInfo(signal: Signal, title: str, id: str, useId: bool) -> None:
signal.emit(appInfo)
except Exception as e:
report(e)

def installAssistant(p: subprocess.Popen, closeAndInform: Signal, infoSignal: Signal, counterSignal: Signal) -> None:
print(f"🟢 winget installer assistant thread started for process {p}")
outputCode = 0
counter = 0
output = ""
while p.poll() is None:
Expand All @@ -370,14 +369,17 @@ def installAssistant(p: subprocess.Popen, closeAndInform: Signal, infoSignal: Si
counterSignal.emit(counter)
output += line+"\n"
p.wait()
outputCode = p.returncode
if outputCode == 0x8A150011:
outputCode = 2
match p.returncode:
case 0x8A150011:
outputCode = 2
case 0x8A150109: # need restart
outputCode = 3
case other:
outputCode = p.returncode
closeAndInform.emit(outputCode, output)

def uninstallAssistant(p: subprocess.Popen, closeAndInform: Signal, infoSignal: Signal, counterSignal: Signal) -> None:
print(f"🟢 winget installer assistant thread started for process {p}")
outputCode = 0
counter = 0
output = ""
while p.poll() is None:
Expand Down

0 comments on commit 4f146de

Please sign in to comment.