Skip to content

Commit

Permalink
Fix duplicate packages on the discover software section (fix #1373, fix
Browse files Browse the repository at this point in the history
  • Loading branch information
marticliment committed Dec 12, 2023
1 parent f8f948d commit 3346bfd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions wingetui/Interface/SoftwareSections.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def isLoadingDynamicPackages(self) -> bool:

def addItem(self, package: Package) -> None:
if "---" not in package.Name and package.Name not in ("+", "Scoop", "At", "The", "But", "Au") and version not in ("the", "is"):

item = PackageItem(package)

self.PackageItemReference[package] = item
Expand Down Expand Up @@ -489,9 +489,11 @@ def loadDynamicPackages(self, query: str, manager: PackageManagerModule) -> None
self.runningThreads += 1
packages = manager.getPackagesForQuery(query)
for package in packages:
if package.Id not in self.IdPackageReference:
self.addProgram.emit(package)
elif package.Source != self.IdPackageReference[package.Id].Source:
if package.Id in self.IdPackageReference and package.Source == self.IdPackageReference[package.Id].Source and package.Version == self.IdPackageReference[package.Id].Version:
print(f"🟡 Not showing found result {package} because it is already present")
elif query != self.query.text():
print(f"🟡 Not showing found result {package} because the query changed") # thanks copilot :)
else:
self.addProgram.emit(package)
self.DynamicPackagesLoaded[manager] = True
self.runningThreads -= 1
Expand Down

0 comments on commit 3346bfd

Please sign in to comment.