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, qVersion, QProcess, QByteArray |
16 from PyQt4.QtGui import QWidget, QDialog, QInputDialog, QApplication, QClipboard, \ |
16 from PyQt4.QtGui import QWidget, QDialog, QInputDialog, QApplication, \ |
17 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 |
21 |
21 |
22 from .Ui_QRegularExpressionWizardDialog import Ui_QRegularExpressionWizardDialog |
22 from .Ui_QRegularExpressionWizardDialog import \ |
|
23 Ui_QRegularExpressionWizardDialog |
23 |
24 |
24 import UI.PixmapCache |
25 import UI.PixmapCache |
25 |
26 |
26 import Utilities |
27 import Utilities |
27 import Preferences |
28 import Preferences |
28 |
29 |
29 |
30 |
30 class QRegularExpressionWizardWidget(QWidget, Ui_QRegularExpressionWizardDialog): |
31 class QRegularExpressionWizardWidget(QWidget, |
|
32 Ui_QRegularExpressionWizardDialog): |
31 """ |
33 """ |
32 Class implementing the QRegularExpression wizard dialog. |
34 Class implementing the QRegularExpression wizard dialog. |
33 """ |
35 """ |
34 def __init__(self, parent=None, fromEric=True): |
36 def __init__(self, parent=None, fromEric=True): |
35 """ |
37 """ |
45 self.commentButton.setIcon(UI.PixmapCache.getIcon("comment.png")) |
47 self.commentButton.setIcon(UI.PixmapCache.getIcon("comment.png")) |
46 self.charButton.setIcon(UI.PixmapCache.getIcon("characters.png")) |
48 self.charButton.setIcon(UI.PixmapCache.getIcon("characters.png")) |
47 self.anycharButton.setIcon(UI.PixmapCache.getIcon("anychar.png")) |
49 self.anycharButton.setIcon(UI.PixmapCache.getIcon("anychar.png")) |
48 self.repeatButton.setIcon(UI.PixmapCache.getIcon("repeat.png")) |
50 self.repeatButton.setIcon(UI.PixmapCache.getIcon("repeat.png")) |
49 self.nonGroupButton.setIcon(UI.PixmapCache.getIcon("nongroup.png")) |
51 self.nonGroupButton.setIcon(UI.PixmapCache.getIcon("nongroup.png")) |
50 self.atomicGroupButton.setIcon(UI.PixmapCache.getIcon("atomicgroup.png")) |
52 self.atomicGroupButton.setIcon( |
|
53 UI.PixmapCache.getIcon("atomicgroup.png")) |
51 self.groupButton.setIcon(UI.PixmapCache.getIcon("group.png")) |
54 self.groupButton.setIcon(UI.PixmapCache.getIcon("group.png")) |
52 self.namedGroupButton.setIcon(UI.PixmapCache.getIcon("namedgroup.png")) |
55 self.namedGroupButton.setIcon(UI.PixmapCache.getIcon("namedgroup.png")) |
53 self.namedReferenceButton.setIcon(UI.PixmapCache.getIcon("namedreference.png")) |
56 self.namedReferenceButton.setIcon( |
|
57 UI.PixmapCache.getIcon("namedreference.png")) |
54 self.altnButton.setIcon(UI.PixmapCache.getIcon("altn.png")) |
58 self.altnButton.setIcon(UI.PixmapCache.getIcon("altn.png")) |
55 self.beglineButton.setIcon(UI.PixmapCache.getIcon("begline.png")) |
59 self.beglineButton.setIcon(UI.PixmapCache.getIcon("begline.png")) |
56 self.endlineButton.setIcon(UI.PixmapCache.getIcon("endline.png")) |
60 self.endlineButton.setIcon(UI.PixmapCache.getIcon("endline.png")) |
57 self.wordboundButton.setIcon(UI.PixmapCache.getIcon("wordboundary.png")) |
61 self.wordboundButton.setIcon( |
58 self.nonwordboundButton.setIcon(UI.PixmapCache.getIcon("nonwordboundary.png")) |
62 UI.PixmapCache.getIcon("wordboundary.png")) |
59 self.poslookaheadButton.setIcon(UI.PixmapCache.getIcon("poslookahead.png")) |
63 self.nonwordboundButton.setIcon( |
60 self.neglookaheadButton.setIcon(UI.PixmapCache.getIcon("neglookahead.png")) |
64 UI.PixmapCache.getIcon("nonwordboundary.png")) |
61 self.poslookbehindButton.setIcon(UI.PixmapCache.getIcon("poslookbehind.png")) |
65 self.poslookaheadButton.setIcon( |
62 self.neglookbehindButton.setIcon(UI.PixmapCache.getIcon("neglookbehind.png")) |
66 UI.PixmapCache.getIcon("poslookahead.png")) |
|
67 self.neglookaheadButton.setIcon( |
|
68 UI.PixmapCache.getIcon("neglookahead.png")) |
|
69 self.poslookbehindButton.setIcon( |
|
70 UI.PixmapCache.getIcon("poslookbehind.png")) |
|
71 self.neglookbehindButton.setIcon( |
|
72 UI.PixmapCache.getIcon("neglookbehind.png")) |
63 self.undoButton.setIcon(UI.PixmapCache.getIcon("editUndo.png")) |
73 self.undoButton.setIcon(UI.PixmapCache.getIcon("editUndo.png")) |
64 self.redoButton.setIcon(UI.PixmapCache.getIcon("editRedo.png")) |
74 self.redoButton.setIcon(UI.PixmapCache.getIcon("editRedo.png")) |
65 |
75 |
66 self.namedGroups = re.compile(r"""\(?P<([^>]+)>""").findall |
76 self.namedGroups = re.compile(r"""\(?P<([^>]+)>""").findall |
67 |
77 |
68 # start the PyQt5 server part |
78 # start the PyQt5 server part |
69 self.__pyqt5Available = False |
79 self.__pyqt5Available = False |
70 self.__pyqt5Server = QProcess(self) |
80 self.__pyqt5Server = QProcess(self) |
71 self.__pyqt5Server.start(sys.executable, [ |
81 self.__pyqt5Server.start( |
72 os.path.join(os.path.dirname(__file__), "QRegularExpressionWizardServer.py")]) |
82 sys.executable, [os.path.join( |
|
83 os.path.dirname(__file__), "QRegularExpressionWizardServer.py") |
|
84 ]) |
73 if self.__pyqt5Server.waitForStarted(5000): |
85 if self.__pyqt5Server.waitForStarted(5000): |
74 self.__pyqt5Server.setReadChannel(QProcess.StandardOutput) |
86 self.__pyqt5Server.setReadChannel(QProcess.StandardOutput) |
75 if self.__sendCommand("available"): |
87 if self.__sendCommand("available"): |
76 response = self.__receiveResponse() |
88 response = self.__receiveResponse() |
77 if response and response["available"]: |
89 if response and response["available"]: |
78 self.__pyqt5Available = True |
90 self.__pyqt5Available = True |
79 |
91 |
80 self.saveButton = \ |
92 self.saveButton = self.buttonBox.addButton( |
81 self.buttonBox.addButton(self.trUtf8("Save"), QDialogButtonBox.ActionRole) |
93 self.trUtf8("Save"), QDialogButtonBox.ActionRole) |
82 self.saveButton.setToolTip(self.trUtf8("Save the regular expression to a file")) |
94 self.saveButton.setToolTip( |
83 self.loadButton = \ |
95 self.trUtf8("Save the regular expression to a file")) |
84 self.buttonBox.addButton(self.trUtf8("Load"), QDialogButtonBox.ActionRole) |
96 self.loadButton = self.buttonBox.addButton( |
85 self.loadButton.setToolTip(self.trUtf8("Load a regular expression from a file")) |
97 self.trUtf8("Load"), QDialogButtonBox.ActionRole) |
|
98 self.loadButton.setToolTip( |
|
99 self.trUtf8("Load a regular expression from a file")) |
86 if qVersion() >= "5.0.0" and self.__pyqt5Available: |
100 if qVersion() >= "5.0.0" and self.__pyqt5Available: |
87 self.validateButton = self.buttonBox.addButton( |
101 self.validateButton = self.buttonBox.addButton( |
88 self.trUtf8("Validate"), QDialogButtonBox.ActionRole) |
102 self.trUtf8("Validate"), QDialogButtonBox.ActionRole) |
89 self.validateButton.setToolTip(self.trUtf8("Validate the regular expression")) |
103 self.validateButton.setToolTip( |
|
104 self.trUtf8("Validate the regular expression")) |
90 self.executeButton = self.buttonBox.addButton( |
105 self.executeButton = self.buttonBox.addButton( |
91 self.trUtf8("Execute"), QDialogButtonBox.ActionRole) |
106 self.trUtf8("Execute"), QDialogButtonBox.ActionRole) |
92 self.executeButton.setToolTip(self.trUtf8("Execute the regular expression")) |
107 self.executeButton.setToolTip( |
|
108 self.trUtf8("Execute the regular expression")) |
93 self.nextButton = self.buttonBox.addButton( |
109 self.nextButton = self.buttonBox.addButton( |
94 self.trUtf8("Next match"), QDialogButtonBox.ActionRole) |
110 self.trUtf8("Next match"), QDialogButtonBox.ActionRole) |
95 self.nextButton.setToolTip( |
111 self.nextButton.setToolTip( |
96 self.trUtf8("Show the next match of the regular expression")) |
112 self.trUtf8("Show the next match of the regular expression")) |
97 self.nextButton.setEnabled(False) |
113 self.nextButton.setEnabled(False) |
383 if not ext: |
404 if not ext: |
384 ex = selectedFilter.split("(*")[1].split(")")[0] |
405 ex = selectedFilter.split("(*")[1].split(")")[0] |
385 if ex: |
406 if ex: |
386 fname += ex |
407 fname += ex |
387 if QFileInfo(fname).exists(): |
408 if QFileInfo(fname).exists(): |
388 res = E5MessageBox.yesNo(self, |
409 res = E5MessageBox.yesNo( |
|
410 self, |
389 self.trUtf8("Save regular expression"), |
411 self.trUtf8("Save regular expression"), |
390 self.trUtf8("<p>The file <b>{0}</b> already exists." |
412 self.trUtf8("<p>The file <b>{0}</b> already exists." |
391 " Overwrite it?</p>").format(fname), |
413 " Overwrite it?</p>").format(fname), |
392 icon=E5MessageBox.Warning) |
414 icon=E5MessageBox.Warning) |
393 if not res: |
415 if not res: |
394 return |
416 return |
395 |
417 |
396 try: |
418 try: |
397 f = open(Utilities.toNativeSeparators(fname), "w", encoding="utf-8") |
419 f = open( |
|
420 Utilities.toNativeSeparators(fname), "w", encoding="utf-8") |
398 f.write(self.regexpTextEdit.toPlainText()) |
421 f.write(self.regexpTextEdit.toPlainText()) |
399 f.close() |
422 f.close() |
400 except IOError as err: |
423 except IOError as err: |
401 E5MessageBox.information(self, |
424 E5MessageBox.information( |
|
425 self, |
402 self.trUtf8("Save regular expression"), |
426 self.trUtf8("Save regular expression"), |
403 self.trUtf8("""<p>The regular expression could not be saved.</p>""" |
427 self.trUtf8("""<p>The regular expression could not""" |
404 """<p>Reason: {0}</p>""").format(str(err))) |
428 """ be saved.</p><p>Reason: {0}</p>""") |
|
429 .format(str(err))) |
405 |
430 |
406 @pyqtSlot() |
431 @pyqtSlot() |
407 def on_loadButton_clicked(self): |
432 def on_loadButton_clicked(self): |
408 """ |
433 """ |
409 Private slot to load a QRegularExpression from a file. |
434 Private slot to load a QRegularExpression from a file. |
413 self.trUtf8("Load regular expression"), |
438 self.trUtf8("Load regular expression"), |
414 "", |
439 "", |
415 self.trUtf8("RegExp Files (*.rx);;All Files (*)")) |
440 self.trUtf8("RegExp Files (*.rx);;All Files (*)")) |
416 if fname: |
441 if fname: |
417 try: |
442 try: |
418 f = open(Utilities.toNativeSeparators(fname), "r", encoding="utf-8") |
443 f = open( |
|
444 Utilities.toNativeSeparators(fname), "r", encoding="utf-8") |
419 regexp = f.read() |
445 regexp = f.read() |
420 f.close() |
446 f.close() |
421 self.regexpTextEdit.setPlainText(regexp) |
447 self.regexpTextEdit.setPlainText(regexp) |
422 except IOError as err: |
448 except IOError as err: |
423 E5MessageBox.information(self, |
449 E5MessageBox.information( |
|
450 self, |
424 self.trUtf8("Save regular expression"), |
451 self.trUtf8("Save regular expression"), |
425 self.trUtf8("""<p>The regular expression could not be saved.</p>""" |
452 self.trUtf8("""<p>The regular expression could not""" |
426 """<p>Reason: {0}</p>""").format(str(err))) |
453 """ be saved.</p><p>Reason: {0}</p>""") |
|
454 .format(str(err))) |
427 |
455 |
428 @pyqtSlot() |
456 @pyqtSlot() |
429 def on_copyButton_clicked(self): |
457 def on_copyButton_clicked(self): |
430 """ |
458 """ |
431 Private slot to copy the QRegularExpression string into the clipboard. |
459 Private slot to copy the QRegularExpression string into the clipboard. |
469 |
497 |
470 if self.__sendCommand("validate", options=options, regexp=regexp): |
498 if self.__sendCommand("validate", options=options, regexp=regexp): |
471 response = self.__receiveResponse() |
499 response = self.__receiveResponse() |
472 if response and "valid" in response: |
500 if response and "valid" in response: |
473 if response["valid"]: |
501 if response["valid"]: |
474 E5MessageBox.information(self, |
502 E5MessageBox.information( |
|
503 self, |
475 self.trUtf8("Validation"), |
504 self.trUtf8("Validation"), |
476 self.trUtf8("""The regular expression is valid.""")) |
505 self.trUtf8( |
|
506 """The regular expression is valid.""")) |
477 else: |
507 else: |
478 E5MessageBox.critical(self, |
508 E5MessageBox.critical( |
|
509 self, |
479 self.trUtf8("Error"), |
510 self.trUtf8("Error"), |
480 self.trUtf8("""Invalid regular expression: {0}""") |
511 self.trUtf8("""Invalid regular expression: {0}""") |
481 .format(response["errorMessage"])) |
512 .format(response["errorMessage"])) |
482 # move cursor to error offset |
513 # move cursor to error offset |
483 offset = response["errorOffset"] |
514 offset = response["errorOffset"] |
484 tc = self.regexpTextEdit.textCursor() |
515 tc = self.regexpTextEdit.textCursor() |
485 tc.setPosition(offset) |
516 tc.setPosition(offset) |
486 self.regexpTextEdit.setTextCursor(tc) |
517 self.regexpTextEdit.setTextCursor(tc) |
487 self.regexpTextEdit.setFocus() |
518 self.regexpTextEdit.setFocus() |
488 return |
519 return |
489 else: |
520 else: |
490 E5MessageBox.critical(self, |
521 E5MessageBox.critical( |
|
522 self, |
491 self.trUtf8("Communication Error"), |
523 self.trUtf8("Communication Error"), |
492 self.trUtf8("""Invalid response received from PyQt5 backend.""")) |
524 self.trUtf8("""Invalid response received from""" |
|
525 """ PyQt5 backend.""")) |
493 else: |
526 else: |
494 E5MessageBox.critical(self, |
527 E5MessageBox.critical( |
|
528 self, |
495 self.trUtf8("Communication Error"), |
529 self.trUtf8("Communication Error"), |
496 self.trUtf8("""Communication with PyQt5 backend failed.""")) |
530 self.trUtf8("""Communication with PyQt5 backend""" |
|
531 """ failed.""")) |
497 else: |
532 else: |
498 E5MessageBox.critical(self, |
533 E5MessageBox.critical( |
|
534 self, |
499 self.trUtf8("Error"), |
535 self.trUtf8("Error"), |
500 self.trUtf8("""A regular expression must be given.""")) |
536 self.trUtf8("""A regular expression must be given.""")) |
501 |
537 |
502 @pyqtSlot() |
538 @pyqtSlot() |
503 def on_executeButton_clicked(self, startpos=0): |
539 def on_executeButton_clicked(self, startpos=0): |
504 """ |
540 """ |
505 Private slot to execute the entered QRegularExpression on the test text. |
541 Private slot to execute the entered QRegularExpression on the test |
506 |
542 text. |
507 This slot will execute the entered QRegularExpression on the entered test |
543 |
508 data and will display the result in the table part of the dialog. |
544 This slot will execute the entered QRegularExpression on the entered |
|
545 test data and will display the result in the table part of the dialog. |
509 |
546 |
510 @param startpos starting position for the QRegularExpression matching |
547 @param startpos starting position for the QRegularExpression matching |
511 """ |
548 """ |
512 if qVersion() < "5.0.0" or not self.__pyqt5Available: |
549 if qVersion() < "5.0.0" or not self.__pyqt5Available: |
513 # only available for Qt5 |
550 # only available for Qt5 |
535 if self.__sendCommand("execute", options=options, regexp=regexp, |
572 if self.__sendCommand("execute", options=options, regexp=regexp, |
536 text=text, startpos=startpos): |
573 text=text, startpos=startpos): |
537 response = self.__receiveResponse() |
574 response = self.__receiveResponse() |
538 if response and ("valid" in response or "matched" in response): |
575 if response and ("valid" in response or "matched" in response): |
539 if "valid" in response: |
576 if "valid" in response: |
540 E5MessageBox.critical(self, |
577 E5MessageBox.critical( |
|
578 self, |
541 self.trUtf8("Error"), |
579 self.trUtf8("Error"), |
542 self.trUtf8("""Invalid regular expression: {0}""") |
580 self.trUtf8("""Invalid regular expression: {0}""") |
543 .format(response["errorMessage"])) |
581 .format(response["errorMessage"])) |
544 # move cursor to error offset |
582 # move cursor to error offset |
545 offset = response["errorOffset"] |
583 offset = response["errorOffset"] |
546 tc = self.regexpTextEdit.textCursor() |
584 tc = self.regexpTextEdit.textCursor() |
547 tc.setPosition(offset) |
585 tc.setPosition(offset) |
548 self.regexpTextEdit.setTextCursor(tc) |
586 self.regexpTextEdit.setTextCursor(tc) |
565 # index 0 is the complete match |
603 # index 0 is the complete match |
566 offset = captures[0][1] |
604 offset = captures[0][1] |
567 self.lastMatchEnd = captures[0][2] |
605 self.lastMatchEnd = captures[0][2] |
568 self.nextButton.setEnabled(True) |
606 self.nextButton.setEnabled(True) |
569 row += 1 |
607 row += 1 |
570 self.resultTable.setItem(row, 0, |
608 self.resultTable.setItem( |
|
609 row, 0, |
571 QTableWidgetItem(self.trUtf8("Offset"))) |
610 QTableWidgetItem(self.trUtf8("Offset"))) |
572 self.resultTable.setItem(row, 1, |
611 self.resultTable.setItem( |
|
612 row, 1, |
573 QTableWidgetItem("{0:d}".format(offset))) |
613 QTableWidgetItem("{0:d}".format(offset))) |
574 |
614 |
575 row += 1 |
615 row += 1 |
576 self.resultTable.setItem(row, 0, |
616 self.resultTable.setItem( |
|
617 row, 0, |
577 QTableWidgetItem(self.trUtf8("Captures"))) |
618 QTableWidgetItem(self.trUtf8("Captures"))) |
578 self.resultTable.setItem(row, 1, |
619 self.resultTable.setItem( |
579 QTableWidgetItem("{0:d}".format(len(captures) - 1))) |
620 row, 1, |
|
621 QTableWidgetItem( |
|
622 "{0:d}".format(len(captures) - 1))) |
580 row += 1 |
623 row += 1 |
581 self.resultTable.setItem(row, 1, |
624 self.resultTable.setItem( |
|
625 row, 1, |
582 QTableWidgetItem(self.trUtf8("Text"))) |
626 QTableWidgetItem(self.trUtf8("Text"))) |
583 self.resultTable.setItem(row, 2, |
627 self.resultTable.setItem( |
|
628 row, 2, |
584 QTableWidgetItem(self.trUtf8("Characters"))) |
629 QTableWidgetItem(self.trUtf8("Characters"))) |
585 |
630 |
586 row += 1 |
631 row += 1 |
587 self.resultTable.setItem(row, 0, |
632 self.resultTable.setItem( |
|
633 row, 0, |
588 QTableWidgetItem(self.trUtf8("Match"))) |
634 QTableWidgetItem(self.trUtf8("Match"))) |
589 self.resultTable.setItem(row, 1, |
635 self.resultTable.setItem( |
|
636 row, 1, |
590 QTableWidgetItem(captures[0][0])) |
637 QTableWidgetItem(captures[0][0])) |
591 self.resultTable.setItem(row, 2, |
638 self.resultTable.setItem( |
592 QTableWidgetItem("{0:d}".format(captures[0][3]))) |
639 row, 2, |
|
640 QTableWidgetItem( |
|
641 "{0:d}".format(captures[0][3]))) |
593 |
642 |
594 for i in range(1, len(captures)): |
643 for i in range(1, len(captures)): |
595 if captures[i][0]: |
644 if captures[i][0]: |
596 row += 1 |
645 row += 1 |
597 self.resultTable.insertRow(row) |
646 self.resultTable.insertRow(row) |
598 self.resultTable.setItem(row, 0, |
647 self.resultTable.setItem( |
|
648 row, 0, |
599 QTableWidgetItem( |
649 QTableWidgetItem( |
600 self.trUtf8("Capture #{0}").format(i))) |
650 self.trUtf8("Capture #{0}") |
601 self.resultTable.setItem(row, 1, |
651 .format(i))) |
|
652 self.resultTable.setItem( |
|
653 row, 1, |
602 QTableWidgetItem(captures[i][0])) |
654 QTableWidgetItem(captures[i][0])) |
603 self.resultTable.setItem(row, 2, |
655 self.resultTable.setItem( |
604 QTableWidgetItem("{0:d}".format(captures[i][3]))) |
656 row, 2, |
|
657 QTableWidgetItem( |
|
658 "{0:d}".format(captures[i][3]))) |
605 |
659 |
606 # highlight the matched text |
660 # highlight the matched text |
607 tc = self.textTextEdit.textCursor() |
661 tc = self.textTextEdit.textCursor() |
608 tc.setPosition(offset) |
662 tc.setPosition(offset) |
609 tc.setPosition(self.lastMatchEnd, QTextCursor.KeepAnchor) |
663 tc.setPosition( |
|
664 self.lastMatchEnd, QTextCursor.KeepAnchor) |
610 self.textTextEdit.setTextCursor(tc) |
665 self.textTextEdit.setTextCursor(tc) |
611 else: |
666 else: |
612 self.nextButton.setEnabled(False) |
667 self.nextButton.setEnabled(False) |
613 self.resultTable.setRowCount(2) |
668 self.resultTable.setRowCount(2) |
614 row += 1 |
669 row += 1 |
615 if startpos > 0: |
670 if startpos > 0: |
616 self.resultTable.setItem(row, 0, |
671 self.resultTable.setItem( |
617 QTableWidgetItem(self.trUtf8("No more matches"))) |
672 row, 0, |
|
673 QTableWidgetItem( |
|
674 self.trUtf8("No more matches"))) |
618 else: |
675 else: |
619 self.resultTable.setItem(row, 0, |
676 self.resultTable.setItem( |
620 QTableWidgetItem(self.trUtf8("No matches"))) |
677 row, 0, |
|
678 QTableWidgetItem( |
|
679 self.trUtf8("No matches"))) |
621 |
680 |
622 # remove the highlight |
681 # remove the highlight |
623 tc = self.textTextEdit.textCursor() |
682 tc = self.textTextEdit.textCursor() |
624 tc.setPosition(0) |
683 tc.setPosition(0) |
625 self.textTextEdit.setTextCursor(tc) |
684 self.textTextEdit.setTextCursor(tc) |
627 self.resultTable.resizeColumnsToContents() |
686 self.resultTable.resizeColumnsToContents() |
628 self.resultTable.resizeRowsToContents() |
687 self.resultTable.resizeRowsToContents() |
629 self.resultTable.verticalHeader().hide() |
688 self.resultTable.verticalHeader().hide() |
630 self.resultTable.horizontalHeader().hide() |
689 self.resultTable.horizontalHeader().hide() |
631 else: |
690 else: |
632 E5MessageBox.critical(self, |
691 E5MessageBox.critical( |
|
692 self, |
633 self.trUtf8("Communication Error"), |
693 self.trUtf8("Communication Error"), |
634 self.trUtf8("""Invalid response received from PyQt5 backend.""")) |
694 self.trUtf8("""Invalid response received from""" |
|
695 """ PyQt5 backend.""")) |
635 else: |
696 else: |
636 E5MessageBox.critical(self, |
697 E5MessageBox.critical( |
|
698 self, |
637 self.trUtf8("Communication Error"), |
699 self.trUtf8("Communication Error"), |
638 self.trUtf8("""Communication with PyQt5 backend failed.""")) |
700 self.trUtf8("""Communication with PyQt5""" |
|
701 """ backend failed.""")) |
639 else: |
702 else: |
640 E5MessageBox.critical(self, |
703 E5MessageBox.critical( |
|
704 self, |
641 self.trUtf8("Error"), |
705 self.trUtf8("Error"), |
642 self.trUtf8("""A regular expression and a text must be given.""")) |
706 self.trUtf8("""A regular expression and a text must""" |
|
707 """ be given.""")) |
643 |
708 |
644 @pyqtSlot() |
709 @pyqtSlot() |
645 def on_nextButton_clicked(self): |
710 def on_nextButton_clicked(self): |
646 """ |
711 """ |
647 Private slot to find the next match. |
712 Private slot to find the next match. |