included version in vent title
import datetime
import docker
import npyscreen
+import pkg_resources
import subprocess
class VentForm(npyscreen.FormBaseNewWithMenus):
@@ -25,11 +26,10 @@ class VentForm(npyscreen.FormBaseNewWithMenus):
self.addfield = self.add(npyscreen.TitleFixedText, name='Date:', value=str(datetime.datetime.now())+" UTC")
self.addfield2 = self.add(npyscreen.TitleFixedText, name='Uptime:', value=str(subprocess.check_output(["uptime"]))[1:])
self.addfield3 = self.add(npyscreen.TitleFixedText, name='Containers:', value=str(len(self.d_client.containers.list()))+" running")
- self.addfield4 = self.add(npyscreen.TitleFixedText, name='Version:', value="")
- self.addfield5 = self.add(npyscreen.TitleFixedText, name='Jobs:', value="")
- self.addfield6 = self.add(npyscreen.TitleFixedText, name='Status:', value="Healthy")
- self.addfield7 = self.add(npyscreen.TitleFixedText, name='Management:', value="Running")
- self.addfield8 = self.add(npyscreen.TitleFixedText, name='Clustered:', value="No")
+ self.addfield4 = self.add(npyscreen.TitleFixedText, name='Jobs:', value="")
+ self.addfield5 = self.add(npyscreen.TitleFixedText, name='Status:', value="Healthy")
+ self.addfield6 = self.add(npyscreen.TitleFixedText, name='Management:', value="Running")
+ self.addfield7 = self.add(npyscreen.TitleFixedText, name='Clustered:', value="No")
self.multifield1 = self.add(npyscreen.MultiLineEdit,
value = """
@@ -114,7 +114,8 @@ class VentApp(npyscreen.NPSAppManaged):
def onStart(self):
""" Override onStart method for npyscreen """
- self.addForm("MAIN", VentForm, name="Vent\t\t\t\t\t\t\t\tPress ^T to toggle help", color="IMPORTANT")
+ version = pkg_resources.require("vent")[0].version
+ self.addForm("MAIN", VentForm, name="Vent v"+version+"\t\t\t\t\tPress ^T to toggle help", color="IMPORTANT")
self.addForm("HELP", HelpForm, name="Help\t\t\t\t\t\t\t\tPress ^T to toggle help", color="DANGER")
def change_form(self, name):
