def createUI(self): """Set up the user interface, signals & slots """ self.widget = QWidget(self) self.setCentralWidget(self.widget) # In this widget, the video will be drawn if sys.platform == "darwin": # for MacOS from PyQt5.QtWidgets import QMacCocoaViewContainer self.videoframe = QMacCocoaViewContainer(0) else: self.videoframe = QFrame() self.palette = self.videoframe.palette() self.palette.setColor (QPalette.Window, QColor(0,0,0)) self.videoframe.setPalette(self.palette) self.videoframe.setAutoFillBackground(True) self.positionslider = QSlider(Qt.Horizontal, self) self.positionslider.setToolTip("Position") self.positionslider.setMaximum(1000) self.positionslider.sliderMoved.connect(self.setPosition) self.hbuttonbox = QHBoxLayout() self.playbutton = QPushButton("Play") self.hbuttonbox.addWidget(self.playbutton) self.playbutton.clicked.connect(self.PlayPause) self.stopbutton = QPushButton("Stop") self.hbuttonbox.addWidget(self.stopbutton) self.stopbutton.clicked.connect(self.Stop) self.hbuttonbox.addStretch(1) self.volumeslider = QSlider(Qt.Horizontal, self) self.volumeslider.setMaximum(100) self.volumeslider.setValue(self.mediaplayer.audio_get_volume()) self.volumeslider.setToolTip("Volume") self.hbuttonbox.addWidget(self.volumeslider) self.volumeslider.valueChanged.connect(self.setVolume) self.vboxlayout = QVBoxLayout() self.vboxlayout.addWidget(self.videoframe) self.vboxlayout.addWidget(self.positionslider) self.vboxlayout.addLayout(self.hbuttonbox) self.widget.setLayout(self.vboxlayout) open = QAction("&Open", self) open.triggered.connect(self.OpenFile) exit = QAction("&Exit", self) exit.triggered.connect(sys.exit) menubar = self.menuBar() filemenu = menubar.addMenu("&File") filemenu.addAction(open) filemenu.addSeparator() filemenu.addAction(exit) self.timer = QTimer(self) self.timer.setInterval(200) self.timer.timeout.connect(self.updateUI)
def __init__(self, parent=None): QWidget.__init__(self) self.setWindowTitle('XXOO') vbox = QVBoxLayout() self.wv = QMacCocoaViewContainer(0) vbox.addWidget(self.wv) self.setLayout(vbox) self.resize(350, 250)
def createUI(self): """ Set up the window for the VLC viewer """ self.widget = QWidget(self) self.setCentralWidget(self.widget) self.test = QWidget(self) self.setMenuWidget(self.test) # In this widget, the video will be drawn if sys.platform == "darwin": # for MacOS from PyQt5.QtWidgets import QMacCocoaViewContainer self.videoframe = QMacCocoaViewContainer(0) else: self.videoframe = QFrame() self.palette = self.videoframe.palette() self.palette.setColor(QPalette.Window, QColor(0, 0, 0)) self.videoframe.setPalette(self.palette) self.videoframe.setAutoFillBackground(True) self.hbuttonbox = QHBoxLayout() self.playbutton = QPushButton("Run my program") #self.hbuttonbox.addWidget(self.playbutton) #self.playbutton.clicked.connect(partial(self.drone_vision.run_user_code, self.playbutton)) self.landbutton = QPushButton("Land NOW") self.hbuttonbox.addWidget(self.landbutton) self.landbutton.clicked.connect(self.drone_vision.land) self.takeoff = QPushButton("Take off") self.hbuttonbox.addWidget(self.takeoff) self.takeoff.clicked.connect(self.drone_vision.safe_takeoff) self.stopbutton = QPushButton("Quit") self.hbuttonbox.addWidget(self.stopbutton) self.stopbutton.clicked.connect(self.drone_vision.close_exit) self.vboxlayout = QVBoxLayout() self.vboxlayout.addWidget(self.videoframe) self.vboxlayout.addLayout(self.hbuttonbox) self.widget.setLayout(self.vboxlayout) # the media player has to be 'connected' to the QFrame # (otherwise a video would be displayed in it's own window) # this is platform specific! # you have to give the id of the QFrame (or similar object) to # vlc, different platforms have different functions for this if sys.platform.startswith('linux'): # for Linux using the X Server self.mediaplayer.set_xwindow(self.videoframe.winId()) elif sys.platform == "win32": # for Windows self.mediaplayer.set_hwnd(self.videoframe.winId()) elif sys.platform == "darwin": # for MacOS self.mediaplayer.set_nsobject(int(self.videoframe.winId()))
def initUI(self): self.setWindowTitle(self.title) self.widget = QWidget(self) self.setCentralWidget(self.widget) self.videoframe = QMacCocoaViewContainer(0) self.palette = self.videoframe.palette() self.palette.setColor(QPalette.Window, QColor(0, 0, 0)) self.videoframe.setPalette(self.palette) self.videoframe.setAutoFillBackground(True) self.vboxlayout = QVBoxLayout() self.vboxlayout.addWidget(self.videoframe) self.widget.setLayout(self.vboxlayout) self.player.set_nsobject(int(self.videoframe.winId())) self.play()
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(500, 360) self.button_play = QtWidgets.QPushButton(Form) self.button_play.setGeometry(QtCore.QRect(9, 290, 40, 40)) self.button_play.setText("") icon = QtGui.QIcon.fromTheme("SP_MediaPlay") self.button_play.setIcon(icon) self.button_play.setObjectName("button_play") self.button_play.setIcon(self.style().standardIcon( QStyle.SP_MediaPlay)) self.video = None if sys.platform == "darwin": # for MacOS from PyQt5.QtWidgets import QMacCocoaViewContainer self.video = QMacCocoaViewContainer(0, parent=Form) else: self.video = QtWidgets.QFrame(parent=Form) self.video.setGeometry(QtCore.QRect(9, 0, 500, 280)) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.video.sizePolicy().hasHeightForWidth()) self.video.setSizePolicy(sizePolicy) self.video.setObjectName("video") self.button_pause = QtWidgets.QPushButton(Form) self.button_pause.setGeometry(QtCore.QRect(54, 290, 40, 40)) self.button_pause.setText("") self.button_pause.setObjectName("button_pause") self.button_pause.setIcon(self.style().standardIcon( QStyle.SP_MediaPause)) self.time_slider = QtWidgets.QSlider(Form) self.time_slider.setGeometry(QtCore.QRect(140, 300, 301, 22)) self.time_slider.setOrientation(QtCore.Qt.Horizontal) self.time_slider.setObjectName("time_slider") self.label_time_passed = QtWidgets.QLabel(Form) self.label_time_passed.setGeometry(QtCore.QRect(100, 300, 61, 20)) self.label_time_passed.setObjectName("label_time_passed") self.label_time_left = QtWidgets.QLabel(Form) self.label_time_left.setGeometry(QtCore.QRect(450, 300, 60, 16)) self.label_time_left.setObjectName("label_time_left") self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setUpGUI(self): self.resize(800, 480) self.widget = QWidget(self) self.setCentralWidget(self.widget) if sys.platform == "darwin": from PyQt5.QtWidgets import QMacCocoaViewContainer self.videoframe = QMacCocoaViewContainer(0) else: self.videoframe = QFrame() self.videoframe.mouseDoubleClickEvent = self.openDialog self.videoframe.mouseReleaseEvent = self.PlayPause self.palette = self.videoframe.palette() self.palette.setColor(QPalette.Window, QColor(0, 0, 0)) self.videoframe.setPalette(self.palette) self.videoframe.setAutoFillBackground(True) self.videoframe self.positionSlider = QSlider(Qt.Horizontal, self) self.positionSlider.setMaximum(1000) self.positionSlider.sliderMoved.connect(self.setPosition) self.hboxLayout = QHBoxLayout() self.hboxLayout.addWidget(self.positionSlider) self.hboxLayout.setSpacing(0) self.hboxLayout.setContentsMargins(0, 0, 0, 0) self.vboxLayout = QVBoxLayout() self.vboxLayout.addWidget(self.videoframe) self.vboxLayout.addLayout(self.hboxLayout) self.vboxLayout.setSpacing(0) self.vboxLayout.setContentsMargins(0, 0, 0, 0) self.widget.setLayout(self.vboxLayout) _open = QAction("&Open", self) _open.triggered.connect(sys.exit) try: _thread.start_new_thread(self.updateUI, ()) except: print("error with positionSliderThread")
def buildVideoPlayer(self): # creating a basic vlc instance self.instance = vlc.Instance() # creating an empty vlc media player self.mediaplayer = self.instance.media_player_new() # In this widget, the video will be drawn if sys.platform == "darwin": # for MacOS from PyQt5.QtWidgets import QMacCocoaViewContainer self.videoframe = QMacCocoaViewContainer(0) else: self.videoframe = QFrame() self.palette = self.videoframe.palette() self.palette.setColor (QPalette.Window, QColor(0,0,0)) self.videoframe.setPalette(self.palette) self.videoframe.setAutoFillBackground(True) self.timer = QTimer(self) self.timer.setInterval(50) self.timer.timeout.connect(self.updateUI) return self.videoframe
def set_media_player(self, *args): """ 获得并设置媒体播放器 :param args: :return: """ if args: self.instance = vlc.Instance(*args) self.media_player = self.instance.media_player_new() else: self.media_player = vlc.MediaPlayer() if get_system_platform() == CommonEnum.WindowsPlatform: self.media_player_frame = QFrame() self.media_player.set_hwnd(self.media_player_frame.winId()) elif get_system_platform() == CommonEnum.LinuxPlatform: self.media_player_frame = QFrame() self.media_player.set_xwindow(self.media_player_frame.winId()) elif get_system_platform() == CommonEnum.DarwinPlatform: from PyQt5.QtWidgets import QMacCocoaViewContainer self.media_player_frame = QMacCocoaViewContainer(0) self.media_player.set_nsobject(self.media_player_frame.winId()) else: self.media_player.set_hwnd(self.media_player_frame.winId())
def createUI(self): """ Set up the window for the VLC viewer """ self.widget = QWidget(self) self.setCentralWidget(self.widget) # In this widget, the video will be drawn if sys.platform == "darwin": # for MacOS from PyQt5.QtWidgets import QMacCocoaViewContainer self.videoframe = QMacCocoaViewContainer(0) else: self.videoframe = QFrame() self.palette = self.videoframe.palette() self.palette.setColor(QPalette.Window, QColor(0, 0, 0)) self.videoframe.setPalette(self.palette) self.videoframe.setAutoFillBackground(True) self.hbuttonbox = QHBoxLayout() self.raise_lower_box = QHBoxLayout() self.forward_box = QHBoxLayout() self.left_right_box = QHBoxLayout() self.backward_box = QHBoxLayout() self.toggle_box = QHBoxLayout() self.playbutton = QPushButton("Start") self.hbuttonbox.addWidget(self.playbutton) self.playbutton.clicked.connect(partial(self.move.restart)) self.landbutton = QPushButton("Land NOW") self.hbuttonbox.addWidget(self.landbutton) self.landbutton.clicked.connect(self.drone_vision.land) self.landsafebutton = QPushButton("Land safe") self.hbuttonbox.addWidget(self.landsafebutton) self.landsafebutton.clicked.connect(self.move.kill) self.stopbutton = QPushButton("Quit") self.hbuttonbox.addWidget(self.stopbutton) self.stopbutton.clicked.connect(self.drone_vision.close_exit) self.raise_button = QPushButton("Raise Drone") self.raise_lower_box.addWidget(self.raise_button) self.raise_button.clicked.connect(self.move.raise_drone) self.lower_button = QPushButton("Lower Drone") self.raise_lower_box.addWidget(self.lower_button) self.lower_button.clicked.connect(self.move.lower_drone) self.forward_button = QPushButton("^") self.forward_box.addWidget(self.forward_button) self.forward_button.clicked.connect(self.move.drone_forward) self.left_button = QPushButton("<") self.hover_button = QPushButton("o") self.right_button = QPushButton(">") self.left_right_box.addWidget(self.left_button) self.left_right_box.addWidget(self.hover_button) self.left_right_box.addWidget(self.right_button) self.left_button.clicked.connect(self.move.drone_left) self.hover_button.clicked.connect(self.move.drone_hover) self.right_button.clicked.connect(self.move.drone_right) self.backward_button = QPushButton("v") self.backward_box.addWidget(self.backward_button) self.backward_button.clicked.connect(self.move.drone_right) self.rotation_button = QPushButton("Rotation Track") self.toggle_box.addWidget(self.rotation_button) self.rotation_button.clicked.connect(self.move.rotate_true) self.fixed_button = QPushButton("Fixed Track") self.toggle_box.addWidget(self.fixed_button) self.fixed_button.clicked.connect(self.move.rotate_false) self.vboxlayout = QVBoxLayout() self.vboxlayout.addWidget(self.videoframe) self.vboxlayout.addLayout(self.hbuttonbox) self.vboxlayout.addLayout(self.raise_lower_box) self.vboxlayout.addLayout(self.forward_box) self.vboxlayout.addLayout(self.left_right_box) self.vboxlayout.addLayout(self.backward_box) self.vboxlayout.addLayout(self.toggle_box) # determined how far away from the tracked object the drone should be sld = QSlider(Qt.Horizontal, self) sld.setFocusPolicy(Qt.NoFocus) sld.setGeometry(30, 40, 100, 30) sld.setValue(60) sld.valueChanged[int].connect(self.change_box_size_max) sld1 = QSlider(Qt.Horizontal, self) sld1.setFocusPolicy(Qt.NoFocus) sld1.setGeometry(30, 40, 100, 30) sld1.setValue(40) sld1.valueChanged[int].connect(self.change_box_size_min) sld1.move(30, 60) # shows how much the drone 'wants' to rotate to the left/right # (this corresponds to where on the x-axis the tracked object is) # self.yaw_bar = QProgressBar(self) # self.yaw_bar.setGeometry(30, 40, 200, 25) # self.yaw_bar.move(0, 100) # # # shows how much the drone 'wants' to go forwards/backwards # # (corresponds to how far away the tracked object is) # self.pitch_bar = QProgressBar(self) # self.pitch_bar.setGeometry(30, 40, 200, 25) # self.pitch_bar.move(0, 200) # self.pitch_bar.setValue(60) self.label = QLabel(self) self.setGeometry(300, 300, 280, 170) self.setWindowTitle('QSlider') self.show() self.widget.setLayout(self.vboxlayout) # the media player has to be 'connected' to the QFrame # (otherwise a video would be displayed in it's own window) # this is platform specific! # you have to give the id of the QFrame (or similar object) to # vlc, different platforms have different functions for this if sys.platform.startswith('linux'): # for Linux using the X Server self.mediaplayer.set_xwindow(self.videoframe.winId()) elif sys.platform == "win32": # for Windows self.mediaplayer.set_hwnd(self.videoframe.winId()) elif sys.platform == "darwin": # for MacOS self.mediaplayer.set_nsobject(int(self.videoframe.winId()))
def createUI(self): """Set up the user interface, signals & slots """ self.widget = QWidget(self) self.setCentralWidget(self.widget) # In this widget, the video will be drawn if sys.platform == "darwin": # for MacOS from PyQt5.QtWidgets import QMacCocoaViewContainer self.videoframe = QMacCocoaViewContainer(0) else: self.videoframe = QFrame() self.palette = self.videoframe.palette() self.palette.setColor(QPalette.Window, QColor(0, 0, 0)) self.videoframe.setPalette(self.palette) self.videoframe.setAutoFillBackground(True) self.positionslider = QSlider(Qt.Horizontal, self) self.positionslider.setToolTip("Position") self.positionslider.setMaximum(1000) self.positionslider.sliderMoved.connect(self.setPosition) self.hbuttonbox = QHBoxLayout() self.playbutton = QPushButton("►") self.hbuttonbox.addWidget(self.playbutton) self.playbutton.clicked.connect(self.PlayPause) self.stopbutton = QPushButton("⯀") self.hbuttonbox.addWidget(self.stopbutton) self.stopbutton.clicked.connect(self.Stop) self.audiobutton = QPushButton("𝅘𝅥") self.hbuttonbox.addWidget(self.audiobutton) self.audiobutton.setToolTip( "Switch to audio only mode\n(must search again)") self.audiobutton.clicked.connect(self.AudioVideo) self.hbuttonbox.addStretch(1) self.volumeslider = QSlider(Qt.Horizontal, self) self.volumeslider.setMaximum(100) self.volumeslider.setValue(self.mediaplayer.audio_get_volume()) self.volumeslider.setToolTip("Volume") self.hbuttonbox.addWidget(self.volumeslider) self.volumeslider.valueChanged.connect(self.setVolume) self.hbuttonbox2 = QHBoxLayout() self.searchline = QLineEdit() self.hbuttonbox2.addWidget(self.searchline) self.searchline.setToolTip("Enter search term here") self.searchbutton = QPushButton("Search") self.hbuttonbox2.addWidget(self.searchbutton) self.searchbutton.setToolTip("Press to search") self.searchbutton.clicked.connect(self.searchYouTube) self.searchresult = QHBoxLayout() #adding QListWidget to the layout causes the video frame #to disappear and im not sure why #self.searchresults = QListWidget(self) #self.searchresult.addWidget(self.searchresults) #self.searchresults.addItem("testing1") #self.searchresults.addItem("testing2") self.vboxlayout = QVBoxLayout() self.vboxlayout.addWidget(self.videoframe) self.vboxlayout.addWidget(self.positionslider) self.vboxlayout.addLayout(self.hbuttonbox) self.vboxlayout.addLayout(self.hbuttonbox2) #self.vboxlayout.addLayout(self.searchresult) self.widget.setLayout(self.vboxlayout) open = QAction("&Open", self) open.triggered.connect(lambda: self.OpenFile()) exit = QAction("&Exit", self) exit.triggered.connect(sys.exit) download = QAction("&Download", self) download.triggered.connect(self.downloadFile) menubar = self.menuBar() filemenu = menubar.addMenu("&File") filemenu.addAction(open) filemenu.addSeparator() filemenu.addAction(exit) filemenu.addSeparator() filemenu.addAction(download) self.timer = QTimer(self) self.timer.setInterval(200) self.timer.timeout.connect(self.updateUI)
def createUI(self): """Set up the user interface, signals & slots """ self.widget = QWidget(self) self.setCentralWidget(self.widget) # In this widget, the video will be drawn if sys.platform == "darwin": # for MacOS from PyQt5.QtWidgets import QMacCocoaViewContainer self.videoframe = QMacCocoaViewContainer(0) else: self.videoframe = QFrame() self.palette = self.videoframe.palette() self.palette.setColor(QPalette.Window, QColor(0, 0, 0)) self.videoframe.setPalette(self.palette) self.videoframe.setAutoFillBackground(True) self.label = QtWidgets.QLabel(self.videoframe) #self.label.setGeometry(QtCore.QRect(0, 0, 1024, 631)) self.label.setText("") self.label.setScaledContents(True) self.label.setObjectName("label") # self.positionslider = QSlider(Qt.Horizontal, self) # self.positionslider.setToolTip("Position") # self.positionslider.setMaximum(1000) # self.positionslider.sliderMoved.connect(self.setPosition) # # self.hbuttonbox = QHBoxLayout() # self.playbutton = QPushButton("Play") # self.hbuttonbox.addWidget(self.playbutton) # self.playbutton.clicked.connect(self.PlayPause) # # self.stopbutton = QPushButton("Stop") # self.hbuttonbox.addWidget(self.stopbutton) # self.stopbutton.clicked.connect(self.Stop) # # self.hbuttonbox.addStretch(1) # self.volumeslider = QSlider(Qt.Horizontal, self) # self.volumeslider.setMaximum(100) # self.volumeslider.setValue(self.mediaplayer.audio_get_volume()) # self.volumeslider.setToolTip("Volume") # self.hbuttonbox.addWidget(self.volumeslider) # self.volumeslider.valueChanged.connect(self.setVolume) self.vboxlayout = QVBoxLayout() self.vboxlayout.setContentsMargins(0, 0, 0, 0) self.videoframe.setStyleSheet( "background: black; border: 0px; padding: 0px;") self.vboxlayout.addWidget(self.videoframe) # self.vboxlayout.addWidget(self.positionslider) # self.vboxlayout.addLayout(self.hbuttonbox) self.widget.setLayout(self.vboxlayout) # open = QAction("&Open", self) # open.triggered.connect(self.OpenFile) # exit = QAction("&Exit", self) # exit.triggered.connect(sys.exit) # menubar = self.menuBar() # filemenu = menubar.addMenu("&File") # #filemenu.addAction(open) # filemenu.addSeparator() # filemenu.addAction(exit) self.timer = QTimer(self) self.timer.setInterval(200) self.timer.timeout.connect(self.updateUI)
def createUI(self): """Set up the user interface, signals & slots """ self.widget = QWidget(self) self.setCentralWidget(self.widget) self.widget.setStyleSheet("background: '#EEEEEE';") image_path = os.getcwd() + "/mamaro/babybedPNG/login0.png" image_profile = QtGui.QImage(image_path) #QImage object lbl1 = QtWidgets.QLabel('bluetoothstate', self) lbl1.setObjectName('bluetoothstate') lbl1.setPixmap(QtGui.QPixmap.fromImage(image_profile)) lbl1.setScaledContents(True) lbl1.setGeometry(48, 38, 195, 120) lbl1.resize(lbl1.sizeHint()) #create background lbl1 = QtWidgets.QLabel('back1', self) lbl1.setObjectName('back1') lbl1.setText("") lbl1.setFont(QtGui.QFont("ms gothic", 28)) lbl1.setStyleSheet("background: 'white';") lbl1.setGeometry(0, 120, 297, 296) lbl1 = QtWidgets.QLabel('back2', self) lbl1.setObjectName('back2') lbl1.setText("") lbl1.setFont(QtGui.QFont("ms gothic", 28)) lbl1.setStyleSheet("background: 'white';") lbl1.setGeometry(0, 420, 297, 296) lbl1 = QtWidgets.QLabel('back3', self) lbl1.setObjectName('back3') lbl1.setText("") lbl1.setFont(QtGui.QFont("ms gothic", 28)) lbl1.setStyleSheet("background: 'white';") lbl1.setGeometry(0, 720, 297, 296) #create background #create icon image_path = os.getcwd() + "/mamaro/babybedPNG/height0.png" image_profile = QtGui.QImage(image_path) #QImage object lbl1 = QtWidgets.QLabel('heighticon', self) lbl1.setObjectName('heighticon') lbl1.setPixmap(QtGui.QPixmap.fromImage(image_profile)) lbl1.setScaledContents(True) lbl1.setStyleSheet("background: 'white';") lbl1.setGeometry(91, 180, 115, 104) image_path = os.getcwd() + "/mamaro/babybedPNG/weight0.png" image_profile = QtGui.QImage(image_path) #QImage object lbl1 = QtWidgets.QLabel('weighticon', self) lbl1.setObjectName('weighticon') lbl1.setPixmap(QtGui.QPixmap.fromImage(image_profile)) lbl1.setScaledContents(True) lbl1.setStyleSheet("background: 'white';") lbl1.setGeometry(91, 480, 115, 104) image_path = os.getcwd() + "/mamaro/babybedPNG/temp0.png" image_profile = QtGui.QImage(image_path) #QImage object lbl1 = QtWidgets.QLabel('tempicon', self) lbl1.setObjectName('tempicon') lbl1.setPixmap(QtGui.QPixmap.fromImage(image_profile)) lbl1.setScaledContents(True) lbl1.setStyleSheet("background: 'white';") lbl1.setGeometry(91, 780, 115, 104) # lbl1.resize(lbl1.sizeHint()); #create text lbl1 = None lbl1 = QtWidgets.QLabel('heighttext', self) lbl1.setObjectName('heighttext') lbl1.setText("") lbl1.setFont(QtGui.QFont("ms gothic", 28)) lbl1.setStyleSheet("color:#9EA2A2;") #lbl1.setAlignment(QtCore.Qt.AlignTop) lbl1.setAlignment(QtCore.Qt.AlignCenter) lbl1.setGeometry(91, 314, 115, 46) lbl1 = QtWidgets.QLabel('weighttext', self) lbl1.setObjectName('weighttext') lbl1.setText("") lbl1.setFont(QtGui.QFont("ms gothic", 28)) lbl1.setStyleSheet("color:#9EA2A2;") #lbl1.setAlignment(QtCore.Qt.AlignTop) lbl1.setAlignment(QtCore.Qt.AlignCenter) lbl1.setGeometry(91, 614, 115, 52) lbl1 = QtWidgets.QLabel('temptext', self) lbl1.setObjectName('temptext') lbl1.setText("") lbl1.setFont(QtGui.QFont("ms gothic", 28)) lbl1.setStyleSheet("color:#9EA2A2;") #lbl1.setAlignment(QtCore.Qt.AlignTop) lbl1.setAlignment(QtCore.Qt.AlignCenter) lbl1.setGeometry(91, 914, 115, 46) lbl1 = QtWidgets.QLabel('contentcover', self) lbl1.setObjectName('contentcover') lbl1.setText("") lbl1.setCursor(Qt.PointingHandCursor) lbl1.setGeometry(0, 0, 297, 1080) lbl1.mousePressEvent = self.contentclick # In this widget, the video will be drawn if sys.platform == "darwin": # for MacOS from PyQt5.QtWidgets import QMacCocoaViewContainer videoframe = QMacCocoaViewContainer(0) else: videoframe = QtWidgets.QFrame(self) self.palette = videoframe.palette() self.palette.setColor(QPalette.Window, QColor(0, 0, 0)) videoframe.setObjectName('videoview') videoframe.setPalette(self.palette) videoframe.setAutoFillBackground(True) videoframe.mousePressEvent = self.contentclick videoframe.setGeometry(QtCore.QRect(298, 0, 1622, 1080)) global connection, roomid, readcheck, playlist, sorted_x, totalfile, oneloopindex, totalindexx, checkonetime, strings2, cou self.OpenFile(strings2[cou]) insertdata(sorted_x[cou].DBindex, sorted_x[cou].playindex, totalindexx) cou += 1 totalindexx += 1 print(self.mediaplayer.get_state())
def __init__(self): self.file_list = [] super(MainWindow, self).__init__() uic.loadUi('../Vista/interface.ui', self) ''' Actions for label buttons of widget list ''' self.Add.clicked.connect(self.Add_files) self.Select.clicked.connect(self.get_selected_item) self.Erase.clicked.connect(self.remove_selected_item) self.ChangePosition.clicked.connect(self.change_image) ''' Actions for Control the editor ''' self.export_2.clicked.connect(self.Remderize_video) self.ChangeImage.clicked.connect(self.put_image) self.ChangeAudio.clicked.connect(self.put_audio) self.get_start.clicked.connect(self.set_init_frame) self.get_end.clicked.connect(self.set_end_frame) self.label2 = QtWidgets.QLabel("Ja'mapel cocunubo", self) self.label2.setText("") ''' Actions of menu bar ''' self.actionExit.triggered.connect(self.exit) self.actionExport.triggered.connect(self.Remderize_video) self.actionOpen_Video.triggered.connect(self.OpenFile2) ''' Para entradas y salidas ''' self.to_draw = None self.selected_item = None # Variable con el item seleccionado por ej imagen ,a udio , video self.changes = None self.actvid = None self.actaud = None self.s1 = None self.s2 = None self.actimg = None self.tinicio = None self.tfin = None self.minframe = -1 self.maxframe = -1 self.newpath = None self.inicio = None # Variable con frame de inicio self.final = None # Variable con frame de terminacion self.x = None # Variable con posicion relativa en x self.y = None # Variable con posicion relative en y self.frame = None ''' DOnde puedes probar lo del VLC ''' # creating a basic vlc instance self.instance = vlc.Instance() self.mediaPlayer = self.instance.media_player_new() # In this widget, the video will be drawn if sys.platform == "darwin": # for MacOS from PyQt5.QtWidgets import QMacCocoaViewContainer self.videoPlayer = QMacCocoaViewContainer(0) else: self.videoPlayer = QtWidgets.QFrame() self.videoPlayer.resize(640, 360) self.palette = self.videoPlayer.palette() self.palette.setColor(QPalette.Window, QColor(0, 0, 0)) self.videoPlayer.setPalette(self.palette) self.videoPlayer.setAutoFillBackground(True) self.isPaused = False self.Play.clicked.connect(self.play) self.Pause.clicked.connect(self.pause) self.Stop.clicked.connect(self.stop) self.Timer.setMaximum(1000) self.Timer.sliderMoved.connect(self.setPosition) self.Volume.sliderMoved.connect(self.setVolume) self.Volume.setRange(0, 100) self.lay.addWidget(self.videoPlayer) self.reloj = QtCore.QTimer(self) self.reloj.setInterval(1) self.reloj.timeout.connect(self.updateUI) self.t = Thread(target=self.counter) self.t2 = Thread(target=self.counter2) self.t3 = Thread(target=self.Draw_Image) self.timeEdit.setDisplayFormat("hh:mm:ss AP") self.timer = QtCore.QTimer(self) self.timer.timeout.connect(self.updateTime) self.timer.start(1000) self.t.start() self.t2.start() #self.selection.mousePressEvent = self.getPos #self.layout = QtWidgets.QVBoxLayout() self.counterpro.display(0) self.show()
def createUI(self): """Set up the user interface, signals & slots """ self.widget = QWidget(self) self.setCentralWidget(self.widget) # In this widget, the video will be drawn if sys.platform == "darwin": # for MacOS from PyQt5.QtWidgets import QMacCocoaViewContainer self.videoframe = QMacCocoaViewContainer(0) else: self.videoframe = QFrame() self.palette = self.videoframe.palette() self.palette.setColor(QPalette.Window, QColor(0, 0, 0)) self.videoframe.setPalette(self.palette) self.videoframe.setAutoFillBackground(True) self.videoframe.setMinimumWidth(720) self.videoframe.setMinimumHeight(480) #self.hbuttonbox = QHBoxLayout() #self.openchannel = QPushButton("Open Channel Data") #self.hbuttonbox.addWidget(self.openchannel) #self.openchannel.clicked.connect(self.PlayPause) self.hcontrolbox = QHBoxLayout() self.hinfobox = QHBoxLayout() self.icon = QLabel() self.icon.setFixedSize(200, 60) self.icon.setAlignment(Qt.AlignCenter) self.hinfobox.addWidget(self.icon) self.vinfobox = QVBoxLayout() self.ch_name = QLabel("Loading...") font = QFont() font.setBold(True) font.setFamily('Malgun Gothic') font.setPointSize(16) self.ch_name.setFont(font) self.vinfobox.addWidget(self.ch_name) self.hservicebox = QHBoxLayout() self.hservicebox.addWidget(QLabel('Service ID ')) self.service_id = QLabel("[#]") self.hservicebox.addWidget(self.service_id) self.vinfobox.addLayout(self.hservicebox) self.hinfobox.addLayout(self.vinfobox) self.hcontrolbox.addLayout(self.hinfobox) self.hcontrolbox.addStretch(1) self.volumeslider = QSlider(Qt.Horizontal, self) self.volumeslider.setMaximum(100) self.volumeslider.setValue(self.mediaplayer.audio_get_volume()) self.volumeslider.setToolTip("Volume") self.hcontrolbox.addWidget(self.volumeslider) self.volumeslider.valueChanged.connect(self.setVolume) # self.channelbox = QVBoxLayout() self.channellist = QListWidget() self.channellist.setFixedWidth(320) self.channellist.itemClicked.connect(self.selectChannel) self.channelbox.addWidget(self.channellist) self.channelfilter = QLineEdit() self.channelfilter.setFixedWidth(320) self.channelfilter.textChanged.connect(self.find_channel) self.channelbox.addWidget(self.channelfilter) self.streambox = QVBoxLayout() self.streamlist = QListWidget() self.streamlist.setFixedWidth(320) self.streamlist.itemClicked.connect(self.selectStream) self.streambox.addWidget(self.streamlist) self.mapbutton = QPushButton("Map") self.mapbutton.clicked.connect(self.map) self.streambox.addWidget(self.mapbutton) self.vboxlayout = QVBoxLayout() self.vboxlayout.addWidget(self.videoframe) self.vboxlayout.addLayout(self.hcontrolbox) self.hboxlayout = QHBoxLayout() self.hboxlayout.addLayout(self.vboxlayout) self.hboxlayout.addLayout(self.channelbox) self.hboxlayout.addLayout(self.streambox) self.widget.setLayout(self.hboxlayout) export = QAction("&Export", self) export.triggered.connect(self.ExportFile) exit = QAction("E&xit", self) exit.triggered.connect(sys.exit) menubar = self.menuBar() filemenu = menubar.addMenu("&File") filemenu.addAction(export) filemenu.addSeparator() filemenu.addAction(exit) self.updatePlaylist()
def create_reader(self): # code from github.com/devos50/vlc-pyqt5-example.git # Video UI if sys.platform == "darwin": from PyQt5.QtWidgets import QMacCocoaViewContainer self.__video_reader = QMacCocoaViewContainer(0) else: self.__video_reader = QFrame(self) self.__palette = self.__video_reader.palette() self.__palette.setColor(QPalette.Window, QColor(0, 0, 0)) self.__video_reader.setPalette(self.__palette) self.__video_reader.setAutoFillBackground(True) self.__gr_video_reader = GraphicalObject(self.__video_reader, width=80, height=80, pos_x=10, pos_y=10, parent=self.__body) self.__videotitle = QLabel("No Video!", self) self.__videotitle.setWordWrap(True) self.__gr_videotitle = GraphicalObject(self.__videotitle, width=80, height=10, pos_x=10, pos_y=90, parent=self.__body) number_of_button = 3 btn_height = 7 btn_width = 7 ui_origin_x = 0 ui_origin_y = 100 - btn_height self.__buttonbar_video = QLabel(self) self.__buttonbar_video.setStyleSheet( "QLabel { background-color : white; color : blue; }") self.__gr_buttonbar_video = GraphicalObject( self.__buttonbar_video, width=100, height=btn_height, pos_x=0, pos_y=ui_origin_y, parent=self.__gr_video_reader) self.__previousbtn_video = TranslucidButton(self) self.__previousbtn_image = QPixmap('resources/back.svg') self.__previousbtn_video.setScaledContents(True) self.__previousbtn_video.setPixmap(self.__previousbtn_image) self.__gr_previousbtn_video = GraphicalObject( self.__previousbtn_video, width=btn_width, height=btn_height, pos_x=ui_origin_x + 0 * btn_width, pos_y=ui_origin_y, parent=self.__gr_video_reader) self.__skipbtn_video = TranslucidButton(self) self.__skipbtn_image = QPixmap('resources/skip.svg') self.__skipbtn_video.setScaledContents(True) self.__skipbtn_video.setPixmap(self.__skipbtn_image) self.__gr_skipbtn_video = GraphicalObject( self.__skipbtn_video, width=btn_width, height=btn_height, pos_x=ui_origin_x + 2 * btn_width, pos_y=ui_origin_y, parent=self.__gr_video_reader) self.__playbtn_video = TranslucidButton(self) self.__playbtn_video.clicked.connect(self.video_play_pause) self.__playbtn_image = QPixmap('resources/play.svg') self.__playbtn_video.setScaledContents(True) self.__playbtn_video.setPixmap(self.__playbtn_image) self.__gr_playbtn_video = GraphicalObject( self.__playbtn_video, width=btn_width, height=btn_height, pos_x=ui_origin_x + 1 * btn_width, pos_y=ui_origin_y, parent=self.__gr_video_reader) # Audio UI number_of_button = 3 btn_height = 5 btn_width = 10 ui_origin_x = 30 ui_origin_y = 50 - (btn_height / 2) self.__previousbtn_audio = QPushButton('Previous', self) #clicked.connect(self.handle_research) self.__gr_previousbtn_audio = GraphicalObject( self.__previousbtn_audio, width=btn_width, height=btn_height, pos_x=ui_origin_x + (0 * (100 - 2 * ui_origin_x)) / number_of_button, pos_y=ui_origin_y, parent=self.__body) self.__playbtn_audio = QPushButton('Play', self) self.__playbtn_audio.clicked.connect(self.audio_play_pause) self.__gr_playbtn_audio = GraphicalObject( self.__playbtn_audio, width=btn_width, height=btn_height, pos_x=ui_origin_x + (1 * (100 - 2 * ui_origin_x)) / number_of_button, pos_y=ui_origin_y, parent=self.__body) self.__skipbtn_audio = QPushButton('Skip', self) self.__skipbtn_audio.clicked.connect(self.__video_player.skip) self.__gr_skipbtn_audio = GraphicalObject( self.__skipbtn_audio, width=btn_width, height=btn_height, pos_x=ui_origin_x + (2 * (100 - 2 * ui_origin_x)) / number_of_button, pos_y=ui_origin_y, parent=self.__body)
def setupUi(self, hydraMainWindow): hydraMainWindow.setObjectName("hydraMainWindow") hydraMainWindow.resize(642, 400) hydraMainWindow.setMinimumSize(QtCore.QSize(0, 400)) hydraMainWindow.setFocusPolicy(QtCore.Qt.StrongFocus) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(self.resource_path("hydra_icon.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) hydraMainWindow.setWindowIcon(icon) hydraMainWindow.setStyleSheet("color: rgb(255, 255, 255);\n" "background-color: rgb(136, 138, 133);") self.centralwidget = QtWidgets.QWidget(hydraMainWindow) self.centralwidget.setStyleSheet("background-color: rgb(0, 0, 0);") self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setSpacing(0) self.gridLayout.setObjectName("gridLayout") if sys.platform == "darwin": # for MacOS from PyQt5.QtWidgets import QMacCocoaViewContainer self.videoFrame = QMacCocoaViewContainer(self.centralwidget) else: self.videoFrame = QtWidgets.QFrame(self.centralwidget) self.videoFrame.setStyleSheet("") self.videoFrame.setFrameShape(QtWidgets.QFrame.StyledPanel) self.videoFrame.setFrameShadow(QtWidgets.QFrame.Raised) self.videoFrame.setObjectName("videoFrame") self.gridLayout_3 = QtWidgets.QGridLayout(self.videoFrame) self.gridLayout_3.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint) self.gridLayout_3.setContentsMargins(0, 0, 0, 0) self.gridLayout_3.setHorizontalSpacing(0) self.gridLayout_3.setVerticalSpacing(6) self.gridLayout_3.setObjectName("gridLayout_3") self.frame_2 = QtWidgets.QFrame(self.videoFrame) self.frame_2.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.frame_2.setStyleSheet("background-color: rgb(0, 0, 0);") self.frame_2.setFrameShape(QtWidgets.QFrame.NoFrame) self.frame_2.setFrameShadow(QtWidgets.QFrame.Plain) self.frame_2.setObjectName("frame_2") self.gridLayout_3.addWidget(self.frame_2, 0, 0, 1, 1) self.gridLayout.addWidget(self.videoFrame, 0, 0, 1, 1) self.controlsFrame = QtWidgets.QFrame(self.centralwidget) self.controlsFrame.setMinimumSize(QtCore.QSize(0, 40)) self.controlsFrame.setMaximumSize(QtCore.QSize(16777215, 40)) self.controlsFrame.setStyleSheet("color: rgb(255, 255, 255);\n" "background-color: rgb(85, 87, 83);") self.controlsFrame.setObjectName("controlsFrame") self.horizontalLayout = QtWidgets.QHBoxLayout(self.controlsFrame) self.horizontalLayout.setContentsMargins(2, 0, 2, 0) self.horizontalLayout.setObjectName("horizontalLayout") self.openMediaButton = QtWidgets.QPushButton(self.controlsFrame) self.openMediaButton.setMinimumSize(QtCore.QSize(32, 26)) self.openMediaButton.setMaximumSize(QtCore.QSize(32, 26)) self.openMediaButton.setFocusPolicy(QtCore.Qt.NoFocus) self.openMediaButton.setText("") icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(self.resource_path("open_vid.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.openMediaButton.setIcon(icon1) self.openMediaButton.setIconSize(QtCore.QSize(20, 20)) self.openMediaButton.setObjectName("openMediaButton") self.horizontalLayout.addWidget(self.openMediaButton) self.openPlaylistButton = QtWidgets.QPushButton(self.controlsFrame) self.openPlaylistButton.setMinimumSize(QtCore.QSize(32, 26)) self.openPlaylistButton.setMaximumSize(QtCore.QSize(32, 26)) self.openPlaylistButton.setFocusPolicy(QtCore.Qt.NoFocus) self.openPlaylistButton.setText("") icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(self.resource_path("load_playlist.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.openPlaylistButton.setIcon(icon2) self.openPlaylistButton.setIconSize(QtCore.QSize(20, 20)) self.openPlaylistButton.setObjectName("openPlaylistButton") self.horizontalLayout.addWidget(self.openPlaylistButton) self.previousMediaButton = QtWidgets.QPushButton(self.controlsFrame) self.previousMediaButton.setMinimumSize(QtCore.QSize(32, 26)) self.previousMediaButton.setMaximumSize(QtCore.QSize(32, 26)) self.previousMediaButton.setFocusPolicy(QtCore.Qt.NoFocus) self.previousMediaButton.setText("") icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(self.resource_path("previous_media.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.previousMediaButton.setIcon(icon3) self.previousMediaButton.setIconSize(QtCore.QSize(20, 20)) self.previousMediaButton.setObjectName("previousMediaButton") self.horizontalLayout.addWidget(self.previousMediaButton) self.playPauseButton = QtWidgets.QPushButton(self.controlsFrame) self.playPauseButton.setMinimumSize(QtCore.QSize(32, 26)) self.playPauseButton.setMaximumSize(QtCore.QSize(32, 26)) self.playPauseButton.setFocusPolicy(QtCore.Qt.NoFocus) self.playPauseButton.setText("") icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap(self.resource_path("play.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.playPauseButton.setIcon(icon4) self.playPauseButton.setIconSize(QtCore.QSize(20, 20)) self.playPauseButton.setObjectName("playPauseButton") self.horizontalLayout.addWidget(self.playPauseButton) self.stopButton = QtWidgets.QPushButton(self.controlsFrame) self.stopButton.setMinimumSize(QtCore.QSize(32, 26)) self.stopButton.setMaximumSize(QtCore.QSize(32, 26)) self.stopButton.setFocusPolicy(QtCore.Qt.NoFocus) self.stopButton.setText("") icon5 = QtGui.QIcon() icon5.addPixmap(QtGui.QPixmap(self.resource_path("stop.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.stopButton.setIcon(icon5) self.stopButton.setIconSize(QtCore.QSize(20, 20)) self.stopButton.setObjectName("stopButton") self.horizontalLayout.addWidget(self.stopButton) self.repeatButton = QtWidgets.QPushButton(self.controlsFrame) self.repeatButton.setMinimumSize(QtCore.QSize(32, 26)) self.repeatButton.setMaximumSize(QtCore.QSize(32, 26)) self.repeatButton.setFocusPolicy(QtCore.Qt.NoFocus) self.repeatButton.setText("") icon6 = QtGui.QIcon() icon6.addPixmap(QtGui.QPixmap(self.resource_path("repeat_off.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.repeatButton.setIcon(icon6) self.repeatButton.setIconSize(QtCore.QSize(20, 20)) self.repeatButton.setCheckable(True) self.repeatButton.setObjectName("repeatButton") self.horizontalLayout.addWidget(self.repeatButton) self.nextMediaButton = QtWidgets.QPushButton(self.controlsFrame) self.nextMediaButton.setMinimumSize(QtCore.QSize(32, 26)) self.nextMediaButton.setMaximumSize(QtCore.QSize(32, 26)) self.nextMediaButton.setFocusPolicy(QtCore.Qt.NoFocus) self.nextMediaButton.setText("") icon7 = QtGui.QIcon() icon7.addPixmap(QtGui.QPixmap(self.resource_path("next_media.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.nextMediaButton.setIcon(icon7) self.nextMediaButton.setIconSize(QtCore.QSize(20, 20)) self.nextMediaButton.setObjectName("nextMediaButton") self.horizontalLayout.addWidget(self.nextMediaButton) self.line = QtWidgets.QFrame(self.controlsFrame) self.line.setFrameShape(QtWidgets.QFrame.VLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.line.setObjectName("line") self.horizontalLayout.addWidget(self.line) self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setSpacing(0) self.verticalLayout.setObjectName("verticalLayout") self.progressSlider = QtWidgets.QSlider(self.controlsFrame) self.progressSlider.setMinimumSize(QtCore.QSize(225, 0)) self.progressSlider.setFocusPolicy(QtCore.Qt.NoFocus) self.progressSlider.setStyleSheet("background-color: rgb(85, 87, 83);") self.progressSlider.setMaximum(1000) self.progressSlider.setPageStep(20) self.progressSlider.setOrientation(QtCore.Qt.Horizontal) self.progressSlider.setObjectName("progressSlider") self.verticalLayout.addWidget(self.progressSlider) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setContentsMargins(-1, -1, -1, 5) self.horizontalLayout_2.setSpacing(0) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.currentTimeLabel = QtWidgets.QLabel(self.controlsFrame) self.currentTimeLabel.setMaximumSize(QtCore.QSize(16777215, 10)) font = QtGui.QFont() font.setPointSize(10) self.currentTimeLabel.setFont(font) self.currentTimeLabel.setObjectName("currentTimeLabel") self.horizontalLayout_2.addWidget(self.currentTimeLabel) self.totalDurationLabel = QtWidgets.QLabel(self.controlsFrame) self.totalDurationLabel.setMaximumSize(QtCore.QSize(16777215, 10)) font = QtGui.QFont() font.setPointSize(10) self.totalDurationLabel.setFont(font) self.totalDurationLabel.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.totalDurationLabel.setObjectName("totalDurationLabel") self.horizontalLayout_2.addWidget(self.totalDurationLabel) self.verticalLayout.addLayout(self.horizontalLayout_2) self.horizontalLayout.addLayout(self.verticalLayout) self.line_2 = QtWidgets.QFrame(self.controlsFrame) self.line_2.setFrameShape(QtWidgets.QFrame.VLine) self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_2.setObjectName("line_2") self.horizontalLayout.addWidget(self.line_2) self.volumeSlider = QtWidgets.QSlider(self.controlsFrame) self.volumeSlider.setMinimumSize(QtCore.QSize(109, 0)) self.volumeSlider.setMaximumSize(QtCore.QSize(109, 16777215)) self.volumeSlider.setFocusPolicy(QtCore.Qt.NoFocus) self.volumeSlider.setMaximum(100) self.volumeSlider.setPageStep(5) self.volumeSlider.setProperty("value", 100) self.volumeSlider.setOrientation(QtCore.Qt.Horizontal) self.volumeSlider.setObjectName("volumeSlider") self.horizontalLayout.addWidget(self.volumeSlider) self.gridLayout.addWidget(self.controlsFrame, 1, 0, 1, 1) hydraMainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(hydraMainWindow) QtCore.QMetaObject.connectSlotsByName(hydraMainWindow)
def createUI(self): """ Set up the window for the VLC viewer """ self.widget = QWidget(self) self.setCentralWidget(self.widget) # In this widget, the video will be drawn if sys.platform == "darwin": # for MacOS from PyQt5.QtWidgets import QMacCocoaViewContainer self.videoframe = QMacCocoaViewContainer(0) else: self.videoframe = QFrame() self.palette = self.videoframe.palette() self.palette.setColor (QPalette.Window, QColor(0,0,0)) self.videoframe.setPalette(self.palette) self.videoframe.setAutoFillBackground(True) self.hbuttonbox = QHBoxLayout() self.playbutton = QPushButton("Run my program") self.hbuttonbox.addWidget(self.playbutton) self.playbutton.clicked.connect(partial(self.drone_vision.run_user_code, self.playbutton)) self.landbutton = QPushButton("Land NOW") self.hbuttonbox.addWidget(self.landbutton) self.landbutton.clicked.connect(self.drone_vision.land) self.stopbutton = QPushButton("Quit") self.hbuttonbox.addWidget(self.stopbutton) self.stopbutton.clicked.connect(self.drone_vision.close_exit) self.vboxlayout = QVBoxLayout() self.vboxlayout.addWidget(self.videoframe) if (self.drone_vision.user_draw_window_fn is not None): self.userWindow = QLabel() fullPath = inspect.getfile(DroneVisionGUI) shortPathIndex = fullPath.rfind("/") if (shortPathIndex == -1): # handle Windows paths shortPathIndex = fullPath.rfind("\\") print(shortPathIndex) shortPath = fullPath[0:shortPathIndex] pixmap = QPixmap('%s/demo_user_image.png' % shortPath) print(pixmap) print(pixmap.isNull()) self.userWindow.setPixmap(pixmap) self.vboxlayout.addWidget(self.userWindow) self.vboxlayout.addLayout(self.hbuttonbox) self.widget.setLayout(self.vboxlayout) # the media player has to be 'connected' to the QFrame # (otherwise a video would be displayed in it's own window) # this is platform specific! # you have to give the id of the QFrame (or similar object) to # vlc, different platforms have different functions for this if sys.platform.startswith('linux'): # for Linux using the X Server self.mediaplayer.set_xwindow(self.videoframe.winId()) elif sys.platform == "win32": # for Windows self.mediaplayer.set_hwnd(self.videoframe.winId()) elif sys.platform == "darwin": # for MacOS self.mediaplayer.set_nsobject(int(self.videoframe.winId()))