mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 20:54:15 +02:00
[api] improvement: SoftwareManager.get_screenshots returning a generator instead of a list
This commit is contained in:
@@ -520,11 +520,11 @@ class GenericSoftwareManager(SoftwareManager):
|
||||
self.logger.info(f'Launching {pkg}')
|
||||
man.launch(pkg)
|
||||
|
||||
def get_screenshots(self, pkg: SoftwarePackage):
|
||||
def get_screenshots(self, pkg: SoftwarePackage) -> Generator[str, None, None]:
|
||||
man = self._get_manager_for(pkg)
|
||||
|
||||
if man:
|
||||
return man.get_screenshots(pkg)
|
||||
yield from man.get_screenshots(pkg)
|
||||
|
||||
def get_working_managers(self):
|
||||
return [m for m in self.managers if self._can_work(m)]
|
||||
|
||||
@@ -1066,7 +1066,7 @@ class ShowScreenshots(AsyncAction):
|
||||
|
||||
def run(self):
|
||||
if self.pkg:
|
||||
self.notify_finished({'pkg': self.pkg, 'screenshots': self.manager.get_screenshots(self.pkg.model)})
|
||||
self.notify_finished({'pkg': self.pkg, 'screenshots': tuple(self.manager.get_screenshots(self.pkg.model))})
|
||||
|
||||
self.pkg = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user