diff --git a/src/calibre/gui2/actions/choose_library.py b/src/calibre/gui2/actions/choose_library.py index fedf4742d4..caa47ddf01 100644 --- a/src/calibre/gui2/actions/choose_library.py +++ b/src/calibre/gui2/actions/choose_library.py @@ -303,7 +303,7 @@ class ChooseLibraryAction(InterfaceAction): if len(lname) > 16: lname = lname[:16] + u'…' a = self.qaction - a.setText(lname) + a.setText(lname.replace('&', '&&&')) # I have no idea why this requires a triple ampersand self.update_tooltip(db.count()) self.build_menus() state = self.view_state_map.get(self.stats.canonicalize_path( @@ -331,6 +331,7 @@ class ChooseLibraryAction(InterfaceAction): self.delete_menu.clear() quick_actions, rename_actions, delete_actions = [], [], [] for name, loc in locations: + name = name.replace('&', '&&') ac = self.quick_menu.addAction(name, Dispatcher(partial(self.switch_requested, loc))) ac.setStatusTip(_('Switch to: %s') % loc) @@ -347,6 +348,7 @@ class ChooseLibraryAction(InterfaceAction): qs_actions = [] for i, x in enumerate(locations[:len(self.switch_actions)]): name, loc = x + name = name.replace('&', '&&') ac = self.switch_actions[i] ac.setText(name) ac.setStatusTip(_('Switch to: %s') % loc) @@ -371,12 +373,13 @@ class ChooseLibraryAction(InterfaceAction): LibraryDatabase = db_class() loc = location.replace('/', os.sep) base = os.path.dirname(loc) - newname, ok = QInputDialog.getText(self.gui, _('Rename') + ' ' + name, + old_name = name.replace('&&', '&') + newname, ok = QInputDialog.getText(self.gui, _('Rename') + ' ' + old_name, '
'+_('Choose a new name for the library %s. ')%name + '
'+_('Note that the actual library folder will be renamed.'), - text=name) + text=old_name) newname = sanitize_file_name_unicode(unicode(newname)) - if not ok or not newname or newname == name: + if not ok or not newname or newname == old_name: return newloc = os.path.join(base, newname) if os.path.exists(newloc): diff --git a/src/calibre/gui2/actions/copy_to_library.py b/src/calibre/gui2/actions/copy_to_library.py index 305f5848d6..c9b01193e5 100644 --- a/src/calibre/gui2/actions/copy_to_library.py +++ b/src/calibre/gui2/actions/copy_to_library.py @@ -351,6 +351,7 @@ class CopyToLibraryAction(InterfaceAction): self.menu.addAction(_('Choose library by path...'), self.choose_library) self.menu.addSeparator() for name, loc in locations: + name = name.replace('&', '&&') self.menu.addAction(name, partial(self.copy_to_library, loc)) self.menu.addAction(name + ' ' + _('(delete after copy)'),