diff --git a/src/qt/.idea/.gitignore b/src/qt/.idea/.gitignore new file mode 100644 index 0000000..35410ca --- /dev/null +++ b/src/qt/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/src/qt/.idea/inspectionProfiles/profiles_settings.xml b/src/qt/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/src/qt/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/src/qt/.idea/misc.xml b/src/qt/.idea/misc.xml new file mode 100644 index 0000000..d6c20c7 --- /dev/null +++ b/src/qt/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/qt/.idea/modules.xml b/src/qt/.idea/modules.xml new file mode 100644 index 0000000..45b9f23 --- /dev/null +++ b/src/qt/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/qt/.idea/qt.iml b/src/qt/.idea/qt.iml new file mode 100644 index 0000000..a8a0ef9 --- /dev/null +++ b/src/qt/.idea/qt.iml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/qt/.idea/vcs.xml b/src/qt/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/src/qt/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/qt/findpath_UI.py b/src/qt/findpath_UI.py index 8cb4358..596ef8b 100644 --- a/src/qt/findpath_UI.py +++ b/src/qt/findpath_UI.py @@ -9,6 +9,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets +from PyQt5.QtCore import QTimer from PyQt5.QtMultimediaWidgets import QVideoWidget from PyQt5.QtMultimedia import QMediaContent, QMediaPlayer from PyQt5.QtWidgets import QFileDialog @@ -71,6 +72,7 @@ class Ui_MainWindow1(object): self.sld_duration.setGeometry(QtCore.QRect(20, 20, 1051, 22)) self.sld_duration.setOrientation(QtCore.Qt.Horizontal) self.sld_duration.setObjectName("sld_duration") + self.sld_duration.setEnabled(True) self.lab_duration = QtWidgets.QLabel(self.frame_2) self.lab_duration.setGeometry(QtCore.QRect(1100, 20, 81, 21)) font = QtGui.QFont() @@ -111,12 +113,17 @@ class Ui_MainWindow1(object): self.player = QMediaPlayer() self.player.setVideoOutput(self.widget) + self.maxValue = 1000 + self.timer = QTimer() + self.timer.start(1000) + self.timer.timeout.connect(lambda: self.onTimerOut()) self.actionl1.triggered.connect(lambda: self.openfile()) - self.displayTime() self.pushButton_2.clicked.connect(lambda: self.playpause()) + def openfile(self): - self.player.setMedia(QMediaContent(QFileDialog.getOpenFileUrl()[0])) + media_list = QMediaContent(QFileDialog.getOpenFileUrl()[0]) + self.player.setMedia(media_list) self.player.play() self.player.pause() @@ -133,16 +140,17 @@ class Ui_MainWindow1(object): icon9.addPixmap(QtGui.QPixmap("window_png/暂停.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pushButton_2.setIcon(icon9) self.pushButton_2.setIconSize(QtCore.QSize(50, 50)) - def getms(self): - a = self.player.duration() - self.sld_duration.setRange(0, a) - self.sld_duration.setEnabled(True) - return a - def displayTime(self): - ms = self.getms() + + def onTimerOut(self): + alltime = self.player.duration() + ms = self.player.position() minutes = int(ms / 60000) seconds = int((ms - minutes * 60000) / 1000) - self.lab_duration.setText('{}:{}'.format(minutes, seconds)) + minute = int(alltime / 60000) + sec = int((alltime - minute * 60000) / 1000) + self.lab_duration.setText('{}:{}/{}:{}'.format(minutes, seconds, minute, sec)) + self.sld_duration.setMaximum(alltime) + self.sld_duration.setValue(ms) def retranslateUi(self, MainWindow):