From d5622a77aad3f770700a27d2409e2f8232304eb2 Mon Sep 17 00:00:00 2001 From: ritish Date: Mon, 11 Mar 2024 21:00:33 -0600 Subject: [PATCH 1/8] Purge old messages from mavlink debugger at repeated intervals --- pigeon/ui/ui.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pigeon/ui/ui.py b/pigeon/ui/ui.py index d2e5402..96d8e8e 100644 --- a/pigeon/ui/ui.py +++ b/pigeon/ui/ui.py @@ -2,6 +2,7 @@ import logging import signal as signal_ # For exiting pigeon from terminal from queue import Queue +from time import time from PyQt6 import QtCore, QtWidgets, QtGui @@ -161,6 +162,8 @@ def __init__(self) -> None: self.message_display = QtWidgets.QTextEdit(self) self.message_display.setReadOnly(True) + self.number_of_messages = 0 + self.current_message_number = 1 layout = QtWidgets.QVBoxLayout(self) layout.addWidget(self.message_display) @@ -170,7 +173,13 @@ def __init__(self) -> None: def handleMessage(self, message: MavlinkMessage): current_time = message.time.strftime("%H:%M:%S") self.message_display.append( - f"Message: {message.type}, Received: {current_time}") + f"{self.current_message_number}. Message: {message.type}, Received: {current_time}" + ) + self.current_message_number += 1 + self.number_of_messages += 1 + if self.number_of_messages == 50000: + self.message_display.clear() + self.number_of_messages = 0 class AboutWindow(QtWidgets.QWidget): From b9f7dbbdf7aa9bf57be8bb7950e80cc50ea2cd55 Mon Sep 17 00:00:00 2001 From: ritish Date: Mon, 11 Mar 2024 21:05:49 -0600 Subject: [PATCH 2/8] Remove time.time from ui.py --- pigeon/ui/ui.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pigeon/ui/ui.py b/pigeon/ui/ui.py index 96d8e8e..21c3981 100644 --- a/pigeon/ui/ui.py +++ b/pigeon/ui/ui.py @@ -2,7 +2,6 @@ import logging import signal as signal_ # For exiting pigeon from terminal from queue import Queue -from time import time from PyQt6 import QtCore, QtWidgets, QtGui From d57cff5a7ff450dce12797a7d38bf78667f55a7f Mon Sep 17 00:00:00 2001 From: ritish Date: Mon, 11 Mar 2024 22:35:13 -0600 Subject: [PATCH 3/8] Switch Mavlink Debugger from QTextEdit to QTableWidget --- pigeon/ui/ui.py | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/pigeon/ui/ui.py b/pigeon/ui/ui.py index 21c3981..e900ba3 100644 --- a/pigeon/ui/ui.py +++ b/pigeon/ui/ui.py @@ -159,25 +159,52 @@ class MavLinkDebugger(QtWidgets.QWidget): def __init__(self) -> None: super().__init__() - self.message_display = QtWidgets.QTextEdit(self) - self.message_display.setReadOnly(True) + self.message_table = QtWidgets.QTableWidget(self) + self.message_table.setColumnCount(3) + self.message_table.setHorizontalHeaderLabels( + ["Message Number", "Message Type", "Received"]) + self.no_of_rows = 0 self.number_of_messages = 0 self.current_message_number = 1 layout = QtWidgets.QVBoxLayout(self) - layout.addWidget(self.message_display) + layout.addWidget(self.message_table) self.receive_message.connect(self.handleMessage) + def add_message(self, number, message_type, received): + row_position = self.message_table.rowCount() + self.message_table.insertRow(row_position) + + number_item = QtWidgets.QTableWidgetItem(str(number)) + number_item.setTextAlignment( + QtCore.Qt.AlignmentFlag.AlignCenter) # Align to cell center + number_item.setFlags( + number_item.flags() + & ~QtCore.Qt.ItemFlag.ItemIsEditable) # Make it read-only + self.message_table.setItem(row_position, 0, number_item) + + message_type_item = QtWidgets.QTableWidgetItem(message_type) + message_type_item.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + message_type_item.setFlags(message_type_item.flags() + & ~QtCore.Qt.ItemFlag.ItemIsEditable) + self.message_table.setItem(row_position, 1, message_type_item) + + received_item = QtWidgets.QTableWidgetItem(received) + received_item.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + received_item.setFlags(received_item.flags() + & ~QtCore.Qt.ItemFlag.ItemIsEditable) + self.message_table.setItem(row_position, 2, received_item) + def handleMessage(self, message: MavlinkMessage): current_time = message.time.strftime("%H:%M:%S") - self.message_display.append( - f"{self.current_message_number}. Message: {message.type}, Received: {current_time}" - ) + self.add_message(self.current_message_number, str(message.type), + current_time) self.current_message_number += 1 self.number_of_messages += 1 - if self.number_of_messages == 50000: - self.message_display.clear() + if self.number_of_messages == 1000: # Note: Every 1000th message wont be displayed since table gets cleared at that instance + self.message_table.clearContents() + self.message_table.setRowCount(0) self.number_of_messages = 0 From e7d58b7129130934b30382a8371c5b86c40617c9 Mon Sep 17 00:00:00 2001 From: ritish Date: Wed, 13 Mar 2024 01:46:27 -0600 Subject: [PATCH 4/8] Add ability to filter messages --- pigeon/ui/ui.py | 54 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/pigeon/ui/ui.py b/pigeon/ui/ui.py index e900ba3..f703aeb 100644 --- a/pigeon/ui/ui.py +++ b/pigeon/ui/ui.py @@ -166,13 +166,24 @@ def __init__(self) -> None: self.no_of_rows = 0 self.number_of_messages = 0 self.current_message_number = 1 + self.currently_filtering = False + + self.search_textbox = QtWidgets.QLineEdit(self) + self.search_textbox.setPlaceholderText("Enter word to search") + self.search_button = QtWidgets.QPushButton("Search", self) + self.search_button.clicked.connect(self.filter) + self.stop_search_button = QtWidgets.QPushButton("Stop Searching", self) + self.stop_search_button.clicked.connect(self.undoFilterHighlighting) layout = QtWidgets.QVBoxLayout(self) layout.addWidget(self.message_table) + layout.addWidget(self.search_textbox) + layout.addWidget(self.search_button) + layout.addWidget(self.stop_search_button) self.receive_message.connect(self.handleMessage) - def add_message(self, number, message_type, received): + def addMessage(self, number, message_type, received): row_position = self.message_table.rowCount() self.message_table.insertRow(row_position) @@ -183,23 +194,35 @@ def add_message(self, number, message_type, received): number_item.flags() & ~QtCore.Qt.ItemFlag.ItemIsEditable) # Make it read-only self.message_table.setItem(row_position, 0, number_item) + number_item.setBackground( + QtGui.QColor("black")) # Make the background color black message_type_item = QtWidgets.QTableWidgetItem(message_type) message_type_item.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) message_type_item.setFlags(message_type_item.flags() & ~QtCore.Qt.ItemFlag.ItemIsEditable) self.message_table.setItem(row_position, 1, message_type_item) + message_type_item.setBackground(QtGui.QColor("black")) received_item = QtWidgets.QTableWidgetItem(received) received_item.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) received_item.setFlags(received_item.flags() & ~QtCore.Qt.ItemFlag.ItemIsEditable) self.message_table.setItem(row_position, 2, received_item) + received_item.setBackground(QtGui.QColor("black")) + + text = self.search_textbox.text() + if text != '' and (text.lower() in message_type.lower() + or text.lower() in received.lower() + ) and (self.currently_filtering is True): + number_item.setBackground(QtGui.QColor("lightgreen")) + received_item.setBackground(QtGui.QColor("lightgreen")) + message_type_item.setBackground(QtGui.QColor("lightgreen")) def handleMessage(self, message: MavlinkMessage): current_time = message.time.strftime("%H:%M:%S") - self.add_message(self.current_message_number, str(message.type), - current_time) + self.addMessage(self.current_message_number, str(message.type), + current_time) self.current_message_number += 1 self.number_of_messages += 1 if self.number_of_messages == 1000: # Note: Every 1000th message wont be displayed since table gets cleared at that instance @@ -207,6 +230,31 @@ def handleMessage(self, message: MavlinkMessage): self.message_table.setRowCount(0) self.number_of_messages = 0 + def filter(self, query): + text = self.search_textbox.text() + self.currently_filtering = True + + if text != '': + for row in range(self.message_table.rowCount()): + item1 = self.message_table.item(row, 1) + item2 = self.message_table.item(row, 2) + + if (text.lower() in item1.text().lower() + or text.lower() in item2.text().lower()): + item1.setBackground(QtGui.QColor("lightgreen")) + item2.setBackground(QtGui.QColor("lightgreen")) + self.message_table.item(row, 0).setBackground( + QtGui.QColor("lightgreen")) + + def undoFilterHighlighting(self): + for row in range(self.message_table.rowCount()): + self.message_table.item(row, + 0).setBackground(QtGui.QColor("black")) + self.message_table.item(row, + 1).setBackground(QtGui.QColor("black")) + self.message_table.item(row, + 2).setBackground(QtGui.QColor("black")) + class AboutWindow(QtWidgets.QWidget): """ From 0ca0441f81d285ccdd72604ab9a4c0baa6771250 Mon Sep 17 00:00:00 2001 From: ritish Date: Thu, 14 Mar 2024 00:57:38 -0600 Subject: [PATCH 5/8] Minor changes --- pigeon/ui/ui.py | 64 ++++++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 25 deletions(-) diff --git a/pigeon/ui/ui.py b/pigeon/ui/ui.py index f703aeb..3304836 100644 --- a/pigeon/ui/ui.py +++ b/pigeon/ui/ui.py @@ -173,13 +173,16 @@ def __init__(self) -> None: self.search_button = QtWidgets.QPushButton("Search", self) self.search_button.clicked.connect(self.filter) self.stop_search_button = QtWidgets.QPushButton("Stop Searching", self) - self.stop_search_button.clicked.connect(self.undoFilterHighlighting) + self.stop_search_button.clicked.connect(self.undoSearch) layout = QtWidgets.QVBoxLayout(self) - layout.addWidget(self.message_table) layout.addWidget(self.search_textbox) layout.addWidget(self.search_button) layout.addWidget(self.stop_search_button) + layout.addWidget(self.message_table) + + self.stop_search_button.hide() # Should be visible only when search is active + self.search_textbox.returnPressed.connect(self.filter) self.receive_message.connect(self.handleMessage) @@ -194,30 +197,35 @@ def addMessage(self, number, message_type, received): number_item.flags() & ~QtCore.Qt.ItemFlag.ItemIsEditable) # Make it read-only self.message_table.setItem(row_position, 0, number_item) - number_item.setBackground( - QtGui.QColor("black")) # Make the background color black + # number_item.setBackground( + # QtGui.QColor("black")) # Make the background color black message_type_item = QtWidgets.QTableWidgetItem(message_type) message_type_item.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) message_type_item.setFlags(message_type_item.flags() & ~QtCore.Qt.ItemFlag.ItemIsEditable) self.message_table.setItem(row_position, 1, message_type_item) - message_type_item.setBackground(QtGui.QColor("black")) + # message_type_item.setBackground(QtGui.QColor("black")) received_item = QtWidgets.QTableWidgetItem(received) received_item.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) received_item.setFlags(received_item.flags() & ~QtCore.Qt.ItemFlag.ItemIsEditable) self.message_table.setItem(row_position, 2, received_item) - received_item.setBackground(QtGui.QColor("black")) + # received_item.setBackground(QtGui.QColor("black")) + + scrollbar = self.message_table.verticalScrollBar() + if scrollbar.value() == scrollbar.maximum(): # Automatically scroll with new rows if you're at the bottom of the table + self.message_table.scrollToBottom() text = self.search_textbox.text() - if text != '' and (text.lower() in message_type.lower() - or text.lower() in received.lower() + if text != '' and (text.lower() not in message_type.lower() + and text.lower() not in received.lower() ) and (self.currently_filtering is True): - number_item.setBackground(QtGui.QColor("lightgreen")) - received_item.setBackground(QtGui.QColor("lightgreen")) - message_type_item.setBackground(QtGui.QColor("lightgreen")) + # number_item.setBackground(QtGui.QColor("lightgreen")) + # received_item.setBackground(QtGui.QColor("lightgreen")) + # message_type_item.setBackground(QtGui.QColor("lightgreen")) + self.message_table.hideRow(row_position) def handleMessage(self, message: MavlinkMessage): current_time = message.time.strftime("%H:%M:%S") @@ -230,30 +238,36 @@ def handleMessage(self, message: MavlinkMessage): self.message_table.setRowCount(0) self.number_of_messages = 0 - def filter(self, query): + def filter(self): text = self.search_textbox.text() self.currently_filtering = True + self.stop_search_button.show() if text != '': for row in range(self.message_table.rowCount()): item1 = self.message_table.item(row, 1) item2 = self.message_table.item(row, 2) - if (text.lower() in item1.text().lower() - or text.lower() in item2.text().lower()): - item1.setBackground(QtGui.QColor("lightgreen")) - item2.setBackground(QtGui.QColor("lightgreen")) - self.message_table.item(row, 0).setBackground( - QtGui.QColor("lightgreen")) + if (text.lower() not in item1.text().lower() + and text.lower() not in item2.text().lower()): + # item1.setBackground(QtGui.QColor("lightgreen")) + # item2.setBackground(QtGui.QColor("lightgreen")) + # self.message_table.item(row, 0).setBackground( + # QtGui.QColor("lightgreen")) + self.message_table.hideRow(row) - def undoFilterHighlighting(self): + def undoSearch(self): for row in range(self.message_table.rowCount()): - self.message_table.item(row, - 0).setBackground(QtGui.QColor("black")) - self.message_table.item(row, - 1).setBackground(QtGui.QColor("black")) - self.message_table.item(row, - 2).setBackground(QtGui.QColor("black")) + # self.message_table.item(row, + # 0).setBackground(QtGui.QColor("black")) + # self.message_table.item(row, + # 1).setBackground(QtGui.QColor("black")) + # self.message_table.item(row, + # 2).setBackground(QtGui.QColor("black")) + self.message_table.showRow(row) + + self.currently_filtering = False + self.stop_search_button.hide() class AboutWindow(QtWidgets.QWidget): From c51a43aa83293881a0dd16a5cad791d6eb46b463 Mon Sep 17 00:00:00 2001 From: ritish Date: Thu, 14 Mar 2024 00:59:21 -0600 Subject: [PATCH 6/8] Run formatter and linter --- pigeon/ui/ui.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pigeon/ui/ui.py b/pigeon/ui/ui.py index 3304836..c75bc2f 100644 --- a/pigeon/ui/ui.py +++ b/pigeon/ui/ui.py @@ -181,7 +181,8 @@ def __init__(self) -> None: layout.addWidget(self.stop_search_button) layout.addWidget(self.message_table) - self.stop_search_button.hide() # Should be visible only when search is active + self.stop_search_button.hide( + ) # Should be visible only when search is active self.search_textbox.returnPressed.connect(self.filter) self.receive_message.connect(self.handleMessage) @@ -198,7 +199,7 @@ def addMessage(self, number, message_type, received): & ~QtCore.Qt.ItemFlag.ItemIsEditable) # Make it read-only self.message_table.setItem(row_position, 0, number_item) # number_item.setBackground( - # QtGui.QColor("black")) # Make the background color black + # QtGui.QColor("black")) # Make the background color black message_type_item = QtWidgets.QTableWidgetItem(message_type) message_type_item.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) @@ -213,15 +214,16 @@ def addMessage(self, number, message_type, received): & ~QtCore.Qt.ItemFlag.ItemIsEditable) self.message_table.setItem(row_position, 2, received_item) # received_item.setBackground(QtGui.QColor("black")) - + scrollbar = self.message_table.verticalScrollBar() - if scrollbar.value() == scrollbar.maximum(): # Automatically scroll with new rows if you're at the bottom of the table + if scrollbar.value() == scrollbar.maximum( + ): # Automatically scroll with new rows if you're at the bottom of the table self.message_table.scrollToBottom() text = self.search_textbox.text() if text != '' and (text.lower() not in message_type.lower() - and text.lower() not in received.lower() - ) and (self.currently_filtering is True): + and text.lower() not in received.lower()) and ( + self.currently_filtering is True): # number_item.setBackground(QtGui.QColor("lightgreen")) # received_item.setBackground(QtGui.QColor("lightgreen")) # message_type_item.setBackground(QtGui.QColor("lightgreen")) @@ -265,7 +267,7 @@ def undoSearch(self): # self.message_table.item(row, # 2).setBackground(QtGui.QColor("black")) self.message_table.showRow(row) - + self.currently_filtering = False self.stop_search_button.hide() From 001480985e0818164d6c3b2611fdec7f644187ba Mon Sep 17 00:00:00 2001 From: ritish Date: Thu, 14 Mar 2024 12:43:14 -0600 Subject: [PATCH 7/8] Add additional feaatures to Mavlink debugger Switch from QTextEdit to QTableWidget Add ability to search/filter messages Message Box now scrolls with new rows --- pigeon/ui/ui.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/pigeon/ui/ui.py b/pigeon/ui/ui.py index c75bc2f..4f490dd 100644 --- a/pigeon/ui/ui.py +++ b/pigeon/ui/ui.py @@ -198,22 +198,18 @@ def addMessage(self, number, message_type, received): number_item.flags() & ~QtCore.Qt.ItemFlag.ItemIsEditable) # Make it read-only self.message_table.setItem(row_position, 0, number_item) - # number_item.setBackground( - # QtGui.QColor("black")) # Make the background color black message_type_item = QtWidgets.QTableWidgetItem(message_type) message_type_item.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) message_type_item.setFlags(message_type_item.flags() & ~QtCore.Qt.ItemFlag.ItemIsEditable) self.message_table.setItem(row_position, 1, message_type_item) - # message_type_item.setBackground(QtGui.QColor("black")) received_item = QtWidgets.QTableWidgetItem(received) received_item.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) received_item.setFlags(received_item.flags() & ~QtCore.Qt.ItemFlag.ItemIsEditable) self.message_table.setItem(row_position, 2, received_item) - # received_item.setBackground(QtGui.QColor("black")) scrollbar = self.message_table.verticalScrollBar() if scrollbar.value() == scrollbar.maximum( @@ -224,9 +220,6 @@ def addMessage(self, number, message_type, received): if text != '' and (text.lower() not in message_type.lower() and text.lower() not in received.lower()) and ( self.currently_filtering is True): - # number_item.setBackground(QtGui.QColor("lightgreen")) - # received_item.setBackground(QtGui.QColor("lightgreen")) - # message_type_item.setBackground(QtGui.QColor("lightgreen")) self.message_table.hideRow(row_position) def handleMessage(self, message: MavlinkMessage): @@ -252,20 +245,10 @@ def filter(self): if (text.lower() not in item1.text().lower() and text.lower() not in item2.text().lower()): - # item1.setBackground(QtGui.QColor("lightgreen")) - # item2.setBackground(QtGui.QColor("lightgreen")) - # self.message_table.item(row, 0).setBackground( - # QtGui.QColor("lightgreen")) self.message_table.hideRow(row) def undoSearch(self): for row in range(self.message_table.rowCount()): - # self.message_table.item(row, - # 0).setBackground(QtGui.QColor("black")) - # self.message_table.item(row, - # 1).setBackground(QtGui.QColor("black")) - # self.message_table.item(row, - # 2).setBackground(QtGui.QColor("black")) self.message_table.showRow(row) self.currently_filtering = False From 751cc1951c5e88195faab43c3092899c6117e46b Mon Sep 17 00:00:00 2001 From: ritish Date: Mon, 11 Mar 2024 21:00:33 -0600 Subject: [PATCH 8/8] Add additional features to Mavlink debugger Switch from QTextEdit to QTableWidget Add ability to search/filter messages Message Box now scrolls with new rows --- pigeon/ui/ui.py | 92 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 87 insertions(+), 5 deletions(-) diff --git a/pigeon/ui/ui.py b/pigeon/ui/ui.py index d2e5402..4f490dd 100644 --- a/pigeon/ui/ui.py +++ b/pigeon/ui/ui.py @@ -159,18 +159,100 @@ class MavLinkDebugger(QtWidgets.QWidget): def __init__(self) -> None: super().__init__() - self.message_display = QtWidgets.QTextEdit(self) - self.message_display.setReadOnly(True) + self.message_table = QtWidgets.QTableWidget(self) + self.message_table.setColumnCount(3) + self.message_table.setHorizontalHeaderLabels( + ["Message Number", "Message Type", "Received"]) + self.no_of_rows = 0 + self.number_of_messages = 0 + self.current_message_number = 1 + self.currently_filtering = False + + self.search_textbox = QtWidgets.QLineEdit(self) + self.search_textbox.setPlaceholderText("Enter word to search") + self.search_button = QtWidgets.QPushButton("Search", self) + self.search_button.clicked.connect(self.filter) + self.stop_search_button = QtWidgets.QPushButton("Stop Searching", self) + self.stop_search_button.clicked.connect(self.undoSearch) layout = QtWidgets.QVBoxLayout(self) - layout.addWidget(self.message_display) + layout.addWidget(self.search_textbox) + layout.addWidget(self.search_button) + layout.addWidget(self.stop_search_button) + layout.addWidget(self.message_table) + + self.stop_search_button.hide( + ) # Should be visible only when search is active + self.search_textbox.returnPressed.connect(self.filter) self.receive_message.connect(self.handleMessage) + def addMessage(self, number, message_type, received): + row_position = self.message_table.rowCount() + self.message_table.insertRow(row_position) + + number_item = QtWidgets.QTableWidgetItem(str(number)) + number_item.setTextAlignment( + QtCore.Qt.AlignmentFlag.AlignCenter) # Align to cell center + number_item.setFlags( + number_item.flags() + & ~QtCore.Qt.ItemFlag.ItemIsEditable) # Make it read-only + self.message_table.setItem(row_position, 0, number_item) + + message_type_item = QtWidgets.QTableWidgetItem(message_type) + message_type_item.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + message_type_item.setFlags(message_type_item.flags() + & ~QtCore.Qt.ItemFlag.ItemIsEditable) + self.message_table.setItem(row_position, 1, message_type_item) + + received_item = QtWidgets.QTableWidgetItem(received) + received_item.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + received_item.setFlags(received_item.flags() + & ~QtCore.Qt.ItemFlag.ItemIsEditable) + self.message_table.setItem(row_position, 2, received_item) + + scrollbar = self.message_table.verticalScrollBar() + if scrollbar.value() == scrollbar.maximum( + ): # Automatically scroll with new rows if you're at the bottom of the table + self.message_table.scrollToBottom() + + text = self.search_textbox.text() + if text != '' and (text.lower() not in message_type.lower() + and text.lower() not in received.lower()) and ( + self.currently_filtering is True): + self.message_table.hideRow(row_position) + def handleMessage(self, message: MavlinkMessage): current_time = message.time.strftime("%H:%M:%S") - self.message_display.append( - f"Message: {message.type}, Received: {current_time}") + self.addMessage(self.current_message_number, str(message.type), + current_time) + self.current_message_number += 1 + self.number_of_messages += 1 + if self.number_of_messages == 1000: # Note: Every 1000th message wont be displayed since table gets cleared at that instance + self.message_table.clearContents() + self.message_table.setRowCount(0) + self.number_of_messages = 0 + + def filter(self): + text = self.search_textbox.text() + self.currently_filtering = True + self.stop_search_button.show() + + if text != '': + for row in range(self.message_table.rowCount()): + item1 = self.message_table.item(row, 1) + item2 = self.message_table.item(row, 2) + + if (text.lower() not in item1.text().lower() + and text.lower() not in item2.text().lower()): + self.message_table.hideRow(row) + + def undoSearch(self): + for row in range(self.message_table.rowCount()): + self.message_table.showRow(row) + + self.currently_filtering = False + self.stop_search_button.hide() class AboutWindow(QtWidgets.QWidget):