mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add icon to In Device column and fix a couple of minor typos
This commit is contained in:
parent
6b6dcf8c40
commit
06f6f8cbeb
@ -49,7 +49,7 @@ class Book(object):
|
|||||||
@property
|
@property
|
||||||
def db_id(self):
|
def db_id(self):
|
||||||
'''The database id in the application database that this file corresponds to'''
|
'''The database id in the application database that this file corresponds to'''
|
||||||
match = re.search(r'_(\d+)$', self.rpath.rpartition('.')[0])
|
match = re.search(r'_(\d+)$', self.path.rpartition('.')[0])
|
||||||
if match:
|
if match:
|
||||||
return int(match.group(1))
|
return int(match.group(1))
|
||||||
|
|
||||||
|
@ -778,6 +778,12 @@ class BooksModel(QAbstractTableModel):
|
|||||||
return self.bool_blank_icon
|
return self.bool_blank_icon
|
||||||
return self.bool_no_icon
|
return self.bool_no_icon
|
||||||
|
|
||||||
|
def ondevice_decorator(r, idx=-1):
|
||||||
|
text = self.db.data[r][idx]
|
||||||
|
if text:
|
||||||
|
return self.bool_yes_icon
|
||||||
|
return self.bool_blank_icon
|
||||||
|
|
||||||
def text_type(r, mult=False, idx=-1):
|
def text_type(r, mult=False, idx=-1):
|
||||||
text = self.db.data[r][idx]
|
text = self.db.data[r][idx]
|
||||||
if text and mult:
|
if text and mult:
|
||||||
@ -810,7 +816,11 @@ class BooksModel(QAbstractTableModel):
|
|||||||
'ondevice' : functools.partial(text_type,
|
'ondevice' : functools.partial(text_type,
|
||||||
idx=self.db.FIELD_MAP['ondevice'], mult=False),
|
idx=self.db.FIELD_MAP['ondevice'], mult=False),
|
||||||
}
|
}
|
||||||
self.dc_decorator = {}
|
|
||||||
|
self.dc_decorator = {
|
||||||
|
'ondevice':functools.partial(ondevice_decorator,
|
||||||
|
idx=self.db.FIELD_MAP['ondevice']),
|
||||||
|
}
|
||||||
|
|
||||||
# Add the custom columns to the data converters
|
# Add the custom columns to the data converters
|
||||||
for col in self.custom_columns:
|
for col in self.custom_columns:
|
||||||
|
@ -959,7 +959,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
self.status_bar.reset_info()
|
self.status_bar.reset_info()
|
||||||
self.location_view.setCurrentIndex(self.location_view.model().index(0))
|
self.location_view.setCurrentIndex(self.location_view.model().index(0))
|
||||||
self.eject_action.setEnabled(False)
|
self.eject_action.setEnabled(False)
|
||||||
self.refresh_ondevice_info (clear_info = True)
|
self.refresh_ondevice_info(clear_flags=True)
|
||||||
|
|
||||||
def info_read(self, job):
|
def info_read(self, job):
|
||||||
'''
|
'''
|
||||||
@ -1019,7 +1019,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
### Force the library view to refresh, taking into consideration books information
|
### Force the library view to refresh, taking into consideration books information
|
||||||
def refresh_ondevice_info(self, clear_flags = False):
|
def refresh_ondevice_info(self, clear_flags=False):
|
||||||
self.book_on_device(None, reset=True)
|
self.book_on_device(None, reset=True)
|
||||||
self.library_view.model().refresh()
|
self.library_view.model().refresh()
|
||||||
############################################################################
|
############################################################################
|
||||||
|
Loading…
x
Reference in New Issue
Block a user