tweak tab order

This commit is contained in:
Damien Elmes 2011-04-18 07:47:03 +09:00
parent 0c38354dae
commit c7fb1146da
2 changed files with 17 additions and 9 deletions

View file

@ -815,18 +815,20 @@ where id in %s""" % ids2str(sf))
frm.groupBox.layout().insertWidget(0, te) frm.groupBox.layout().insertWidget(0, te)
te.setDeck(self.deck) te.setDeck(self.deck)
d.connect(d, SIGNAL("accepted()"), lambda: self.onSetGroup(frm, te)) d.connect(d, SIGNAL("accepted()"), lambda: self.onSetGroup(frm, te))
self.setTabOrder(frm.setCur, te)
self.setTabOrder(te, frm.setInitial)
d.show() d.show()
te.setFocus() te.setFocus()
def onSetGroup(self, frm, te): def onSetGroup(self, frm, te):
self.model.beginReset() self.model.beginReset()
self.mw.checkpoint(_("Set Group")) self.mw.checkpoint(_("Set Group"))
if frm.selGroup.isChecked(): if frm.setCur.isChecked():
gid = self.deck.groupId(unicode(te.text())) gid = self.deck.groupId(unicode(te.text()))
self.deck.db.execute( self.deck.db.execute(
"update cards set gid = ? where id in " + ids2str( "update cards set gid = ? where id in " + ids2str(
self.selectedCards()), gid) self.selectedCards()), gid)
if frm.moveFacts.isChecked(): if frm.setInitial.isChecked():
self.deck.db.execute( self.deck.db.execute(
"update facts set gid = ? where id in " + ids2str( "update facts set gid = ? where id in " + ids2str(
self.selectedFacts()), gid) self.selectedFacts()), gid)

View file

@ -15,9 +15,9 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QRadioButton" name="selGroup"> <widget class="QRadioButton" name="setCur">
<property name="text"> <property name="text">
<string>Move cards to chosen group:</string> <string>Set current group to:</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>true</bool>
@ -31,9 +31,9 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QCheckBox" name="moveFacts"> <widget class="QCheckBox" name="setInitial">
<property name="text"> <property name="text">
<string>Move facts too</string> <string>Set initial group too</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -41,9 +41,9 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QRadioButton" name="factGroup"> <widget class="QRadioButton" name="reset">
<property name="text"> <property name="text">
<string>Move cards to their fact's group</string> <string>Reset to initial group</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -59,6 +59,12 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>setCur</tabstop>
<tabstop>setInitial</tabstop>
<tabstop>reset</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/> <resources/>
<connections> <connections>
<connection> <connection>
@ -94,7 +100,7 @@
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>selGroup</sender> <sender>setCur</sender>
<signal>toggled(bool)</signal> <signal>toggled(bool)</signal>
<receiver>groupBox</receiver> <receiver>groupBox</receiver>
<slot>setEnabled(bool)</slot> <slot>setEnabled(bool)</slot>