touchscreen

This commit is contained in:
Page Asgardius 2024-08-27 12:50:56 -07:00
parent ea12c10744
commit 54a8cd9b4f

View file

@ -1,4 +1,6 @@
import sys
import time
import threading
from PyQt6.QtWidgets import QApplication, QMainWindow, QHBoxLayout, QVBoxLayout, QWidget, QPushButton, QSlider
from PyQt6.QtMultimedia import QMediaPlayer, QAudioOutput
from PyQt6.QtMultimediaWidgets import QVideoWidget
@ -8,7 +10,8 @@ from PyQt6.QtCore import QUrl, Qt, QEvent
class VideoPlayer(QMainWindow):
def __init__(self):
super().__init__()
self.fswindow = False
self.fswindow = 0
self.dclick = False
self.setWindowTitle("Video Player")
self.setGeometry(100, 100, 640, 480)
@ -103,19 +106,37 @@ class VideoPlayer(QMainWindow):
if not self.fswindow:
self.slider.setRange(0, duration)
def toglefs(self):
if not self.fswindow == 0:
self.showNormal()
if self.fswindow == 1:
self.showMaximized()
self.set_layout()
self.fswindow = 0
else:
if self.isMaximized():
self.fswindow = 1
print("maximized")
else:
self.fswindow = 2
self.showFullScreen()
self.setCentralWidget(self.video_widget)
def dclickthr(self):
self.dclick = True
print(self.dclick)
time.sleep(0.5)
self.dclick = False
print(self.dclick)
def eventFilter(self, obj, event):
if event.type() == QEvent.Type.MouseButtonDblClick:
#print('two left')
if self.fswindow:
self.showNormal()
self.set_layout()
self.fswindow = False
if event.type() == 3:
if self.dclick:
self.toglefs()
else:
self.showFullScreen()
self.fswindow = True
self.setCentralWidget(self.video_widget)
dclickth = threading.Thread(target=self.dclickthr, name="Double Click")
dclickth.start()
#print(event.type())
return True