UI/SymbolsWidget.py

branch
Py2 comp.
changeset 2677
3d4277929fb3
parent 2600
a3feb717c3f0
parent 2605
20036ebbf50a
child 3057
10516539f238
equal deleted inserted replaced
2670:e60ea6cb8e11 2677:3d4277929fb3
7 Module implementing a widget to select a symbol in various formats. 7 Module implementing a widget to select a symbol in various formats.
8 """ 8 """
9 9
10 from __future__ import unicode_literals # __IGNORE_WARNING__ 10 from __future__ import unicode_literals # __IGNORE_WARNING__
11 11
12 import sys
12 import unicodedata 13 import unicodedata
13 try: # Py3 14 try: # Py3
14 import html.entities as html_entities 15 import html.entities as html_entities
15 except (ImportError): 16 except (ImportError):
16 chr = unichr 17 chr = unichr
45 self.trUtf8("Hex"), 46 self.trUtf8("Hex"),
46 self.trUtf8("HTML"), 47 self.trUtf8("HTML"),
47 self.trUtf8("Name"), 48 self.trUtf8("Name"),
48 ] 49 ]
49 50
50 self.__tables = ( 51 self.__tables = [
51 # first last display name 52 # first last display name
52 (0x0, 0x1f, self.trUtf8("Control Characters")), 53 (0x0, 0x1f, self.trUtf8("Control Characters")),
53 (0x20, 0x7f, self.trUtf8("Basic Latin")), 54 (0x20, 0x7f, self.trUtf8("Basic Latin")),
54 (0x80, 0x100, self.trUtf8("Latin-1 Supplement")), 55 (0x80, 0xff, self.trUtf8("Latin-1 Supplement")),
55 (0x100, 0x180, self.trUtf8("Latin Extended A")), 56 (0x100, 0x17f, self.trUtf8("Latin Extended-A")),
56 (0x180, 0x24f, self.trUtf8("Latin Extended B")), 57 (0x180, 0x24f, self.trUtf8("Latin Extended-B")),
57 (0x250, 0x2af, self.trUtf8("IPA Extensions")), 58 (0x250, 0x2af, self.trUtf8("IPA Extensions")),
58 (0x2b0, 0x2ff, self.trUtf8("Spacing Modifier Letters")), 59 (0x2b0, 0x2ff, self.trUtf8("Spacing Modifier Letters")),
59 (0x300, 0x36f, self.trUtf8("Combining Diacritical Marks")), 60 (0x300, 0x36f, self.trUtf8("Combining Diacritical Marks")),
60 (0x370, 0x3ff, self.trUtf8("Greek and Coptic")), 61 (0x370, 0x3ff, self.trUtf8("Greek and Coptic")),
61 (0x400, 0x4ff, self.trUtf8("Cyrillic")), 62 (0x400, 0x4ff, self.trUtf8("Cyrillic")),
63 (0x530, 0x58f, self.trUtf8("Armenian")), 64 (0x530, 0x58f, self.trUtf8("Armenian")),
64 (0x590, 0x5ff, self.trUtf8("Hebrew")), 65 (0x590, 0x5ff, self.trUtf8("Hebrew")),
65 (0x600, 0x6ff, self.trUtf8("Arabic")), 66 (0x600, 0x6ff, self.trUtf8("Arabic")),
66 (0x700, 0x74f, self.trUtf8("Syriac")), 67 (0x700, 0x74f, self.trUtf8("Syriac")),
67 (0x780, 0x7bf, self.trUtf8("Thaana")), 68 (0x780, 0x7bf, self.trUtf8("Thaana")),
69 (0x7c0, 0x7ff, self.trUtf8("N'Ko")),
70 (0x800, 0x83f, self.trUtf8("Samaritan")),
71 (0x840, 0x85f, self.trUtf8("Mandaic")),
72 (0x8a0, 0x8ff, self.trUtf8("Arabic Extended-A")),
68 (0x900, 0x97f, self.trUtf8("Devanagari")), 73 (0x900, 0x97f, self.trUtf8("Devanagari")),
69 (0x980, 0x9ff, self.trUtf8("Bengali")), 74 (0x980, 0x9ff, self.trUtf8("Bengali")),
70 (0xa00, 0xa7f, self.trUtf8("Gurmukhi")), 75 (0xa00, 0xa7f, self.trUtf8("Gurmukhi")),
71 (0xa80, 0xaff, self.trUtf8("Gujarati")), 76 (0xa80, 0xaff, self.trUtf8("Gujarati")),
72 (0xb00, 0xb7f, self.trUtf8("Oriya")), 77 (0xb00, 0xb7f, self.trUtf8("Oriya")),
80 (0xf00, 0xfff, self.trUtf8("Tibetan")), 85 (0xf00, 0xfff, self.trUtf8("Tibetan")),
81 (0x1000, 0x109f, self.trUtf8("Myanmar")), 86 (0x1000, 0x109f, self.trUtf8("Myanmar")),
82 (0x10a0, 0x10ff, self.trUtf8("Georgian")), 87 (0x10a0, 0x10ff, self.trUtf8("Georgian")),
83 (0x1100, 0x11ff, self.trUtf8("Hangul Jamo")), 88 (0x1100, 0x11ff, self.trUtf8("Hangul Jamo")),
84 (0x1200, 0x137f, self.trUtf8("Ethiopic")), 89 (0x1200, 0x137f, self.trUtf8("Ethiopic")),
90 (0x1380, 0x139f, self.trUtf8("Ethiopic Supplement")),
85 (0x13a0, 0x13ff, self.trUtf8("Cherokee")), 91 (0x13a0, 0x13ff, self.trUtf8("Cherokee")),
86 (0x1400, 0x167f, self.trUtf8("Canadian Aboriginal Syllabics")), 92 (0x1400, 0x167f, self.trUtf8("Unified Canadian Aboriginal Syllabics")),
87 (0x1680, 0x169f, self.trUtf8("Ogham")), 93 (0x1680, 0x169f, self.trUtf8("Ogham")),
88 (0x16a0, 0x16ff, self.trUtf8("Runic")), 94 (0x16a0, 0x16ff, self.trUtf8("Runic")),
89 (0x1700, 0x171f, self.trUtf8("Tagalog")), 95 (0x1700, 0x171f, self.trUtf8("Tagalog")),
90 (0x1720, 0x173f, self.trUtf8("Hanunoo")), 96 (0x1720, 0x173f, self.trUtf8("Hanunoo")),
91 (0x1740, 0x175f, self.trUtf8("Buhid")), 97 (0x1740, 0x175f, self.trUtf8("Buhid")),
92 (0x1760, 0x177f, self.trUtf8("Tagbanwa")), 98 (0x1760, 0x177f, self.trUtf8("Tagbanwa")),
93 (0x1780, 0x17ff, self.trUtf8("Khmer")), 99 (0x1780, 0x17ff, self.trUtf8("Khmer")),
94 (0x1800, 0x18af, self.trUtf8("Mongolian")), 100 (0x1800, 0x18af, self.trUtf8("Mongolian")),
101 (0x18b0, 0x18ff, self.trUtf8("Unified Canadian Aboriginal Syllabics Extended")),
95 (0x1900, 0x194f, self.trUtf8("Limbu")), 102 (0x1900, 0x194f, self.trUtf8("Limbu")),
96 (0x1950, 0x197f, self.trUtf8("Tai Le")), 103 (0x1950, 0x197f, self.trUtf8("Tai Le")),
97 (0x19e0, 0x19ff, self.trUtf8("Khmer Symbols")), 104 (0x19e0, 0x19ff, self.trUtf8("Khmer Symbols")),
105 (0x1a00, 0x1a1f, self.trUtf8("Buginese")),
106 (0x1a20, 0x1aaf, self.trUtf8("Tai Tham")),
107 (0x1b00, 0x1b7f, self.trUtf8("Balinese")),
108 (0x1b80, 0x1bbf, self.trUtf8("Sundanese")),
109 (0x1bc0, 0x1bff, self.trUtf8("Batak")),
110 (0x1c00, 0x1c4f, self.trUtf8("Lepcha")),
111 (0x1c50, 0x1c7f, self.trUtf8("Ol Chiki")),
112 (0x1cc0, 0x1ccf, self.trUtf8("Sundanese Supplement")),
113 (0x1cd0, 0x1cff, self.trUtf8("Vedic Extensions")),
98 (0x1d00, 0x1d7f, self.trUtf8("Phonetic Extensions")), 114 (0x1d00, 0x1d7f, self.trUtf8("Phonetic Extensions")),
115 (0x1d80, 0x1dbf, self.trUtf8("Phonetic Extensions Supplement")),
116 (0x1dc0, 0x1dff, self.trUtf8("Combining Diacritical Marks Supplement")),
99 (0x1e00, 0x1eff, self.trUtf8("Latin Extended Additional")), 117 (0x1e00, 0x1eff, self.trUtf8("Latin Extended Additional")),
100 (0x1f00, 0x1fff, self.trUtf8("Greek Extended")), 118 (0x1f00, 0x1fff, self.trUtf8("Greek Extended")),
101 (0x2000, 0x206f, self.trUtf8("General Punctuation")), 119 (0x2000, 0x206f, self.trUtf8("General Punctuation")),
102 (0x2070, 0x209f, self.trUtf8("Superscripts and Subscripts")), 120 (0x2070, 0x209f, self.trUtf8("Superscripts and Subscripts")),
103 (0x20a0, 0x20cf, self.trUtf8("Currency Symbols")), 121 (0x20a0, 0x20cf, self.trUtf8("Currency Symbols")),
120 (0x2800, 0x28ff, self.trUtf8("Braille Patterns")), 138 (0x2800, 0x28ff, self.trUtf8("Braille Patterns")),
121 (0x2900, 0x297f, self.trUtf8("Supplement Arcolumns-B")), 139 (0x2900, 0x297f, self.trUtf8("Supplement Arcolumns-B")),
122 (0x2980, 0x29ff, self.trUtf8("Miscellaneous Mathematical Symbols-B")), 140 (0x2980, 0x29ff, self.trUtf8("Miscellaneous Mathematical Symbols-B")),
123 (0x2a00, 0x2aff, self.trUtf8("Supplemental Mathematical Operators")), 141 (0x2a00, 0x2aff, self.trUtf8("Supplemental Mathematical Operators")),
124 (0x2b00, 0x2bff, self.trUtf8("Miscellaneous Symbols and Arcolumns")), 142 (0x2b00, 0x2bff, self.trUtf8("Miscellaneous Symbols and Arcolumns")),
143 (0x2c00, 0x2c5f, self.trUtf8("Glagolitic")),
144 (0x2c60, 0x2c7f, self.trUtf8("Latin Extended-C")),
145 (0x2c80, 0x2cff, self.trUtf8("Coptic")),
146 (0x2d00, 0x2d2f, self.trUtf8("Georgian Supplement")),
147 (0x2d30, 0x2d7f, self.trUtf8("Tifinagh")),
148 (0x2d80, 0x2ddf, self.trUtf8("Ethiopic Extended")),
149 (0x2de0, 0x2dff, self.trUtf8("Cyrillic Extended-A")),
150 (0x2e00, 0x2e7f, self.trUtf8("Supplemental Punctuation")),
125 (0x2e80, 0x2eff, self.trUtf8("CJK Radicals Supplement")), 151 (0x2e80, 0x2eff, self.trUtf8("CJK Radicals Supplement")),
126 (0x2f00, 0x2fdf, self.trUtf8("KangXi Radicals")), 152 (0x2f00, 0x2fdf, self.trUtf8("KangXi Radicals")),
127 (0x2ff0, 0x2fff, self.trUtf8("Ideographic Description Chars")), 153 (0x2ff0, 0x2fff, self.trUtf8("Ideographic Description Chars")),
128 (0x3000, 0x303f, self.trUtf8("CJK Symbols and Punctuation")), 154 (0x3000, 0x303f, self.trUtf8("CJK Symbols and Punctuation")),
129 (0x3040, 0x309f, self.trUtf8("Hiragana")), 155 (0x3040, 0x309f, self.trUtf8("Hiragana")),
130 (0x30a0, 0x30ff, self.trUtf8("Katakana")), 156 (0x30a0, 0x30ff, self.trUtf8("Katakana")),
131 (0x3100, 0x312f, self.trUtf8("Bopomofo")), 157 (0x3100, 0x312f, self.trUtf8("Bopomofo")),
132 (0x3130, 0x318f, self.trUtf8("Hangul Compatibility Jamo")), 158 (0x3130, 0x318f, self.trUtf8("Hangul Compatibility Jamo")),
133 (0x3190, 0x319f, self.trUtf8("Kanbun")), 159 (0x3190, 0x319f, self.trUtf8("Kanbun")),
134 (0x31a0, 0x31bf, self.trUtf8("Bopomofo Extended")), 160 (0x31a0, 0x31bf, self.trUtf8("Bopomofo Extended")),
161 (0x31c0, 0x31ef, self.trUtf8("CJK Strokes")),
135 (0x31f0, 0x31ff, self.trUtf8("Katakana Phonetic Extensions")), 162 (0x31f0, 0x31ff, self.trUtf8("Katakana Phonetic Extensions")),
136 (0x3200, 0x32ff, self.trUtf8("Enclosed CJK Letters and Months")), 163 (0x3200, 0x32ff, self.trUtf8("Enclosed CJK Letters and Months")),
137 (0x3300, 0x33ff, self.trUtf8("CJK Compatibility")), 164 (0x3300, 0x33ff, self.trUtf8("CJK Compatibility")),
138 (0x3400, 0x4db5, self.trUtf8("CJK Unified Ideogr. Ext. A")), 165 (0x3400, 0x4dbf, self.trUtf8("CJK Unified Ideogr. Ext. A")),
139 (0x4dc0, 0x4dff, self.trUtf8("Yijing Hexagram Symbols")), 166 (0x4dc0, 0x4dff, self.trUtf8("Yijing Hexagram Symbols")),
140 (0x4e00, 0x9fbb, self.trUtf8("CJK Unified Ideographs")), 167 (0x4e00, 0x9fff, self.trUtf8("CJK Unified Ideographs")),
141 (0xa000, 0xa48f, self.trUtf8("Yi Syllables")), 168 (0xa000, 0xa48f, self.trUtf8("Yi Syllables")),
142 (0xa490, 0xa4cf, self.trUtf8("Yi Radicals")), 169 (0xa490, 0xa4cf, self.trUtf8("Yi Radicals")),
143 (0xac00, 0xd7a3, self.trUtf8("Hangul Syllables")), 170 (0xa4d0, 0xa4ff, self.trUtf8("Lisu")),
171 (0xa500, 0xa63f, self.trUtf8("Vai")),
172 (0xa640, 0xa69f, self.trUtf8("Cyrillic Extended-B")),
173 (0xa6a0, 0xa6ff, self.trUtf8("Bamum")),
174 (0xa700, 0xa71f, self.trUtf8("Modifier Tone Letters")),
175 (0xa720, 0xa7ff, self.trUtf8("Latin Extended-D")),
176 (0xa800, 0xa82f, self.trUtf8("Syloti Nagri")),
177 (0xa830, 0xa83f, self.trUtf8("Common Indic Number Forms")),
178 (0xa840, 0xa87f, self.trUtf8("Phags-pa")),
179 (0xa880, 0xa8df, self.trUtf8("Saurashtra")),
180 (0xa8e0, 0xa8ff, self.trUtf8("Devanagari Extended")),
181 (0xa900, 0xa92f, self.trUtf8("Kayah Li")),
182 (0xa930, 0xa95f, self.trUtf8("Rejang")),
183 (0xa960, 0xa97f, self.trUtf8("Hangul Jamo Extended-A")),
184 (0xa980, 0xa9df, self.trUtf8("Javanese")),
185 (0xaa00, 0xaa5f, self.trUtf8("Cham")),
186 (0xaa60, 0xaa7f, self.trUtf8("Myanmar Extended-A")),
187 (0xaa80, 0xaadf, self.trUtf8("Tai Viet")),
188 (0xaae0, 0xaaff, self.trUtf8("Meetei Mayek Extensions")),
189 (0xab00, 0xab2f, self.trUtf8("Ethiopic Extended-A")),
190 (0xabc0, 0xabff, self.trUtf8("Meetei Mayek")),
191 (0xac00, 0xd7af, self.trUtf8("Hangul Syllables")),
192 (0xd7b0, 0xd7ff, self.trUtf8("Hangul Jamo Extended-B")),
144 (0xd800, 0xdb7f, self.trUtf8("High Surrogates")), 193 (0xd800, 0xdb7f, self.trUtf8("High Surrogates")),
145 (0xdb80, 0xdbff, self.trUtf8("High Private Use Surrogates")), 194 (0xdb80, 0xdbff, self.trUtf8("High Private Use Surrogates")),
146 (0xdc00, 0xdfff, self.trUtf8("Low Surrogates")), 195 (0xdc00, 0xdfff, self.trUtf8("Low Surrogates")),
147 (0xe000, 0xf8ff, self.trUtf8("Private Use")), 196 (0xe000, 0xf8ff, self.trUtf8("Private Use")),
148 (0xf900, 0xfaff, self.trUtf8("CJK Compatibility Ideographs")), 197 (0xf900, 0xfaff, self.trUtf8("CJK Compatibility Ideographs")),
149 (0xfb00, 0xfb4f, self.trUtf8("Alphabetic Presentation Forms")), 198 (0xfb00, 0xfb4f, self.trUtf8("Alphabetic Presentation Forms")),
150 (0xfb50, 0xfdff, self.trUtf8("Arabic Presentation Forms-A")), 199 (0xfb50, 0xfdff, self.trUtf8("Arabic Presentation Forms-A")),
151 (0xfe00, 0xfe0f, self.trUtf8("Variation Selectors")), 200 (0xfe00, 0xfe0f, self.trUtf8("Variation Selectors")),
201 (0xfe10, 0xfe1f, self.trUtf8("Vertical Forms")),
152 (0xfe20, 0xfe2f, self.trUtf8("Combining Half Marks")), 202 (0xfe20, 0xfe2f, self.trUtf8("Combining Half Marks")),
153 (0xfe30, 0xfe4f, self.trUtf8("CJK Compatibility Forms")), 203 (0xfe30, 0xfe4f, self.trUtf8("CJK Compatibility Forms")),
154 (0xfe50, 0xfe6f, self.trUtf8("Small Form Variants")), 204 (0xfe50, 0xfe6f, self.trUtf8("Small Form Variants")),
155 (0xfe70, 0xfefe, self.trUtf8("Arabic Presentation Forms-B")), 205 (0xfe70, 0xfeff, self.trUtf8("Arabic Presentation Forms-B")),
156 (0xfeff, 0xfeff, self.trUtf8("Specials")),
157 (0xff00, 0xffef, self.trUtf8("Half- and Fullwidth Forms")), 206 (0xff00, 0xffef, self.trUtf8("Half- and Fullwidth Forms")),
158 (0xfff0, 0xffff, self.trUtf8("Specials")), 207 (0xfff0, 0xffff, self.trUtf8("Specials")),
159 (0x10300, 0x1032f, self.trUtf8("Old Italic")), 208 ]
160 (0x10330, 0x1034f, self.trUtf8("Gothic")), 209 if sys.maxunicode > 0xffff:
161 (0x10400, 0x1044f, self.trUtf8("Deseret")), 210 self.__tables.extend([
162 (0x1d000, 0x1d0ff, self.trUtf8("Byzantine Musical Symbols")), 211 (0x10000, 0x1007f, self.trUtf8("Linear B Syllabary")),
163 (0x1d100, 0x1d1ff, self.trUtf8("Musical Symbols")), 212 (0x10080, 0x100ff, self.trUtf8("Linear B Ideograms")),
164 (0x1d400, 0x1d7ff, self.trUtf8("Mathematical Alphanumeric Symbols")), 213 (0x10100, 0x1013f, self.trUtf8("Aegean Numbers")),
165 (0x20000, 0x2a6d6, self.trUtf8("CJK Unified Ideogr. Ext. B")), 214 (0x10140, 0x1018f, self.trUtf8("Ancient Greek Numbers")),
166 (0x2f800, 0x2fa1f, self.trUtf8("CJK Compatapility Ideogr. Suppl.")), 215 (0x10190, 0x101cf, self.trUtf8("Ancient Symbols")),
167 (0xe0000, 0xe007f, self.trUtf8("Tags")), 216 (0x101d0, 0x101ff, self.trUtf8("Phaistos Disc")),
168 ) 217 (0x10280, 0x1029f, self.trUtf8("Lycian")),
218 (0x102a0, 0x102df, self.trUtf8("Carian")),
219 (0x10300, 0x1032f, self.trUtf8("Old Italic")),
220 (0x10330, 0x1034f, self.trUtf8("Gothic")),
221 (0x10380, 0x1039f, self.trUtf8("Ugaritic")),
222 (0x103a0, 0x103df, self.trUtf8("Old Persian")),
223 (0x10400, 0x1044f, self.trUtf8("Deseret")),
224 (0x10450, 0x1047f, self.trUtf8("Shavian")),
225 (0x10480, 0x104af, self.trUtf8("Osmanya")),
226 (0x10800, 0x1083f, self.trUtf8("Cypriot Syllabary")),
227 (0x10840, 0x1085f, self.trUtf8("Imperial Aramaic")),
228 (0x10900, 0x1091f, self.trUtf8("Phoenician")),
229 (0x10920, 0x1093f, self.trUtf8("Lydian")),
230 (0x10980, 0x1099f, self.trUtf8("Meroitic Hieroglyphs")),
231 (0x109a0, 0x109ff, self.trUtf8("Meroitic Cursive")),
232 (0x10a00, 0x10a5f, self.trUtf8("Kharoshthi")),
233 (0x10a60, 0x10a7f, self.trUtf8("Old South Arabian")),
234 (0x10b00, 0x10b3f, self.trUtf8("Avestan")),
235 (0x10b40, 0x10b5f, self.trUtf8("Inscriptional Parthian")),
236 (0x10b60, 0x10b7f, self.trUtf8("Inscriptional Pahlavi")),
237 (0x10c00, 0x10c4f, self.trUtf8("Old Turkic")),
238 (0x10e60, 0x10e7f, self.trUtf8("Rumi Numeral Symbols")),
239 (0x11000, 0x1107f, self.trUtf8("Brahmi")),
240 (0x11080, 0x110cf, self.trUtf8("Kaithi")),
241 (0x110d0, 0x110ff, self.trUtf8("Sora Sompeng")),
242 (0x11100, 0x1114f, self.trUtf8("Chakma")),
243 (0x11180, 0x111df, self.trUtf8("Sharada")),
244 (0x11680, 0x116cf, self.trUtf8("Takri")),
245 (0x12000, 0x123ff, self.trUtf8("Cuneiform")),
246 (0x12400, 0x1247f, self.trUtf8("Cuneiform Numbers and Punctuation")),
247 (0x13000, 0x1342f, self.trUtf8("Egyptian Hieroglyphs")),
248 (0x16800, 0x16a3f, self.trUtf8("Bamum Supplement")),
249 (0x16f00, 0x16f9f, self.trUtf8("Miao")),
250 (0x1b000, 0x1b0ff, self.trUtf8("Kana Supplement")),
251 (0x1d000, 0x1d0ff, self.trUtf8("Byzantine Musical Symbols")),
252 (0x1d100, 0x1d1ff, self.trUtf8("Musical Symbols")),
253 (0x1d200, 0x1d24f, self.trUtf8("Ancient Greek Musical Notation")),
254 (0x1d300, 0x1d35f, self.trUtf8("Tai Xuan Jing Symbols")),
255 (0x1d360, 0x1d37f, self.trUtf8("Counting Rod Numerals")),
256 (0x1d400, 0x1d7ff, self.trUtf8("Mathematical Alphanumeric Symbols")),
257 (0x1ee00, 0x1eeff, self.trUtf8("Arabic Mathematical Alphabetic Symbols")),
258 (0x1f000, 0x1f02f, self.trUtf8("Mahjong Tiles")),
259 (0x1f030, 0x1f09f, self.trUtf8("Domino Tiles")),
260 (0x1f0a0, 0x1f0ff, self.trUtf8("Playing Cards")),
261 (0x1f100, 0x1f1ff, self.trUtf8("Enclosed Alphanumeric Supplement")),
262 (0x1f200, 0x1f2ff, self.trUtf8("Enclosed Ideographic Supplement")),
263 (0x1f300, 0x1f5ff, self.trUtf8("Miscellaneous Symbols And Pictographs")),
264 (0x1f600, 0x1f64f, self.trUtf8("Emoticons")),
265 (0x1f680, 0x1f6ff, self.trUtf8("Transport And Map Symbols")),
266 (0x1f700, 0x1f77f, self.trUtf8("Alchemical Symbols")),
267 (0x20000, 0x2a6df, self.trUtf8("CJK Unified Ideogr. Ext. B")),
268 (0x2a700, 0x2b73f, self.trUtf8("CJK Unified Ideographs Extension C")),
269 (0x2b740, 0x2b81f, self.trUtf8("CJK Unified Ideographs Extension D")),
270 (0x2f800, 0x2fa1f, self.trUtf8("CJK Compatapility Ideogr. Suppl.")),
271 (0xe0000, 0xe007f, self.trUtf8("Tags")),
272 (0xe0100, 0xe01ef, self.trUtf8("Variation Selectors Supplement")),
273 (0xf0000, 0xfffff, self.trUtf8("Supplementary Private Use Area-A")),
274 (0x100000, 0x10ffff, self.trUtf8("Supplementary Private Use Area-B")),
275 ])
169 self.__currentTableIndex = 0 276 self.__currentTableIndex = 0
170 277
171 def getTableNames(self): 278 def getTableNames(self):
172 """ 279 """
173 Public method to get a list of table names. 280 Public method to get a list of table names.
230 if role == Qt.DisplayRole: 337 if role == Qt.DisplayRole:
231 col = index.column() 338 col = index.column()
232 if col == 0: 339 if col == 0:
233 return str(id) 340 return str(id)
234 elif col == 1: 341 elif col == 1:
235 try: 342 return chr(id)
236 return chr(id)
237 except ValueError:
238 return chr(65533)
239 elif col == 2: 343 elif col == 2:
240 return "0x{0:04x}".format(id) 344 return "0x{0:04x}".format(id)
241 elif col == 3: 345 elif col == 3:
242 if id in html_entities.codepoint2name: 346 if id in html_entities.codepoint2name:
243 return "&{0};".format(html_entities.codepoint2name[id]) 347 return "&{0};".format(html_entities.codepoint2name[id])
244 elif col == 4: 348 elif col == 4:
245 try: 349 return unicodedata.name(chr(id), '').title()
246 return unicodedata.name(chr(id), '').title()
247 except ValueError:
248 return self.trUtf8("not possible: narrow Python build")
249 350
250 if role == Qt.BackgroundColorRole: 351 if role == Qt.BackgroundColorRole:
251 if index.column() == 0: 352 if index.column() == 0:
252 return QColor(Qt.lightGray) 353 return QColor(Qt.lightGray)
253 354
254 if role == Qt.TextColorRole: 355 if role == Qt.TextColorRole:
255 try: 356 char = chr(id)
256 char = chr(id)
257 except ValueError:
258 char = chr(65533)
259 if self.__isDigit(char): 357 if self.__isDigit(char):
260 return QColor(Qt.darkBlue) 358 return QColor(Qt.darkBlue)
261 elif self.__isLetter(char): 359 elif self.__isLetter(char):
262 return QColor(Qt.darkGreen) 360 return QColor(Qt.darkGreen)
263 elif self.__isMark(char): 361 elif self.__isMark(char):

eric ide

mercurial