mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #4442 (Make input character encoding selection more user-friendly)
This commit is contained in:
parent
7e309d5d28
commit
e1bbefba83
@ -127,9 +127,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="3">
|
||||
<widget class="QLineEdit" name="opt_input_encoding"/>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="opt_remove_paragraph_spacing">
|
||||
<property name="text">
|
||||
@ -244,8 +241,22 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="3">
|
||||
<widget class="EncodingComboBox" name="opt_input_encoding">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>EncodingComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>widgets.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../../resources/images.qrc"/>
|
||||
<include location="../../../../resources/images.qrc"/>
|
||||
|
@ -616,6 +616,31 @@ class ComboBoxWithHelp(QComboBox):
|
||||
QComboBox.hidePopup(self)
|
||||
self.set_state()
|
||||
|
||||
|
||||
class EncodingComboBox(QComboBox):
|
||||
'''
|
||||
A combobox that holds text encodings support
|
||||
by Python. This is only populated with the most
|
||||
common and standard encodings. There is no good
|
||||
way to programatically list all supported encodings
|
||||
using encodings.aliases.aliases.keys(). It
|
||||
will not work.
|
||||
'''
|
||||
|
||||
ENCODINGS = ['', 'cp1252', 'latin1', 'utf-8', '', 'ascii', 'big5', 'cp1250', 'cp1251', 'cp1253',
|
||||
'cp1254', 'cp1255', 'cp1256', 'euc_jp', 'euc_kr', 'gb2312', 'gb18030',
|
||||
'hz', 'iso2022_jp', 'iso2022_kr', 'iso8859_5', 'shift_jis',
|
||||
]
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QComboBox.__init__(self, parent)
|
||||
self.setEditable(True)
|
||||
self.setLineEdit(EnLineEdit(self))
|
||||
|
||||
for item in self.ENCODINGS:
|
||||
self.addItem(item)
|
||||
|
||||
|
||||
class PythonHighlighter(QSyntaxHighlighter):
|
||||
|
||||
Rules = []
|
||||
|
Loading…
x
Reference in New Issue
Block a user