From 13385116af8e1e6ad4a49eb57380f487ec06508f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Tue, 13 Dec 2011 23:04:16 +0200 Subject: [PATCH] Using toInt of QVariant for sure is better than a chain of toString, str and int. Thanks to superfly. --- openlp/plugins/songs/forms/songimportform.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index fa24eaf83..53e70cde6 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -659,15 +659,12 @@ class SongImportForm(OpenLPWizard): self.restart() self.finishButton.setVisible(False) self.cancelButton.setVisible(True) - try: - last_import_type = int(QtCore.QSettings().value( - u'songs/last import type').toString()) - if last_import_type >= self.formatComboBox.count() or \ - last_import_type < 0: - last_import_type = 0 - self.formatComboBox.setCurrentIndex(last_import_type) - except ValueError: - self.formatComboBox.setCurrentIndex(0) + last_import_type = QtCore.QSettings().value( + u'songs/last import type').toInt()[0] + if last_import_type < 0 or \ + last_import_type >= self.formatComboBox.count(): + last_import_type = 0 + self.formatComboBox.setCurrentIndex(last_import_type) self.openLP2FilenameEdit.setText(u'') self.openLP1FilenameEdit.setText(u'') self.openLyricsFileListWidget.clear()