43 super(PyRegExpWizardCharactersDialog, self).__init__(parent) |
43 super(PyRegExpWizardCharactersDialog, self).__init__(parent) |
44 self.setupUi(self) |
44 self.setupUi(self) |
45 |
45 |
46 self.comboItems = [] |
46 self.comboItems = [] |
47 self.singleComboItems = [] # these are in addition to the above |
47 self.singleComboItems = [] # these are in addition to the above |
48 self.comboItems.append(self.trUtf8("Normal character")) |
48 self.comboItems.append(self.tr("Normal character")) |
49 self.comboItems.append( |
49 self.comboItems.append( |
50 self.trUtf8("Unicode character in hexadecimal notation")) |
50 self.tr("Unicode character in hexadecimal notation")) |
51 self.comboItems.append( |
51 self.comboItems.append( |
52 self.trUtf8("Unicode character in octal notation")) |
52 self.tr("Unicode character in octal notation")) |
53 self.singleComboItems.append(self.trUtf8("---")) |
53 self.singleComboItems.append(self.tr("---")) |
54 self.singleComboItems.append(self.trUtf8("Bell character (\\a)")) |
54 self.singleComboItems.append(self.tr("Bell character (\\a)")) |
55 self.singleComboItems.append(self.trUtf8("Page break (\\f)")) |
55 self.singleComboItems.append(self.tr("Page break (\\f)")) |
56 self.singleComboItems.append(self.trUtf8("Line feed (\\n)")) |
56 self.singleComboItems.append(self.tr("Line feed (\\n)")) |
57 self.singleComboItems.append(self.trUtf8("Carriage return (\\r)")) |
57 self.singleComboItems.append(self.tr("Carriage return (\\r)")) |
58 self.singleComboItems.append(self.trUtf8("Horizontal tabulator (\\t)")) |
58 self.singleComboItems.append(self.tr("Horizontal tabulator (\\t)")) |
59 self.singleComboItems.append(self.trUtf8("Vertical tabulator (\\v)")) |
59 self.singleComboItems.append(self.tr("Vertical tabulator (\\v)")) |
60 |
60 |
61 self.charValidator = QRegExpValidator(QRegExp(".{0,1}"), self) |
61 self.charValidator = QRegExpValidator(QRegExp(".{0,1}"), self) |
62 self.hexValidator = QRegExpValidator(QRegExp("[0-9a-fA-F]{0,4}"), self) |
62 self.hexValidator = QRegExpValidator(QRegExp("[0-9a-fA-F]{0,4}"), self) |
63 self.octValidator = QRegExpValidator(QRegExp("[0-3]?[0-7]{0,2}"), self) |
63 self.octValidator = QRegExpValidator(QRegExp("[0-3]?[0-7]{0,2}"), self) |
64 |
64 |
85 hlayout0 = QHBoxLayout() |
85 hlayout0 = QHBoxLayout() |
86 hlayout0.setContentsMargins(0, 0, 0, 0) |
86 hlayout0.setContentsMargins(0, 0, 0, 0) |
87 hlayout0.setSpacing(6) |
87 hlayout0.setSpacing(6) |
88 hlayout0.setObjectName("hlayout0") |
88 hlayout0.setObjectName("hlayout0") |
89 self.moreSinglesButton = QPushButton( |
89 self.moreSinglesButton = QPushButton( |
90 self.trUtf8("Additional Entries"), self.singlesBox) |
90 self.tr("Additional Entries"), self.singlesBox) |
91 self.moreSinglesButton.setObjectName("moreSinglesButton") |
91 self.moreSinglesButton.setObjectName("moreSinglesButton") |
92 hlayout0.addWidget(self.moreSinglesButton) |
92 hlayout0.addWidget(self.moreSinglesButton) |
93 hspacer0 = QSpacerItem( |
93 hspacer0 = QSpacerItem( |
94 30, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) |
94 30, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) |
95 hlayout0.addItem(hspacer0) |
95 hlayout0.addItem(hspacer0) |
96 self.singlesBoxLayout.addLayout(hlayout0) |
96 self.singlesBoxLayout.addLayout(hlayout0) |
97 self.moreSinglesButton.clicked[()].connect(self.__addSinglesLine) |
97 self.moreSinglesButton.clicked.connect(self.__addSinglesLine) |
98 |
98 |
99 # generate dialog part for character ranges |
99 # generate dialog part for character ranges |
100 self.rangesBoxLayout = QVBoxLayout(self.rangesBox) |
100 self.rangesBoxLayout = QVBoxLayout(self.rangesBox) |
101 self.rangesBoxLayout.setObjectName("rangesBoxLayout") |
101 self.rangesBoxLayout.setObjectName("rangesBoxLayout") |
102 self.rangesBoxLayout.setSpacing(6) |
102 self.rangesBoxLayout.setSpacing(6) |
119 hlayout1 = QHBoxLayout() |
119 hlayout1 = QHBoxLayout() |
120 hlayout1.setContentsMargins(0, 0, 0, 0) |
120 hlayout1.setContentsMargins(0, 0, 0, 0) |
121 hlayout1.setSpacing(6) |
121 hlayout1.setSpacing(6) |
122 hlayout1.setObjectName("hlayout1") |
122 hlayout1.setObjectName("hlayout1") |
123 self.moreRangesButton = QPushButton( |
123 self.moreRangesButton = QPushButton( |
124 self.trUtf8("Additional Entries"), self.rangesBox) |
124 self.tr("Additional Entries"), self.rangesBox) |
125 self.moreSinglesButton.setObjectName("moreRangesButton") |
125 self.moreSinglesButton.setObjectName("moreRangesButton") |
126 hlayout1.addWidget(self.moreRangesButton) |
126 hlayout1.addWidget(self.moreRangesButton) |
127 hspacer1 = QSpacerItem( |
127 hspacer1 = QSpacerItem( |
128 30, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) |
128 30, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) |
129 hlayout1.addItem(hspacer1) |
129 hlayout1.addItem(hspacer1) |
130 self.rangesBoxLayout.addLayout(hlayout1) |
130 self.rangesBoxLayout.addLayout(hlayout1) |
131 self.moreRangesButton.clicked[()].connect(self.__addRangesLine) |
131 self.moreRangesButton.clicked.connect(self.__addRangesLine) |
132 |
132 |
133 def __addSinglesLine(self): |
133 def __addSinglesLine(self): |
134 """ |
134 """ |
135 Private slot to add a line of entry widgets for single characters. |
135 Private slot to add a line of entry widgets for single characters. |
136 """ |
136 """ |
177 hbox.setLayout(hboxLayout) |
177 hbox.setLayout(hboxLayout) |
178 cb1 = QComboBox(hbox) |
178 cb1 = QComboBox(hbox) |
179 cb1.setEditable(False) |
179 cb1.setEditable(False) |
180 cb1.addItems(self.comboItems) |
180 cb1.addItems(self.comboItems) |
181 hboxLayout.addWidget(cb1) |
181 hboxLayout.addWidget(cb1) |
182 l1 = QLabel(self.trUtf8("Between:"), hbox) |
182 l1 = QLabel(self.tr("Between:"), hbox) |
183 hboxLayout.addWidget(l1) |
183 hboxLayout.addWidget(l1) |
184 le1 = QLineEdit(hbox) |
184 le1 = QLineEdit(hbox) |
185 le1.setValidator(self.charValidator) |
185 le1.setValidator(self.charValidator) |
186 hboxLayout.addWidget(le1) |
186 hboxLayout.addWidget(le1) |
187 l2 = QLabel(self.trUtf8("And:"), hbox) |
187 l2 = QLabel(self.tr("And:"), hbox) |
188 hboxLayout.addWidget(l2) |
188 hboxLayout.addWidget(l2) |
189 le2 = QLineEdit(hbox) |
189 le2 = QLineEdit(hbox) |
190 le2.setValidator(self.charValidator) |
190 le2.setValidator(self.charValidator) |
191 hboxLayout.addWidget(le2) |
191 hboxLayout.addWidget(le2) |
192 self.rangesItemsBoxLayout.addWidget(hbox) |
192 self.rangesItemsBoxLayout.addWidget(hbox) |