mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-13 20:01:48 +01:00
Updated for progress message
This commit is contained in:
parent
53d5b22183
commit
eb798b20f3
3 changed files with 10 additions and 4 deletions
|
@ -4,6 +4,7 @@
|
|||
import subprocess
|
||||
from multiprocessing import Process
|
||||
|
||||
from slpkg.views.asciibox import AsciiBox
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.progress_bar import ProgressBar
|
||||
|
@ -16,6 +17,7 @@ class MultiProcess(Configs):
|
|||
|
||||
self.utils = Utilities()
|
||||
self.progress = ProgressBar()
|
||||
self.ascii = AsciiBox()
|
||||
|
||||
self.stderr = None
|
||||
self.stdout = None
|
||||
|
@ -26,13 +28,15 @@ class MultiProcess(Configs):
|
|||
def process(self, command: str, filename: str, process_message: str, progress_message: str) -> None:
|
||||
""" Starting multiprocessing install/upgrade process. """
|
||||
if self.silent_mode and not self.option_for_no_silent:
|
||||
done: str = f"{'':>1}{self.byellow}Done{self.endc}"
|
||||
done: str = f"{'':>1}{self.yellow}Done{self.endc}"
|
||||
self.stderr = subprocess.DEVNULL
|
||||
self.stdout = subprocess.DEVNULL
|
||||
|
||||
# Starting multiprocessing
|
||||
p1 = Process(target=self.utils.process, args=(command, self.stderr, self.stdout))
|
||||
p2 = Process(target=self.progress.progress_bar, args=(f'- {progress_message}:', filename))
|
||||
p2 = Process(target=self.progress.progress_bar, args=(
|
||||
f"{'':>2}{self.bold}{self.ascii.bullet} {progress_message}:", filename)
|
||||
)
|
||||
|
||||
p1.start()
|
||||
p2.start()
|
||||
|
|
|
@ -88,7 +88,7 @@ class RemovePackages(Configs):
|
|||
command: str = f'{self.removepkg} {package}'
|
||||
name: str = self.utils.split_package(package)['name']
|
||||
process_message: str = f"package '{name}' to remove"
|
||||
progress_message: str = f'{self.bold}{self.red}Remove{self.endc}'
|
||||
progress_message: str = f'{self.bold}{self.red}Removing{self.endc}'
|
||||
|
||||
dependencies: list = self.is_dependency(name)
|
||||
if dependencies:
|
||||
|
@ -117,7 +117,7 @@ class RemovePackages(Configs):
|
|||
print()
|
||||
|
||||
def view_warning_message(self, dependencies: list, name: str) -> None:
|
||||
print(f"\n{self.bold}{self.violet}WARNING!{self.endc}: The package '{self.red}{name}{self.endc}' "
|
||||
print(f"\n{'':>4}{self.bold}{self.violet}WARNING!{self.endc}: The package '{self.red}{name}{self.endc}' "
|
||||
f"is a dependency for the packages:")
|
||||
for dependency in dependencies:
|
||||
print(f"{self.cyan:>16}-> {dependency}{self.endc}")
|
||||
|
|
|
@ -19,6 +19,7 @@ class AsciiBox(Configs):
|
|||
if self.package_alignment < 1:
|
||||
self.package_alignment = 1
|
||||
|
||||
self.bullet: str = '-'
|
||||
self.vertical_line: str = '|'
|
||||
self.horizontal_line: str = '='
|
||||
self.horizontal_vertical: str = '+'
|
||||
|
@ -32,6 +33,7 @@ class AsciiBox(Configs):
|
|||
self.vertical_and_left: str = '+'
|
||||
|
||||
if self.ascii_characters:
|
||||
self.bullet: str = '•'
|
||||
self.vertical_line: str = '│'
|
||||
self.horizontal_line: str = '─'
|
||||
self.horizontal_vertical: str = '┼'
|
||||
|
|
Loading…
Reference in a new issue