def showMainWindow(self): self.move((self.screen.width() - self.width()) / 2, (self.screen.height() - self.height()) / 2) self.meidaPlayer = QMediaPlayer() self.playlist = QMediaPlaylist() self.playlist.setCurrentIndex(1) self.playlist.addMedia( QMediaContent(QUrl().fromLocalFile( "video/Radio-Digital-Scheme-Live-Wallpaper~1.mp4"))) self.playlist.setPlaybackMode(QMediaPlaylist.CurrentItemInLoop) self.meidaPlayer.setPlaylist(self.playlist) videoWidget = QVideoWidget() videoWidget.setAspectRatioMode(Qt.IgnoreAspectRatio) videoWidget.setAutoFillBackground(True) videoWidget.setSizePolicy( QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) # videoWidget.setMinimumSize(videoWidget.size()) self.meidaPlayer.setVideoOutput(videoWidget) self.videoLayout.insertWidget(0, videoWidget) self.meidaPlayer.play() # self.pushButton_4.clicked.connect(self.showColorDialog) self.pushButton_4.installEventFilter(self) # self.pushButton.setGeometry() self.setVisible(1)
class Ui_MainWindow1(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(800, 560) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout.setObjectName("gridLayout") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize) self.horizontalLayout.setObjectName("horizontalLayout") self.pushButton = QtWidgets.QPushButton(self.centralwidget) self.pushButton.setObjectName("pushButton") self.horizontalLayout.addWidget(self.pushButton) self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_2.setObjectName("pushButton_2") self.horizontalLayout.addWidget(self.pushButton_2) self.pushButton_4 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_4.setObjectName("pushButton_4") self.horizontalLayout.addWidget(self.pushButton_4) self.pushButton_5 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_5.setObjectName("pushButton_5") self.horizontalLayout.addWidget(self.pushButton_5) self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_3.setObjectName("pushButton_3") self.horizontalLayout.addWidget(self.pushButton_3) self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 1) self.widget = QVideoWidget(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.widget.sizePolicy().hasHeightForWidth()) self.widget.setSizePolicy(sizePolicy) self.widget.setObjectName("widget") self.gridLayout.addWidget(self.widget, 0, 0, 1, 1) self.horizontalSlider = QtWidgets.QSlider(self.centralwidget) self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal) self.horizontalSlider.setObjectName("horizontalSlider") self.gridLayout.addWidget(self.horizontalSlider, 2, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "VideoEditor")) self.pushButton.setText(_translate("MainWindow", "打开")) self.pushButton_4.setText(_translate("MainWindow", "起始")) self.pushButton_5.setText(_translate("MainWindow", "无声")) self.pushButton_3.setText(_translate("MainWindow", "处理"))
class CamConfig(QWidget,_camconfig.Mixin): def __init__(self): super(CamConfig, self).__init__() self.setWindowTitle("Configurações de Câmera") self.setWindowIcon(QIcon('./gui/res/icon_device.png')) self.ipcamservices = IpCamServices() self.UI() self.populateCameras() def UI(self): layout = QHBoxLayout() self.setLayout(layout) self.ipcam = QUrl('') self.mp = QMediaPlayer() self.vw = QVideoWidget() self.media = QMediaContent(QNetworkRequest(self.ipcam)) self.mp.setMedia(self.media) self.mp.setVideoOutput(self.vw) #self.mp.play() self.vw.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding) vbox = QVBoxLayout() vbox.addWidget(self.vw) layout.addLayout(vbox) #self.vw.show() form = QFormLayout() self.lstCameras = QListWidget() layout.addLayout(form) self.edtIP = QLineEdit() self.btnConnect = QPushButton('Conectar') self.btnSelectVideo = QPushButton('Selecionar vídeo') self.btnSave = QPushButton('Salvar modificações') self.btnConnect.clicked.connect(self.btnConnect_onclick) self.btnSave.clicked.connect(self.btnSave_onclick) self.btnSelectVideo.clicked.connect(self.btnSelectVideo_onclick) form.addRow(self.lstCameras) layout = QHBoxLayout() layout.addWidget(self.edtIP) layout.addWidget(self.btnConnect) form.addRow(layout) layout = QHBoxLayout() layout.addWidget(self.btnSelectVideo) layout.addWidget(self.btnSave) form.addRow(layout) self.lstCameras.currentRowChanged.connect(self.lstCameras_changed)
class App(QWidget): def __init__(self): super().__init__() self.title = 'Main' self.left = 10 self.top = 10 self.width = 640 self.height = 480 self.setWindowTitle(self.title) # self.setGeometry(self.left, self.top, self.width, self.height) # Create video widget self.videoWidget = QVideoWidget() self.videoWidget.aspectRatioMode = Qt.KeepAspectRatio self.videoWidget.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred) self.videoWidget.setMinimumSize(320, 320) # Create Media player self.mediaPlayer = QMediaPlayer(None, QMediaPlayer.VideoSurface) self.mediaPlayer.setVideoOutput(self.videoWidget) # self.mediaPlayer.positionChanged.connect(self.positionChanged) self.mediaPlayer.setMedia( QMediaContent(QUrl.fromLocalFile(os.path.abspath('sample2.mov')))) # Create media player bridge self.mediaPlayerBridge = MediaPlayerBridge(self.mediaPlayer) # Create Web View self.webView = QtWebEngineWidgets.QWebEngineView() self.webView.setContextMenuPolicy( Qt.PreventContextMenu) # TODO: test NoContextMenu # self.webView.setWindowFlags(Qt.FramelessWindowHint) # self.webView.setAttribute(Qt.WA_TranslucentBackground, True) self.page = WebRTCPageView() self.page.setBackgroundColor(Qt.transparent) self.page.objects = {"mediaPlayerBridge": self.mediaPlayerBridge} self.page.profile().clearHttpCache() self.webView.setPage(self.page) # Create layout layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) layout.addWidget(self.videoWidget) layout.addWidget(self.webView) self.setLayout(layout) self.resize(640, 800) self.show() self.mediaPlayer.play()
class Ui_NewProject(object): def setupUi(self, NewProject): NewProject.setObjectName("NewProject") NewProject.resize(736, 625) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/plugins/Video_UAV_Tracker/icon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) NewProject.setWindowIcon(icon) self.gridLayout_2 = QtWidgets.QGridLayout(NewProject) self.gridLayout_2.setObjectName("gridLayout_2") self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.video_frame_2 = QVideoWidget(NewProject) p = self.video_frame_2.palette() p.setColor(QtGui.QPalette.Window, QtCore.Qt.black) self.video_frame_2.setPalette(p) self.video_frame_2.setAttribute(QtCore.Qt.WA_OpaquePaintEvent) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.video_frame_2.sizePolicy().hasHeightForWidth()) self.video_frame_2.setSizePolicy(sizePolicy) self.video_frame_2.setStyleSheet("background-color: rgb(0, 0, 0);") self.video_frame_2.setObjectName("video_frame_2") self.horizontalLayout.addWidget(self.video_frame_2) self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 15) self.horizontalSlider = QtWidgets.QSlider(NewProject) self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal) self.horizontalSlider.setObjectName("horizontalSlider") self.gridLayout.addWidget(self.horizontalSlider, 1, 0, 1, 15) self.replayPlay_pushButton = QtWidgets.QPushButton(NewProject) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.replayPlay_pushButton.sizePolicy().hasHeightForWidth()) self.replayPlay_pushButton.setSizePolicy(sizePolicy) self.replayPlay_pushButton.setCheckable(False) self.replayPlay_pushButton.setChecked(False) self.replayPlay_pushButton.setObjectName("replayPlay_pushButton") self.gridLayout.addWidget(self.replayPlay_pushButton, 3, 1, 1, 1) self.replayPosition_label = QtWidgets.QLabel(NewProject) self.replayPosition_label.setObjectName("replayPosition_label") self.gridLayout.addWidget(self.replayPosition_label, 3, 4, 1, 1) self.muteButton = QtWidgets.QToolButton(NewProject) self.muteButton.setText("") self.muteButton.setObjectName("muteButton") self.gridLayout.addWidget(self.muteButton, 3, 2, 1, 1) self.comboBox = QtWidgets.QComboBox(NewProject) self.comboBox.setObjectName("comboBox") self.gridLayout.addWidget(self.comboBox, 3, 14, 1, 1) self.pushButton_2 = QtWidgets.QPushButton(NewProject) self.pushButton_2.setObjectName("pushButton_2") self.gridLayout.addWidget(self.pushButton_2, 3, 12, 1, 1) self.toolButton_3 = QtWidgets.QToolButton(NewProject) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(":/plugins/Video_UAV_Tracker/mIconFormSelect.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_3.setIcon(icon1) self.toolButton_3.setObjectName("toolButton_3") self.gridLayout.addWidget(self.toolButton_3, 3, 11, 1, 1) self.toolButton_2 = QtWidgets.QToolButton(NewProject) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(":/VgisIcon/mActionAtlasNext.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_2.setIcon(icon2) self.toolButton_2.setObjectName("toolButton_2") self.gridLayout.addWidget(self.toolButton_2, 3, 9, 1, 1) self.SkipFortoolButton_8 = QtWidgets.QToolButton(NewProject) self.SkipFortoolButton_8.setStyleSheet("") icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(":/VgisIcon/mActionArrowRight.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.SkipFortoolButton_8.setIcon(icon3) self.SkipFortoolButton_8.setObjectName("SkipFortoolButton_8") self.gridLayout.addWidget(self.SkipFortoolButton_8, 3, 8, 1, 1) self.SkipBacktoolButton_7 = QtWidgets.QToolButton(NewProject) self.SkipBacktoolButton_7.setStyleSheet("") icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap(":/VgisIcon/mActionArrowLeft.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.SkipBacktoolButton_7.setIcon(icon4) self.SkipBacktoolButton_7.setObjectName("SkipBacktoolButton_7") self.gridLayout.addWidget(self.SkipBacktoolButton_7, 3, 7, 1, 1) self.toolButton = QtWidgets.QToolButton(NewProject) icon5 = QtGui.QIcon() icon5.addPixmap(QtGui.QPixmap(":/VgisIcon/mActionAtlasPrev.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton.setIcon(icon5) self.toolButton.setObjectName("toolButton") self.gridLayout.addWidget(self.toolButton, 3, 6, 1, 1) self.pushButton = QtWidgets.QPushButton(NewProject) self.pushButton.setObjectName("pushButton") self.gridLayout.addWidget(self.pushButton, 3, 0, 1, 1) self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1) self.retranslateUi(NewProject) QtCore.QMetaObject.connectSlotsByName(NewProject) def retranslateUi(self, NewProject): _translate = QtCore.QCoreApplication.translate NewProject.setWindowTitle(_translate("NewProject", "Video UAV Tracker - New Project")) self.replayPlay_pushButton.setText(_translate("NewProject", "Play/Pause")) self.replayPosition_label.setText(_translate("NewProject", "-:- / -:-")) self.pushButton_2.setToolTip(_translate("NewProject", "<html><head/><body><p>Synchronize actual video frame with selected GPS time</p></body></html>")) self.comboBox.setToolTip(_translate("NewProject", "<html><head/><body><p> GPS time</p></body></html>")) self.pushButton_2.setText(_translate("NewProject", "Synchronize!")) self.toolButton_3.setToolTip(_translate("NewProject", "<html><head/><body><p>Add point shape database to project</p></body></html>")) #self.toolButton_3.setText(_translate("NewProject", "DB")) self.toolButton_2.setToolTip(_translate("NewProject", "<html><head/><body><p>Next second</p></body></html>")) self.toolButton_2.setText(_translate("NewProject", ">>")) self.SkipFortoolButton_8.setToolTip(_translate("NewProject", "<html><head/><body><p>Next frame</p></body></html>")) self.SkipFortoolButton_8.setText(_translate("NewProject", ">")) self.SkipBacktoolButton_7.setToolTip(_translate("NewProject", "<html><head/><body><p>Previous frame</p></body></html>")) self.SkipBacktoolButton_7.setText(_translate("NewProject", "<")) self.toolButton.setToolTip(_translate("NewProject", "<html><head/><body><p>Previous second</p></body></html>")) self.toolButton.setText(_translate("NewProject", "<<")) self.pushButton.setToolTip(_translate("NewProject", "<html><head/><body><p>Select video and relative gpx</p></body></html>")) self.pushButton.setText(_translate("NewProject", "Select Video and GPX"))
class Ui_NewProject(object): def setupUi(self, NewProject): NewProject.setObjectName("NewProject") NewProject.resize(736, 625) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/plugins/VideoGis/icon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) NewProject.setWindowIcon(icon) self.gridLayout_2 = QtWidgets.QGridLayout(NewProject) self.gridLayout_2.setObjectName("gridLayout_2") self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.video_frame_2 = QVideoWidget(NewProject) p = self.video_frame_2.palette() p.setColor(QtGui.QPalette.Window, QtCore.Qt.black) self.video_frame_2.setPalette(p) self.video_frame_2.setAttribute(QtCore.Qt.WA_OpaquePaintEvent) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.video_frame_2.sizePolicy().hasHeightForWidth()) self.video_frame_2.setSizePolicy(sizePolicy) self.video_frame_2.setStyleSheet("background-color: rgb(0, 0, 0);") self.video_frame_2.setObjectName("video_frame_2") self.horizontalLayout.addWidget(self.video_frame_2) self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 16) self.horizontalSlider = QtWidgets.QSlider(NewProject) self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal) self.horizontalSlider.setObjectName("horizontalSlider") self.gridLayout.addWidget(self.horizontalSlider, 1, 0, 1, 16) self.replayPlay_pushButton = QtWidgets.QPushButton(NewProject) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.replayPlay_pushButton.sizePolicy().hasHeightForWidth()) self.replayPlay_pushButton.setSizePolicy(sizePolicy) self.replayPlay_pushButton.setCheckable(False) self.replayPlay_pushButton.setChecked(False) self.replayPlay_pushButton.setObjectName("replayPlay_pushButton") self.gridLayout.addWidget(self.replayPlay_pushButton, 3, 1, 1, 1) self.replayPosition_label = QtWidgets.QLabel(NewProject) self.replayPosition_label.setObjectName("replayPosition_label") self.gridLayout.addWidget(self.replayPosition_label, 3, 4, 1, 1) self.muteButton = QtWidgets.QToolButton(NewProject) self.muteButton.setText("") self.muteButton.setObjectName("muteButton") self.gridLayout.addWidget(self.muteButton, 3, 2, 1, 1) self.comboBox = QtWidgets.QComboBox(NewProject) self.comboBox.setObjectName("comboBox") self.gridLayout.addWidget(self.comboBox, 3, 15, 1, 1) self.pushButton_2 = QtWidgets.QPushButton(NewProject) self.pushButton_2.setObjectName("pushButton_2") self.gridLayout.addWidget(self.pushButton_2, 3, 13, 1, 1) self.toolButton_3 = QtWidgets.QToolButton(NewProject) icon1 = QtGui.QIcon() icon1.addPixmap( QtGui.QPixmap(":/plugins/VideoGis/mIconFormSelect.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_3.setIcon(icon1) self.toolButton_3.setObjectName("toolButton_3") self.gridLayout.addWidget(self.toolButton_3, 3, 11, 1, 1) self.toolButton_2 = QtWidgets.QToolButton(NewProject) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(":/VgisIcon/mActionAtlasNext.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_2.setIcon(icon2) self.toolButton_2.setObjectName("toolButton_2") self.gridLayout.addWidget(self.toolButton_2, 3, 9, 1, 1) self.SkipFortoolButton_8 = QtWidgets.QToolButton(NewProject) self.SkipFortoolButton_8.setStyleSheet("") icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(":/VgisIcon/mActionArrowRight.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.SkipFortoolButton_8.setIcon(icon3) self.SkipFortoolButton_8.setObjectName("SkipFortoolButton_8") self.gridLayout.addWidget(self.SkipFortoolButton_8, 3, 8, 1, 1) self.SkipBacktoolButton_7 = QtWidgets.QToolButton(NewProject) self.SkipBacktoolButton_7.setStyleSheet("") icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap(":/VgisIcon/mActionArrowLeft.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.SkipBacktoolButton_7.setIcon(icon4) self.SkipBacktoolButton_7.setObjectName("SkipBacktoolButton_7") self.gridLayout.addWidget(self.SkipBacktoolButton_7, 3, 7, 1, 1) self.toolButton = QtWidgets.QToolButton(NewProject) icon5 = QtGui.QIcon() icon5.addPixmap(QtGui.QPixmap(":/VgisIcon/mActionAtlasPrev.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton.setIcon(icon5) self.toolButton.setObjectName("toolButton") self.gridLayout.addWidget(self.toolButton, 3, 6, 1, 1) self.pushButton = QtWidgets.QPushButton(NewProject) self.pushButton.setObjectName("pushButton") self.gridLayout.addWidget(self.pushButton, 3, 0, 1, 1) self.toolButton_4 = QtWidgets.QToolButton(NewProject) self.toolButton_4.setObjectName("toolButton_4") self.gridLayout.addWidget(self.toolButton_4, 3, 12, 1, 1) self.checkBox = QtWidgets.QCheckBox(NewProject) self.checkBox.setObjectName("checkBox") self.gridLayout.addWidget(self.checkBox, 3, 14, 1, 1) self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1) self.retranslateUi(NewProject) QtCore.QMetaObject.connectSlotsByName(NewProject) def retranslateUi(self, NewProject): _translate = QtCore.QCoreApplication.translate NewProject.setWindowTitle( _translate("NewProject", "Video UAV Tracker - New Project")) self.replayPlay_pushButton.setText( _translate("NewProject", "Play/Pause")) self.replayPosition_label.setText(_translate("NewProject", "-:- / -:-")) self.pushButton_2.setToolTip( _translate( "NewProject", "<html><head/><body><p>Synchronize actual video frame with selected GPS time</p></body></html>" )) self.comboBox.setToolTip( _translate("NewProject", "<html><head/><body><p> GPS time</p></body></html>")) self.pushButton_2.setText(_translate("NewProject", "Synchronize!")) self.toolButton_3.setToolTip( _translate( "NewProject", "<html><head/><body><p>Add point shape database to project</p></body></html>" )) #self.toolButton_3.setText(_translate("NewProject", "DB")) self.toolButton_2.setToolTip( _translate("NewProject", "<html><head/><body><p>Next second</p></body></html>")) self.toolButton_2.setText(_translate("NewProject", ">>")) self.SkipFortoolButton_8.setToolTip( _translate("NewProject", "<html><head/><body><p>Next frame</p></body></html>")) self.SkipFortoolButton_8.setText(_translate("NewProject", ">")) self.SkipBacktoolButton_7.setToolTip( _translate( "NewProject", "<html><head/><body><p>Previous frame</p></body></html>")) self.SkipBacktoolButton_7.setText(_translate("NewProject", "<")) self.toolButton.setToolTip( _translate( "NewProject", "<html><head/><body><p>Previous second</p></body></html>")) self.toolButton.setText(_translate("NewProject", "<<")) self.pushButton.setToolTip( _translate( "NewProject", "<html><head/><body><p>Select video and relative gpx</p></body></html>" )) self.pushButton.setText( _translate("NewProject", "Select Video and GPX")) self.toolButton_4.setText(_translate("NewProject", "3D")) self.checkBox.setToolTip( _translate( "NewProject", "<html><head/><body><p>Activate Pixel value conversion and display (see README)</p></body></html>" ))
class GameWindow(QWidget): def open_file(self, file_name): if file_name != "": url = QUrl() self.media_player.setMedia(QMediaContent(url.fromLocalFile(file_name))) def play(self): if self.media_player.state() == QMediaPlayer.PlayingState: self.media_player.pause() else: self.media_player.play() def play_v(self, file, rate, visibility, string=""): self.position = 0 self.startPos = 0 self.duration = 0 self.durChanged = False self.stopPos = False self.open_file(file) self.media_player.setPlaybackRate(rate) if visibility: self.media_player.setVolume(100) self.video_widget.show() self.string_label.show() self.string_label.setText(string) else: self.media_player.setVolume(0) self.video_widget.hide() self.play() def closeEvent(self, event): event.ignore() self.media_player.stop() self.hide() def position_changed(self, pos): self.position = pos if not self.durChanged and self.position > 0: self.duration_changed(self.media_player.duration()) self.durChanged = True if self.startPos > 0 and not self.stopPos and not self.video_widget.isVisible(): if self.position > self.startPos + 20000: self.play() self.stopPos = True def duration_changed(self, dur): self.duration = dur if self.duration > 40000 and not self.video_widget.isVisible(): self.startPos = random.randint(5000, self.duration - 25000) self.media_player.setPosition(self.startPos) self.media_player.setVolume(100) def show_string(self, string): self.video_widget.hide() self.string_label.show() self.string_label.setText(string) def open_close_window(self): if self.isVisible(): self.hide() else: self.show() def __init__(self, parent=None): super(GameWindow, self).__init__(parent) self.media_player = QMediaPlayer(None, QMediaPlayer.VideoSurface) self.video_widget = QVideoWidget() self.video_widget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.media_player.setVideoOutput(self.video_widget) self.string_label = QLabel() self.string_label.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) self.string_label.setTextFormat(Qt.RichText) self.string_label.setAlignment(Qt.AlignHCenter) self.string_label.setWordWrap(1) layout = QVBoxLayout() layout.addWidget(self.video_widget) layout.addWidget(self.string_label) self.setLayout(layout) self.media_player.positionChanged.connect(self.position_changed) self.resize(640, 480) self.setWindowTitle("Game")
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1225, 788) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth( MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setPointSize(13) font.setBold(True) font.setWeight(75) MainWindow.setFont(font) MainWindow.setAutoFillBackground(False) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.label = QtWidgets.QLabel(self.centralwidget) self.label.setGeometry(QtCore.QRect(460, 10, 331, 71)) self.label.setObjectName("label") self.gridLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.gridLayoutWidget.setGeometry(QtCore.QRect(40, 110, 531, 361)) self.gridLayoutWidget.setObjectName("gridLayoutWidget") self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setObjectName("gridLayout") self.label_7 = QtWidgets.QLabel(self.gridLayoutWidget) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.label_7.setFont(font) self.label_7.setFrameShape(QtWidgets.QFrame.Box) self.label_7.setObjectName("label_7") self.gridLayout.addWidget(self.label_7, 4, 0, 1, 1) self.label_2 = QtWidgets.QLabel(self.gridLayoutWidget) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.label_2.setFont(font) self.label_2.setFrameShape(QtWidgets.QFrame.Box) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 2, 1, 1, 1) self.label_4 = QtWidgets.QLabel(self.gridLayoutWidget) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.label_4.setFont(font) self.label_4.setFrameShape(QtWidgets.QFrame.Box) self.label_4.setObjectName("label_4") self.gridLayout.addWidget(self.label_4, 2, 0, 1, 1) self.label_5 = QtWidgets.QLabel(self.gridLayoutWidget) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.label_5.setFont(font) self.label_5.setFrameShape(QtWidgets.QFrame.Box) self.label_5.setObjectName("label_5") self.gridLayout.addWidget(self.label_5, 4, 2, 1, 1) self.label_6 = QtWidgets.QLabel(self.gridLayoutWidget) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.label_6.setFont(font) self.label_6.setFrameShape(QtWidgets.QFrame.Box) self.label_6.setObjectName("label_6") self.gridLayout.addWidget(self.label_6, 4, 1, 1, 1) self.label_3 = QtWidgets.QLabel(self.gridLayoutWidget) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.label_3.setFont(font) self.label_3.setFrameShape(QtWidgets.QFrame.Box) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 2, 2, 1, 1) self.spot_no_1 = QtWidgets.QGraphicsView(self.gridLayoutWidget) self.spot_no_1.setFrameShape(QtWidgets.QFrame.StyledPanel) self.spot_no_1.setObjectName("spot_no_1") self.gridLayout.addWidget(self.spot_no_1, 0, 0, 1, 1) self.spot_no_2 = QtWidgets.QGraphicsView(self.gridLayoutWidget) self.spot_no_2.setObjectName("spot_no_2") self.gridLayout.addWidget(self.spot_no_2, 0, 1, 1, 1) self.spot_no_3 = QtWidgets.QGraphicsView(self.gridLayoutWidget) self.spot_no_3.setObjectName("spot_no_3") self.gridLayout.addWidget(self.spot_no_3, 0, 2, 1, 1) self.spot_no_4 = QtWidgets.QGraphicsView(self.gridLayoutWidget) self.spot_no_4.setObjectName("spot_no_4") self.gridLayout.addWidget(self.spot_no_4, 3, 0, 1, 1) self.spot_no_5 = QtWidgets.QGraphicsView(self.gridLayoutWidget) self.spot_no_5.setObjectName("spot_no_5") self.gridLayout.addWidget(self.spot_no_5, 3, 1, 1, 1) self.spot_no_6 = QtWidgets.QGraphicsView(self.gridLayoutWidget) self.spot_no_6.setObjectName("spot_no_6") self.gridLayout.addWidget(self.spot_no_6, 3, 2, 1, 1) self.gridLayoutWidget_2 = QtWidgets.QWidget(self.centralwidget) self.gridLayoutWidget_2.setGeometry(QtCore.QRect(40, 510, 1141, 201)) self.gridLayoutWidget_2.setObjectName("gridLayoutWidget_2") self.gridLayout_2 = QtWidgets.QGridLayout(self.gridLayoutWidget_2) self.gridLayout_2.setContentsMargins(0, 0, 0, 0) self.gridLayout_2.setObjectName("gridLayout_2") self.label_10 = QtWidgets.QLabel(self.gridLayoutWidget_2) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.label_10.setFont(font) self.label_10.setFrameShape(QtWidgets.QFrame.Box) self.label_10.setObjectName("label_10") self.gridLayout_2.addWidget(self.label_10, 1, 2, 1, 1) self.label_9 = QtWidgets.QLabel(self.gridLayoutWidget_2) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.label_9.setFont(font) self.label_9.setFrameShape(QtWidgets.QFrame.Box) self.label_9.setObjectName("label_9") self.gridLayout_2.addWidget(self.label_9, 1, 1, 1, 1) self.label_8 = QtWidgets.QLabel(self.gridLayoutWidget_2) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.label_8.setFont(font) self.label_8.setFrameShape(QtWidgets.QFrame.Box) self.label_8.setObjectName("label_8") self.gridLayout_2.addWidget(self.label_8, 1, 0, 1, 1) self.vid_1 = QVideoWidget(self.gridLayoutWidget_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth( self.vid_1.sizePolicy().hasHeightForWidth()) self.vid_1.setSizePolicy(sizePolicy) self.vid_1.setObjectName("vid_1") self.gridLayout_2.addWidget(self.vid_1, 0, 0, 1, 1) self.vid_2 = QVideoWidget(self.gridLayoutWidget_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth( self.vid_2.sizePolicy().hasHeightForWidth()) self.vid_2.setSizePolicy(sizePolicy) self.vid_2.setObjectName("vid_2") self.gridLayout_2.addWidget(self.vid_2, 0, 1, 1, 1) self.vid_3 = QVideoWidget(self.gridLayoutWidget_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth( self.vid_3.sizePolicy().hasHeightForWidth()) self.vid_3.setSizePolicy(sizePolicy) self.vid_3.setObjectName("vid_3") self.gridLayout_2.addWidget(self.vid_3, 0, 2, 1, 1) self.gridLayoutWidget_3 = QtWidgets.QWidget(self.centralwidget) self.gridLayoutWidget_3.setGeometry(QtCore.QRect(660, 250, 411, 211)) self.gridLayoutWidget_3.setObjectName("gridLayoutWidget_3") self.gridLayout_3 = QtWidgets.QGridLayout(self.gridLayoutWidget_3) self.gridLayout_3.setContentsMargins(0, 0, 0, 0) self.gridLayout_3.setObjectName("gridLayout_3") self.tableWidget = QtWidgets.QTableWidget(self.gridLayoutWidget_3) self.tableWidget.setFrameShape(QtWidgets.QFrame.WinPanel) self.tableWidget.setObjectName("tableWidget") self.tableWidget.setColumnCount(4) self.tableWidget.setRowCount(6) item = QtWidgets.QTableWidgetItem() font = QtGui.QFont() font.setBold(False) font.setWeight(50) item.setFont(font) self.tableWidget.setVerticalHeaderItem(0, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setVerticalHeaderItem(1, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setVerticalHeaderItem(2, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setVerticalHeaderItem(3, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setVerticalHeaderItem(4, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setVerticalHeaderItem(5, item) item = QtWidgets.QTableWidgetItem() font = QtGui.QFont() font.setBold(True) font.setWeight(75) item.setFont(font) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) item.setForeground(brush) self.tableWidget.setHorizontalHeaderItem(0, item) item = QtWidgets.QTableWidgetItem() font = QtGui.QFont() font.setBold(True) font.setWeight(75) item.setFont(font) self.tableWidget.setHorizontalHeaderItem(1, item) item = QtWidgets.QTableWidgetItem() font = QtGui.QFont() font.setBold(True) font.setWeight(75) item.setFont(font) self.tableWidget.setHorizontalHeaderItem(2, item) item = QtWidgets.QTableWidgetItem() font = QtGui.QFont() font.setBold(True) font.setWeight(75) item.setFont(font) self.tableWidget.setHorizontalHeaderItem(3, item) self.gridLayout_3.addWidget(self.tableWidget, 0, 0, 1, 1) self.horizontalLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.horizontalLayoutWidget.setGeometry(QtCore.QRect(220, 80, 172, 22)) self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget") self.horizontalLayout = QtWidgets.QHBoxLayout( self.horizontalLayoutWidget) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.horizontalLayout.setObjectName("horizontalLayout") self.label_11 = QtWidgets.QLabel(self.horizontalLayoutWidget) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.label_11.setFont(font) self.label_11.setLayoutDirection(QtCore.Qt.LeftToRight) self.label_11.setAutoFillBackground(False) self.label_11.setFrameShape(QtWidgets.QFrame.WinPanel) self.label_11.setObjectName("label_11") self.horizontalLayout.addWidget(self.label_11) self.gridLayoutWidget_4 = QtWidgets.QWidget(self.centralwidget) self.gridLayoutWidget_4.setGeometry(QtCore.QRect(740, 110, 309, 80)) self.gridLayoutWidget_4.setObjectName("gridLayoutWidget_4") self.gridLayout_4 = QtWidgets.QGridLayout(self.gridLayoutWidget_4) self.gridLayout_4.setContentsMargins(0, 0, 0, 0) self.gridLayout_4.setObjectName("gridLayout_4") self.no_spots_label = QtWidgets.QLabel(self.gridLayoutWidget_4) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.no_spots_label.setFont(font) self.no_spots_label.setFrameShape(QtWidgets.QFrame.WinPanel) self.no_spots_label.setObjectName("no_spots_label") self.gridLayout_4.addWidget(self.no_spots_label, 0, 1, 1, 1) self.label_13 = QtWidgets.QLabel(self.gridLayoutWidget_4) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.label_13.setFont(font) self.label_13.setFrameShape(QtWidgets.QFrame.WinPanel) self.label_13.setObjectName("label_13") self.gridLayout_4.addWidget(self.label_13, 0, 0, 1, 1) self.label_12 = QtWidgets.QLabel(self.gridLayoutWidget_4) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.label_12.setFont(font) self.label_12.setFrameShape(QtWidgets.QFrame.WinPanel) self.label_12.setObjectName("label_12") self.gridLayout_4.addWidget(self.label_12, 2, 0, 1, 1) self.price_label_15 = QtWidgets.QLabel(self.gridLayoutWidget_4) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.price_label_15.setFont(font) self.price_label_15.setFrameShape(QtWidgets.QFrame.WinPanel) self.price_label_15.setObjectName("price_label_15") self.gridLayout_4.addWidget(self.price_label_15, 2, 1, 1, 1) self.label_14 = QtWidgets.QLabel(self.centralwidget) self.label_14.setGeometry(QtCore.QRect(810, 220, 141, 21)) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.label_14.setFont(font) self.label_14.setFrameShape(QtWidgets.QFrame.WinPanel) self.label_14.setObjectName("label_14") self.label_15 = QtWidgets.QLabel(self.centralwidget) self.label_15.setGeometry(QtCore.QRect(530, 720, 101, 16)) self.label_15.setFrameShape(QtWidgets.QFrame.WinPanel) self.label_15.setObjectName("label_15") MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) self.label.setText( _translate( "MainWindow", "<html><head/><body><p align=\"center\"><span style=\" font-size:36pt; font-weight:600;\">SJSU AI PARKING</span></p></body></html>" )) self.label_7.setText( _translate("MainWindow", " Spot No 4")) self.label_2.setText( _translate("MainWindow", " Spot No 2")) self.label_4.setText( _translate("MainWindow", " Spot No 1")) self.label_5.setText( _translate("MainWindow", " Spot No 6")) self.label_6.setText( _translate("MainWindow", " Spot No 5")) self.label_3.setText( _translate("MainWindow", " Spot No 3")) self.label_10.setText(_translate("MainWindow", "Video 3")) self.label_9.setText(_translate("MainWindow", "Video 2")) self.label_8.setText(_translate("MainWindow", "Video 1")) item = self.tableWidget.horizontalHeaderItem(0) item.setText(_translate("MainWindow", "Vehicle_no")) item = self.tableWidget.horizontalHeaderItem(1) item.setText(_translate("MainWindow", "Entry time")) item = self.tableWidget.horizontalHeaderItem(2) item.setText(_translate("MainWindow", "Exit time")) item = self.tableWidget.horizontalHeaderItem(3) item.setText(_translate("MainWindow", "Amount due")) self.label_11.setText( _translate("MainWindow", "Parking Spot Availability")) self.no_spots_label.setText(_translate("MainWindow", "4")) self.label_13.setText( _translate("MainWindow", "Number of slots available")) self.label_12.setText(_translate("MainWindow", "Price of the hour")) self.price_label_15.setText(_translate("MainWindow", "$3.99")) self.label_14.setText(_translate("MainWindow", "Vehicle Information")) self.label_15.setText(_translate("MainWindow", "Video Footage"))
class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(706, 493) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/plugins/VideoGis/icon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) Form.setWindowIcon(icon) self.verticalLayout_3 = QtWidgets.QVBoxLayout(Form) self.verticalLayout_3.setObjectName("verticalLayout_3") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.pushButton_3 = QtWidgets.QPushButton(Form) font = QtGui.QFont() font.setKerning(True) self.pushButton_3.setFont(font) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(":/VgisIcon/Hand-icon.png"), QtGui.QIcon.Normal, QtGui.QIcon.On) self.pushButton_3.setIcon(icon1) self.pushButton_3.setAutoExclusive(False) self.pushButton_3.setAutoDefault(False) self.pushButton_3.setDefault(False) self.pushButton_3.setFlat(False) self.pushButton_3.setObjectName("pushButton_3") self.horizontalLayout.addWidget(self.pushButton_3) self.toolButton_6 = QtWidgets.QToolButton(Form) icon2 = QtGui.QIcon() icon2.addPixmap( QtGui.QPixmap(":/plugins/VideoGis/iconNewTabEditorConsole.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_6.setIcon(icon2) self.toolButton_6.setObjectName("toolButton_6") self.horizontalLayout.addWidget(self.toolButton_6) self.toolButton_7 = QtWidgets.QToolButton(Form) self.toolButton_7.setEnabled(False) self.toolButton_7.setCheckable(True) self.toolButton_7.setObjectName("toolButton_7") self.horizontalLayout.addWidget(self.toolButton_7) self.pushButton = QtWidgets.QPushButton(Form) self.pushButton.setEnabled(False) self.pushButton.setCheckable(True) self.pushButton.setObjectName("pushButton") self.horizontalLayout.addWidget(self.pushButton) self.label_2 = QtWidgets.QLabel(Form) self.label_2.setEnabled(False) self.label_2.setObjectName("label_2") self.horizontalLayout.addWidget(self.label_2) self.spinBox = QtWidgets.QSpinBox(Form) self.spinBox.setEnabled(False) self.spinBox.setMinimum(1) self.spinBox.setSingleStep(10) self.spinBox.setProperty("value", 25) self.spinBox.setObjectName("spinBox") self.horizontalLayout.addWidget(self.spinBox) spacerItem = QtWidgets.QSpacerItem(23, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.toolButton_4 = QtWidgets.QToolButton(Form) self.toolButton_4.setObjectName("toolButton_4") self.horizontalLayout.addWidget(self.toolButton_4) self.toolButton_5 = QtWidgets.QToolButton(Form) self.toolButton_5.setObjectName("toolButton_5") self.horizontalLayout.addWidget(self.toolButton_5) self.verticalLayout_3.addLayout(self.horizontalLayout) self.dockWidget_2 = QtWidgets.QDockWidget(Form) self.dockWidget_2.setFeatures( QtWidgets.QDockWidget.NoDockWidgetFeatures) self.dockWidget_2.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea | QtCore.Qt.RightDockWidgetArea) self.dockWidget_2.setObjectName("dockWidget_2") self.dockWidgetContents_7 = QtWidgets.QWidget() self.dockWidgetContents_7.setObjectName("dockWidgetContents_7") self.gridLayout_2 = QtWidgets.QGridLayout(self.dockWidgetContents_7) self.gridLayout_2.setObjectName("gridLayout_2") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.video_frame = QVideoWidget(Form) p = self.video_frame.palette() p.setColor(QtGui.QPalette.Window, QtCore.Qt.black) self.video_frame.setPalette(p) self.video_frame.setAttribute(QtCore.Qt.WA_OpaquePaintEvent) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.video_frame.sizePolicy().hasHeightForWidth()) self.video_frame.setSizePolicy(sizePolicy) self.video_frame.setMinimumSize(QtCore.QSize(200, 200)) self.video_frame.setStyleSheet("background-color: rgb(0, 0, 0);") self.video_frame.setObjectName("video_frame") self.verticalLayout.addWidget(self.video_frame) self.horizontalSlider = QtWidgets.QSlider(self.dockWidgetContents_7) self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal) self.horizontalSlider.setObjectName("horizontalSlider") self.verticalLayout.addWidget(self.horizontalSlider) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") spacerItem1 = QtWidgets.QSpacerItem(98, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem1) self.toolButton_11 = QtWidgets.QToolButton(self.dockWidgetContents_7) icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(":/VgisIcon/mActionArrowLeft.svg"), QtGui.QIcon.Normal, QtGui.QIcon.On) self.toolButton_11.setIcon(icon3) self.toolButton_11.setObjectName("toolButton_11") self.horizontalLayout_3.addWidget(self.toolButton_11) self.SkipBacktoolButton_8 = QtWidgets.QToolButton( self.dockWidgetContents_7) self.SkipBacktoolButton_8.setStyleSheet("") icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap(":/VgisIcon/mActionAtlasPrev.svg"), QtGui.QIcon.Normal, QtGui.QIcon.On) self.SkipBacktoolButton_8.setIcon(icon4) self.SkipBacktoolButton_8.setObjectName("SkipBacktoolButton_8") self.horizontalLayout_3.addWidget(self.SkipBacktoolButton_8) self.playButton = QtWidgets.QToolButton(self.dockWidgetContents_7) self.playButton.setObjectName("playButton") self.horizontalLayout_3.addWidget(self.playButton) self.muteButton = QtWidgets.QToolButton(self.dockWidgetContents_7) self.muteButton.setText("") self.muteButton.setObjectName("muteButton") self.horizontalLayout_3.addWidget(self.muteButton) self.replayPosition_label = QtWidgets.QLabel(self.dockWidgetContents_7) self.replayPosition_label.setObjectName("replayPosition_label") self.horizontalLayout_3.addWidget(self.replayPosition_label) self.SkipFortoolButton_9 = QtWidgets.QToolButton( self.dockWidgetContents_7) self.SkipFortoolButton_9.setStyleSheet("") icon5 = QtGui.QIcon() icon5.addPixmap(QtGui.QPixmap(":/VgisIcon/mActionAtlasNext.svg"), QtGui.QIcon.Normal, QtGui.QIcon.On) self.SkipFortoolButton_9.setIcon(icon5) self.SkipFortoolButton_9.setObjectName("SkipFortoolButton_9") self.horizontalLayout_3.addWidget(self.SkipFortoolButton_9) self.toolButton_12 = QtWidgets.QToolButton(self.dockWidgetContents_7) icon6 = QtGui.QIcon() icon6.addPixmap(QtGui.QPixmap(":/VgisIcon/mActionArrowRight.svg"), QtGui.QIcon.Normal, QtGui.QIcon.On) self.toolButton_12.setIcon(icon6) self.toolButton_12.setObjectName("toolButton_12") self.horizontalLayout_3.addWidget(self.toolButton_12) spacerItem2 = QtWidgets.QSpacerItem(98, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem2) self.lcdNumber = QtWidgets.QLCDNumber(self.dockWidgetContents_7) self.lcdNumber.setObjectName("lcdNumber") self.horizontalLayout_3.addWidget(self.lcdNumber) self.verticalLayout.addLayout(self.horizontalLayout_3) self.gridLayout_2.addLayout(self.verticalLayout, 0, 0, 1, 1) self.dockWidget_2.setWidget(self.dockWidgetContents_7) self.verticalLayout_3.addWidget(self.dockWidget_2) self.dockWidget_4 = QtWidgets.QDockWidget(Form) self.dockWidget_4.setMaximumSize(QtCore.QSize(524287, 121)) self.dockWidget_4.setFeatures( QtWidgets.QDockWidget.NoDockWidgetFeatures) self.dockWidget_4.setAllowedAreas(QtCore.Qt.BottomDockWidgetArea) self.dockWidget_4.setObjectName("dockWidget_4") self.dockWidgetContents_6 = QtWidgets.QWidget() self.dockWidgetContents_6.setObjectName("dockWidgetContents_6") self.verticalLayout_2 = QtWidgets.QVBoxLayout( self.dockWidgetContents_6) self.verticalLayout_2.setObjectName("verticalLayout_2") self.label = QtWidgets.QLabel(self.dockWidgetContents_6) self.label.setObjectName("label") self.verticalLayout_2.addWidget(self.label) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setSizeConstraint( QtWidgets.QLayout.SetFixedSize) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.pushButtonCutA_6 = QtWidgets.QPushButton( self.dockWidgetContents_6) self.pushButtonCutA_6.setEnabled(True) self.pushButtonCutA_6.setObjectName("pushButtonCutA_6") self.horizontalLayout_2.addWidget(self.pushButtonCutA_6) self.pushButtonCutB_6 = QtWidgets.QPushButton( self.dockWidgetContents_6) self.pushButtonCutB_6.setObjectName("pushButtonCutB_6") self.horizontalLayout_2.addWidget(self.pushButtonCutB_6) self.label_7 = QtWidgets.QLabel(self.dockWidgetContents_6) self.label_7.setObjectName("label_7") self.horizontalLayout_2.addWidget(self.label_7) self.doubleSpinBox_2 = QtWidgets.QDoubleSpinBox( self.dockWidgetContents_6) self.doubleSpinBox_2.setObjectName("doubleSpinBox_2") self.horizontalLayout_2.addWidget(self.doubleSpinBox_2) self.comboBox_6 = QtWidgets.QComboBox(self.dockWidgetContents_6) self.comboBox_6.setObjectName("comboBox_6") self.comboBox_6.addItem("") self.comboBox_6.addItem("") self.horizontalLayout_2.addWidget(self.comboBox_6) self.pushButton_5 = QtWidgets.QPushButton(self.dockWidgetContents_6) self.pushButton_5.setObjectName("pushButton_5") self.horizontalLayout_2.addWidget(self.pushButton_5) self.pushButtonCut_2 = QtWidgets.QPushButton(self.dockWidgetContents_6) self.pushButtonCut_2.setObjectName("pushButtonCut_2") self.horizontalLayout_2.addWidget(self.pushButtonCut_2) self.verticalLayout_2.addLayout(self.horizontalLayout_2) self.progressBar = QtWidgets.QProgressBar(self.dockWidgetContents_6) self.progressBar.setProperty("value", 24) self.progressBar.setObjectName("progressBar") self.verticalLayout_2.addWidget(self.progressBar) self.dockWidget_4.setWidget(self.dockWidgetContents_6) self.verticalLayout_3.addWidget(self.dockWidget_4) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "Video UAV Tracker - Player")) self.pushButton_3.setToolTip( _translate( "Form", "<html><head/><body><p>Move along Video directly clicking on gps track</p></body></html>" )) self.pushButton_3.setText(_translate("Form", "MapTool ")) self.label_2.setText(_translate("Form", "Overlap %")) self.toolButton_6.setToolTip( _translate("Form", "<html><head/><body><p>Add point</p></body></html>")) self.toolButton_6.setText(_translate("Form", "o")) self.toolButton_4.setToolTip( _translate( "Form", "<html><head/><body><p>Enable extract frames toolbox</p><p><br/></p></body></html>" )) self.toolButton_4.setText(_translate("Form", "Extract frames")) self.toolButton_5.setText(_translate("Form", "Close")) self.toolButton_11.setText(_translate("Form", "<<")) self.SkipBacktoolButton_8.setText(_translate("Form", "<")) self.playButton.setText(_translate("Form", "> / ||")) self.replayPosition_label.setText(_translate("Form", "-:- / -:-")) self.SkipFortoolButton_9.setText(_translate("Form", ">")) self.toolButton_12.setText(_translate("Form", ">>")) self.label.setText(_translate("Form", "Export Frames Tool")) self.pushButtonCutA_6.setToolTip( _translate( "Form", "<html><head/><body><p>Export from actual Video Frame</p></body></html>" )) self.pushButtonCutA_6.setText(_translate("Form", "From A")) self.pushButtonCutB_6.setToolTip( _translate( "Form", "<html><head/><body><p>Export to actual Video Frame</p></body></html>" )) self.pushButtonCutB_6.setText(_translate("Form", "To B")) self.label_7.setText(_translate("Form", "Pick one frame every")) self.comboBox_6.setItemText(0, _translate("Form", "meters")) self.comboBox_6.setItemText(1, _translate("Form", "seconds")) self.pushButton_5.setText(_translate("Form", "Cancel")) self.pushButtonCut_2.setText(_translate("Form", "Extract!")) self.toolButton_7.setText(_translate("Form", "3D")) self.pushButton.setText(_translate("Form", "Create Mosaic"))
class Match(QWidget, _match.Mixin): def __init__(self): super(Match, self).__init__() self.setWindowTitle("Sumocup Match") self.setWindowIcon(QIcon('./gui/res/icon_main.png')) self.timerMain = QTimer(self) self.timerDisplay = QTimer(self) self.timerMain.timeout.connect(self.mainTimer_timeout) self.timerDisplay.timeout.connect(self.refresh_LCD) self.time = 0 self.count = False self.ipcamservices = IpCamServices() self.UI() self.populate_medias() self.defineShortcuts() def UI(self): layout = QHBoxLayout() self.setLayout(layout) self.vw = QVideoWidget() sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(True) self.vw.setSizePolicy(sizePolicy) vbox = QVBoxLayout() vbox.addWidget(self.vw) self.vw.show() layout.addLayout(vbox) self.MatchControls = QTabWidget() self.Sponsors = QTabWidget() self.tabMatch = TabMatch() self.tabSponsors = TabSponsor() self.MatchControls.addTab(self.tabMatch, 'Partida') self.Sponsors.addTab(self.tabSponsors, 'Apoio') sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.MatchControls.sizePolicy().hasHeightForWidth()) self.MatchControls.setSizePolicy(sizePolicy) sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.Sponsors.sizePolicy().hasHeightForWidth()) self.Sponsors.setSizePolicy(sizePolicy) vbox = QVBoxLayout() vbox.addWidget(self.MatchControls) vbox.addWidget(self.Sponsors) layout.addLayout(vbox) self.tabMatch.btnPlay.clicked.connect(self.btnPlay_onClick) self.tabMatch.btnStop.clicked.connect(self.btnStop_onClick) self.populate_teams() self.ipcamservices.mainMP.setVideoOutput(self.vw)
class FFWindow(QtWidgets.QWidget): def __init__(self, movie_dir, pos_snapshot_dir, neg_snapshot_dir): super().__init__() self.media_player = QMediaPlayer(None, QMediaPlayer.VideoSurface) self.movie_dir = movie_dir video_list = glob.glob(os.path.join(self.movie_dir, "*.mp4")) print("{} movies found".format(len(video_list))) # We want to be able to cycle through them self.video_files = itertools.cycle(iter(video_list)) # Check the output directories exist self.pos_snapshot_dir = pos_snapshot_dir if not os.path.exists(self.pos_snapshot_dir): os.makedirs(self.pos_snapshot_dir) self.neg_snapshot_dir = neg_snapshot_dir if not os.path.exists(self.neg_snapshot_dir): os.makedirs(self.neg_snapshot_dir) self.setWindowTitle('FrameFinder') self.video_widget = QVideoWidget() # self.video_widget.setFixedSize(640, 360) # self.video_widget. self.video_widget.setMinimumSize(640, 360) self.video_widget.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.media_player.setVideoOutput(self.video_widget) self.position_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal) self.position_slider.setRange(0, 0) self.position_slider.sliderMoved.connect(self.set_position) self.errorLabel = QtWidgets.QLabel() # self.errorLabel.setSizePolicy(QtWidgets.QSizePolicy.Preferred, # QtWidgets.QSizePolicy.Maximum) self.fileLabel = QtWidgets.QLabel() self.rewind_but = QtWidgets.QPushButton() self.rewind_but.setIcon(self.style().standardIcon( QtWidgets.QStyle.SP_ArrowLeft)) self.rewind_but.setText("Normal [A]") self.rewind_but.clicked.connect(self.rewind) self.slow_rewind_but = QtWidgets.QPushButton() self.slow_rewind_but.setIcon(self.style().standardIcon( QtWidgets.QStyle.SP_ArrowLeft)) self.slow_rewind_but.setText("Slow [S]") self.slow_rewind_but.clicked.connect(self.slow_rewind) self.play_but = QtWidgets.QPushButton() self.play_but.setIcon(self.style().standardIcon( QtWidgets.QStyle.SP_MediaPlay)) self.play_but.setText("[D]") self.play_but.clicked.connect(self.playtoggle) self.slow_forward_but = QtWidgets.QPushButton() self.slow_forward_but.setIcon(self.style().standardIcon( QtWidgets.QStyle.SP_ArrowRight)) self.slow_forward_but.setText("Slow [F]") self.slow_forward_but.clicked.connect(self.slow_forward) self.forward_but = QtWidgets.QPushButton() self.forward_but.setIcon(self.style().standardIcon( QtWidgets.QStyle.SP_ArrowRight)) self.forward_but.setText("Normal [G]") self.forward_but.clicked.connect(self.forward) self.fast_forward_but = QtWidgets.QPushButton() self.fast_forward_but.setIcon(self.style().standardIcon( QtWidgets.QStyle.SP_ArrowRight)) self.fast_forward_but.setText("Fast [H]") self.fast_forward_but.clicked.connect(self.fast_forward) self.pos_snapshot_but = QtWidgets.QPushButton() self.pos_snapshot_but.setText("Snapshot Positive [P]") self.pos_snapshot_but.clicked.connect(self.pos_snapshot) self.neg_snapshot_but = QtWidgets.QPushButton() self.neg_snapshot_but.setText("Snapshot Negative [O]") self.neg_snapshot_but.clicked.connect(self.neg_snapshot) self.next_but = QtWidgets.QPushButton() self.next_but.setText("Next movie [N]") self.next_but.clicked.connect(self.next_video) video_vbox = QtWidgets.QVBoxLayout() video_vbox.addWidget(self.video_widget) video_vbox.addWidget(self.position_slider) control_box = QtWidgets.QHBoxLayout() control_box.addWidget(self.rewind_but) control_box.addWidget(self.slow_rewind_but) control_box.addWidget(self.play_but) control_box.addWidget(self.slow_forward_but) control_box.addWidget(self.forward_but) control_box.addWidget(self.fast_forward_but) video_vbox.addLayout(control_box) video_vbox.addWidget(self.errorLabel) video_vbox.addWidget(self.fileLabel) file_box = QtWidgets.QHBoxLayout() file_box.addWidget(self.pos_snapshot_but) file_box.addWidget(self.neg_snapshot_but) file_box.addWidget(self.next_but) v_box = QtWidgets.QVBoxLayout() # v_box.addStretch() v_box.addLayout(video_vbox) v_box.addLayout(file_box) # v_box.addStretch() self.setLayout(v_box) self.media_player.stateChanged.connect(self.status_changed) # self.media_player.availabilityChanged.connect(self.status_changed) self.media_player.positionChanged.connect(self.position_changed) self.media_player.durationChanged.connect(self.duration_changed) self.media_player.error.connect(self.handleError) self.next_video() # Set up some keyboard shortcuts shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("a"), self) shortcut.activated.connect(self.rewind_but.animateClick) shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("s"), self) shortcut.activated.connect(self.slow_rewind_but.animateClick) shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("d"), self) shortcut.activated.connect(self.play_but.animateClick) shortcut = QtWidgets.QShortcut(QtGui.QKeySequence(" "), self) shortcut.activated.connect(self.play_but.animateClick) shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("f"), self) shortcut.activated.connect(self.slow_forward_but.animateClick) shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("g"), self) shortcut.activated.connect(self.forward_but.animateClick) shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("h"), self) shortcut.activated.connect(self.fast_forward_but.animateClick) shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("p"), self) shortcut.activated.connect(self.pos_snapshot_but.animateClick) shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("o"), self) shortcut.activated.connect(self.neg_snapshot_but.animateClick) shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("n"), self) shortcut.activated.connect(self.next_but.animateClick) def playtoggle(self): if self.media_player.state() == QMediaPlayer.PlayingState: self.pause() else: self.play() def pause(self): self.media_player.pause() def play(self): self.media_player.play() # This is a nasty hack. The video tends to zoom to 1:1 # when you play, but rescales itself when you resize the window. # Faking a window resize is the only way I could find to fix the zoom. size = self.size() self.resize(size.width() + 1, size.height() + 1) self.resize(size.width(), size.height()) def rewind(self): self.media_player.setPlaybackRate(-1) self.errorLabel.setText("Rewind 1x") self.play() def slow_rewind(self): self.media_player.setPlaybackRate(-0.25) self.errorLabel.setText("Rewind 0.25x") self.play() def slow_forward(self): self.media_player.setPlaybackRate(0.25) self.errorLabel.setText("Forward 0.25x") self.play() def forward(self): self.media_player.setPlaybackRate(1.0) self.errorLabel.setText("Forward 1x") self.play() def fast_forward(self): self.media_player.setPlaybackRate(2.0) self.errorLabel.setText("Forward 2x") self.play() def status_changed(self): if self.media_player.state() == QMediaPlayer.PlayingState: self.play_but.setIcon(self.style().standardIcon( QtWidgets.QStyle.SP_MediaPause)) else: self.play_but.setIcon(self.style().standardIcon( QtWidgets.QStyle.SP_MediaPlay)) self.play_but.repaint() # print ("Status", self.media_player.mediaStatus()) def position_changed(self, position): # print("Position changed to", position) self.position_slider.setValue(position) def duration_changed(self, duration): print("Duration changed to", duration) self.position_slider.setRange(0, duration) def set_position(self, position): self.media_player.setPosition(position) def pos_snapshot(self): self.snapshot(self.pos_snapshot_dir) def neg_snapshot(self): self.snapshot(self.neg_snapshot_dir) def snapshot(self, snap_dir): video_path = self.media.canonicalUrl().path() position = self.media_player.position() video_file, extension = os.path.splitext(os.path.basename(video_path)) snapshot_file = os.path.join(snap_dir, "{}_{}.jpg".format(video_file, position)) # Use ffmpeg because it's not clear how to get # the frame back from the video surface cmd = [ "ffmpeg", "-ss", str(position / 1000), "-i", video_path, "-frames", "1", snapshot_file ] print(" ".join(cmd)) retcode = subprocess.call(cmd) if retcode == 0: self.errorLabel.setText("Saved {}".format(snapshot_file)) else: self.errorLabel.setText("Error running ffmpeg") def next_video(self): # Display the next file if there is one try: self.errorLabel.clear() next_video = os.path.join(os.getcwd(), next(self.video_files)) print(next_video) self.pause() self.media = QMediaContent(QtCore.QUrl.fromLocalFile(next_video)) self.media_player.setMedia(self.media) self.fileLabel.setText(next_video) self.play() except StopIteration: pass def handleError(self): self.errorLabel.setText("Error: " + self.media_player.errorString())
class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(706, 493) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/plugins/Video_UAV_Tracker/icon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) Form.setWindowIcon(icon) self.verticalLayout_3 = QtWidgets.QVBoxLayout(Form) self.verticalLayout_3.setObjectName("verticalLayout_3") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.pushButton_3 = QtWidgets.QPushButton(Form) font = QtGui.QFont() font.setKerning(True) self.pushButton_3.setFont(font) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(":/VgisIcon/Hand-icon.png"), QtGui.QIcon.Normal, QtGui.QIcon.On) self.pushButton_3.setIcon(icon1) self.pushButton_3.setAutoExclusive(False) self.pushButton_3.setAutoDefault(False) self.pushButton_3.setDefault(False) self.pushButton_3.setFlat(False) self.pushButton_3.setObjectName("pushButton_3") self.horizontalLayout.addWidget(self.pushButton_3) self.toolButton_6 = QtWidgets.QToolButton(Form) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(":/plugins/Video_UAV_Tracker/iconNewTabEditorConsole.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_6.setIcon(icon2) self.toolButton_6.setObjectName("toolButton_6") self.horizontalLayout.addWidget(self.toolButton_6) spacerItem = QtWidgets.QSpacerItem(23, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.toolButton_4 = QtWidgets.QToolButton(Form) self.toolButton_4.setStyleSheet("background: url(/mnt/574916AB2EEEC400/LAVORO/Sviluppo_VUT_StandAlone/Progetto_VUT/115757-magic-marker-icon-people-things-hand22-sc48.png)") self.toolButton_4.setObjectName("toolButton_4") self.horizontalLayout.addWidget(self.toolButton_4) self.toolButton_5 = QtWidgets.QToolButton(Form) self.toolButton_5.setObjectName("toolButton_5") self.horizontalLayout.addWidget(self.toolButton_5) self.verticalLayout_3.addLayout(self.horizontalLayout) self.dockWidget_2 = QtWidgets.QDockWidget(Form) self.dockWidget_2.setFeatures(QtWidgets.QDockWidget.NoDockWidgetFeatures) self.dockWidget_2.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea|QtCore.Qt.RightDockWidgetArea) self.dockWidget_2.setObjectName("dockWidget_2") self.dockWidgetContents_7 = QtWidgets.QWidget() self.dockWidgetContents_7.setObjectName("dockWidgetContents_7") self.gridLayout_2 = QtWidgets.QGridLayout(self.dockWidgetContents_7) self.gridLayout_2.setObjectName("gridLayout_2") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.video_frame = QVideoWidget(Form) p = self.video_frame.palette() p.setColor(QtGui.QPalette.Window, QtCore.Qt.black) self.video_frame.setPalette(p) self.video_frame.setAttribute(QtCore.Qt.WA_OpaquePaintEvent) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.video_frame.sizePolicy().hasHeightForWidth()) self.video_frame.setSizePolicy(sizePolicy) self.video_frame.setMinimumSize(QtCore.QSize(200, 200)) self.video_frame.setStyleSheet("background-color: rgb(0, 0, 0);") self.video_frame.setObjectName("video_frame") self.verticalLayout.addWidget(self.video_frame) self.horizontalSlider = QtWidgets.QSlider(self.dockWidgetContents_7) self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal) self.horizontalSlider.setObjectName("horizontalSlider") self.verticalLayout.addWidget(self.horizontalSlider) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") spacerItem1 = QtWidgets.QSpacerItem(98, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem1) self.toolButton_11 = QtWidgets.QToolButton(self.dockWidgetContents_7) icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(":/VgisIcon/mActionArrowLeft.svg"), QtGui.QIcon.Normal, QtGui.QIcon.On) self.toolButton_11.setIcon(icon3) self.toolButton_11.setObjectName("toolButton_11") self.horizontalLayout_3.addWidget(self.toolButton_11) self.SkipBacktoolButton_8 = QtWidgets.QToolButton(self.dockWidgetContents_7) self.SkipBacktoolButton_8.setStyleSheet("") icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap(":/VgisIcon/mActionAtlasPrev.svg"), QtGui.QIcon.Normal, QtGui.QIcon.On) self.SkipBacktoolButton_8.setIcon(icon4) self.SkipBacktoolButton_8.setObjectName("SkipBacktoolButton_8") self.horizontalLayout_3.addWidget(self.SkipBacktoolButton_8) self.playButton = QtWidgets.QToolButton(self.dockWidgetContents_7) self.playButton.setObjectName("playButton") self.horizontalLayout_3.addWidget(self.playButton) self.muteButton = QtWidgets.QToolButton(self.dockWidgetContents_7) self.muteButton.setText("") self.muteButton.setObjectName("muteButton") self.horizontalLayout_3.addWidget(self.muteButton) self.replayPosition_label = QtWidgets.QLabel(self.dockWidgetContents_7) self.replayPosition_label.setObjectName("replayPosition_label") self.horizontalLayout_3.addWidget(self.replayPosition_label) self.SkipFortoolButton_9 = QtWidgets.QToolButton(self.dockWidgetContents_7) self.SkipFortoolButton_9.setStyleSheet("") icon5 = QtGui.QIcon() icon5.addPixmap(QtGui.QPixmap(":/VgisIcon/mActionAtlasNext.svg"), QtGui.QIcon.Normal, QtGui.QIcon.On) self.SkipFortoolButton_9.setIcon(icon5) self.SkipFortoolButton_9.setObjectName("SkipFortoolButton_9") self.horizontalLayout_3.addWidget(self.SkipFortoolButton_9) self.toolButton_12 = QtWidgets.QToolButton(self.dockWidgetContents_7) icon6 = QtGui.QIcon() icon6.addPixmap(QtGui.QPixmap(":/VgisIcon/mActionArrowRight.svg"), QtGui.QIcon.Normal, QtGui.QIcon.On) self.toolButton_12.setIcon(icon6) self.toolButton_12.setObjectName("toolButton_12") self.horizontalLayout_3.addWidget(self.toolButton_12) spacerItem2 = QtWidgets.QSpacerItem(98, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem2) self.verticalLayout.addLayout(self.horizontalLayout_3) self.gridLayout_2.addLayout(self.verticalLayout, 0, 0, 1, 1) self.dockWidget_2.setWidget(self.dockWidgetContents_7) self.verticalLayout_3.addWidget(self.dockWidget_2) self.dockWidget_4 = QtWidgets.QDockWidget(Form) self.dockWidget_4.setMaximumSize(QtCore.QSize(524287, 121)) self.dockWidget_4.setFeatures(QtWidgets.QDockWidget.NoDockWidgetFeatures) self.dockWidget_4.setAllowedAreas(QtCore.Qt.BottomDockWidgetArea) self.dockWidget_4.setObjectName("dockWidget_4") self.dockWidgetContents_6 = QtWidgets.QWidget() self.dockWidgetContents_6.setObjectName("dockWidgetContents_6") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.dockWidgetContents_6) self.verticalLayout_2.setObjectName("verticalLayout_2") self.label = QtWidgets.QLabel(self.dockWidgetContents_6) self.label.setObjectName("label") self.verticalLayout_2.addWidget(self.label) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setSizeConstraint(QtWidgets.QLayout.SetFixedSize) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.pushButtonCutA_6 = QtWidgets.QPushButton(self.dockWidgetContents_6) self.pushButtonCutA_6.setEnabled(True) self.pushButtonCutA_6.setObjectName("pushButtonCutA_6") self.horizontalLayout_2.addWidget(self.pushButtonCutA_6) self.pushButtonCutB_6 = QtWidgets.QPushButton(self.dockWidgetContents_6) self.pushButtonCutB_6.setObjectName("pushButtonCutB_6") self.horizontalLayout_2.addWidget(self.pushButtonCutB_6) self.label_7 = QtWidgets.QLabel(self.dockWidgetContents_6) self.label_7.setObjectName("label_7") self.horizontalLayout_2.addWidget(self.label_7) self.doubleSpinBox_2 = QtWidgets.QDoubleSpinBox(self.dockWidgetContents_6) self.doubleSpinBox_2.setObjectName("doubleSpinBox_2") self.horizontalLayout_2.addWidget(self.doubleSpinBox_2) self.comboBox_6 = QtWidgets.QComboBox(self.dockWidgetContents_6) self.comboBox_6.setObjectName("comboBox_6") self.comboBox_6.addItem("") self.comboBox_6.addItem("") self.horizontalLayout_2.addWidget(self.comboBox_6) self.pushButton_5 = QtWidgets.QPushButton(self.dockWidgetContents_6) self.pushButton_5.setObjectName("pushButton_5") self.horizontalLayout_2.addWidget(self.pushButton_5) self.pushButtonCut_2 = QtWidgets.QPushButton(self.dockWidgetContents_6) self.pushButtonCut_2.setObjectName("pushButtonCut_2") self.horizontalLayout_2.addWidget(self.pushButtonCut_2) self.verticalLayout_2.addLayout(self.horizontalLayout_2) self.progressBar = QtWidgets.QProgressBar(self.dockWidgetContents_6) self.progressBar.setProperty("value", 24) self.progressBar.setObjectName("progressBar") self.verticalLayout_2.addWidget(self.progressBar) self.dockWidget_4.setWidget(self.dockWidgetContents_6) self.verticalLayout_3.addWidget(self.dockWidget_4) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "Video UAV Tracker - Player")) self.pushButton_3.setToolTip(_translate("Form", "<html><head/><body><p>Move along Video directly clicking on gps track</p></body></html>")) self.pushButton_3.setText(_translate("Form", "MapTool ")) self.toolButton_6.setToolTip(_translate("Form", "<html><head/><body><p>Add point</p></body></html>")) self.toolButton_6.setText(_translate("Form", "o")) self.toolButton_4.setToolTip(_translate("Form", "<html><head/><body><p>Enable extract frames toolbox</p><p><br/></p></body></html>")) self.toolButton_4.setText(_translate("Form", "Extract frames")) self.toolButton_5.setText(_translate("Form", "Close")) self.toolButton_11.setText(_translate("Form", "<<")) self.SkipBacktoolButton_8.setText(_translate("Form", "<")) self.playButton.setText(_translate("Form", "> / ||")) self.replayPosition_label.setText(_translate("Form", "-:- / -:-")) self.SkipFortoolButton_9.setText(_translate("Form", ">")) self.toolButton_12.setText(_translate("Form", ">>")) self.label.setText(_translate("Form", "Export Frames Tool")) self.pushButtonCutA_6.setToolTip(_translate("Form", "<html><head/><body><p>Export from actual Video Frame</p></body></html>")) self.pushButtonCutA_6.setText(_translate("Form", "From A")) self.pushButtonCutB_6.setToolTip(_translate("Form", "<html><head/><body><p>Export to actual Video Frame</p></body></html>")) self.pushButtonCutB_6.setText(_translate("Form", "To B")) self.label_7.setText(_translate("Form", "Pick one frame every")) self.comboBox_6.setItemText(0, _translate("Form", "meters")) self.comboBox_6.setItemText(1, _translate("Form", "seconds")) self.pushButton_5.setText(_translate("Form", "Cancel")) self.pushButtonCut_2.setText(_translate("Form", "Extract!"))
class VideoPlayer(QWidget): def __init__(self, aPath, parent=None): super(VideoPlayer, self).__init__(parent) self.setAttribute(Qt.WA_NoSystemBackground, True) self.setAcceptDrops(True) self.mediaPlayer = QMediaPlayer(None, QMediaPlayer.StreamPlayback) self.mediaPlayer.setVolume(80) self.videoWidget = QVideoWidget(self) self.videoWidget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.videoWidget.setMinimumSize(QSize(640, 360)) self.lbl = QLineEdit('00:00:00') self.lbl.setReadOnly(True) self.lbl.setFixedWidth(70) self.lbl.setUpdatesEnabled(True) self.lbl.setStyleSheet(stylesheet(self)) self.elbl = QLineEdit('00:00:00') self.elbl.setReadOnly(True) self.elbl.setFixedWidth(70) self.elbl.setUpdatesEnabled(True) self.elbl.setStyleSheet(stylesheet(self)) self.playButton = QPushButton() self.playButton.setEnabled(False) self.playButton.setFixedWidth(32) self.playButton.setStyleSheet("background-color: black") self.playButton.setIcon(self.style().standardIcon(QStyle.SP_MediaPlay)) self.playButton.clicked.connect(self.play) self.positionSlider = QSlider(Qt.Horizontal, self) self.positionSlider.setStyleSheet(stylesheet(self)) self.positionSlider.setRange(0, 100) self.positionSlider.sliderMoved.connect(self.setPosition) self.positionSlider.sliderMoved.connect(self.handleLabel) self.positionSlider.setSingleStep(2) self.positionSlider.setPageStep(20) self.positionSlider.setAttribute(Qt.WA_TranslucentBackground, True) self.clip = QApplication.clipboard() self.process = QProcess(self) self.process.readyRead.connect(self.dataReady) self.process.finished.connect(self.playFromURL) self.myurl = "" # channel list self.channelList = QListView(self) self.channelList.setMinimumSize(QSize(150, 0)) self.channelList.setMaximumSize(QSize(150, 4000)) self.channelList.setFrameShape(QFrame.Box) self.channelList.setObjectName("channelList") self.channelList.setStyleSheet("background-color: black; color: #585858;") self.channelList.setFocus() # for adding items to list must create a model self.model = QStandardItemModel() self.channelList.setModel(self.model) self.controlLayout = QHBoxLayout() self.controlLayout.setContentsMargins(5, 0, 5, 0) self.controlLayout.addWidget(self.playButton) self.controlLayout.addWidget(self.lbl) self.controlLayout.addWidget(self.positionSlider) self.controlLayout.addWidget(self.elbl) self.mainLayout = QHBoxLayout() # contains video and cotrol widgets to the left side self.layout = QVBoxLayout() self.layout.setContentsMargins(0, 0, 0, 0) self.layout.addWidget(self.videoWidget) self.layout.addLayout(self.controlLayout) # adds channels list to the right self.mainLayout.addLayout(self.layout) self.mainLayout.addWidget(self.channelList) self.setLayout(self.mainLayout) self.myinfo = "©2020\nTIVOpy v1.0" self.widescreen = True #### shortcuts #### self.shortcut = QShortcut(QKeySequence("q"), self) self.shortcut.activated.connect(self.handleQuit) self.shortcut = QShortcut(QKeySequence("u"), self) self.shortcut.activated.connect(self.playFromURL) self.shortcut = QShortcut(QKeySequence(Qt.Key_Space), self) self.shortcut.activated.connect(self.play) self.shortcut = QShortcut(QKeySequence(Qt.Key_F), self) self.shortcut.activated.connect(self.handleFullscreen) self.shortcut = QShortcut(QKeySequence(Qt.Key_Escape), self) self.shortcut.activated.connect(self.exitFullscreen) self.shortcut.activated.connect(self.handleFullscreen) self.shortcut = QShortcut(QKeySequence("i"), self) self.shortcut.activated.connect(self.handleInfo) self.shortcut = QShortcut(QKeySequence("s"), self) self.shortcut.activated.connect(self.toggleSlider) self.shortcut = QShortcut(QKeySequence(Qt.Key_Right), self) self.shortcut.activated.connect(self.forwardSlider) self.shortcut = QShortcut(QKeySequence(Qt.Key_Left), self) self.shortcut.activated.connect(self.backSlider) self.mediaPlayer.setVideoOutput(self.videoWidget) self.mediaPlayer.stateChanged.connect(self.mediaStateChanged) self.mediaPlayer.positionChanged.connect(self.positionChanged) self.mediaPlayer.positionChanged.connect(self.handleLabel) self.mediaPlayer.durationChanged.connect(self.durationChanged) self.mediaPlayer.error.connect(self.handleError) self.populateChannelList() self.selectChannel() self.initialPlay() def playFromURL(self): self.mediaPlayer.pause() self.myurl = self.clip.text() self.mediaPlayer.setMedia(QMediaContent(QUrl(self.myurl))) self.playButton.setEnabled(True) self.mediaPlayer.play() self.hideSlider() print(self.myurl) def dataReady(self): self.myurl = str(self.process.readAll(), encoding='utf8').rstrip() ### self.myurl = self.myurl.partition("\n")[0] print(self.myurl) self.clip.setText(self.myurl) self.playFromURL() def play(self): if self.mediaPlayer.state() == QMediaPlayer.PlayingState: self.mediaPlayer.pause() else: self.mediaPlayer.play() def mediaStateChanged(self, state): if self.mediaPlayer.state() == QMediaPlayer.PlayingState: self.playButton.setIcon( self.style().standardIcon(QStyle.SP_MediaPause)) else: self.playButton.setIcon( self.style().standardIcon(QStyle.SP_MediaPlay)) def positionChanged(self, position): self.positionSlider.setValue(position) def durationChanged(self, duration): self.positionSlider.setRange(0, duration) mtime = QTime(0, 0, 0, 0) mtime = mtime.addMSecs(self.mediaPlayer.duration()) self.elbl.setText(mtime.toString()) def setPosition(self, position): self.mediaPlayer.setPosition(position) def handleError(self): self.playButton.setEnabled(False) print("Error: ", self.mediaPlayer.errorString()) def handleQuit(self): self.mediaPlayer.stop() print("Goodbye ...") app.quit() def contextMenuRequested(self, point): menu = QMenu() actionURL = menu.addAction(QIcon.fromTheme("browser"), "URL from Clipboard (u)") menu.addSeparator() actionToggle = menu.addAction(QIcon.fromTheme("next"), "Show / Hide Channels (s)") actionFull = menu.addAction(QIcon.fromTheme("view-fullscreen"), "Fullscreen (f)") menu.addSeparator() actionInfo = menu.addAction(QIcon.fromTheme("help-about"), "About (i)") menu.addSeparator() actionQuit = menu.addAction(QIcon.fromTheme("application-exit"), "Exit (q)") actionQuit.triggered.connect(self.handleQuit) actionFull.triggered.connect(self.handleFullscreen) actionInfo.triggered.connect(self.handleInfo) actionToggle.triggered.connect(self.toggleSlider) actionURL.triggered.connect(self.playFromURL) menu.exec_(self.mapToGlobal(point)) def wheelEvent(self, event): mscale = event.angleDelta().y() / 13 self.mediaPlayer.setVolume(self.mediaPlayer.volume() + mscale) print("Volume: " + str(self.mediaPlayer.volume())) def mouseDoubleClickEvent(self, event): if event.buttons() == Qt.LeftButton: self.handleFullscreen() def handleFullscreen(self): if self.windowState() and Qt.WindowFullScreen: self.showNormal() else: self.showFullScreen() def exitFullscreen(self): self.showNormal() def handleInfo(self): QMessageBox.about(self, "About", self.myinfo) def toggleSlider(self): if self.positionSlider.isVisible(): self.hideSlider() else: self.showSlider() def hideSlider(self): self.channelList.hide() self.playButton.hide() self.lbl.hide() self.positionSlider.hide() self.elbl.hide() def showSlider(self): self.channelList.show() self.playButton.show() self.lbl.show() self.positionSlider.show() self.elbl.show() self.channelList.setFocus() def forwardSlider(self): self.mediaPlayer.setPosition(self.mediaPlayer.position() + 1000 * 60) def backSlider(self): self.mediaPlayer.setPosition(self.mediaPlayer.position() - 1000 * 60) def volumeUp(self): self.mediaPlayer.setVolume(self.mediaPlayer.volume() + 10) print("Volume: " + str(self.mediaPlayer.volume())) def volumeDown(self): self.mediaPlayer.setVolume(self.mediaPlayer.volume() - 10) print("Volume: " + str(self.mediaPlayer.volume())) def dragEnterEvent(self, event): if event.mimeData().hasUrls(): event.accept() elif event.mimeData().hasText(): event.accept() else: event.ignore() def dropEvent(self, event): print("drop") if event.mimeData().hasUrls(): url = event.mimeData().urls()[0].toString() print("url = ", url) self.mediaPlayer.stop() self.mediaPlayer.setMedia(QMediaContent(QUrl(url))) self.playButton.setEnabled(True) self.mediaPlayer.play() elif event.mimeData().hasText(): mydrop = event.mimeData().text() print("generic url = ", mydrop) self.mediaPlayer.setMedia(QMediaContent(QUrl(mydrop))) self.playButton.setEnabled(True) self.mediaPlayer.play() self.hideSlider() def loadFilm(self, f): self.mediaPlayer.setMedia(QMediaContent(QUrl.fromLocalFile(f))) self.playButton.setEnabled(True) self.mediaPlayer.play() def populateChannelList(self): # file must be in same directory as the script FILEPATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "canaletv.txt") # lines from file with "channel name" -- "link" channelArray = [] # split file by line and adding it to the array with open(FILEPATH) as f: for line in f: channelArray.append(line.rstrip()) # dictionary with key = channel name and value = link self.channelDict = dict(ch.split(" -- ") for ch in channelArray) for channel in self.channelDict.keys(): item = QStandardItem(channel) self.model.appendRow(item) def selectedItemBehavior(self, index): # gets the link for the selected channel and plays it itms = self.channelList.selectedIndexes() for it in itms: channel = it.data() link = self.channelDict[channel] self.mediaPlayer.setMedia(QMediaContent(QUrl(link))) self.play() def selectChannel(self): # selecting channel from sidebar calls selectedItemBehavior self.selModel = self.channelList.selectionModel() self.selModel.selectionChanged.connect(self.selectedItemBehavior) def initialPlay(self): # play somenting when app opens self.mediaPlayer.setMedia(QMediaContent(QUrl("https://vid.hls.protv.ro/proxhdn/proxhd_3_34/index.m3u8?1"))) self.play() def handleLabel(self): self.lbl.clear() mtime = QTime(0, 0, 0, 0) self.time = mtime.addMSecs(self.mediaPlayer.position()) self.lbl.setText(self.time.toString())
class Ui_VideoAnnoWidget(object): def setupUi(self, VideoAnnoWidget): VideoAnnoWidget.setObjectName("VideoAnnoWidget") VideoAnnoWidget.resize(1168, 750) self.horizontalLayout_3 = QtWidgets.QHBoxLayout(VideoAnnoWidget) self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setContentsMargins(4, 8, 8, 4) self.verticalLayout.setObjectName("verticalLayout") self.videoWidget = QVideoWidget(VideoAnnoWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.videoWidget.sizePolicy().hasHeightForWidth()) self.videoWidget.setSizePolicy(sizePolicy) self.videoWidget.setStyleSheet("background-color: rgb(0, 0, 0);") self.videoWidget.setObjectName("videoWidget") self.verticalLayout.addWidget(self.videoWidget) self.segmentColorBar = SegmentColorBar(VideoAnnoWidget) self.segmentColorBar.setMaximumSize(QtCore.QSize(16777215, 12)) self.segmentColorBar.setText("") self.segmentColorBar.setObjectName("segmentColorBar") self.verticalLayout.addWidget(self.segmentColorBar) self.positionSlider = QtWidgets.QSlider(VideoAnnoWidget) self.positionSlider.setOrientation(QtCore.Qt.Horizontal) self.positionSlider.setObjectName("positionSlider") self.verticalLayout.addWidget(self.positionSlider) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setSizeConstraint(QtWidgets.QLayout.SetMinimumSize) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.playButton = QtWidgets.QPushButton(VideoAnnoWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.playButton.sizePolicy().hasHeightForWidth()) self.playButton.setSizePolicy(sizePolicy) self.playButton.setMinimumSize(QtCore.QSize(30, 30)) self.playButton.setMaximumSize(QtCore.QSize(30, 30)) self.playButton.setBaseSize(QtCore.QSize(30, 30)) self.playButton.setText("") self.playButton.setObjectName("playButton") self.horizontalLayout_2.addWidget(self.playButton) self.stepBackwardButton = QtWidgets.QPushButton(VideoAnnoWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.stepBackwardButton.sizePolicy().hasHeightForWidth()) self.stepBackwardButton.setSizePolicy(sizePolicy) self.stepBackwardButton.setMinimumSize(QtCore.QSize(30, 30)) self.stepBackwardButton.setMaximumSize(QtCore.QSize(30, 30)) self.stepBackwardButton.setText("") self.stepBackwardButton.setObjectName("stepBackwardButton") self.horizontalLayout_2.addWidget(self.stepBackwardButton) self.stepForwardButton = QtWidgets.QPushButton(VideoAnnoWidget) self.stepForwardButton.setMinimumSize(QtCore.QSize(30, 30)) self.stepForwardButton.setMaximumSize(QtCore.QSize(30, 30)) self.stepForwardButton.setText("") self.stepForwardButton.setObjectName("stepForwardButton") self.horizontalLayout_2.addWidget(self.stepForwardButton) self.curTimeLabel = QtWidgets.QLabel(VideoAnnoWidget) self.curTimeLabel.setObjectName("curTimeLabel") self.horizontalLayout_2.addWidget(self.curTimeLabel) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem) self.label = QtWidgets.QLabel(VideoAnnoWidget) self.label.setObjectName("label") self.horizontalLayout_2.addWidget(self.label) self.stepSpinBox = QtWidgets.QSpinBox(VideoAnnoWidget) self.stepSpinBox.setMinimumSize(QtCore.QSize(100, 30)) self.stepSpinBox.setMaximumSize(QtCore.QSize(100, 30)) self.stepSpinBox.setMinimum(50) self.stepSpinBox.setMaximum(999999999) self.stepSpinBox.setObjectName("stepSpinBox") self.horizontalLayout_2.addWidget(self.stepSpinBox) self.verticalLayout.addLayout(self.horizontalLayout_2) self.verticalLayout.setStretch(0, 1) self.horizontalLayout_3.addLayout(self.verticalLayout) self.verticalLayout_4 = QtWidgets.QVBoxLayout() self.verticalLayout_4.setObjectName("verticalLayout_4") self.horizontalLayout_4 = QtWidgets.QHBoxLayout() self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.label_3 = QtWidgets.QLabel(VideoAnnoWidget) self.label_3.setObjectName("label_3") self.horizontalLayout_4.addWidget(self.label_3) self.labelLineEdit = QtWidgets.QLineEdit(VideoAnnoWidget) self.labelLineEdit.setObjectName("labelLineEdit") self.horizontalLayout_4.addWidget(self.labelLineEdit) self.verticalLayout_4.addLayout(self.horizontalLayout_4) self.horizontalLayout_6 = QtWidgets.QHBoxLayout() self.horizontalLayout_6.setObjectName("horizontalLayout_6") self.verticalLayout_5 = QtWidgets.QVBoxLayout() self.verticalLayout_5.setObjectName("verticalLayout_5") self.label_5 = QtWidgets.QLabel(VideoAnnoWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_5.sizePolicy().hasHeightForWidth()) self.label_5.setSizePolicy(sizePolicy) self.label_5.setMaximumSize(QtCore.QSize(16777215, 20)) self.label_5.setObjectName("label_5") self.verticalLayout_5.addWidget(self.label_5) self.startTimeLabel = QtWidgets.QLabel(VideoAnnoWidget) self.startTimeLabel.setStyleSheet("background-color: rgb(195, 195, 195);") self.startTimeLabel.setObjectName("startTimeLabel") self.verticalLayout_5.addWidget(self.startTimeLabel) self.getStartTimeButton = QtWidgets.QPushButton(VideoAnnoWidget) self.getStartTimeButton.setMinimumSize(QtCore.QSize(0, 30)) self.getStartTimeButton.setMaximumSize(QtCore.QSize(16777215, 30)) self.getStartTimeButton.setObjectName("getStartTimeButton") self.verticalLayout_5.addWidget(self.getStartTimeButton) self.horizontalLayout_6.addLayout(self.verticalLayout_5) self.verticalLayout_3 = QtWidgets.QVBoxLayout() self.verticalLayout_3.setObjectName("verticalLayout_3") self.label_2 = QtWidgets.QLabel(VideoAnnoWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth()) self.label_2.setSizePolicy(sizePolicy) self.label_2.setMaximumSize(QtCore.QSize(16777215, 20)) self.label_2.setObjectName("label_2") self.verticalLayout_3.addWidget(self.label_2) self.endTimeLabel = QtWidgets.QLabel(VideoAnnoWidget) self.endTimeLabel.setStyleSheet("background-color: rgb(195, 195, 195);") self.endTimeLabel.setObjectName("endTimeLabel") self.verticalLayout_3.addWidget(self.endTimeLabel) self.getEndTimeButton = QtWidgets.QPushButton(VideoAnnoWidget) self.getEndTimeButton.setMinimumSize(QtCore.QSize(0, 30)) self.getEndTimeButton.setMaximumSize(QtCore.QSize(16777215, 30)) self.getEndTimeButton.setObjectName("getEndTimeButton") self.verticalLayout_3.addWidget(self.getEndTimeButton) self.horizontalLayout_6.addLayout(self.verticalLayout_3) self.verticalLayout_4.addLayout(self.horizontalLayout_6) self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.label_4 = QtWidgets.QLabel(VideoAnnoWidget) self.label_4.setObjectName("label_4") self.horizontalLayout_5.addWidget(self.label_4) self.addSegmentButton = QtWidgets.QPushButton(VideoAnnoWidget) self.addSegmentButton.setMinimumSize(QtCore.QSize(30, 30)) self.addSegmentButton.setMaximumSize(QtCore.QSize(30, 30)) self.addSegmentButton.setText("") self.addSegmentButton.setObjectName("addSegmentButton") self.horizontalLayout_5.addWidget(self.addSegmentButton) self.delSegmentButton = QtWidgets.QPushButton(VideoAnnoWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.delSegmentButton.sizePolicy().hasHeightForWidth()) self.delSegmentButton.setSizePolicy(sizePolicy) self.delSegmentButton.setMinimumSize(QtCore.QSize(30, 30)) self.delSegmentButton.setMaximumSize(QtCore.QSize(30, 30)) self.delSegmentButton.setText("") self.delSegmentButton.setObjectName("delSegmentButton") self.horizontalLayout_5.addWidget(self.delSegmentButton) self.verticalLayout_4.addLayout(self.horizontalLayout_5) self.segmentListWidget = QtWidgets.QListWidget(VideoAnnoWidget) self.segmentListWidget.setObjectName("segmentListWidget") self.verticalLayout_4.addWidget(self.segmentListWidget) self.verticalLayout_4.setStretch(3, 1) self.horizontalLayout_3.addLayout(self.verticalLayout_4) self.horizontalLayout_3.setStretch(0, 1) self.retranslateUi(VideoAnnoWidget) QtCore.QMetaObject.connectSlotsByName(VideoAnnoWidget) def retranslateUi(self, VideoAnnoWidget): _translate = QtCore.QCoreApplication.translate VideoAnnoWidget.setWindowTitle(_translate("VideoAnnoWidget", "Form")) self.playButton.setToolTip(_translate("VideoAnnoWidget", "Play / Pause Video")) self.stepBackwardButton.setToolTip(_translate("VideoAnnoWidget", "Video Step Backward")) self.stepForwardButton.setToolTip(_translate("VideoAnnoWidget", "Video Step Forward")) self.curTimeLabel.setText(_translate("VideoAnnoWidget", "00:00:00")) self.label.setText(_translate("VideoAnnoWidget", "Step Size")) self.stepSpinBox.setSuffix(_translate("VideoAnnoWidget", " ms")) self.label_3.setText(_translate("VideoAnnoWidget", "Label")) self.label_5.setText(_translate("VideoAnnoWidget", "Segment Start")) self.startTimeLabel.setText(_translate("VideoAnnoWidget", "00:00:00")) self.getStartTimeButton.setToolTip(_translate("VideoAnnoWidget", "Grab Segment Start Time")) self.getStartTimeButton.setText(_translate("VideoAnnoWidget", "Grab Time")) self.label_2.setText(_translate("VideoAnnoWidget", "Segment End")) self.endTimeLabel.setText(_translate("VideoAnnoWidget", "00:00:00")) self.getEndTimeButton.setToolTip(_translate("VideoAnnoWidget", "Grab Segment End Time")) self.getEndTimeButton.setText(_translate("VideoAnnoWidget", "Grab Time")) self.label_4.setText(_translate("VideoAnnoWidget", "Segments")) self.addSegmentButton.setToolTip(_translate("VideoAnnoWidget", "Add New Segment")) self.delSegmentButton.setToolTip(_translate("VideoAnnoWidget", "Delete Selected Segment"))
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(676, 409) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.button_play_pause = QtWidgets.QPushButton(self.centralwidget) self.button_play_pause.setGeometry(QtCore.QRect(20, 290, 91, 31)) self.button_play_pause.setObjectName("button_play_pause") self.video_slider = QtWidgets.QSlider(self.centralwidget) self.video_slider.setGeometry(QtCore.QRect(110, 290, 281, 22)) self.video_slider.setOrientation(QtCore.Qt.Horizontal) self.video_slider.setObjectName("video_slider") self.video_widget = QVideoWidget(self.centralwidget) self.video_widget.setGeometry(QtCore.QRect(20, 50, 371, 231)) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.video_widget.sizePolicy().hasHeightForWidth()) self.video_widget.setSizePolicy(sizePolicy) self.video_widget.setBaseSize(QtCore.QSize(50, 100)) self.video_widget.setObjectName("video_widget") self.label_info = QtWidgets.QTextBrowser(self.centralwidget) self.label_info.setGeometry(QtCore.QRect(410, 10, 256, 141)) self.label_info.setBaseSize(QtCore.QSize(50, 50)) self.label_info.setObjectName("label_info") self.button_load = QtWidgets.QPushButton(self.centralwidget) self.button_load.setGeometry(QtCore.QRect(310, 20, 80, 31)) self.button_load.setObjectName("button_load") self.file_info = QtWidgets.QTextBrowser(self.centralwidget) self.file_info.setGeometry(QtCore.QRect(20, 20, 291, 21)) self.file_info.setObjectName("file_info") self.original_video_widget = QVideoWidget(self.centralwidget) self.original_video_widget.setGeometry(QtCore.QRect( 410, 160, 251, 191)) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.original_video_widget.sizePolicy().hasHeightForWidth()) self.original_video_widget.setSizePolicy(sizePolicy) self.original_video_widget.setBaseSize(QtCore.QSize(50, 100)) self.original_video_widget.setObjectName("original_video_widget") self.button_track = QtWidgets.QPushButton(self.centralwidget) self.button_track.setGeometry(QtCore.QRect(170, 340, 81, 31)) self.button_track.setObjectName("button_track") MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) self.button_play_pause.setText(_translate("MainWindow", "Play/Pause")) self.button_load.setText(_translate("MainWindow", "Load")) self.file_info.setHtml( _translate( "MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:\'.SF NS Text\'; font-size:13pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-style:italic;\">No file loaded...</span></p></body></html>" )) self.button_track.setText(_translate("MainWindow", "Track"))
class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(1020, 885) self.groupBox = QtWidgets.QGroupBox(Form) self.groupBox.setGeometry(QtCore.QRect(0, 630, 631, 71)) self.groupBox.setObjectName("groupBox") self.label = QtWidgets.QLabel(self.groupBox) self.label.setGeometry(QtCore.QRect(10, 30, 24, 16)) self.label.setObjectName("label") self.cutStartTime = QtWidgets.QLineEdit(self.groupBox) self.cutStartTime.setGeometry(QtCore.QRect(50, 30, 150, 20)) self.cutStartTime.setObjectName("cutStartTime") self.cutEndTime = QtWidgets.QLineEdit(self.groupBox) self.cutEndTime.setGeometry(QtCore.QRect(290, 30, 150, 20)) self.cutEndTime.setObjectName("cutEndTime") self.label_2 = QtWidgets.QLabel(self.groupBox) self.label_2.setGeometry(QtCore.QRect(260, 30, 18, 16)) self.label_2.setObjectName("label_2") self.cutButton = QtWidgets.QPushButton(self.groupBox) self.cutButton.setGeometry(QtCore.QRect(500, 30, 75, 23)) self.cutButton.setObjectName("cutButton") self.widget = QVideoWidget(Form) self.widget.setGeometry(QtCore.QRect(40, 70, 900, 500)) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.widget.sizePolicy().hasHeightForWidth()) self.widget.setSizePolicy(sizePolicy) self.widget.setObjectName("widget") self.playButton = QtWidgets.QPushButton(Form) self.playButton.setGeometry(QtCore.QRect(0, 570, 40, 40)) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.playButton.sizePolicy().hasHeightForWidth()) self.playButton.setSizePolicy(sizePolicy) self.playButton.setText("") self.playButton.setObjectName("playButton") self.horizontalSlider = QtWidgets.QSlider(Form) self.horizontalSlider.setEnabled(True) self.horizontalSlider.setGeometry(QtCore.QRect(40, 580, 900, 25)) self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal) self.horizontalSlider.setObjectName("horizontalSlider") self.timeLcd = QtWidgets.QLCDNumber(Form) self.timeLcd.setGeometry(QtCore.QRect(940, 580, 80, 23)) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.timeLcd.sizePolicy().hasHeightForWidth()) self.timeLcd.setSizePolicy(sizePolicy) self.timeLcd.setObjectName("timeLcd") self.OpenButton = QtWidgets.QPushButton(Form) self.OpenButton.setGeometry(QtCore.QRect(0, 0, 81, 41)) self.OpenButton.setObjectName("OpenButton") self.groupBox_2 = QtWidgets.QGroupBox(Form) self.groupBox_2.setGeometry(QtCore.QRect(650, 630, 361, 71)) self.groupBox_2.setObjectName("groupBox_2") self.mirror_xButton = QtWidgets.QPushButton(self.groupBox_2) self.mirror_xButton.setGeometry(QtCore.QRect(60, 30, 75, 23)) self.mirror_xButton.setObjectName("mirror_xButton") self.mirror_yButton = QtWidgets.QPushButton(self.groupBox_2) self.mirror_yButton.setGeometry(QtCore.QRect(220, 30, 75, 23)) self.mirror_yButton.setObjectName("mirror_yButton") self.groupBox_3 = QtWidgets.QGroupBox(Form) self.groupBox_3.setGeometry(QtCore.QRect(0, 730, 421, 101)) self.groupBox_3.setObjectName("groupBox_3") self.speed_line = QtWidgets.QLineEdit(self.groupBox_3) self.speed_line.setGeometry(QtCore.QRect(140, 40, 113, 20)) self.speed_line.setObjectName("speed_line") self.label_3 = QtWidgets.QLabel(self.groupBox_3) self.label_3.setGeometry(QtCore.QRect(10, 40, 111, 16)) self.label_3.setObjectName("label_3") self.speedButton = QtWidgets.QPushButton(self.groupBox_3) self.speedButton.setGeometry(QtCore.QRect(280, 40, 101, 23)) self.speedButton.setObjectName("speedButton") self.groupBox_4 = QtWidgets.QGroupBox(Form) self.groupBox_4.setGeometry(QtCore.QRect(540, 730, 191, 101)) self.groupBox_4.setObjectName("groupBox_4") self.blackwhiteButton = QtWidgets.QPushButton(self.groupBox_4) self.blackwhiteButton.setGeometry(QtCore.QRect(40, 30, 101, 21)) self.blackwhiteButton.setObjectName("blackwhiteButton") self.saveButton = QtWidgets.QPushButton(Form) self.saveButton.setGeometry(QtCore.QRect(950, 0, 71, 41)) self.saveButton.setObjectName("saveButton") self.redoButton = QtWidgets.QPushButton(Form) self.redoButton.setGeometry(QtCore.QRect(870, 0, 41, 41)) self.redoButton.setText("") self.redoButton.setObjectName("redoButton") self.undoButton = QtWidgets.QPushButton(Form) self.undoButton.setGeometry(QtCore.QRect(810, 0, 41, 41)) self.undoButton.setText("") self.undoButton.setObjectName("undoButton") self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "Form")) self.groupBox.setTitle(_translate("Form", "Cut")) self.label.setText(_translate("Form", "Start")) self.label_2.setText(_translate("Form", "End")) self.cutButton.setText(_translate("Form", "Cut")) self.OpenButton.setText(_translate("Form", "Open")) self.groupBox_2.setTitle(_translate("Form", "Mirror video")) self.mirror_xButton.setText(_translate("Form", "Mirror x")) self.mirror_yButton.setText(_translate("Form", "Mirror y")) self.groupBox_3.setTitle(_translate("Form", "Change speed")) self.label_3.setText(_translate("Form", "Coefficient of speed")) self.speedButton.setText(_translate("Form", "Change speed")) self.groupBox_4.setTitle(_translate("Form", "Blackwhite filter")) self.blackwhiteButton.setText(_translate("Form", "Apply filter")) self.saveButton.setText(_translate("Form", "Save"))
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(800, 600) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout.setObjectName("gridLayout") self.graphicsView = QtWidgets.QGraphicsView(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.graphicsView.sizePolicy().hasHeightForWidth()) self.graphicsView.setSizePolicy(sizePolicy) self.graphicsView.setObjectName("graphicsView") self.gridLayout.addWidget(self.graphicsView, 0, 1, 1, 1) self.horizontalSlider = QtWidgets.QSlider(self.centralwidget) self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal) self.horizontalSlider.setObjectName("horizontalSlider") self.gridLayout.addWidget(self.horizontalSlider, 1, 0, 1, 1) self.horizontalSlider_2 = QtWidgets.QSlider(self.centralwidget) self.horizontalSlider_2.setOrientation(QtCore.Qt.Horizontal) self.horizontalSlider_2.setObjectName("horizontalSlider_2") self.gridLayout.addWidget(self.horizontalSlider_2, 1, 1, 1, 1) self.widget = QVideoWidget(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.widget.sizePolicy().hasHeightForWidth()) self.widget.setSizePolicy(sizePolicy) self.widget.setObjectName("widget") self.gridLayout.addWidget(self.widget, 0, 0, 1, 1) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.pushButton = QtWidgets.QPushButton(self.centralwidget) self.pushButton.setObjectName("pushButton") self.horizontalLayout.addWidget(self.pushButton) self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_2.setText("") self.pushButton_2.setObjectName("pushButton_2") self.horizontalLayout.addWidget(self.pushButton_2) self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_3.setObjectName("pushButton_3") self.horizontalLayout.addWidget(self.pushButton_3) self.gridLayout.addLayout(self.horizontalLayout, 2, 0, 1, 2) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) self.pushButton.setText(_translate("MainWindow", "Open")) self.pushButton_3.setText(_translate("MainWindow", "Process"))
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(965, 592) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout.setObjectName("gridLayout") self.widget = QVideoWidget(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.widget.sizePolicy().hasHeightForWidth()) self.widget.setSizePolicy(sizePolicy) self.widget.setObjectName("widget") self.gridLayout.addWidget(self.widget, 0, 0, 1, 1) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize) self.horizontalLayout.setObjectName("horizontalLayout") self.pushButton_7 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_7.setObjectName("pushButton_7") self.horizontalLayout.addWidget(self.pushButton_7) self.pushButton_6 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_6.setObjectName("pushButton_6") self.horizontalLayout.addWidget(self.pushButton_6) self.pushButton = QtWidgets.QPushButton(self.centralwidget) self.pushButton.setObjectName("pushButton") self.horizontalLayout.addWidget(self.pushButton) self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_2.setText("") self.pushButton_2.setObjectName("pushButton_2") self.horizontalLayout.addWidget(self.pushButton_2) self.pushButton_4 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_4.setObjectName("pushButton_4") self.horizontalLayout.addWidget(self.pushButton_4) self.pushButton_9 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_9.setObjectName("pushButton_9") self.horizontalLayout.addWidget(self.pushButton_9) self.pushButton_5 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_5.setObjectName("pushButton_5") self.horizontalLayout.addWidget(self.pushButton_5) self.pushButton_8 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_8.setObjectName("pushButton_8") self.horizontalLayout.addWidget(self.pushButton_8) self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_3.setObjectName("pushButton_3") self.horizontalLayout.addWidget(self.pushButton_3) self.pushButton_10 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_10.setObjectName("pushButton_10") self.horizontalLayout.addWidget(self.pushButton_10) self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 1) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.horizontalSlider = QtWidgets.QSlider(self.centralwidget) self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal) self.horizontalSlider.setObjectName("horizontalSlider") self.horizontalLayout_3.addWidget(self.horizontalSlider) self.label = QtWidgets.QLabel(self.centralwidget) self.label.setText("") self.label.setObjectName("label") self.horizontalLayout_3.addWidget(self.label) self.gridLayout.addLayout(self.horizontalLayout_3, 2, 0, 1, 1) self.listWidget = QtWidgets.QListWidget(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.listWidget.sizePolicy().hasHeightForWidth()) self.listWidget.setSizePolicy(sizePolicy) self.listWidget.setObjectName("listWidget") self.gridLayout.addWidget(self.listWidget, 3, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 965, 26)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "VideoEditor")) self.pushButton_7.setText(_translate("MainWindow", "打开背景")) self.pushButton_6.setText(_translate("MainWindow", "打开bgm")) self.pushButton.setText(_translate("MainWindow", "打开目标")) self.pushButton_4.setText(_translate("MainWindow", "起始")) self.pushButton_9.setText(_translate("MainWindow", "tiktok")) self.pushButton_5.setText(_translate("MainWindow", "分身")) self.pushButton_8.setText(_translate("MainWindow", "切分")) self.pushButton_3.setText(_translate("MainWindow", "生成")) self.pushButton_10.setText(_translate("MainWindow", "增加"))
def __init__(self, parent=None): super(MovieWidget, self).__init__(parent) mini = True self.parent = parent self.isVideoAvailable = False self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.mediaPlayer = QMediaPlayer(None, QMediaPlayer.VideoSurface) self.mediaPlayer.videoAvailableChanged.connect( self.videoAvailableChanged) videoWidget = QVideoWidget(self) videoWidget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.setContextMenuPolicy(Qt.CustomContextMenu) # Context Menu self.customContextMenuRequested.connect(self.openContextMenu) self.contextMenu = QMenu() self.openAction = self.contextMenu.addAction("Open file") icon = QIcon(self.style().standardIcon(QStyle.SP_DialogOpenButton)) self.openAction.setIcon(icon) self.urlAction = self.contextMenu.addAction("Open stream") icon = QIcon(self.style().standardIcon(QStyle.SP_DirLinkIcon)) self.urlAction.setIcon(icon) self.playAction = self.contextMenu.addAction("Play/Pause") icon = QIcon(self.style().standardIcon(QStyle.SP_MediaPlay)) self.playAction.setEnabled(False) self.playAction.setIcon(icon) self.closeAction = self.contextMenu.addAction("Close") icon = QIcon(self.style().standardIcon(QStyle.SP_DialogCloseButton)) self.closeAction.setEnabled(False) self.closeAction.setIcon(icon) self.posSlider = QSlider(Qt.Horizontal) self.posSlider.setRange(0, 0) self.posSlider.sliderMoved.connect(self.setPosition) self.wac = QWidgetAction(self.contextMenu) self.wac.setDefaultWidget(self.posSlider) self.posAction = self.contextMenu.addAction(self.wac) self.lblFile = QLabel() self.wal = QWidgetAction(self.contextMenu) self.wal.setDefaultWidget(self.lblFile) self.posAction = self.contextMenu.addAction(self.wal) # Control box self.openButton = QPushButton() self.openButton.setIcon(self.style().standardIcon( QStyle.SP_DialogOpenButton)) self.openButton.clicked.connect(self.openFile) self.urlButton = QPushButton() self.urlButton.setIcon(self.style().standardIcon( QStyle.SP_DirLinkIcon)) self.urlButton.clicked.connect(self.openURL) self.playButton = QPushButton() self.playButton.setEnabled(False) self.playButton.setIcon(self.style().standardIcon(QStyle.SP_MediaPlay)) self.playButton.clicked.connect(self.play) self.positionSlider = QSlider(Qt.Horizontal) self.positionSlider.setRange(0, 0) self.positionSlider.sliderMoved.connect(self.setPosition) self.errorLabel = QLabel() self.errorLabel.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum) # Create layouts to place inside widget controlLayout = QHBoxLayout() controlLayout.setContentsMargins(0, 0, 0, 0) controlLayout.addWidget(self.openButton) controlLayout.addWidget(self.urlButton) controlLayout.addWidget(self.playButton) controlLayout.addWidget(self.positionSlider) vLayout = QVBoxLayout() vLayout.setContentsMargins(0, 0, 0, 0) vLayout.addWidget(videoWidget) if mini != True: vLayout.addLayout(controlLayout) vLayout.addWidget(self.errorLabel) self.setLayout(vLayout) # Set widget to contain window contents self.mediaPlayer.setVideoOutput(videoWidget) self.mediaPlayer.stateChanged.connect(self.mediaStateChanged) self.mediaPlayer.positionChanged.connect(self.positionChanged) self.mediaPlayer.durationChanged.connect(self.durationChanged) self.mediaPlayer.error.connect(self.handleError) self.resize(180, 100)