significant improvements to database (adding/removing books, categories, etc.)
[public/library.git] / form.py
diff --git a/form.py b/form.py
index 899032c..2bef3a6 100644 (file)
--- a/form.py
+++ b/form.py
@@ -14,13 +14,16 @@ class formWindow:
     labels = ["label1"]
     entries = []
 
+    commands = [('pU', 'top'),('pD', 'bottom'),('Es', 'cancel')]
+
     def clear(self):
         self.w.erase()
         self.w.refresh()
 
-    def __init__(self,window,book={}):
+    def __init__(self,window,helpbar,book={}):
         self.w = window
         self.w.resize(len(self.labels)+6,50)
+        self.hb = helpbar
         self.updateEntries(book)
         self.updateGeometry()
 
@@ -45,6 +48,8 @@ class formWindow:
                 self.entries.append("")
 
     def refresh(self):
+        self.hb.commands = self.commands
+        self.hb.refresh()
         self.updateGeometry()
         self.w.box()
         self.w.addstr(0,(self.mx-len(self.caption))/2,self.caption)
@@ -209,3 +214,11 @@ class bookForm(formWindow):
                     self.updateEntries(book)
                 self.refresh()
         formWindow.handleInput(self,ch)
+
+class categoryForm(formWindow):
+    caption = "Add a Category"
+    blabel = "Add"
+    labels = ["Category"]
+
+    def returnValues(self):
+        return self.entries