viewing book (without changing original) from browser
authorJohn Ladan <jladan@uwaterloo.ca>
Tue, 20 Mar 2012 20:53:12 +0000 (16:53 -0400)
committerJohn Ladan <jladan@uwaterloo.ca>
Tue, 20 Mar 2012 20:53:12 +0000 (16:53 -0400)
browser.py
librarian.py

index e76c129..541e402 100644 (file)
@@ -25,6 +25,15 @@ class browserWindow:
         if len(newbook)!=0:
             db.updateBook(newbook,bookid)
 
+    def viewSelection(self,book):
+        bookid = book['id']
+        w=curses.newwin(1,1,20,20)
+        bf = bookForm(w)
+        bf.caption='Viewing Book '+str(bookid)
+        bf.blabel='done'
+        bf.updateEntries(book)
+        bf.eventLoop()
+
 
     def __init__(self,window):
         self.w = window
@@ -119,6 +128,12 @@ class browserWindow:
                 self.books[self.hl]=db.getBookByID(book['id'])
                 self.refresh()
 
+            elif ch == 10:
+                book = self.books[self.hl]
+                self.viewSelection(book)
+                self.refresh()
+                
+
             self.w.refresh()
             ch = self.w.getch()
 
index 9dfcaae..a3fecff 100755 (executable)
@@ -67,13 +67,11 @@ def redrawMenu(w,items,highlight):
 
 
 def addForm():
-    book = {"title":"A Book of Tests", "pages":"123"}
     w=curses.newwin(1,1,20,20)
     bf = bookForm.bookForm(w)
     bf.lookup=bookData.openLibrary
     bf.caption='Add a Book'
     bf.blabel = 'Add'
-    bf.updateEntries(book)
     book = bf.eventLoop()
     if len(book)!=0:
         db.addBook(book)