from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import * class TestGUI(QMainWindow): def __init__(self, source=None): QMainWindow.__init__(self) self.vidpip = GstVideoPipeline(source=source) self.initUI() self.vidpip.setupGst() self.vidpip.run() def initUI(self): self.setWindowTitle('Demo') self.vidpip.setupWidgets() layout = QHBoxLayout() layout.addWidget(self.vidpip.full_widget) widget = QWidget() widget.setLayout(layout) self.setCentralWidget(widget) self.showMaximized() self.show() if __name__ == '__main__': gstwidget_main(TestGUI)
def lowerlLayout(): layout = QHBoxLayout() self.control_scroll = get_control_scroll(self.vidpip) layout.addWidget(self.control_scroll) layout.addWidget(imageTabs()) return layout layout = QVBoxLayout() layout.addLayout(buttonBarLayout()) layout.addLayout(lowerlLayout()) centralWidget = QWidget() centralWidget.setLayout(layout) self.setCentralWidget(centralWidget) self.show() def parse_args(): import argparse parser = argparse.ArgumentParser(description='') parser.add_argument('--esize', type=int, default=0) args = parser.parse_args() return vars(args) if __name__ == '__main__': gstwidget_main(TestGUI, parse_args=parse_args)
return layout layout = QHBoxLayout() layout.addLayout(rightLayout()) w = QWidget() w.setLayout(layout) self.setCentralWidget(w) self.show() dbg("initUI done") def keyPressEvent(self, event): k = event.key() if k == Qt.Key_Escape: self.stop() def parse_args(): import argparse parser = argparse.ArgumentParser(description='') parser.add_argument('--controls', action="store_true") parser.add_argument('source', nargs="?", default=None) args = parser.parse_args() return vars(args) if __name__ == '__main__': gstwidget_main(MainWindow, parse_args=parse_args)