From e8a03cbd1dcfcd119ea17b5282d2cfaf3165b62e Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 18 Jan 2011 01:47:46 +0900 Subject: [PATCH] make sure we focus on currently selected template from model properties --- ankiqt/ui/clayout.py | 6 +++++- ankiqt/ui/modelproperties.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ankiqt/ui/clayout.py b/ankiqt/ui/clayout.py index 20db505c4..fe631154d 100644 --- a/ankiqt/ui/clayout.py +++ b/ankiqt/ui/clayout.py @@ -49,7 +49,7 @@ class CardLayout(QDialog): sys.platform.startswith("win32")): self.plastiqueStyle = QStyleFactory.create("plastique") if self.card: - # limited to an existing templates + # limited to an existing template self.cards = [self.deck.s.query(Card).get(id) for id in self.deck.s.column0( "select id from cards where factId = :fid " @@ -87,6 +87,10 @@ class CardLayout(QDialog): self.setupCards() self.setupFields() restoreGeom(self, "CardLayout") + # hack to ensure we're focused on the active template in the model + # properties + if type == 2 and factOrModel.currentCard.ordinal != 0: + self.form.cardList.setCurrentIndex(factOrModel.currentCard.ordinal) self.exec_() # Cards & Preview diff --git a/ankiqt/ui/modelproperties.py b/ankiqt/ui/modelproperties.py index defc0edb6..78344fbbf 100644 --- a/ankiqt/ui/modelproperties.py +++ b/ankiqt/ui/modelproperties.py @@ -63,6 +63,7 @@ class ModelProperties(QDialog): self.cardLayout) def cardLayout(self): + self.m.currentCard = self.currentCard ui.clayout.CardLayout(self, None, self.m) def renameCard(self):