Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardDialog.py

changeset 3213
95fbeca03619
parent 3190
a9a94491c4fd
child 3345
071afe8be2a1
equal deleted inserted replaced
3212:27a73942b8c8 3213:95fbeca03619
10 import os 10 import os
11 import re 11 import re
12 import sys 12 import sys
13 import json 13 import json
14 14
15 from PyQt4.QtCore import QFileInfo, pyqtSlot, qVersion, QProcess, QByteArray 15 from PyQt4.QtCore import QFileInfo, pyqtSlot, QProcess, QByteArray
16 from PyQt4.QtGui import QWidget, QDialog, QInputDialog, QApplication, \ 16 from PyQt4.QtGui import QWidget, QDialog, QInputDialog, QApplication, \
17 QClipboard, QTextCursor, QDialogButtonBox, QVBoxLayout, QTableWidgetItem 17 QClipboard, QTextCursor, QDialogButtonBox, QVBoxLayout, QTableWidgetItem
18 18
19 from E5Gui import E5MessageBox, E5FileDialog 19 from E5Gui import E5MessageBox, E5FileDialog
20 from E5Gui.E5MainWindow import E5MainWindow 20 from E5Gui.E5MainWindow import E5MainWindow
95 self.tr("Save the regular expression to a file")) 95 self.tr("Save the regular expression to a file"))
96 self.loadButton = self.buttonBox.addButton( 96 self.loadButton = self.buttonBox.addButton(
97 self.tr("Load"), QDialogButtonBox.ActionRole) 97 self.tr("Load"), QDialogButtonBox.ActionRole)
98 self.loadButton.setToolTip( 98 self.loadButton.setToolTip(
99 self.tr("Load a regular expression from a file")) 99 self.tr("Load a regular expression from a file"))
100 if qVersion() >= "5.0.0" and self.__pyqt5Available: 100 if self.__pyqt5Available:
101 self.validateButton = self.buttonBox.addButton( 101 self.validateButton = self.buttonBox.addButton(
102 self.tr("Validate"), QDialogButtonBox.ActionRole) 102 self.tr("Validate"), QDialogButtonBox.ActionRole)
103 self.validateButton.setToolTip( 103 self.validateButton.setToolTip(
104 self.tr("Validate the regular expression")) 104 self.tr("Validate the regular expression"))
105 self.executeButton = self.buttonBox.addButton( 105 self.executeButton = self.buttonBox.addButton(
472 @pyqtSlot() 472 @pyqtSlot()
473 def on_validateButton_clicked(self): 473 def on_validateButton_clicked(self):
474 """ 474 """
475 Private slot to validate the entered QRegularExpression. 475 Private slot to validate the entered QRegularExpression.
476 """ 476 """
477 if qVersion() < "5.0.0" or not self.__pyqt5Available: 477 if not self.__pyqt5Available:
478 # only available for Qt5 478 # only available for PyQt5
479 return 479 return
480 480
481 regexp = self.regexpTextEdit.toPlainText() 481 regexp = self.regexpTextEdit.toPlainText()
482 if regexp: 482 if regexp:
483 options = [] 483 options = []
545 This slot will execute the entered QRegularExpression on the entered 545 This slot will execute the entered QRegularExpression on the entered
546 test data and will display the result in the table part of the dialog. 546 test data and will display the result in the table part of the dialog.
547 547
548 @param startpos starting position for the QRegularExpression matching 548 @param startpos starting position for the QRegularExpression matching
549 """ 549 """
550 if qVersion() < "5.0.0" or not self.__pyqt5Available: 550 if not self.__pyqt5Available:
551 # only available for Qt5 551 # only available for PyQt5
552 return 552 return
553 553
554 regexp = self.regexpTextEdit.toPlainText() 554 regexp = self.regexpTextEdit.toPlainText()
555 text = self.textTextEdit.toPlainText() 555 text = self.textTextEdit.toPlainText()
556 if regexp and text: 556 if regexp and text:

eric ide

mercurial