From 242159e17cda632247f27acfea544a68a44b40a6 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 18 Jul 2015 03:34:55 +0300 Subject: [PATCH] Added disable progress status bar --- conf/slpkg.conf | 4 ++++ slpkg/__metadata__.py | 6 ++++-- slpkg/config.py | 3 ++- slpkg/toolbar.py | 21 +++++++++++---------- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/conf/slpkg.conf b/conf/slpkg.conf index 16f9cfdd..98dd9bc4 100644 --- a/conf/slpkg.conf +++ b/conf/slpkg.conf @@ -112,3 +112,7 @@ SLACKPKG_LOG=on # NOTE: This option is not recommended at "on" because it can leave out # packages required for distribution. ONLY_INSTALLED=off + +# Enable or disable the progress bar. Status bar progress delays the search +# process in package lists. Choose "off" if you need speed. Deafult is "on". +PRG_BAR=on diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py index 97278402..0c6bd8fb 100644 --- a/slpkg/__metadata__.py +++ b/slpkg/__metadata__.py @@ -88,7 +88,7 @@ class MetaData(object): __all__ = "slpkg" __author__ = "dslackw" - __version_info__ = (2, 6, 2) + __version_info__ = (2, 6, 3) __version__ = "{0}.{1}.{2}".format(*__version_info__) __license__ = "GNU General Public License v3 (GPLv3)" __email__ = "d.zlatanidis@gmail.com" @@ -129,7 +129,8 @@ class MetaData(object): "DOWNDER": "wget", "DOWNDER_OPTIONS": "-c -N", "SLACKPKG_LOG": "on", - "ONLY_INSTALLED": "off" + "ONLY_INSTALLED": "off", + "PRG_BAR": "off" } default_repositories = ["slack", "sbo", "rlw", "alien", "slacky", "studio", @@ -170,6 +171,7 @@ class MetaData(object): downder_options = _conf_slpkg["DOWNDER_OPTIONS"] slackpkg_log = _conf_slpkg["SLACKPKG_LOG"] only_installed = _conf_slpkg["ONLY_INSTALLED"] + prg_bar = _conf_slpkg["PRG_BAR"] # Remove any gaps repositories = [repo.strip() for repo in repositories] diff --git a/slpkg/config.py b/slpkg/config.py index a8074833..0de65079 100644 --- a/slpkg/config.py +++ b/slpkg/config.py @@ -60,7 +60,8 @@ class Config(object): "DOWNDER", "DOWNDER_OPTIONS", "SLACKPKG_LOG", - "ONLY_INSTALLED" + "ONLY_INSTALLED", + "PRG_BAR" ] read_conf = Utils().read_file(self.config_file) try: diff --git a/slpkg/toolbar.py b/slpkg/toolbar.py index 775d85a6..63ba8fb0 100644 --- a/slpkg/toolbar.py +++ b/slpkg/toolbar.py @@ -31,13 +31,14 @@ from __metadata__ import MetaData as _meta_ def status(sec): """Toolbar progressive status """ - try: - syms = ["\\", "|", "/", "-"] - for sym in syms: - sys.stdout.write("\b{0}{1}{2}".format(_meta_.color["GREY"], sym, - _meta_.color["ENDC"])) - sys.stdout.flush() - time.sleep(float(sec)) - except KeyboardInterrupt: - print("") - sys.exit(0) + if _meta_.prg_bar in ["on", "ON"]: + try: + syms = ["\\", "|", "/", "-"] + for sym in syms: + sys.stdout.write("\b{0}{1}{2}".format(_meta_.color["GREY"], sym, + _meta_.color["ENDC"])) + sys.stdout.flush() + time.sleep(float(sec)) + except KeyboardInterrupt: + print("") + sys.exit(0)