Fix calibredb add not refreshing book list in GUI

This commit is contained in:
Kovid Goyal 2009-01-21 19:31:21 -08:00
parent ccd7aaa5c9
commit a33aa9140a
2 changed files with 12 additions and 2 deletions

View File

@ -262,7 +262,17 @@ class BooksModel(QAbstractTableModel):
self.reset() self.reset()
self.sorted_on = (self.column_map[col], order) self.sorted_on = (self.column_map[col], order)
def refresh(self, reset=True):
try:
col = self.column_map.index(self.sorted_on[0])
except:
col = 0
self.db.refresh(field=self.column_map[col],
ascending=self.sorted_on[1]==Qt.AscendingOrder)
if reset:
self.reset()
def resort(self, reset=True): def resort(self, reset=True):
try: try:
col = self.column_map.index(self.sorted_on[0]) col = self.column_map.index(self.sorted_on[0])

View File

@ -478,7 +478,7 @@ class Main(MainWindow, Ui_MainWindow):
self.raise_() self.raise_()
self.activateWindow() self.activateWindow()
elif msg.startswith('refreshdb:'): elif msg.startswith('refreshdb:'):
self.library_view.model().resort() self.library_view.model().refresh()
self.library_view.model().research() self.library_view.model().research()
else: else:
print msg print msg