From ba68312bd5ff289224354700d30bdd97bbcf3663 Mon Sep 17 00:00:00 2001 From: Alessandro Bresciani Date: Thu, 3 Oct 2024 13:42:46 +0200 Subject: [PATCH] refactor/renaming --- core/arp_scanner.py | 14 +++++++------- ui/arpscan.ui | 6 +++--- ui/ui_arpscan.py | 14 +++++++------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/core/arp_scanner.py b/core/arp_scanner.py index acb25ac..9d89062 100644 --- a/core/arp_scanner.py +++ b/core/arp_scanner.py @@ -75,7 +75,7 @@ def setup_ui_elements(self): self.add_static_ui_labels() # Connect item click signal to open_device_details - self._ui.list.itemClicked.connect(self.open_device_details) + self._ui.devices.itemClicked.connect(self.open_device_details) # Set the default font for the list items self.setup_font_for_list_widgets() @@ -97,8 +97,8 @@ def setup_font_for_list_widgets(self): """Sets up a uniform font for list widgets.""" font = QFont() font.setPointSize(12) - self._ui.list.setFont(font) - self._ui.listpkt.setFont(font) + self._ui.devices.setFont(font) + self._ui.responses.setFont(font) @Slot(QListWidgetItem) def open_device_details(self, item): @@ -176,20 +176,20 @@ def handle_scan_results(self, results): def add_device_to_list(self, ip_address, mac, hostname, device_vendor): """Adds a device to the list widget in the UI.""" label = f"{ip_address} {mac} {hostname}, {device_vendor}" - if not self._ui.list.findItems(label, Qt.MatchExactly): + if not self._ui.devices.findItems(label, Qt.MatchExactly): item = QListWidgetItem(label) item.setBackground(QColor(Qt.black)) item.setForeground(QColor(Qt.white)) - self._ui.list.addItem(item) + self._ui.devices.addItem(item) def add_packet_if_new(self, packet_label): """Adds a packet to the listpkt widget if it doesn't already exist.""" - existing_items = self._ui.listpkt.findItems(packet_label, Qt.MatchExactly) + existing_items = self._ui.responses.findItems(packet_label, Qt.MatchExactly) if not existing_items: # Add only if the packet is not already listed packet_item = QListWidgetItem(packet_label) packet_item.setBackground(QColor(Qt.black)) packet_item.setForeground(QColor(Qt.white)) - self._ui.listpkt.addItem(packet_item) + self._ui.responses.addItem(packet_item) def quit_application(self): """Quit the application.""" diff --git a/ui/arpscan.ui b/ui/arpscan.ui index 1dbaf7d..4ef0f67 100644 --- a/ui/arpscan.ui +++ b/ui/arpscan.ui @@ -22,7 +22,7 @@ - + @@ -32,7 +32,7 @@ - + @@ -111,7 +111,7 @@ clear clicked() - list + devices clear() diff --git a/ui/ui_arpscan.py b/ui/ui_arpscan.py index b9e3b9c..9203f71 100644 --- a/ui/ui_arpscan.py +++ b/ui/ui_arpscan.py @@ -31,20 +31,20 @@ def setupUi(self, DeviceDiscovery): self.verticalLayout.addWidget(self.label) - self.list = QListWidget(DeviceDiscovery) - self.list.setObjectName(u"list") + self.devices = QListWidget(DeviceDiscovery) + self.devices.setObjectName(u"devices") - self.verticalLayout.addWidget(self.list) + self.verticalLayout.addWidget(self.devices) self.label_2 = QLabel(DeviceDiscovery) self.label_2.setObjectName(u"label_2") self.verticalLayout.addWidget(self.label_2) - self.listpkt = QListWidget(DeviceDiscovery) - self.listpkt.setObjectName(u"listpkt") + self.responses = QListWidget(DeviceDiscovery) + self.responses.setObjectName(u"responses") - self.verticalLayout.addWidget(self.listpkt) + self.verticalLayout.addWidget(self.responses) self.groupBox = QGroupBox(DeviceDiscovery) self.groupBox.setObjectName(u"groupBox") @@ -88,7 +88,7 @@ def setupUi(self, DeviceDiscovery): self.retranslateUi(DeviceDiscovery) self.quit.clicked.connect(DeviceDiscovery.accept) - self.clear.clicked.connect(self.list.clear) + self.clear.clicked.connect(self.devices.clear) QMetaObject.connectSlotsByName(DeviceDiscovery) # setupUi