From 60b290caed4f9041402da9d8aad2bf6f7ed5c251 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 4 Jan 2010 19:28:12 -0700 Subject: [PATCH] Fix bug when trying to set keyboard shortcuts for the viewer with a translated calibre interface. Also possible workarounf for cover flow related crash on OS X --- src/calibre/gui2/cover_flow.py | 8 +++++++- src/calibre/gui2/shortcuts.py | 6 +++--- src/calibre/gui2/ui.py | 3 --- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/calibre/gui2/cover_flow.py b/src/calibre/gui2/cover_flow.py index 0e326ba239..81d67ff7dd 100644 --- a/src/calibre/gui2/cover_flow.py +++ b/src/calibre/gui2/cover_flow.py @@ -57,7 +57,13 @@ if pictureflow is not None: return self.model.count() def caption(self, index): - return self.model.title(index) + try: + ans = self.model.title(index) + if not ans: + ans = '' + except: + ans = '' + return ans def reset(self): self.emit(SIGNAL('dataChanged()')) diff --git a/src/calibre/gui2/shortcuts.py b/src/calibre/gui2/shortcuts.py index a617b6897f..5c4ebcc2fe 100644 --- a/src/calibre/gui2/shortcuts.py +++ b/src/calibre/gui2/shortcuts.py @@ -152,9 +152,9 @@ class Delegate(QStyledItemDelegate): class Shortcuts(QAbstractListModel): - TEMPLATE = ''' + TEMPLATE = u'''

{0}
- Keys: {1}

+ {2}: {1}

''' def __init__(self, shortcuts, config_file_base_name, parent=None): @@ -212,7 +212,7 @@ class Shortcuts(QAbstractListModel): key = self.order[row] if role == Qt.DisplayRole: return QVariant(self.TEMPLATE.format(self.descriptions[key], - _(' or ').join(self.get_shortcuts(key)))) + _(' or ').join(self.get_shortcuts(key)), _('Keys'))) if role == Qt.ToolTipRole: return QVariant(_('Double click to change')) if role == DEFAULTS: diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index 49f4476188..4d40dccfcd 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -533,8 +533,6 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI): if not config['separate_cover_flow']: self.library.layout().addWidget(self.cover_flow) self.cover_flow.currentChanged.connect(self.sync_listview_to_cf) - #self.connect(self.cover_flow, SIGNAL('itemActivated(int)'), - # self.show_book_info) self.connect(self.status_bar.cover_flow_button, SIGNAL('toggled(bool)'), self.toggle_cover_flow) self.connect(self.cover_flow, SIGNAL('stop()'), @@ -758,7 +756,6 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI): sm.select(index, sm.ClearAndSelect|sm.Rows) self.library_view.setCurrentIndex(index) except: - #raise pass