This commit is contained in:
Kovid Goyal 2014-06-21 09:23:10 +05:30
parent cbc95329fc
commit bf24620e5f
2 changed files with 4 additions and 4 deletions

View File

@ -8,7 +8,7 @@ __copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
from functools import partial
from PyQt4.Qt import QTimer, QProgressDialog, Qt
from PyQt5.Qt import QTimer, QProgressDialog, Qt
from calibre import force_unicode
from calibre.gui2 import warning_dialog

View File

@ -396,13 +396,13 @@ class ToolbarSettings(QWidget):
prefs = prefs or tprefs
val = self.original_settings = {}
for i in xrange(1, self.bars.count()):
name = unicode(self.bars.itemData(i).toString())
name = unicode(self.bars.itemData(i) or '')
val[name] = copy(prefs[name])
self.current_settings = deepcopy(val)
@property
def current_name(self):
return unicode(self.bars.itemData(self.bars.currentIndex()).toString())
return unicode(self.bars.itemData(self.bars.currentIndex()) or '')
def build_lists(self):
from calibre.gui2.tweak_book.plugin import plugin_toolbar_actions
@ -482,7 +482,7 @@ class ToolbarSettings(QWidget):
s = self.current_settings[self.current_name]
except KeyError:
return
names = [unicode(i.data(Qt.UserRole).toString()) for i in self.available.selectedItems()]
names = [unicode(i.data(Qt.UserRole) or '') for i in self.available.selectedItems()]
if not names:
return
for n in names: