[improvement][ui] not performing a full table refresh after installing a new package

This commit is contained in:
Vinicius Moreira
2020-06-11 16:51:55 -03:00
parent cc5c89a350
commit a43e640437
11 changed files with 183 additions and 70 deletions

View File

@@ -7,7 +7,7 @@ from threading import Thread
from typing import List, Set, Type, Tuple, Dict
from bauh.api.abstract.controller import SoftwareManager, SearchResult, ApplicationContext, UpgradeRequirements, \
UpgradeRequirement
UpgradeRequirement, TransactionResult
from bauh.api.abstract.disk import DiskCacheLoader
from bauh.api.abstract.handler import ProcessWatcher, TaskManager
from bauh.api.abstract.model import SoftwarePackage, PackageUpdate, PackageHistory, PackageSuggestion, \
@@ -291,18 +291,22 @@ class GenericSoftwareManager(SoftwareManager):
if man:
return man.uninstall(app, root_password, handler)
def install(self, app: SoftwarePackage, root_password: str, handler: ProcessWatcher) -> bool:
def install(self, app: SoftwarePackage, root_password: str, disk_loader: DiskCacheLoader, handler: ProcessWatcher) -> TransactionResult:
man = self._get_manager_for(app)
if man:
ti = time.time()
disk_loader = self.disk_loader_factory.new()
disk_loader.start()
try:
self.logger.info('Installing {}'.format(app))
return man.install(app, root_password, handler)
return man.install(app, root_password, disk_loader, handler)
except:
traceback.print_exc()
return False
return TransactionResult(success=False, installed=[], removed=[])
finally:
disk_loader.stop_working()
disk_loader.join()
tf = time.time()
self.logger.info('Installation of {}'.format(app) + 'took {0:.2f} minutes'.format((tf - ti)/60))