Added disable progress status bar

This commit is contained in:
Dimitris Zlatanidis 2015-07-18 03:34:55 +03:00
parent ed3f5ca56c
commit 242159e17c
4 changed files with 21 additions and 13 deletions

View file

@ -112,3 +112,7 @@ SLACKPKG_LOG=on
# NOTE: This option is not recommended at "on" because it can leave out # NOTE: This option is not recommended at "on" because it can leave out
# packages required for distribution. # packages required for distribution.
ONLY_INSTALLED=off 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

View file

@ -88,7 +88,7 @@ class MetaData(object):
__all__ = "slpkg" __all__ = "slpkg"
__author__ = "dslackw" __author__ = "dslackw"
__version_info__ = (2, 6, 2) __version_info__ = (2, 6, 3)
__version__ = "{0}.{1}.{2}".format(*__version_info__) __version__ = "{0}.{1}.{2}".format(*__version_info__)
__license__ = "GNU General Public License v3 (GPLv3)" __license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com" __email__ = "d.zlatanidis@gmail.com"
@ -129,7 +129,8 @@ class MetaData(object):
"DOWNDER": "wget", "DOWNDER": "wget",
"DOWNDER_OPTIONS": "-c -N", "DOWNDER_OPTIONS": "-c -N",
"SLACKPKG_LOG": "on", "SLACKPKG_LOG": "on",
"ONLY_INSTALLED": "off" "ONLY_INSTALLED": "off",
"PRG_BAR": "off"
} }
default_repositories = ["slack", "sbo", "rlw", "alien", "slacky", "studio", default_repositories = ["slack", "sbo", "rlw", "alien", "slacky", "studio",
@ -170,6 +171,7 @@ class MetaData(object):
downder_options = _conf_slpkg["DOWNDER_OPTIONS"] downder_options = _conf_slpkg["DOWNDER_OPTIONS"]
slackpkg_log = _conf_slpkg["SLACKPKG_LOG"] slackpkg_log = _conf_slpkg["SLACKPKG_LOG"]
only_installed = _conf_slpkg["ONLY_INSTALLED"] only_installed = _conf_slpkg["ONLY_INSTALLED"]
prg_bar = _conf_slpkg["PRG_BAR"]
# Remove any gaps # Remove any gaps
repositories = [repo.strip() for repo in repositories] repositories = [repo.strip() for repo in repositories]

View file

@ -60,7 +60,8 @@ class Config(object):
"DOWNDER", "DOWNDER",
"DOWNDER_OPTIONS", "DOWNDER_OPTIONS",
"SLACKPKG_LOG", "SLACKPKG_LOG",
"ONLY_INSTALLED" "ONLY_INSTALLED",
"PRG_BAR"
] ]
read_conf = Utils().read_file(self.config_file) read_conf = Utils().read_file(self.config_file)
try: try:

View file

@ -31,13 +31,14 @@ from __metadata__ import MetaData as _meta_
def status(sec): def status(sec):
"""Toolbar progressive status """Toolbar progressive status
""" """
try: if _meta_.prg_bar in ["on", "ON"]:
syms = ["\\", "|", "/", "-"] try:
for sym in syms: syms = ["\\", "|", "/", "-"]
sys.stdout.write("\b{0}{1}{2}".format(_meta_.color["GREY"], sym, for sym in syms:
_meta_.color["ENDC"])) sys.stdout.write("\b{0}{1}{2}".format(_meta_.color["GREY"], sym,
sys.stdout.flush() _meta_.color["ENDC"]))
time.sleep(float(sec)) sys.stdout.flush()
except KeyboardInterrupt: time.sleep(float(sec))
print("") except KeyboardInterrupt:
sys.exit(0) print("")
sys.exit(0)