From be1d6e3ec517a3c7a6e632d6b01e628a86ab02d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Climent?= Date: Thu, 19 Jan 2023 17:54:17 +0100 Subject: [PATCH] little optimizations done on the discover tab package loader --- wingetui/chocoHelpers.py | 1 - wingetui/uiSections.py | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/wingetui/chocoHelpers.py b/wingetui/chocoHelpers.py index aeb7b9f5b..5be135fc6 100644 --- a/wingetui/chocoHelpers.py +++ b/wingetui/chocoHelpers.py @@ -50,7 +50,6 @@ def searchForPackage(signal: Signal, finishSignal: Signal, noretry: bool = False p = subprocess.Popen([choco, "search", "*"] + common_params ,stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE, shell=False) output = "" counter = 0 - idSeparator = 0 while p.poll() is None: line = p.stdout.readline() line = line.strip() diff --git a/wingetui/uiSections.py b/wingetui/uiSections.py index 1a85f640b..0472c8f66 100644 --- a/wingetui/uiSections.py +++ b/wingetui/uiSections.py @@ -39,7 +39,6 @@ def __init__(self, parent = None): super().__init__(parent = parent) self.infobox = globals.infobox self.setStyleSheet("margin: 0px;") - self.packageReference: dict[str, TreeWidgetItemWithQAction] = {} self.programbox = QWidget() self.callInMain.connect(lambda f: f()) @@ -371,7 +370,7 @@ def importPackages(self): print("🟠 Invalid scoop section") for packageId in packageList: try: - item = self.packageReference[packageId.lower()] + item = self.packages[packageId] self.fastinstall(item.text(0), item.text(1), item.text(3)) except KeyError: print(f"🟠 Can't find package {packageId} in the package reference") @@ -451,9 +450,9 @@ def addItem(self, name: str, id: str, version: str, store) -> None: "name": name, "version": version, "store": store, + "item": item } self.packageList.addTopLevelItem(item) - self.packageReference[id.lower()] = item def filter(self) -> None: print(f"🟢 Searching for string \"{self.query.text()}\"") @@ -498,7 +497,6 @@ def fastinstall(self, title: str, id: str, store: str, admin: bool = False, inte self.addInstallation(PackageInstallerWidget(title, store, useId=not("…" in id), packageId=id, admin=admin, args=["--skip" if skiphash else ""], packageItem=packageItem)) def reload(self) -> None: - self.packageReference = {} self.scoopLoaded = False self.wingetLoaded = False self.chocoLoaded = False