This commit is contained in:
N0\A
2025-10-22 13:44:31 +02:00
parent a853df3371
commit a7847b43c8

24
main.py
View File

@@ -13,12 +13,12 @@ class SearchResultsDialog(QtWidgets.QDialog):
self.setWindowTitle("Search Results") self.setWindowTitle("Search Results")
self.setMinimumSize(600, 400) self.setMinimumSize(600, 400)
# Create a list widget to display the results # results list widget
self.list_widget = QtWidgets.QListWidget() self.list_widget = QtWidgets.QListWidget()
self.list_widget.addItems(results) self.list_widget.addItems(results)
self.list_widget.itemDoubleClicked.connect(self.open_file_location) self.list_widget.itemDoubleClicked.connect(self.open_file_location)
# Set up the layout # layout
layout = QtWidgets.QVBoxLayout() layout = QtWidgets.QVBoxLayout()
layout.addWidget(self.list_widget) layout.addWidget(self.list_widget)
self.setLayout(layout) self.setLayout(layout)
@@ -73,9 +73,7 @@ class MainWindow(QtWidgets.QMainWindow):
self.left_menu = QtWidgets.QMenu() self.left_menu = QtWidgets.QMenu()
self.left_menu.addAction("Search Files", self.start_file_search) self.left_menu.addAction("Search Files", self.start_file_search)
# self._drag_pos = None # always on top timer
# Timer to ensure window stays on top
self.stay_on_top_timer = QtCore.QTimer(self) self.stay_on_top_timer = QtCore.QTimer(self)
self.stay_on_top_timer.timeout.connect(self.ensure_on_top) self.stay_on_top_timer.timeout.connect(self.ensure_on_top)
self.stay_on_top_timer.start(1000) self.stay_on_top_timer.start(1000)
@@ -88,27 +86,13 @@ class MainWindow(QtWidgets.QMainWindow):
super().showEvent(event) super().showEvent(event)
self.raise_() self.raise_()
# def mouseDoubleClickEvent(self, event: QtGui.QMouseEvent):
# if event.button() == QtCore.Qt.LeftButton: #type: ignore
# self.start_file_search()
# event.accept()
def mousePressEvent(self, event: QtGui.QMouseEvent): def mousePressEvent(self, event: QtGui.QMouseEvent):
if event.button() == QtCore.Qt.LeftButton: #type: ignore if event.button() == QtCore.Qt.LeftButton: #type: ignore
self.left_menu.popup(event.globalPosition().toPoint()) self.left_menu.popup(event.globalPosition().toPoint())
# self._drag_pos = event.globalPosition().toPoint() - self.frameGeometry().topLeft()
# event.accept()
elif event.button() == QtCore.Qt.RightButton: #type: ignore elif event.button() == QtCore.Qt.RightButton: #type: ignore
self.tray.contextMenu().popup(event.globalPosition().toPoint()) self.tray.contextMenu().popup(event.globalPosition().toPoint())
# def mouseMoveEvent(self, event: QtGui.QMouseEvent):
# if self._drag_pos and (event.buttons() & QtCore.Qt.LeftButton): #type: ignore
# self.move(event.globalPosition().toPoint() - self._drag_pos)
# def mouseReleaseEvent(self, event: QtGui.QMouseEvent):
# self._drag_pos = None
# self.raise_()
def toggle_visible(self): def toggle_visible(self):
self.setVisible(not self.isVisible()) self.setVisible(not self.isVisible())