forked from openlp/openlp
using list of tuples
This commit is contained in:
parent
e81bd1c3fc
commit
bb571b0df5
@ -201,40 +201,37 @@ class OpenLP1SongImport(SongImport):
|
|||||||
guess = u'cp1252'
|
guess = u'cp1252'
|
||||||
|
|
||||||
# Show dialog for encoding selection
|
# Show dialog for encoding selection
|
||||||
encodings = [[u'cp874', u'cp932', u'cp936', u'cp949', u'cp950',
|
encodings = [(u'cp874', translate('SongsPlugin.OpenLP1SongImport',
|
||||||
u'cp1250', u'cp1251', u'cp1252', u'cp1253', u'cp1254',
|
'CP-874 (Thai)')),
|
||||||
u'cp1255', u'cp1256', u'cp1257', u'cp1258'],
|
(u'cp932', translate('SongsPlugin.OpenLP1SongImport',
|
||||||
[translate('SongsPlugin.OpenLP1SongImport',
|
'CP-932 (Japanese)')),
|
||||||
'CP-874 (Thai)'),
|
(u'cp936', translate('SongsPlugin.OpenLP1SongImport',
|
||||||
translate('SongsPlugin.OpenLP1SongImport',
|
'CP-936 (Simplified Chinese)')),
|
||||||
'CP-932 (Japanese)'),
|
(u'cp949', translate('SongsPlugin.OpenLP1SongImport',
|
||||||
translate('SongsPlugin.OpenLP1SongImport',
|
'CP-949 (Korean)')),
|
||||||
'CP-936 (Simplified Chinese)'),
|
(u'cp950', translate('SongsPlugin.OpenLP1SongImport',
|
||||||
translate('SongsPlugin.OpenLP1SongImport',
|
'CP-950 (Traditional Chinese)')),
|
||||||
'CP-949 (Korean)'),
|
(u'cp1250', translate('SongsPlugin.OpenLP1SongImport',
|
||||||
translate('SongsPlugin.OpenLP1SongImport',
|
'CP-1250 (Central European)')),
|
||||||
'CP-950 (Traditional Chinese)'),
|
(u'cp1251', translate('SongsPlugin.OpenLP1SongImport',
|
||||||
translate('SongsPlugin.OpenLP1SongImport',
|
'CP-1251 (Cyrillic)')),
|
||||||
'CP-1250 (Central European)'),
|
(u'cp1252', translate('SongsPlugin.OpenLP1SongImport',
|
||||||
translate('SongsPlugin.OpenLP1SongImport',
|
'CP-1252 (Western European)')),
|
||||||
'CP-1251 (Cyrillic)'),
|
(u'cp1253', translate('SongsPlugin.OpenLP1SongImport',
|
||||||
translate('SongsPlugin.OpenLP1SongImport',
|
'CP-1253 (Greek)')),
|
||||||
'CP-1252 (Western European)'),
|
(u'cp1254', translate('SongsPlugin.OpenLP1SongImport',
|
||||||
translate('SongsPlugin.OpenLP1SongImport',
|
'CP-1254 (Turkish)')),
|
||||||
'CP-1253 (Greek)'),
|
(u'cp1255', translate('SongsPlugin.OpenLP1SongImport',
|
||||||
translate('SongsPlugin.OpenLP1SongImport',
|
'CP-1255 (Hebrew)')),
|
||||||
'CP-1254 (Turkish)'),
|
(u'cp1256', translate('SongsPlugin.OpenLP1SongImport',
|
||||||
translate('SongsPlugin.OpenLP1SongImport',
|
'CP-1256 (Arabic)')),
|
||||||
'CP-1255 (Hebrew)'),
|
(u'cp1257', translate('SongsPlugin.OpenLP1SongImport',
|
||||||
translate('SongsPlugin.OpenLP1SongImport',
|
'CP-1257 (Baltic)')),
|
||||||
'CP-1256 (Arabic)'),
|
(u'cp1258', translate('SongsPlugin.OpenLP1SongImport',
|
||||||
translate('SongsPlugin.OpenLP1SongImport',
|
'CP-1258 (Vietnam)'))]
|
||||||
'CP-1257 (Baltic)'),
|
|
||||||
translate('SongsPlugin.OpenLP1SongImport',
|
|
||||||
'CP-1258 (Vietnam)')]]
|
|
||||||
encoding_index = 0
|
encoding_index = 0
|
||||||
for index in range(len(encodings[0])):
|
for index in range(len(encodings)):
|
||||||
if guess == encodings[0][index]:
|
if guess == encodings[index][0]:
|
||||||
encoding_index = index
|
encoding_index = index
|
||||||
break
|
break
|
||||||
chosen_encoding = QtGui.QInputDialog.getItem(None,
|
chosen_encoding = QtGui.QInputDialog.getItem(None,
|
||||||
@ -244,9 +241,8 @@ class OpenLP1SongImport(SongImport):
|
|||||||
'The codepage setting is responsible\n'
|
'The codepage setting is responsible\n'
|
||||||
'for the correct character representation.\n'
|
'for the correct character representation.\n'
|
||||||
'Usually you are fine with the preselected choise.'),
|
'Usually you are fine with the preselected choise.'),
|
||||||
encodings[1], encoding_index, False)
|
[pair[1] for pair in encodings], encoding_index, False)
|
||||||
if not chosen_encoding[1]:
|
if not chosen_encoding[1]:
|
||||||
return None
|
return None
|
||||||
for index in range(len(encodings[1])):
|
return filter(lambda item: item[1] == chosen_encoding[0],
|
||||||
if chosen_encoding[0] == encodings[1][index]:
|
encodings)[0][0]
|
||||||
return encodings[0][index]
|
|
||||||
|
Loading…
Reference in New Issue
Block a user