Windows clean up after themselves properly
authorJohn Ladan <jladan@uwaterloo.ca>
Tue, 20 Mar 2012 22:12:19 +0000 (18:12 -0400)
committerJohn Ladan <jladan@uwaterloo.ca>
Tue, 20 Mar 2012 22:13:20 +0000 (18:13 -0400)
bookForm.py
browser.py
librarian.py

index 8ca5c81..9671bbc 100644 (file)
@@ -21,6 +21,10 @@ class bookForm:
     def lookup(self,isbn):
         return {'isbn':isbn}
 
+    def clear(self):
+        self.w.erase()
+        self.w.refresh()
+
     def __init__(self,window,book={}):
         self.w = window
         self.w.resize(len(self.labels)+6,50)
index 541e402..a68dce4 100644 (file)
@@ -24,6 +24,7 @@ class browserWindow:
         newbook = bf.eventLoop()
         if len(newbook)!=0:
             db.updateBook(newbook,bookid)
+        bf.clear()
 
     def viewSelection(self,book):
         bookid = book['id']
@@ -33,6 +34,11 @@ class browserWindow:
         bf.blabel='done'
         bf.updateEntries(book)
         bf.eventLoop()
+        bf.clear()
+
+    def clear(self):
+        self.w.erase()
+        self.w.refresh()
 
 
     def __init__(self,window):
index a3fecff..30578bb 100755 (executable)
@@ -73,6 +73,7 @@ def addForm():
     bf.caption='Add a Book'
     bf.blabel = 'Add'
     book = bf.eventLoop()
+    bf.clear()
     if len(book)!=0:
         db.addBook(book)
 
@@ -91,6 +92,7 @@ def browseMenu():
     w=curses.newwin(10,80,20,20)
     b = browser.browserWindow(w)
     b.startBrowser()
+    b.clear()
 
 
 m = [("Browse Library", browseMenu),