Browse Source

get rid of thread_id and useless logic it used

master
Von Random 6 years ago
parent
commit
0495bc2d79
  1. 2
      plugins/batt.py
  2. 2
      plugins/date.py
  3. 2
      plugins/disk.py
  4. 2
      plugins/load.py
  5. 2
      plugins/mem.py
  6. 2
      plugins/ping.py
  7. 4
      vdstatus

2
plugins/batt.py

@ -5,7 +5,7 @@ BATTERY_DIR = '/sys/class/power_supply/BAT0/'
class PluginThread(plugins.common.PluginThreadCommon):
def __init__(self, section, config, thread_id):
def __init__(self, section, config):
super(PluginThread, self).__init__(section, config)
def main(self):

2
plugins/date.py

@ -3,7 +3,7 @@ import plugins.common
class PluginThread(plugins.common.PluginThreadCommon):
def __init__(self, section, config, thread_id):
def __init__(self, section, config):
super(PluginThread, self).__init__(section, config)
self.date_format = config.get(section, 'format', fallback='%c')

2
plugins/disk.py

@ -3,7 +3,7 @@ import psutil
class PluginThread(plugins.common.PluginThreadCommon):
def __init__(self, section, config, thread_id):
def __init__(self, section, config):
super(PluginThread, self).__init__(section, config)
self.part = config.get(section, 'part')

2
plugins/load.py

@ -3,7 +3,7 @@ import plugins.common
class PluginThread(plugins.common.PluginThreadCommon):
def __init__(self, section, config, thread_id):
def __init__(self, section, config):
super(PluginThread, self).__init__(section, config)
self.hide_ok = config.getboolean(section, 'hide_ok', fallback=False)

2
plugins/mem.py

@ -3,7 +3,7 @@ import plugins.common
class PluginThread(plugins.common.PluginThreadCommon):
def __init__(self, section, config, thread_id):
def __init__(self, section, config):
super(PluginThread, self).__init__(section, config)
def main(self):

2
plugins/ping.py

@ -4,7 +4,7 @@ import plugins.common
class PluginThread(plugins.common.PluginThreadCommon):
def __init__(self, section, config, thread_id):
def __init__(self, section, config):
super(PluginThread, self).__init__(section, config)
self.hosts = config.get(section, 'hosts').split(',')
self.title = config.get(section, 'title')

4
vdstatus

@ -1,7 +1,6 @@
#!/usr/bin/python3
# TODO: handle SIGINT properly
# TODO: add documentation / comments
# TODO: add a dummy plugin to use as a starting point
# TODO: interactivity support
import argparse
import configparser
@ -36,9 +35,8 @@ class PluginRunner:
self.format_output = self.format_term
for section in self.config.sections():
plugin_name = self.config.get(section, 'plugin')
plugin_id = len(self.plugins_loaded)
module = importlib.import_module('.' + plugin_name, 'plugins')
thread_object = module.PluginThread(section, self.config, plugin_id)
thread_object = module.PluginThread(section, self.config)
self.plugins_loaded.append(thread_object)
def start(self):

Loading…
Cancel
Save