make sure we focus on currently selected template from model properties

This commit is contained in:
Damien Elmes 2011-01-18 01:47:46 +09:00
parent 49f3da23a4
commit e8a03cbd1d
2 changed files with 6 additions and 1 deletions

View file

@ -49,7 +49,7 @@ class CardLayout(QDialog):
sys.platform.startswith("win32")): sys.platform.startswith("win32")):
self.plastiqueStyle = QStyleFactory.create("plastique") self.plastiqueStyle = QStyleFactory.create("plastique")
if self.card: 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.cards = [self.deck.s.query(Card).get(id) for id in
self.deck.s.column0( self.deck.s.column0(
"select id from cards where factId = :fid " "select id from cards where factId = :fid "
@ -87,6 +87,10 @@ class CardLayout(QDialog):
self.setupCards() self.setupCards()
self.setupFields() self.setupFields()
restoreGeom(self, "CardLayout") 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_() self.exec_()
# Cards & Preview # Cards & Preview

View file

@ -63,6 +63,7 @@ class ModelProperties(QDialog):
self.cardLayout) self.cardLayout)
def cardLayout(self): def cardLayout(self):
self.m.currentCard = self.currentCard
ui.clayout.CardLayout(self, None, self.m) ui.clayout.CardLayout(self, None, self.m)
def renameCard(self): def renameCard(self):