touchscreen
This commit is contained in:
parent
ea12c10744
commit
54a8cd9b4f
1 changed files with 32 additions and 11 deletions
|
@ -1,4 +1,6 @@
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
|
import threading
|
||||||
from PyQt6.QtWidgets import QApplication, QMainWindow, QHBoxLayout, QVBoxLayout, QWidget, QPushButton, QSlider
|
from PyQt6.QtWidgets import QApplication, QMainWindow, QHBoxLayout, QVBoxLayout, QWidget, QPushButton, QSlider
|
||||||
from PyQt6.QtMultimedia import QMediaPlayer, QAudioOutput
|
from PyQt6.QtMultimedia import QMediaPlayer, QAudioOutput
|
||||||
from PyQt6.QtMultimediaWidgets import QVideoWidget
|
from PyQt6.QtMultimediaWidgets import QVideoWidget
|
||||||
|
@ -8,7 +10,8 @@ from PyQt6.QtCore import QUrl, Qt, QEvent
|
||||||
class VideoPlayer(QMainWindow):
|
class VideoPlayer(QMainWindow):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.fswindow = False
|
self.fswindow = 0
|
||||||
|
self.dclick = False
|
||||||
|
|
||||||
self.setWindowTitle("Video Player")
|
self.setWindowTitle("Video Player")
|
||||||
self.setGeometry(100, 100, 640, 480)
|
self.setGeometry(100, 100, 640, 480)
|
||||||
|
@ -103,19 +106,37 @@ class VideoPlayer(QMainWindow):
|
||||||
if not self.fswindow:
|
if not self.fswindow:
|
||||||
self.slider.setRange(0, duration)
|
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):
|
def eventFilter(self, obj, event):
|
||||||
|
|
||||||
if event.type() == QEvent.Type.MouseButtonDblClick:
|
if event.type() == 3:
|
||||||
#print('two left')
|
if self.dclick:
|
||||||
if self.fswindow:
|
self.toglefs()
|
||||||
self.showNormal()
|
|
||||||
self.set_layout()
|
|
||||||
self.fswindow = False
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.showFullScreen()
|
dclickth = threading.Thread(target=self.dclickthr, name="Double Click")
|
||||||
self.fswindow = True
|
dclickth.start()
|
||||||
self.setCentralWidget(self.video_widget)
|
#print(event.type())
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue