[engine] Remove obsolete Argument class
This commit is contained in:
parent
a8b29ed22e
commit
c2adf38b92
1 changed files with 0 additions and 69 deletions
|
@ -9,75 +9,6 @@ import bumblebee.theme
|
||||||
import bumblebee.output
|
import bumblebee.output
|
||||||
import bumblebee.modules
|
import bumblebee.modules
|
||||||
|
|
||||||
class Arguments:
|
|
||||||
def __init__(self):
|
|
||||||
parser = self.create_parser()
|
|
||||||
|
|
||||||
if len(sys.argv) == 1:
|
|
||||||
parser.print_help()
|
|
||||||
parser.exit()
|
|
||||||
|
|
||||||
self._args = parser.parse_args()
|
|
||||||
|
|
||||||
if self._args.list:
|
|
||||||
self.print_module_list()
|
|
||||||
self.print_theme_list()
|
|
||||||
parser.exit()
|
|
||||||
|
|
||||||
def args(self):
|
|
||||||
return self._args
|
|
||||||
|
|
||||||
def create_parser(self):
|
|
||||||
parser = argparse.ArgumentParser(description="display system data in the i3bar")
|
|
||||||
parser.add_argument("-m", "--modules", nargs="+",
|
|
||||||
help="List of modules to load. The order of the list determines "
|
|
||||||
"their order in the i3bar (from left to right)",
|
|
||||||
default=[])
|
|
||||||
parser.add_argument("-e", "--events", nargs="+",
|
|
||||||
help="List of click events that should be handled. Format is: "
|
|
||||||
"<module name><splitter, see -s><button ID><splitter><command to execute>",
|
|
||||||
default=[])
|
|
||||||
parser.add_argument("-l", "--list", action="store_true",
|
|
||||||
help="List all available modules and themes")
|
|
||||||
parser.add_argument("-t", "--theme", help="Specify which theme to use for "
|
|
||||||
"drawing the modules",
|
|
||||||
default="default")
|
|
||||||
parser.add_argument("-i", "--interval", help="Specify the update interval",
|
|
||||||
default=1, type=int)
|
|
||||||
parser.add_argument("-s", "--split", help="Specify string to use for "
|
|
||||||
"splitting modules and their arguments", default="::")
|
|
||||||
|
|
||||||
return parser
|
|
||||||
|
|
||||||
def print_theme_list(self):
|
|
||||||
d = bumblebee.theme.getpath()
|
|
||||||
|
|
||||||
print "available themes:"
|
|
||||||
print textwrap.fill(", ".join(
|
|
||||||
[ os.path.basename(f).replace(".json", "") for f in glob.iglob("{}/*.json".format(d)) ]
|
|
||||||
),
|
|
||||||
80, initial_indent = " ", subsequent_indent = " "
|
|
||||||
)
|
|
||||||
|
|
||||||
def print_module_list(self):
|
|
||||||
print "available modules:"
|
|
||||||
path = os.path.dirname(bumblebee.modules.__file__)
|
|
||||||
for mod in [ name for _, name, _ in pkgutil.iter_modules([path])]:
|
|
||||||
m = importlib.import_module("bumblebee.modules.{}".format(mod))
|
|
||||||
|
|
||||||
desc = "n/a" if not hasattr(m, "description") else getattr(m, "description")()
|
|
||||||
usage = "n/a" if not hasattr(m, "usage") else getattr(m, "usage")()
|
|
||||||
notes = "n/a" if not hasattr(m, "notes") else getattr(m, "notes")()
|
|
||||||
|
|
||||||
print " {}: ".format(mod)
|
|
||||||
print textwrap.fill("Description: {}".format(desc),
|
|
||||||
80, initial_indent=" ", subsequent_indent=" ")
|
|
||||||
print textwrap.fill("Usage : {}".format(usage),
|
|
||||||
80, initial_indent=" ", subsequent_indent=" ")
|
|
||||||
print textwrap.fill("Notes : {}".format(notes),
|
|
||||||
80, initial_indent=" ", subsequent_indent=" ")
|
|
||||||
print ""
|
|
||||||
|
|
||||||
class Engine:
|
class Engine:
|
||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
self._modules = []
|
self._modules = []
|
||||||
|
|
Loading…
Reference in a new issue