mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Fix handling of Card A and Card B in GUI
This commit is contained in:
parent
9bfacddc96
commit
8b17b20066
@ -229,6 +229,12 @@ class LocationModel(QAbstractListModel):
|
|||||||
self.emit(SIGNAL('dataChanged(QModelIndex,QModelIndex)'),
|
self.emit(SIGNAL('dataChanged(QModelIndex,QModelIndex)'),
|
||||||
self.index(0), self.index(self.rowCount(QModelIndex())-1))
|
self.index(0), self.index(self.rowCount(QModelIndex())-1))
|
||||||
|
|
||||||
|
def location_for_row(self, row):
|
||||||
|
if row == 0: return 'library'
|
||||||
|
if row == 1: return 'main'
|
||||||
|
if row == 3: return 'cardb'
|
||||||
|
return 'carda' if self.free[1] > -1 else 'cardb'
|
||||||
|
|
||||||
class LocationView(QListView):
|
class LocationView(QListView):
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
@ -252,7 +258,7 @@ class LocationView(QListView):
|
|||||||
def current_changed(self, current, previous):
|
def current_changed(self, current, previous):
|
||||||
if current.isValid():
|
if current.isValid():
|
||||||
i = current.row()
|
i = current.row()
|
||||||
location = 'library' if i == 0 else 'main' if i == 1 else 'carda' if i == 2 else 'cardb'
|
location = self.model().location_for_row(i)
|
||||||
self.emit(SIGNAL('location_selected(PyQt_PyObject)'), location)
|
self.emit(SIGNAL('location_selected(PyQt_PyObject)'), location)
|
||||||
self.model().location_changed(i)
|
self.model().location_changed(i)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user