From 5e8f45f7e53ddeedd9c243cdfc6eac7568f2f45c Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 11 Apr 2013 15:07:50 +0900 Subject: [PATCH] don't play audio twice when changing templates (#472) - setting current tab index triggered the function, so we don't need to call it manually - no need to set index after adding card either, as it defaults to the most recently added tab --- aqt/clayout.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/aqt/clayout.py b/aqt/clayout.py index 8ceb9385b..70b075205 100644 --- a/aqt/clayout.py +++ b/aqt/clayout.py @@ -52,7 +52,6 @@ class CardLayout(QDialog): self.redrawing = True self.updateTabs() self.redrawing = False - self.selectCard(self.ord) def setupTabs(self): c = self.connect @@ -66,7 +65,7 @@ class CardLayout(QDialog): add.setToolTip(_("Add new card")) c(add, SIGNAL("clicked()"), self.onAddCard) self.tabs.setCornerWidget(add) - c(self.tabs, SIGNAL("currentChanged(int)"), self.selectCard) + c(self.tabs, SIGNAL("currentChanged(int)"), self.onCardSelected) c(self.tabs, SIGNAL("tabCloseRequested(int)"), self.onRemoveTab) def updateTabs(self): @@ -176,6 +175,9 @@ Please create a new card type first.""")) ########################################################################## def selectCard(self, idx): + self.tabs.setCurrentIndex(idx) + + def onCardSelected(self, idx): if self.redrawing: return self.ord = idx