improved the category browser
authorJohn Ladan <jladan@uwaterloo.ca>
Sat, 24 Mar 2012 16:25:14 +0000 (12:25 -0400)
committerJohn Ladan <jladan@uwaterloo.ca>
Sat, 24 Mar 2012 16:25:14 +0000 (12:25 -0400)
browser.py
librarian.py

index 7eaa80d..e29f877 100644 (file)
@@ -54,7 +54,7 @@ class browserWindow:
     def displayHeader(self):
         cursor = 0
         for header,width in self.columns:
-            self.w.addnstr(0,cursor,header,width)
+            self.w.addnstr(0,cursor,header+" "*width,width)
             self.w.addstr(1,cursor,"-"*width)
             cursor += width+1
 
@@ -167,8 +167,7 @@ class bookBrowser(browserWindow):
             self.refresh()
 
 class categoryBrowser(browserWindow):
-    columnDefs = [('ID',0,3),
-                  ('Category',100,None)]
+    columnDefs = [('Category',100,None)]
 
 
     def refreshCategories(self):
index f72de11..8806205 100755 (executable)
@@ -117,12 +117,13 @@ def browseMenu():
 def catMenu():
     (my,mx)=stdscr.getmaxyx()
     w=curses.newwin(10,40,(my-10)/2,(mx-40)/2)
-    b = browser.categoryBrowser(w)
-    b.refreshCategories()
+    c = browser.categoryBrowser(w)
+    c.refreshCategories()
+    c.sortByColumn('category')
     hb.commands=browser_commands
     hb.refresh()
-    b.eventLoop()
-    b.clear()
+    c.eventLoop()
+    c.clear()
 
 
 m = [("Browse Library", browseMenu),