use radio buttons to select q/a as other operating systems give focus to button

This commit is contained in:
Damien Elmes 2012-10-28 02:29:22 +09:00
parent 10e303dc33
commit ce2a20bd43
2 changed files with 32 additions and 5 deletions

View file

@ -374,9 +374,6 @@ Enter deck to place new %s cards in, or leave blank:""") %
t['did'] = self.col.decks.id(te.text())
def onAddField(self):
obj = self.mw.app.focusWidget()
if obj not in (self.tab['tform'].front, self.tab['tform'].back):
return showInfo(_("Please click in the front or back template first."))
diag = QDialog(self)
form = aqt.forms.addfield.Ui_Dialog()
form.setupUi(diag)
@ -388,6 +385,10 @@ Enter deck to place new %s cards in, or leave blank:""") %
form.fields.showPopup()
if not diag.exec_():
return
if form.radioQ.isChecked():
obj = self.tab['tform'].front
else:
obj = self.tab['tform'].back
self._addField(obj,
fields[form.fields.currentIndex()],
form.font.currentFont().family(),

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>434</width>
<height>122</height>
<height>186</height>
</rect>
</property>
<property name="windowTitle">
@ -16,6 +16,16 @@
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="1">
<widget class="QRadioButton" name="radioQ">
<property name="text">
<string>Front</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="size">
<property name="minimum">
@ -53,7 +63,7 @@
<item row="0" column="1">
<widget class="QComboBox" name="fields"/>
</item>
<item row="3" column="1">
<item row="5" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -66,6 +76,20 @@
</property>
</spacer>
</item>
<item row="4" column="1">
<widget class="QRadioButton" name="radioA">
<property name="text">
<string>Back</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Add to:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -84,6 +108,8 @@
<tabstop>fields</tabstop>
<tabstop>font</tabstop>
<tabstop>size</tabstop>
<tabstop>radioQ</tabstop>
<tabstop>radioA</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>