started on category browser
This commit is contained in:
parent
a5a146df68
commit
2e3bf86930
23
browser.py
23
browser.py
|
@ -7,10 +7,7 @@ class browserWindow:
|
||||||
entries = []
|
entries = []
|
||||||
topline = 0
|
topline = 0
|
||||||
# column definitions are in (label, weight, specified width) triples
|
# column definitions are in (label, weight, specified width) triples
|
||||||
columnDefs = [('ID',0,3),
|
columnDefs = [('something',1,None)]
|
||||||
('ISBN',0,13),
|
|
||||||
('Authors',30,None),
|
|
||||||
('Title',60,None)]
|
|
||||||
mx = my = 0
|
mx = my = 0
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +18,6 @@ class browserWindow:
|
||||||
def __init__(self,window):
|
def __init__(self,window):
|
||||||
self.w = window
|
self.w = window
|
||||||
self.updateGeometry()
|
self.updateGeometry()
|
||||||
self.refreshBooks()
|
|
||||||
|
|
||||||
def sortByColumn(self, col):
|
def sortByColumn(self, col):
|
||||||
self.entries.sort() # key=dict.get(col))
|
self.entries.sort() # key=dict.get(col))
|
||||||
|
@ -127,6 +123,10 @@ class browserWindow:
|
||||||
|
|
||||||
|
|
||||||
class bookBrowser(browserWindow):
|
class bookBrowser(browserWindow):
|
||||||
|
columnDefs = [('ID',0,3),
|
||||||
|
('ISBN',0,13),
|
||||||
|
('Authors',30,None),
|
||||||
|
('Title',60,None)]
|
||||||
# redefinable functions
|
# redefinable functions
|
||||||
def updateSelection(self,book):
|
def updateSelection(self,book):
|
||||||
bookid = book['id']
|
bookid = book['id']
|
||||||
|
@ -166,3 +166,16 @@ class bookBrowser(browserWindow):
|
||||||
self.viewSelection(book)
|
self.viewSelection(book)
|
||||||
self.refresh()
|
self.refresh()
|
||||||
|
|
||||||
|
def categoryBrowser():
|
||||||
|
columnDefs = [('ID',0,3),
|
||||||
|
('Category',100,None)]
|
||||||
|
|
||||||
|
def refreshCategories(self):
|
||||||
|
self.entries = []
|
||||||
|
cats = db.getCategories()
|
||||||
|
for c in cats:
|
||||||
|
self.entries.append({'category':c})
|
||||||
|
|
||||||
|
def handleInput(self,ch):
|
||||||
|
browserWindow.handleInput(self,ch)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue