Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3,508 changes: 3,503 additions & 5 deletions WebBasedData/screenshot-database.json

Large diffs are not rendered by default.

24 changes: 23 additions & 1 deletion wingetui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def loadStuffThread(self):

# Preparation threads
Thread(target=self.checkForRunningInstances, daemon=True).start()
Thread(target=self.downloadPackagesMetadata, daemon=True).start()
if not getSettings("DisableWinget"):
Thread(target=self.detectWinget, daemon=True).start()
else:
Expand All @@ -131,7 +132,7 @@ def loadStuffThread(self):
Thread(target=self.instanceThread, daemon=True).start()
Thread(target=self.updateIfPossible, daemon=True).start()

while self.loadStatus < 6:
while self.loadStatus < 7:
time.sleep(0.01)
except Exception as e:
print(e)
Expand Down Expand Up @@ -238,6 +239,27 @@ def detectSudo(self):
print(e)
self.loadStatus += 1

def downloadPackagesMetadata(self):
try:
self.callInMain.emit(lambda: self.loadingText.setText(_("Downloading package metadata...")))
data = urlopen("https://raw.githubusercontent.com/martinet101/WingetUI/screenshots-and-icons/WebBasedData/screenshot-database.json").read()
try:
os.makedirs(os.path.join(os.path.expanduser("~"), f".wingetui/cachedmeta"))
except FileExistsError:
pass
with open(os.path.join(os.path.expanduser("~"), f".wingetui/cachedmeta/packages.json"), "wb") as f:
f.write(data)
print("🟢 Downloaded latest metadata to local file")
except Exception as e:
report(e)
try:
with open(os.path.join(os.path.expanduser("~"), f".wingetui/cachedmeta/packages.json"), "rb") as f:
globals.packageMeta = json.load(f)
print("🔵 Loaded metadata from local file")
except Exception as e:
report(e)
self.loadStatus += 1

def loadMainUI(self):
print("Reached main ui load milestone")
try:
Expand Down
6 changes: 5 additions & 1 deletion wingetui/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,8 @@ def addTreeWidgetItem(item: QTreeWidgetItem):
lastFocusedWindow: int = 0
themeChanged: bool = False
updatesAvailable: bool = False
canUpdate: bool = False
canUpdate: bool = False

packageMeta: dict = {}
infobox: QWidget = None
centralWindowLayout: QWidget = None
15 changes: 14 additions & 1 deletion wingetui/mainWindow.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from xml.dom.minidom import Attr
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
Expand Down Expand Up @@ -31,7 +32,7 @@ def __init__(self):
self.resize(QSize(1100, 700))
self.loadWidgets()
self.blackmatt = QWidget(self)
self.blackmatt.setStyleSheet("background-color: rgba(0, 0, 0, 50%);")
self.blackmatt.setStyleSheet("background-color: rgba(0, 0, 0, 30%);border-top-left-radius: 8px;border-top-right-radius: 8px;")
self.blackmatt.hide()
self.blackmatt.move(0, 0)
self.blackmatt.resize(self.size())
Expand All @@ -49,6 +50,10 @@ def __init__(self):
print("🟢 Main application loaded...")

def loadWidgets(self) -> None:

self.infobox = PackageInfoPopupWindow(self)
globals.infobox = self.infobox

self.widgets = {}
self.mainWidget = QStackedWidget()
self.extrasMenu = QMenu("", self)
Expand Down Expand Up @@ -150,12 +155,15 @@ def showExtrasMenu():
self.setContentsMargins(0, 0, 0, 0)
w.setLayout(vl)
self.setCentralWidget(w)
globals.centralWindowLayout = w
sct = QShortcut(QKeySequence("Ctrl+Tab"), self)
sct.activated.connect(lambda: (self.mainWidget.setCurrentIndex((self.mainWidget.currentIndex() + 1) if self.mainWidget.currentIndex() < 4 else 0), self.buttonBox.buttons()[self.mainWidget.currentIndex()].setChecked(True)))

sct = QShortcut(QKeySequence("Ctrl+Shift+Tab"), self)
sct.activated.connect(lambda: (self.mainWidget.setCurrentIndex((self.mainWidget.currentIndex() - 1) if self.mainWidget.currentIndex() > 0 else 3), self.buttonBox.buttons()[self.mainWidget.currentIndex()].setChecked(True)))



def addTab(self, widget: QWidget, label: str, addToMenu: bool = False, actionIcon: str = "") -> QPushButton:
i = self.mainWidget.addWidget(widget)
btn = PushButtonWithAction(label)
Expand Down Expand Up @@ -247,6 +255,11 @@ def resizeEvent(self, event: QResizeEvent) -> None:
self.blackmatt.resize(self.size())
except AttributeError:
pass
try:
s = self.infobox.size()
self.infobox.move((self.width()-s.width())//2, (self.height()-s.height())//2)
except AttributeError:
pass
return super().resizeEvent(event)

def showWindow(self):
Expand Down
Binary file added wingetui/resources/placeholder_image_black.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/placeholder_image_white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading