src/eric7/UI/SymbolsWidget.py

Mon, 07 Nov 2022 17:19:58 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 07 Nov 2022 17:19:58 +0100
branch
eric7
changeset 9482
a2bc06a54d9d
parent 9473
3f23dbf37dbe
child 9539
67a811025fa7
permissions
-rw-r--r--

Corrected/acknowledged some bad import style and removed some obsolete code.

365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
8881
54e42bc2437a Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8853
diff changeset
3 # Copyright (c) 2010 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a widget to select a symbol in various formats.
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
10 import html.entities
4970
dcbb14191a3b Redid the SymbolsWidget fix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
11 import sys
dcbb14191a3b Redid the SymbolsWidget fix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
12 import unicodedata
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
8318
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
14 from PyQt6.QtCore import (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
15 QAbstractTableModel,
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
16 QItemSelectionModel,
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
17 QLocale,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
18 QModelIndex,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
19 Qt,
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
20 pyqtSignal,
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
21 pyqtSlot,
7264
bedbe458d792 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
22 )
8318
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
23 from PyQt6.QtGui import QColor
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
24 from PyQt6.QtWidgets import QAbstractItemView, QHeaderView, QWidget
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
26 from eric7 import Preferences
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
27 from eric7.EricGui import EricPixmapCache
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
28 from eric7.EricWidgets.EricApplication import ericApp
8853
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
29
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 from .Ui_SymbolsWidget import Ui_SymbolsWidget
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
32
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 class SymbolsModel(QAbstractTableModel):
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 """
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 Class implementing the model for the symbols widget.
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
37
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
38 def __init__(self, parent=None):
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 """
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 Constructor
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
41
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 @param parent reference to the parent object (QObject)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 """
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
44 super().__init__(parent)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
45
4467
fc6f2095a423 Fixed several issues with the symbols viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
46 self.__locale = QLocale()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
47
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 self.__headerData = [
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
49 self.tr("Code"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
50 self.tr("Char"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
51 self.tr("Hex"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
52 self.tr("HTML"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
53 self.tr("Name"),
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 ]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
55
8853
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
56 self.__isDark = ericApp().usesDarkPalette()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
57
2603
2efe1c237c33 Implemented a fix for the Symbols Viewer for Python builds with sys.maxunicode = 0xffff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
58 self.__tables = [
366
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
59 # first last display name
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
60 (0x0, 0x1F, self.tr("Control Characters")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
61 (0x20, 0x7F, self.tr("Basic Latin")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
62 (0x80, 0xFF, self.tr("Latin-1 Supplement")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
63 (0x100, 0x17F, self.tr("Latin Extended-A")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
64 (0x180, 0x24F, self.tr("Latin Extended-B")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
65 (0x250, 0x2AF, self.tr("IPA Extensions")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
66 (0x2B0, 0x2FF, self.tr("Spacing Modifier Letters")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
67 (0x300, 0x36F, self.tr("Combining Diacritical Marks")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
68 (0x370, 0x3FF, self.tr("Greek and Coptic")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
69 (0x400, 0x4FF, self.tr("Cyrillic")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
70 (0x500, 0x52F, self.tr("Cyrillic Supplement")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
71 (0x530, 0x58F, self.tr("Armenian")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
72 (0x590, 0x5FF, self.tr("Hebrew")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
73 (0x600, 0x6FF, self.tr("Arabic")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
74 (0x700, 0x74F, self.tr("Syriac")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
75 (0x780, 0x7BF, self.tr("Thaana")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
76 (0x7C0, 0x7FF, self.tr("N'Ko")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
77 (0x800, 0x83F, self.tr("Samaritan")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
78 (0x840, 0x85F, self.tr("Mandaic")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
79 (0x8A0, 0x8FF, self.tr("Arabic Extended-A")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
80 (0x900, 0x97F, self.tr("Devanagari")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
81 (0x980, 0x9FF, self.tr("Bengali")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
82 (0xA00, 0xA7F, self.tr("Gurmukhi")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
83 (0xA80, 0xAFF, self.tr("Gujarati")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
84 (0xB00, 0xB7F, self.tr("Oriya")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
85 (0xB80, 0xBFF, self.tr("Tamil")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
86 (0xC00, 0xC7F, self.tr("Telugu")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
87 (0xC80, 0xCFF, self.tr("Kannada")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
88 (0xD00, 0xD7F, self.tr("Malayalam")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
89 (0xD80, 0xDFF, self.tr("Sinhala")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
90 (0xE00, 0xE7F, self.tr("Thai")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
91 (0xE80, 0xEFF, self.tr("Lao")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
92 (0xF00, 0xFFF, self.tr("Tibetan")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
93 (0x1000, 0x109F, self.tr("Myanmar")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
94 (0x10A0, 0x10FF, self.tr("Georgian")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
95 (0x1100, 0x11FF, self.tr("Hangul Jamo")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
96 (0x1200, 0x137F, self.tr("Ethiopic")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
97 (0x1380, 0x139F, self.tr("Ethiopic Supplement")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
98 (0x13A0, 0x13FF, self.tr("Cherokee")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
99 (0x1400, 0x167F, self.tr("Unified Canadian Aboriginal Syllabics")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
100 (0x1680, 0x169F, self.tr("Ogham")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
101 (0x16A0, 0x16FF, self.tr("Runic")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
102 (0x1700, 0x171F, self.tr("Tagalog")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
103 (0x1720, 0x173F, self.tr("Hanunoo")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
104 (0x1740, 0x175F, self.tr("Buhid")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
105 (0x1760, 0x177F, self.tr("Tagbanwa")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
106 (0x1780, 0x17FF, self.tr("Khmer")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
107 (0x1800, 0x18AF, self.tr("Mongolian")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
108 (0x18B0, 0x18FF, self.tr("Unified Canadian Aboriginal Syllabics Extended")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
109 (0x1900, 0x194F, self.tr("Limbu")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
110 (0x1950, 0x197F, self.tr("Tai Le")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
111 (0x19E0, 0x19FF, self.tr("Khmer Symbols")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
112 (0x1A00, 0x1A1F, self.tr("Buginese")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
113 (0x1A20, 0x1AAF, self.tr("Tai Tham")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
114 (0x1B00, 0x1B7F, self.tr("Balinese")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
115 (0x1B80, 0x1BBF, self.tr("Sundanese")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
116 (0x1BC0, 0x1BFF, self.tr("Batak")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
117 (0x1C00, 0x1C4F, self.tr("Lepcha")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
118 (0x1C50, 0x1C7F, self.tr("Ol Chiki")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
119 (0x1CC0, 0x1CCF, self.tr("Sundanese Supplement")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
120 (0x1CD0, 0x1CFF, self.tr("Vedic Extensions")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
121 (0x1D00, 0x1D7F, self.tr("Phonetic Extensions")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
122 (0x1D80, 0x1DBF, self.tr("Phonetic Extensions Supplement")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
123 (0x1DC0, 0x1DFF, self.tr("Combining Diacritical Marks Supplement")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
124 (0x1E00, 0x1EFF, self.tr("Latin Extended Additional")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
125 (0x1F00, 0x1FFF, self.tr("Greek Extended")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
126 (0x2000, 0x206F, self.tr("General Punctuation")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
127 (0x2070, 0x209F, self.tr("Superscripts and Subscripts")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
128 (0x20A0, 0x20CF, self.tr("Currency Symbols")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
129 (0x20D0, 0x20FF, self.tr("Combining Diacritical Marks")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
130 (0x2100, 0x214F, self.tr("Letterlike Symbols")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
131 (0x2150, 0x218F, self.tr("Number Forms")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
132 (0x2190, 0x21FF, self.tr("Arcolumns")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
133 (0x2200, 0x22FF, self.tr("Mathematical Operators")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
134 (0x2300, 0x23FF, self.tr("Miscellaneous Technical")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
135 (0x2400, 0x243F, self.tr("Control Pictures")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
136 (0x2440, 0x245F, self.tr("Optical Character Recognition")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
137 (0x2460, 0x24FF, self.tr("Enclosed Alphanumerics")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
138 (0x2500, 0x257F, self.tr("Box Drawing")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
139 (0x2580, 0x259F, self.tr("Block Elements")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
140 (0x25A0, 0x25FF, self.tr("Geometric Shapes")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
141 (0x2600, 0x26FF, self.tr("Miscellaneous Symbols")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
142 (0x2700, 0x27BF, self.tr("Dingbats")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
143 (0x27C0, 0x27EF, self.tr("Miscellaneous Mathematical Symbols-A")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
144 (0x27F0, 0x27FF, self.tr("Supplement Arcolumns-A")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
145 (0x2800, 0x28FF, self.tr("Braille Patterns")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
146 (0x2900, 0x297F, self.tr("Supplement Arcolumns-B")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
147 (0x2980, 0x29FF, self.tr("Miscellaneous Mathematical Symbols-B")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
148 (0x2A00, 0x2AFF, self.tr("Supplemental Mathematical Operators")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
149 (0x2B00, 0x2BFF, self.tr("Miscellaneous Symbols and Arcolumns")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
150 (0x2C00, 0x2C5F, self.tr("Glagolitic")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
151 (0x2C60, 0x2C7F, self.tr("Latin Extended-C")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
152 (0x2C80, 0x2CFF, self.tr("Coptic")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
153 (0x2D00, 0x2D2F, self.tr("Georgian Supplement")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
154 (0x2D30, 0x2D7F, self.tr("Tifinagh")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
155 (0x2D80, 0x2DDF, self.tr("Ethiopic Extended")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
156 (0x2DE0, 0x2DFF, self.tr("Cyrillic Extended-A")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
157 (0x2E00, 0x2E7F, self.tr("Supplemental Punctuation")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
158 (0x2E80, 0x2EFF, self.tr("CJK Radicals Supplement")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
159 (0x2F00, 0x2FDF, self.tr("KangXi Radicals")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
160 (0x2FF0, 0x2FFF, self.tr("Ideographic Description Chars")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
161 (0x3000, 0x303F, self.tr("CJK Symbols and Punctuation")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
162 (0x3040, 0x309F, self.tr("Hiragana")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
163 (0x30A0, 0x30FF, self.tr("Katakana")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
164 (0x3100, 0x312F, self.tr("Bopomofo")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
165 (0x3130, 0x318F, self.tr("Hangul Compatibility Jamo")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
166 (0x3190, 0x319F, self.tr("Kanbun")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
167 (0x31A0, 0x31BF, self.tr("Bopomofo Extended")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
168 (0x31C0, 0x31EF, self.tr("CJK Strokes")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
169 (0x31F0, 0x31FF, self.tr("Katakana Phonetic Extensions")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
170 (0x3200, 0x32FF, self.tr("Enclosed CJK Letters and Months")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
171 (0x3300, 0x33FF, self.tr("CJK Compatibility")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
172 (0x3400, 0x4DBF, self.tr("CJK Unified Ideogr. Ext. A")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
173 (0x4DC0, 0x4DFF, self.tr("Yijing Hexagram Symbols")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
174 (0x4E00, 0x9FFF, self.tr("CJK Unified Ideographs")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
175 (0xA000, 0xA48F, self.tr("Yi Syllables")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
176 (0xA490, 0xA4CF, self.tr("Yi Radicals")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
177 (0xA4D0, 0xA4FF, self.tr("Lisu")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
178 (0xA500, 0xA63F, self.tr("Vai")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
179 (0xA640, 0xA69F, self.tr("Cyrillic Extended-B")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
180 (0xA6A0, 0xA6FF, self.tr("Bamum")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
181 (0xA700, 0xA71F, self.tr("Modifier Tone Letters")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
182 (0xA720, 0xA7FF, self.tr("Latin Extended-D")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
183 (0xA800, 0xA82F, self.tr("Syloti Nagri")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
184 (0xA830, 0xA83F, self.tr("Common Indic Number Forms")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
185 (0xA840, 0xA87F, self.tr("Phags-pa")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
186 (0xA880, 0xA8DF, self.tr("Saurashtra")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
187 (0xA8E0, 0xA8FF, self.tr("Devanagari Extended")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
188 (0xA900, 0xA92F, self.tr("Kayah Li")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
189 (0xA930, 0xA95F, self.tr("Rejang")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
190 (0xA960, 0xA97F, self.tr("Hangul Jamo Extended-A")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
191 (0xA980, 0xA9DF, self.tr("Javanese")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
192 (0xAA00, 0xAA5F, self.tr("Cham")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
193 (0xAA60, 0xAA7F, self.tr("Myanmar Extended-A")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
194 (0xAA80, 0xAADF, self.tr("Tai Viet")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
195 (0xAAE0, 0xAAFF, self.tr("Meetei Mayek Extensions")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
196 (0xAB00, 0xAB2F, self.tr("Ethiopic Extended-A")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
197 (0xABC0, 0xABFF, self.tr("Meetei Mayek")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
198 (0xAC00, 0xD7AF, self.tr("Hangul Syllables")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
199 (0xD7B0, 0xD7FF, self.tr("Hangul Jamo Extended-B")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
200 (0xD800, 0xDB7F, self.tr("High Surrogates")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
201 (0xDB80, 0xDBFF, self.tr("High Private Use Surrogates")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
202 (0xDC00, 0xDFFF, self.tr("Low Surrogates")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
203 (0xE000, 0xF8FF, self.tr("Private Use")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
204 (0xF900, 0xFAFF, self.tr("CJK Compatibility Ideographs")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
205 (0xFB00, 0xFB4F, self.tr("Alphabetic Presentation Forms")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
206 (0xFB50, 0xFDFF, self.tr("Arabic Presentation Forms-A")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
207 (0xFE00, 0xFE0F, self.tr("Variation Selectors")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
208 (0xFE10, 0xFE1F, self.tr("Vertical Forms")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
209 (0xFE20, 0xFE2F, self.tr("Combining Half Marks")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
210 (0xFE30, 0xFE4F, self.tr("CJK Compatibility Forms")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
211 (0xFE50, 0xFE6F, self.tr("Small Form Variants")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
212 (0xFE70, 0xFEFF, self.tr("Arabic Presentation Forms-B")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
213 (0xFF00, 0xFFEF, self.tr("Half- and Fullwidth Forms")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
214 (0xFFF0, 0xFFFF, self.tr("Specials")),
2603
2efe1c237c33 Implemented a fix for the Symbols Viewer for Python builds with sys.maxunicode = 0xffff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
215 ]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
216 if sys.maxunicode > 0xFFFF:
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
217 self.__tables.extend(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
218 [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
219 (0x10000, 0x1007F, self.tr("Linear B Syllabary")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
220 (0x10080, 0x100FF, self.tr("Linear B Ideograms")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
221 (0x10100, 0x1013F, self.tr("Aegean Numbers")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
222 (0x10140, 0x1018F, self.tr("Ancient Greek Numbers")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
223 (0x10190, 0x101CF, self.tr("Ancient Symbols")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
224 (0x101D0, 0x101FF, self.tr("Phaistos Disc")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
225 (0x10280, 0x1029F, self.tr("Lycian")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
226 (0x102A0, 0x102DF, self.tr("Carian")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
227 (0x10300, 0x1032F, self.tr("Old Italic")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
228 (0x10330, 0x1034F, self.tr("Gothic")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
229 (0x10380, 0x1039F, self.tr("Ugaritic")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
230 (0x103A0, 0x103DF, self.tr("Old Persian")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
231 (0x10400, 0x1044F, self.tr("Deseret")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
232 (0x10450, 0x1047F, self.tr("Shavian")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
233 (0x10480, 0x104AF, self.tr("Osmanya")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
234 (0x10800, 0x1083F, self.tr("Cypriot Syllabary")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
235 (0x10840, 0x1085F, self.tr("Imperial Aramaic")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
236 (0x10900, 0x1091F, self.tr("Phoenician")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
237 (0x10920, 0x1093F, self.tr("Lydian")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
238 (0x10980, 0x1099F, self.tr("Meroitic Hieroglyphs")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
239 (0x109A0, 0x109FF, self.tr("Meroitic Cursive")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
240 (0x10A00, 0x10A5F, self.tr("Kharoshthi")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
241 (0x10A60, 0x10A7F, self.tr("Old South Arabian")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
242 (0x10B00, 0x10B3F, self.tr("Avestan")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
243 (0x10B40, 0x10B5F, self.tr("Inscriptional Parthian")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
244 (0x10B60, 0x10B7F, self.tr("Inscriptional Pahlavi")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
245 (0x10C00, 0x10C4F, self.tr("Old Turkic")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
246 (0x10E60, 0x10E7F, self.tr("Rumi Numeral Symbols")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
247 (0x11000, 0x1107F, self.tr("Brahmi")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
248 (0x11080, 0x110CF, self.tr("Kaithi")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
249 (0x110D0, 0x110FF, self.tr("Sora Sompeng")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
250 (0x11100, 0x1114F, self.tr("Chakma")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
251 (0x11180, 0x111DF, self.tr("Sharada")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
252 (0x11680, 0x116CF, self.tr("Takri")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
253 (0x12000, 0x123FF, self.tr("Cuneiform")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
254 (0x12400, 0x1247F, self.tr("Cuneiform Numbers and Punctuation")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
255 (0x13000, 0x1342F, self.tr("Egyptian Hieroglyphs")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
256 (0x16800, 0x16A3F, self.tr("Bamum Supplement")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
257 (0x16F00, 0x16F9F, self.tr("Miao")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
258 (0x1B000, 0x1B0FF, self.tr("Kana Supplement")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
259 (0x1D000, 0x1D0FF, self.tr("Byzantine Musical Symbols")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
260 (0x1D100, 0x1D1FF, self.tr("Musical Symbols")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
261 (0x1D200, 0x1D24F, self.tr("Ancient Greek Musical Notation")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
262 (0x1D300, 0x1D35F, self.tr("Tai Xuan Jing Symbols")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
263 (0x1D360, 0x1D37F, self.tr("Counting Rod Numerals")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
264 (0x1D400, 0x1D7FF, self.tr("Mathematical Alphanumeric Symbols")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
265 (
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
266 0x1EE00,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
267 0x1EEFF,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
268 self.tr("Arabic Mathematical Alphabetic Symbols"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
269 ),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
270 (0x1F000, 0x1F02F, self.tr("Mahjong Tiles")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
271 (0x1F030, 0x1F09F, self.tr("Domino Tiles")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
272 (0x1F0A0, 0x1F0FF, self.tr("Playing Cards")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
273 (0x1F100, 0x1F1FF, self.tr("Enclosed Alphanumeric Supplement")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
274 (0x1F200, 0x1F2FF, self.tr("Enclosed Ideographic Supplement")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
275 (
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
276 0x1F300,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
277 0x1F5FF,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
278 self.tr("Miscellaneous Symbols And Pictographs"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
279 ),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
280 (0x1F600, 0x1F64F, self.tr("Emoticons")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
281 (0x1F680, 0x1F6FF, self.tr("Transport And Map Symbols")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
282 (0x1F700, 0x1F77F, self.tr("Alchemical Symbols")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
283 (0x20000, 0x2A6DF, self.tr("CJK Unified Ideogr. Ext. B")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
284 (0x2A700, 0x2B73F, self.tr("CJK Unified Ideographs Extension C")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
285 (0x2B740, 0x2B81F, self.tr("CJK Unified Ideographs Extension D")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
286 (0x2F800, 0x2FA1F, self.tr("CJK Compatapility Ideogr. Suppl.")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
287 (0xE0000, 0xE007F, self.tr("Tags")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
288 (0xE0100, 0xE01EF, self.tr("Variation Selectors Supplement")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
289 (0xF0000, 0xFFFFF, self.tr("Supplementary Private Use Area-A")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
290 (0x100000, 0x10FFFF, self.tr("Supplementary Private Use Area-B")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
291 ]
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
292 )
366
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
293 self.__currentTableIndex = 0
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
294
366
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
295 def getTableNames(self):
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 """
366
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
297 Public method to get a list of table names.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
298
366
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
299 @return list of table names (list of strings)
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
300 """
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
301 return [table[2] for table in self.__tables]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
302
366
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
303 def getTableBoundaries(self, index):
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
304 """
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
305 Public method to get the first and last character position
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
306 of the given table.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
307
366
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
308 @param index index of the character table (integer)
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
309 @return first and last character position (integer, integer)
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 """
366
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
311 return self.__tables[index][0], self.__tables[index][1]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
312
367
e66ebdb3b6a2 Corrected a few things in the new symbols widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 366
diff changeset
313 def getTableIndex(self):
e66ebdb3b6a2 Corrected a few things in the new symbols widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 366
diff changeset
314 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3539
diff changeset
315 Public method to get the current table index.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
316
367
e66ebdb3b6a2 Corrected a few things in the new symbols widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 366
diff changeset
317 @return current table index (integer)
e66ebdb3b6a2 Corrected a few things in the new symbols widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 366
diff changeset
318 """
e66ebdb3b6a2 Corrected a few things in the new symbols widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 366
diff changeset
319 return self.__currentTableIndex
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
320
366
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
321 def selectTable(self, index):
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
322 """
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
323 Public method to select the shown character table.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
324
366
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
325 @param index index of the character table (integer)
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
326 """
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
327 self.beginResetModel()
366
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
328 self.__currentTableIndex = index
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
329 self.endResetModel()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
330
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
331 def headerData(self, section, orientation, role=Qt.ItemDataRole.DisplayRole):
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 """
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333 Public method to get header data from the model.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
334
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 @param section section number (integer)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 @param orientation orientation (Qt.Orientation)
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
337 @param role role of the data to retrieve (Qt.ItemDataRole)
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 @return requested data
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339 """
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
340 if (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
341 orientation == Qt.Orientation.Horizontal
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
342 and role == Qt.ItemDataRole.DisplayRole
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
343 ):
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
344 return self.__headerData[section]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
345
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
346 return QAbstractTableModel.headerData(self, section, orientation, role)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
347
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
348 def data(self, index, role=Qt.ItemDataRole.DisplayRole):
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
349 """
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
350 Public method to get data from the model.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
351
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
352 @param index index to get data for (QModelIndex)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 @param role role of the data to retrieve (integer)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
354 @return requested data
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
355 """
5603
4f2dd0850803 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
356 symbolId = self.__tables[self.__currentTableIndex][0] + index.row()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
357
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
358 if role == Qt.ItemDataRole.DisplayRole:
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359 col = index.column()
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
360 if col == 0:
5603
4f2dd0850803 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
361 return self.__locale.toString(symbolId)
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
362 elif col == 1:
5603
4f2dd0850803 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
363 return chr(symbolId)
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
364 elif col == 2:
5603
4f2dd0850803 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
365 return "0x{0:04x}".format(symbolId)
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
366 elif col == 3:
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
367 if symbolId in html.entities.codepoint2name:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
368 return "&{0};".format(html.entities.codepoint2name[symbolId])
366
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
369 elif col == 4:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
370 return unicodedata.name(chr(symbolId), "").title()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
371
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
372 if role == Qt.ItemDataRole.BackgroundRole and index.column() == 0:
8853
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
373 if self.__isDark:
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
374 return QColor("#4d4d4d")
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
375 else:
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
376 return QColor(Qt.GlobalColor.lightGray)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
377
8318
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
378 if role == Qt.ItemDataRole.ForegroundRole:
5603
4f2dd0850803 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
379 char = chr(symbolId)
8853
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
380 if self.__isDark:
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
381 if self.__isDigit(char):
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
382 return QColor("#8787ff")
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
383 elif self.__isLetter(char):
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
384 return QColor("#87ff87")
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
385 elif self.__isMark(char):
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
386 return QColor("#ff8787")
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
387 elif self.__isSymbol(char):
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
388 return QColor("#ffc060")
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
389 elif self.__isPunct(char):
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
390 return QColor("#d080ff")
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
391 else:
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
392 return QColor(Qt.GlobalColor.lightGray)
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 else:
8853
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
394 if self.__isDigit(char):
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
395 return QColor(Qt.GlobalColor.darkBlue)
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
396 elif self.__isLetter(char):
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
397 return QColor(Qt.GlobalColor.darkGreen)
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
398 elif self.__isMark(char):
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
399 return QColor(Qt.GlobalColor.darkRed)
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
400 elif self.__isSymbol(char):
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
401 return QColor(Qt.GlobalColor.darkYellow)
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
402 elif self.__isPunct(char):
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
403 return QColor(Qt.GlobalColor.darkMagenta)
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
404 else:
efcceef1e26b Adapted the colors of the symbols viewer for dark color themes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8838
diff changeset
405 return QColor(Qt.GlobalColor.darkGray)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
406
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
407 if role == Qt.ItemDataRole.TextAlignmentRole and index.column() in [0, 1, 3]:
9160
1675c039a568 Implemented a correction for a PyQt6 enum related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
408 return Qt.AlignmentFlag.AlignHCenter.value
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
409
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410 return None
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
411
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 def columnCount(self, parent):
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 """
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414 Public method to get the number of columns of the model.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
415
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 @param parent parent index (QModelIndex)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417 @return number of columns (integer)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418 """
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419 if parent.column() > 0:
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 return 0
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
421 else:
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
422 return len(self.__headerData)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
423
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424 def rowCount(self, parent):
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 """
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
426 Public method to get the number of rows of the model.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
427
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428 @param parent parent index (QModelIndex)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
429 @return number of columns (integer)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430 """
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
431 if parent.isValid():
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
432 return 0
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
433 else:
366
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
434 first, last = self.__tables[self.__currentTableIndex][:2]
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
435 return last - first + 1
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
436
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
437 def __isDigit(self, char):
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
438 """
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
439 Private method to check, if a character is a digit.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
440
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441 @param char character to test (one character string)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
442 @return flag indicating a digit (boolean)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
443 """
4467
fc6f2095a423 Fixed several issues with the symbols viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
444 return unicodedata.category(str(char)) == "Nd"
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
445
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
446 def __isLetter(self, char):
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
447 """
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
448 Private method to check, if a character is a letter.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
449
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
450 @param char character to test (one character string)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
451 @return flag indicating a letter (boolean)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
452 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
453 return unicodedata.category(str(char)) in ["Lu", "Ll", "Lt", "Lm", "Lo"]
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
454
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
455 def __isMark(self, char):
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
456 """
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
457 Private method to check, if a character is a mark character.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
458
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
459 @param char character to test (one character string)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
460 @return flag indicating a mark character (boolean)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
461 """
4467
fc6f2095a423 Fixed several issues with the symbols viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
462 return unicodedata.category(str(char)) in ["Mn", "Mc", "Me"]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
463
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
464 def __isSymbol(self, char):
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
465 """
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
466 Private method to check, if a character is a symbol.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
467
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
468 @param char character to test (one character string)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
469 @return flag indicating a symbol (boolean)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
470 """
4467
fc6f2095a423 Fixed several issues with the symbols viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
471 return unicodedata.category(str(char)) in ["Sm", "Sc", "Sk", "So"]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
472
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
473 def __isPunct(self, char):
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
474 """
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
475 Private method to check, if a character is a punctuation character.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
476
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
477 @param char character to test (one character string)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
478 @return flag indicating a punctuation character (boolean)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
479 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
480 return unicodedata.category(str(char)) in [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
481 "Pc",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
482 "Pd",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
483 "Ps",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
484 "Pe",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
485 "Pi",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
486 "Pf",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
487 "Po",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
488 ]
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
489
4467
fc6f2095a423 Fixed several issues with the symbols viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
490 def getLocale(self):
fc6f2095a423 Fixed several issues with the symbols viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
491 """
fc6f2095a423 Fixed several issues with the symbols viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
492 Public method to get the used locale.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
493
4467
fc6f2095a423 Fixed several issues with the symbols viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
494 @return used locale
fc6f2095a423 Fixed several issues with the symbols viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
495 @rtype QLocale
fc6f2095a423 Fixed several issues with the symbols viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
496 """
fc6f2095a423 Fixed several issues with the symbols viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
497 return self.__locale
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
498
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
499
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
500 class SymbolsWidget(QWidget, Ui_SymbolsWidget):
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
501 """
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
502 Class implementing a widget to select a symbol in various formats.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
503
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
504 @signal insertSymbol(str) emitted after the user has selected a symbol
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
505 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
506
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
507 insertSymbol = pyqtSignal(str)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
508
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
509 def __init__(self, parent=None):
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
510 """
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
511 Constructor
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
512
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
513 @param parent reference to the parent widget (QWidget)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
514 """
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
515 super().__init__(parent)
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
516 self.setupUi(self)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
517
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
518 self.setWindowIcon(EricPixmapCache.getIcon("eric"))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
519
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
520 self.__model = SymbolsModel(self)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
521 self.symbolsTable.setModel(self.__model)
366
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
522 self.symbolsTable.selectionModel().currentRowChanged.connect(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
523 self.__currentRowChanged
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
524 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
525
7198
684261ef2165 Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7192
diff changeset
526 self.symbolsTable.horizontalHeader().setSectionResizeMode(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
527 QHeaderView.ResizeMode.Fixed
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
528 )
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
529 fm = self.fontMetrics()
9482
a2bc06a54d9d Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
530 em = fm.horizontalAdvance("M")
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
531 self.symbolsTable.horizontalHeader().resizeSection(0, em * 5)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
532 self.symbolsTable.horizontalHeader().resizeSection(1, em * 5)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
533 self.symbolsTable.horizontalHeader().resizeSection(2, em * 6)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
534 self.symbolsTable.horizontalHeader().resizeSection(3, em * 8)
366
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
535 self.symbolsTable.horizontalHeader().resizeSection(4, em * 85)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
536 self.symbolsTable.verticalHeader().setDefaultSectionSize(fm.height() + 4)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
537
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
538 tableIndex = int(Preferences.getSettings().value("Symbols/CurrentTable", 1))
366
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
539 self.tableCombo.addItems(self.__model.getTableNames())
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
540 self.tableCombo.setCurrentIndex(tableIndex)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
541
366
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
542 index = self.__model.index(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
543 int(Preferences.getSettings().value("Symbols/Top", 0)), 0
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
544 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
545 self.symbolsTable.scrollTo(index, QAbstractItemView.ScrollHint.PositionAtTop)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3012
diff changeset
546 self.symbolsTable.selectionModel().setCurrentIndex(
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3012
diff changeset
547 index,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
548 QItemSelectionModel.SelectionFlag.SelectCurrent
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
549 | QItemSelectionModel.SelectionFlag.Rows,
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
550 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
551
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
552 @pyqtSlot(QModelIndex)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
553 def on_symbolsTable_activated(self, index):
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
554 """
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
555 Private slot to signal the selection of a symbol.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
556
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
557 @param index index of the selected symbol (QModelIndex)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
558 """
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
559 txt = self.__model.data(index)
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
560 if txt:
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
561 self.insertSymbol.emit(txt)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
562
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
563 @pyqtSlot()
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
564 def on_symbolSpinBox_editingFinished(self):
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
565 """
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
566 Private slot to move the table to the entered symbol id.
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
567 """
5603
4f2dd0850803 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
568 symbolId = self.symbolSpinBox.value()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
569 first, last = self.__model.getTableBoundaries(self.__model.getTableIndex())
5603
4f2dd0850803 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
570 row = symbolId - first
367
e66ebdb3b6a2 Corrected a few things in the new symbols widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 366
diff changeset
571 self.symbolsTable.selectRow(row)
365
0686ac00256e Added a symbols viewer with capability to insert the selected symbol by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
572 self.symbolsTable.scrollTo(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
573 self.__model.index(row, 0), QAbstractItemView.ScrollHint.PositionAtCenter
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
574 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
575
366
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
576 @pyqtSlot(int)
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
577 def on_tableCombo_currentIndexChanged(self, index):
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
578 """
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
579 Private slot to select the current character table.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
580
366
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
581 @param index index of the character table (integer)
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
582 """
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
583 self.symbolsTable.setUpdatesEnabled(False)
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
584 self.__model.selectTable(index)
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
585 self.symbolsTable.setUpdatesEnabled(True)
4467
fc6f2095a423 Fixed several issues with the symbols viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
586 self.symbolsTable.resizeColumnsToContents()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
587
366
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
588 first, last = self.__model.getTableBoundaries(index)
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
589 self.symbolSpinBox.setMinimum(first)
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
590 self.symbolSpinBox.setMaximum(last)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
591
8637
394377638256 Replaced the direct access to 'Preferences.Prefs.settings' with 'Preferences.getSettings()'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
592 Preferences.getSettings().setValue("Symbols/CurrentTable", index)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
593
366
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
594 def __currentRowChanged(self, current, previous):
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
595 """
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
596 Private slot recording the currently selected row.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
597
366
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
598 @param current current index (QModelIndex)
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
599 @param previous previous current index (QModelIndex)
58f2122a5d6a Changed the symbol table to just show characters of a selectable character table.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
600 """
8637
394377638256 Replaced the direct access to 'Preferences.Prefs.settings' with 'Preferences.getSettings()'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
601 Preferences.getSettings().setValue("Symbols/Top", current.row())
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
602 self.symbolSpinBox.setValue(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
603 self.__model.getLocale().toInt(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
604 self.__model.data(self.__model.index(current.row(), 0))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
605 )[0]
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
606 )

eric ide

mercurial