diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index c2ebde21..83e24c46 100644 --- a/slpkg/slackbuild.py +++ b/slpkg/slackbuild.py @@ -5,6 +5,7 @@ import os import subprocess import multiprocessing +from dialog import Dialog from collections import OrderedDict from slpkg.downloader import Wget @@ -13,6 +14,7 @@ from slpkg.configs import Configs from slpkg.queries import SBoQueries from slpkg.utilities import Utilities from slpkg.dependencies import Requires +from slpkg.views.version import Version from slpkg.views.views import ViewMessage from slpkg.models.models import LogsDependencies from slpkg.models.models import session as Session @@ -28,6 +30,8 @@ class Slackbuilds: self.session = Session self.utils = Utilities() self.configs = Configs + self.d = Dialog(dialog="dialog") + self.d.set_background_title(f'{self.configs.prog_name} {Version().version}') self.install_order = [] self.dependencies = [] self.sbos = {} @@ -66,9 +70,27 @@ class Slackbuilds: self.dependencies.append(dep) # Remove duplicate packages and keeps the order. - self.dependencies = list(OrderedDict.fromkeys(self.dependencies)) + dependencies = list(OrderedDict.fromkeys(self.dependencies)) + + if dependencies: + self.dependencies = self.dialog_checklist(dependencies) + self.install_order.extend(self.dependencies) + def dialog_checklist(self, dependencies): + """ Choose packages for upgrade. """ + choices = [] + + for package in dependencies: + repo_ver = SBoQueries(package).version() + choices += [(package, repo_ver, True)] + + code, tags = self.d.checklist(f'There are {len(choices)} dependencies:', + title='Choose dependencies you want to remove', + height=10, width=70, list_height=0, choices=choices) + os.system('clear') + return tags + def creating_main_for_build(self): """ List with the main slackbuilds. """ [self.install_order.append(main) for main in self.sbos.keys()]