tidy up card name list

This commit is contained in:
Damien Elmes 2017-08-11 21:44:05 +10:00
parent 72fdffed8b
commit 03b0ff4565
2 changed files with 9 additions and 9 deletions

View file

@ -89,18 +89,11 @@ class CardLayout(QDialog):
self.redrawing = True self.redrawing = True
combo = self.topAreaForm.templatesBox combo = self.topAreaForm.templatesBox
combo.clear() combo.clear()
combo.addItems(self._templateNameIncludingOrdinal(t) for t in self.model['tmpls']) combo.addItems(self._summarizedName(t) for t in self.model['tmpls'])
combo.setCurrentIndex(self.ord) combo.setCurrentIndex(self.ord)
combo.setEnabled(not self._isCloze()) combo.setEnabled(not self._isCloze())
self.redrawing = False self.redrawing = False
def _templateNameIncludingOrdinal(self, tmpl):
return _("Card Type %(n)d of %(total)d: %(name)s") % dict(
n=tmpl['ord']+1,
total=len(self.model['tmpls']),
name=self._summarizedName(tmpl),
)
def _summarizedName(self, tmpl): def _summarizedName(self, tmpl):
return "{}: {} -> {}".format( return "{}: {} -> {}".format(
tmpl['name'], tmpl['name'],

View file

@ -23,8 +23,15 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing"> <property name="spacing">
<number>-1</number> <number>12</number>
</property> </property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Card Type:</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QComboBox" name="templatesBox"> <widget class="QComboBox" name="templatesBox">
<property name="sizePolicy"> <property name="sizePolicy">