-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.py
48 lines (38 loc) · 1.4 KB
/
mainwindow.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import sys
from PyQt5.uic import loadUi
from PyQt5 import QtWidgets
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QApplication, QDialog
from PyQt5.QtGui import QImage, QPixmap
import resource
from out_window import Ui_OutputDialog
class Ui_Dialog(QDialog):
def __init__(self):
super(Ui_Dialog, self).__init__()
loadUi("mainwindow.ui", self)
splashlogo = self.findChild(QtWidgets.QLabel, 'spLabel')
pixmap = QPixmap('mcgs6-splash.png')
splashlogo.setPixmap(pixmap)
splashlogo.setScaledContents(True)
self.runButton.clicked.connect(self.runSlot)
self._new_window = None
self.Videocapture_ = None
def refreshAll(self): # define source of video ('0' is for webcam)
self.Videocapture_ = "0"
@pyqtSlot()
def runSlot(self): # call after pressing "Start"
print("App started")
self.refreshAll()
print(self.Videocapture_)
ui.hide() # hide the main window
self.outputWindow_() # Create and open new output window
def outputWindow_(self): # reset and create a new window for video output ACScreen
self._new_window = Ui_OutputDialog()
self._new_window.show()
self._new_window.startVideo(self.Videocapture_)
print("Webcam On")
if __name__ == "__main__":
app = QApplication(sys.argv)
ui = Ui_Dialog()
ui.show()
sys.exit(app.exec_())