fix: Remove unused PyQt5 and tkinter overlay code; simplify click indicator function

This commit is contained in:
Showdown76 2025-05-19 12:58:34 +02:00
parent a4e078bc19
commit 52c455b20c

View File

@ -2,22 +2,6 @@ import pyautogui
import threading
import time, io, base64
import sys
# Try PyQt5 for transparent, click-through overlay
try:
from PyQt5 import QtWidgets, QtCore, QtGui
PYQT_AVAILABLE = True
except ImportError:
import tkinter as tk
import sys
if sys.platform == 'darwin':
try:
from AppKit import NSApplication, NSPanel, NSColor, NSBezierPath, NSView, NSWindowStyleMaskBorderless, NSBackingStoreBuffered, NSStatusWindowLevel, NSWindowCollectionBehaviorCanJoinAllSpaces
COCOA_AVAILABLE = True
except ImportError:
COCOA_AVAILABLE = False
else:
COCOA_AVAILABLE = False
PYQT_AVAILABLE = False
from objects.inputs import MouseInput, KeyboardInput, ButtonType
from PIL import ImageGrab # type: ignore
@ -33,46 +17,7 @@ def screenshot_to_base64(screenshot: bytes) -> str:
return base64.b64encode(screenshot).decode('utf-8')
def show_click_indicator(x: int, y: int, duration: float = 2.0, size: int = 50) -> None:
# """Display a red circle at (x, y) for the given duration."""
# """Try PyQt5 overlay first, else fallback to tkinter."""
# half = size // 2
# if PYQT_AVAILABLE:
# # Setup QApplication
# app = QtWidgets.QApplication.instance() or QtWidgets.QApplication(sys.argv)
# # Frameless, transparent, click-through window
# w = QtWidgets.QWidget()
# flags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.Tool
# w.setWindowFlags(flags)
# w.setAttribute(QtCore.Qt.WA_TranslucentBackground)
# w.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)
# w.setGeometry(x-half, y-half, size, size)
# # Draw circle
# pixmap = QtGui.QPixmap(size, size)
# pixmap.fill(QtCore.Qt.transparent)
# painter = QtGui.QPainter(pixmap)
# pen = QtGui.QPen(QtGui.QColor('red'), 4)
# painter.setPen(pen)
# painter.drawEllipse(2, 2, size-4, size-4)
# painter.end()
# label = QtWidgets.QLabel(w)
# label.setPixmap(pixmap)
# w.show()
# app.processEvents()
# time.sleep(duration)
# w.close()
# else:
# # Fallback tkinter overlay (may intercept clicks)
# root = tk.Tk()
# root.overrideredirect(True)
# root.attributes('-topmost', True)
# root.attributes('-alpha', 0.5)
# root.geometry(f"{size}x{size}+{x-half}+{y-half}")
# canvas = tk.Canvas(root, width=size, height=size, highlightthickness=0, bg='white')
# canvas.pack()
# canvas.create_oval(2, 2, size-2, size-2, outline='red', width=4)
# root.update()
# time.sleep(duration)
# root.destroy()
"""Display a red circle at (x, y) for the given duration, can be clicked through."""
pass
def press_mouse(mouse_input: MouseInput) -> None: