From fd67eccb886435ca3a3c4a1347bbaa5ca44022bf Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 22 May 2013 14:13:59 +0530 Subject: [PATCH] Fix switch library dialog and menu popping up when clicking the library button in some WMs --- src/calibre/gui2/actions/choose_library.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/actions/choose_library.py b/src/calibre/gui2/actions/choose_library.py index db2623d73e..f1b68de0d7 100644 --- a/src/calibre/gui2/actions/choose_library.py +++ b/src/calibre/gui2/actions/choose_library.py @@ -161,13 +161,15 @@ class ChooseLibraryAction(InterfaceAction): def genesis(self): self.base_text = _('%d books') self.count_changed(0) - self.qaction.triggered.connect(self.choose_library, - type=Qt.QueuedConnection) self.action_choose = self.menuless_qaction self.stats = LibraryUsageStats() self.popup_type = (QToolButton.InstantPopup if len(self.stats.stats) > 1 else QToolButton.MenuButtonPopup) + if len(self.stats.stats) > 1: + self.action_choose.triggered.connect(self.choose_library) + else: + self.qaction.triggered.connect(self.choose_library) self.choose_menu = self.qaction.menu()