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