Skip to content

Commit

Permalink
little optimizations done on the discover tab package loader
Browse files Browse the repository at this point in the history
  • Loading branch information
marticliment committed Jan 19, 2023
1 parent d73360a commit be1d6e3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
1 change: 0 additions & 1 deletion wingetui/chocoHelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 2 additions & 4 deletions wingetui/uiSections.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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()}\"")
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit be1d6e3

Please sign in to comment.