Skip to content

Commit

Permalink
Hide screen capture with ESC
Browse files Browse the repository at this point in the history
  • Loading branch information
vietanhdev committed Dec 13, 2024
1 parent e88e94d commit ca8052d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion llama_assistant/screen_capture_widget.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import TYPE_CHECKING
from PyQt5.QtWidgets import QApplication, QWidget, QDesktopWidget, QPushButton
from PyQt5.QtCore import Qt, QRect
from PyQt5.QtGui import QPainter, QColor, QPen
from PyQt5.QtGui import QPainter, QColor, QPen, QKeyEvent

from llama_assistant import config
from llama_assistant.ocr_engine import OCREngine
Expand Down Expand Up @@ -74,6 +74,11 @@ def hide(self):
self.button_widget.hide()
super().hide()

def keyPressEvent(self, event: QKeyEvent):
if event.key() == Qt.Key_Escape:
self.hide()
self.parent.show()

def mousePressEvent(self, event):
if event.button() == Qt.LeftButton:
self.start_point = event.pos() # Capture start position
Expand Down

0 comments on commit ca8052d

Please sign in to comment.