5 |
5 |
6 """ |
6 """ |
7 Module implementing a dialog for entering character classes. |
7 Module implementing a dialog for entering character classes. |
8 """ |
8 """ |
9 |
9 |
10 |
10 from PyQt5.QtCore import QRegularExpression |
11 from PyQt5.QtCore import QRegExp |
11 from PyQt5.QtGui import QRegularExpressionValidator |
12 from PyQt5.QtGui import QRegExpValidator |
|
13 from PyQt5.QtWidgets import ( |
12 from PyQt5.QtWidgets import ( |
14 QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, QLineEdit, QPushButton, |
13 QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, QLineEdit, QPushButton, |
15 QDialog, QScrollArea, QComboBox, QVBoxLayout, QLabel |
14 QDialog, QScrollArea, QComboBox, QVBoxLayout, QLabel |
16 ) |
15 ) |
17 |
16 |
58 self.singleComboItems.append(self.tr("Line feed (\\n)")) |
57 self.singleComboItems.append(self.tr("Line feed (\\n)")) |
59 self.singleComboItems.append(self.tr("Carriage return (\\r)")) |
58 self.singleComboItems.append(self.tr("Carriage return (\\r)")) |
60 self.singleComboItems.append(self.tr("Horizontal tabulator (\\t)")) |
59 self.singleComboItems.append(self.tr("Horizontal tabulator (\\t)")) |
61 self.singleComboItems.append(self.tr("Vertical tabulator (\\v)")) |
60 self.singleComboItems.append(self.tr("Vertical tabulator (\\v)")) |
62 |
61 |
63 self.charValidator = QRegExpValidator(QRegExp(".{0,1}"), self) |
62 self.charValidator = QRegularExpressionValidator( |
64 self.hexValidator = QRegExpValidator(QRegExp("[0-9a-fA-F]{0,4}"), self) |
63 QRegularExpression(".{0,1}"), self) |
65 self.octValidator = QRegExpValidator(QRegExp("[0-3]?[0-7]{0,2}"), self) |
64 self.hexValidator = QRegularExpressionValidator( |
|
65 QRegularExpression("[0-9a-fA-F]{0,4}"), self) |
|
66 self.octValidator = QRegularExpressionValidator( |
|
67 QRegularExpression("[0-3]?[0-7]{0,2}"), self) |
66 |
68 |
67 # generate dialog part for single characters |
69 # generate dialog part for single characters |
68 self.singlesBoxLayout = QVBoxLayout(self.singlesBox) |
70 self.singlesBoxLayout = QVBoxLayout(self.singlesBox) |
69 self.singlesBoxLayout.setObjectName("singlesBoxLayout") |
71 self.singlesBoxLayout.setObjectName("singlesBoxLayout") |
70 self.singlesBoxLayout.setSpacing(6) |
72 self.singlesBoxLayout.setSpacing(6) |