phrase verse index decoding more pythonish

This commit is contained in:
M2j 2010-06-10 11:05:56 +02:00
parent 83968d8194
commit 0229b362af
2 changed files with 4 additions and 5 deletions

View File

@ -74,8 +74,6 @@ class VerseType(object):
elif verse_type == \
unicode(VerseType.to_string(VerseType.Other)).lower():
return VerseType.Other
else:
return -1
from authorsform import AuthorsForm
from topicsform import TopicsForm

View File

@ -104,7 +104,7 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
verse_type = match.group(1)
verse_number = int(match.group(2))
verse_type_index = VerseType.from_string(verse_type)
if verse_type_index >= 0:
if not isinstance(verse_type_index, NoneType):
self.VerseTypeComboBox.setCurrentIndex(verse_type_index)
self.VerseNumberBox.setValue(verse_number)
@ -112,8 +112,9 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
tag=u'%s:1' % VerseType.to_string(VerseType.Verse)):
if single:
verse_type, verse_number = tag.split(u':')
self.VerseTypeComboBox.setCurrentIndex(
VerseType.from_string(verse_type))
verse_type_index = VerseType.from_string(verse_type)
if not isinstance(verse_type_index, NoneType):
self.VerseTypeComboBox.setCurrentIndex(verse_type_index)
self.VerseNumberBox.setValue(int(verse_number))
self.InsertButton.setVisible(False)
else: