Commit a41348f6 authored by xuanweiace's avatar xuanweiace

优化1:对话框取消后不抹掉文本

优化2:只有旁白tab可编辑 功能1:打开未完成的工程,询问是否继续检测 功能2:主窗口标题,显示工程名 修复1:同时多次运行旁白检测造成的bug
parent 37fd21ce
...@@ -46,7 +46,7 @@ class Assemble_Dialog(QDialog, Ui_Dialog): ...@@ -46,7 +46,7 @@ class Assemble_Dialog(QDialog, Ui_Dialog):
def openFile(self): def openFile(self):
file_info = QFileDialog.getOpenFileNames(self, '选择视频', os.getcwd(), "All Files(*);;Text Files(*.txt)") file_info = QFileDialog.getOpenFileNames(self, '选择视频', os.getcwd(), "All Files(*);;Text Files(*.txt)")
file_name, ok = validate_and_get_filepath(file_info) file_name, ok = validate_and_get_filepath(file_info)
if ok: if ok and file_name != "":
self.lineEdit.setText(file_name) self.lineEdit.setText(file_name)
def openTableFile(self): def openTableFile(self):
...@@ -58,15 +58,14 @@ class Assemble_Dialog(QDialog, Ui_Dialog): ...@@ -58,15 +58,14 @@ class Assemble_Dialog(QDialog, Ui_Dialog):
print(file_info) print(file_info)
file_name, ok = validate_and_get_filepath(file_info) file_name, ok = validate_and_get_filepath(file_info)
print(file_name, ok) print(file_name, ok)
if ok: if ok and file_name != "":
self.lineEdit_2.setText(file_name) self.lineEdit_2.setText(file_name)
def start_assemble(self): def start_assemble(self):
print("start_assemble") print("start_assemble")
video_path = self.lineEdit.text() video_path = self.lineEdit.text()
# 现在是默认 输出的音频和字幕路径和视频路径一致 # 默认 输出的音频是工程目录+/output
audio_dir = os.path.dirname(self.lineEdit.text()) audio_dir = self.projectContext.project_base_dir+"output/"
# audio_dir = replace_path_suffix(self.lineEdit.text(), "")
sheet_path = self.lineEdit_2.text() sheet_path = self.lineEdit_2.text()
speaker_info = self.lineEdit_3.text() speaker_info = self.lineEdit_3.text()
speed_info = self.lineEdit_4.text() speed_info = self.lineEdit_4.text()
......
...@@ -6,7 +6,7 @@ from PyQt5.QtWidgets import *; ...@@ -6,7 +6,7 @@ from PyQt5.QtWidgets import *;
from detect_dialog_ui import Ui_Dialog from detect_dialog_ui import Ui_Dialog
from utils import validate_and_get_filepath, replace_path_suffix from utils import validate_and_get_filepath, replace_path_suffix
from prompt_dialog import Prompt_Dialog
class Detect_Dialog(QDialog, Ui_Dialog): class Detect_Dialog(QDialog, Ui_Dialog):
...@@ -22,7 +22,7 @@ class Detect_Dialog(QDialog, Ui_Dialog): ...@@ -22,7 +22,7 @@ class Detect_Dialog(QDialog, Ui_Dialog):
self.pushButton.clicked.connect(self.openFile) self.pushButton.clicked.connect(self.openFile)
self.pushButton_2.clicked.connect(self.openTableFile) self.pushButton_2.clicked.connect(self.openTableFile)
self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).clicked.connect(self.start_detect) self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).clicked.connect(self.start_detect)
self.prompt_dialog = Prompt_Dialog()
def init_self(self): def init_self(self):
self.lineEdit.setText(self.projectContext.video_path) self.lineEdit.setText(self.projectContext.video_path)
self.lineEdit_2.setText(self.projectContext.excel_path) self.lineEdit_2.setText(self.projectContext.excel_path)
...@@ -31,9 +31,8 @@ class Detect_Dialog(QDialog, Ui_Dialog): ...@@ -31,9 +31,8 @@ class Detect_Dialog(QDialog, Ui_Dialog):
root_dir = os.getcwd() if self.projectContext.video_path is None else os.path.dirname(self.projectContext.video_path) root_dir = os.getcwd() if self.projectContext.video_path is None else os.path.dirname(self.projectContext.video_path)
file_info = QFileDialog.getOpenFileNames(self, '选择视频', root_dir, "Video Files(*.mp4 *.rmvb *mkv *avi)") file_info = QFileDialog.getOpenFileNames(self, '选择视频', root_dir, "Video Files(*.mp4 *.rmvb *mkv *avi)")
file_name, ok = validate_and_get_filepath(file_info) file_name, ok = validate_and_get_filepath(file_info)
if ok: if ok and file_name != "":
self.lineEdit.setText(file_name) self.lineEdit.setText(file_name)
self.lineEdit_2.setText(replace_path_suffix(file_info[0][0], ".xlsx"))
def openTableFile(self): def openTableFile(self):
now_path = os.path.join(os.getcwd(), self.lineEdit.text()) now_path = os.path.join(os.getcwd(), self.lineEdit.text())
...@@ -43,7 +42,7 @@ class Detect_Dialog(QDialog, Ui_Dialog): ...@@ -43,7 +42,7 @@ class Detect_Dialog(QDialog, Ui_Dialog):
print(file_info) print(file_info)
file_name, ok = validate_and_get_filepath(file_info) file_name, ok = validate_and_get_filepath(file_info)
print(file_name, ok) print(file_name, ok)
if ok: if ok and file_name != "":
self.lineEdit_2.setText(file_name) self.lineEdit_2.setText(file_name)
def start_detect(self): def start_detect(self):
...@@ -53,9 +52,10 @@ class Detect_Dialog(QDialog, Ui_Dialog): ...@@ -53,9 +52,10 @@ class Detect_Dialog(QDialog, Ui_Dialog):
# 版本2.0: # 版本2.0:
# 在主窗口启动时,就启动一个QThread,专门接收该信号并进行检测, # 在主窗口启动时,就启动一个QThread,专门接收该信号并进行检测,
# 发出该信号后,由QThread和主窗口同时接收,然后让他俩通过信号交互即可。 # 发出该信号后,由QThread和主窗口同时接收,然后让他俩通过信号交互即可。
if self.lineEdit.text()!="" and self.lineEdit_2.text()!="":
self.start_detect_signal.emit(self.lineEdit.text(), self.lineEdit_2.text()) self.start_detect_signal.emit(self.lineEdit.text(), self.lineEdit_2.text())
else:
self.prompt_dialog.show_with_msg("检测路径不能为空")
if __name__ == '__main__': if __name__ == '__main__':
app = QApplication(sys.argv) app = QApplication(sys.argv)
......
...@@ -66,6 +66,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -66,6 +66,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# 提示框 # 提示框
self.prompt_dialog = Prompt_Dialog() self.prompt_dialog = Prompt_Dialog()
self.continue_detect_prompt_dialog = Prompt_Dialog(self.continue_detect)
# 操作框 # 操作框
self.operation_dialog = Operation_Dialog(self) self.operation_dialog = Operation_Dialog(self)
...@@ -137,6 +138,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -137,6 +138,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.action_operate.setEnabled(False) self.action_operate.setEnabled(False)
self.action_insert_aside_from_now.triggered.connect(self.insert_aside_from_now_slot) self.action_insert_aside_from_now.triggered.connect(self.insert_aside_from_now_slot)
self.action_insert_aside_from_now.setEnabled(False) self.action_insert_aside_from_now.setEnabled(False)
self.insert_aside_from_now_btn.clicked.connect(self.insert_aside_from_now_slot)
""" """
视频相关信息 视频相关信息
...@@ -251,6 +253,9 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -251,6 +253,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# 更新工程信息 # 更新工程信息
self.projectContext.Init(project_path) self.projectContext.Init(project_path)
# 如果嗅探到旁白检测未完成,则询问是否继续
if self.projectContext.detected == True and self.projectContext.nd_process < 1:
self.continue_detect_prompt_dialog.show_with_msg("您的上次任务未完成,是否继续检测?")
self.update_ui() self.update_ui()
# 重写关闭Mmainwindow窗口 # 重写关闭Mmainwindow窗口
...@@ -314,7 +319,11 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -314,7 +319,11 @@ class MainWindow(QMainWindow, Ui_MainWindow):
QApplication.exit(MainWindow.EXIT_CODE_REBOOT) QApplication.exit(MainWindow.EXIT_CODE_REBOOT)
else: else:
# 直接在当前界面刷新 # 直接在当前界面刷新
project_name = os.path.basename(project_path)
self.setWindowTitle(f"无障碍电影制作软件(当前工程为:{project_name})")
self.projectContext.Init(project_path) self.projectContext.Init(project_path)
if self.projectContext.detected == True and self.projectContext.nd_process < 1:
self.continue_detect_prompt_dialog.show_with_msg("您的上次任务未完成,是否继续检测?")
self.update_ui() self.update_ui()
...@@ -367,6 +376,9 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -367,6 +376,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.playVideo() # 播放视频 self.playVideo() # 播放视频
self.action_insert_aside_from_now.setEnabled(True) self.action_insert_aside_from_now.setEnabled(True)
def continue_detect(self):
print(f"继续检测,video_path={self.projectContext.video_path}, book_path={self.projectContext.excel_path}")
self.start_detect(self.projectContext.video_path, self.projectContext.excel_path)
def start_detect(self, video_path, book_path): def start_detect(self, video_path, book_path):
"""检测旁白 """检测旁白
...@@ -376,6 +388,10 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -376,6 +388,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
函数运行过程中实时监测函数的运行情况,如果发现函数报错,则中断线程,弹出报错窗口,否则等待函数正常结束,并更新UI中的组件。 函数运行过程中实时监测函数的运行情况,如果发现函数报错,则中断线程,弹出报错窗口,否则等待函数正常结束,并更新UI中的组件。
""" """
# 检查是否已有线程在运行旁白检测
if self.threads != []:
self.show_warning_msg_box("请勿重复检测!")
return
# 检测各种输入的合理性 # 检测各种输入的合理性
if len(video_path) == 0: if len(video_path) == 0:
self.show_warning_msg_box("请输入视频文件路径") self.show_warning_msg_box("请输入视频文件路径")
...@@ -758,8 +774,8 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -758,8 +774,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# 只有Content页的字幕列和 Aside页的字幕列 可编辑 # 只有Content页的字幕列和 Aside页的字幕列 可编辑
def checkIfTableItemCanChange(self, table: QTableWidget, i: int, j: int): def checkIfTableItemCanChange(self, table: QTableWidget, i: int, j: int):
if table.objectName() == self.all_tableWidget.objectName() and j in constant.Content.ActivateColumns: # if table.objectName() == self.all_tableWidget.objectName() and j in constant.Content.ActivateColumns:
return True # return True
if table.objectName() == self.pb_tableWidget.objectName() and j in constant.Aside.ActivateColumns: if table.objectName() == self.pb_tableWidget.objectName() and j in constant.Aside.ActivateColumns:
return True return True
return False return False
...@@ -1043,6 +1059,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -1043,6 +1059,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.label_2.setText(cur_time + "/" + duration_time) self.label_2.setText(cur_time + "/" + duration_time)
# video_timer触发timeout信号的时候,会执行该函数,修改高亮行
def change_table_select_rows(self): def change_table_select_rows(self):
cur_time = self.player.position() / 1000 cur_time = self.player.position() / 1000
if self.curTab == 0: if self.curTab == 0:
...@@ -1051,18 +1068,18 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -1051,18 +1068,18 @@ class MainWindow(QMainWindow, Ui_MainWindow):
if utils.trans_to_seconds(all_elements[i].st_time_sec) <= cur_time: if utils.trans_to_seconds(all_elements[i].st_time_sec) <= cur_time:
self.all_tableWidget.selectRow(i) self.all_tableWidget.selectRow(i)
break break
elif self.curTab == 1: # elif self.curTab == 1:
subtitle_list = self.projectContext.subtitle_list # subtitle_list = self.projectContext.subtitle_list
for i in range(len(subtitle_list) - 1, -1, -1): # for i in range(len(subtitle_list) - 1, -1, -1):
if utils.trans_to_seconds(subtitle_list[i].st_time_sec) <= cur_time: # if utils.trans_to_seconds(subtitle_list[i].st_time_sec) <= cur_time:
self.zm_tableWidget.selectRow(i) # self.zm_tableWidget.selectRow(i)
break # break
else: # else:
aside_list = self.projectContext.aside_list # aside_list = self.projectContext.aside_list
for i in range(len(aside_list) - 1, -1, -1): # for i in range(len(aside_list) - 1, -1, -1):
if utils.trans_to_seconds(aside_list[i].st_time_sec) <= cur_time: # if utils.trans_to_seconds(aside_list[i].st_time_sec) <= cur_time:
self.pb_tableWidget.selectRow(i) # self.pb_tableWidget.selectRow(i)
break # break
def player_change_slot(self, new_duration: int): def player_change_slot(self, new_duration: int):
# 在【打开工程】操作的时候,设置sld_video的最大值为电影秒数。 # 在【打开工程】操作的时候,设置sld_video的最大值为电影秒数。
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>924</width> <width>944</width>
<height>763</height> <height>712</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
...@@ -23,13 +23,13 @@ ...@@ -23,13 +23,13 @@
}</string> }</string>
</property> </property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout" stretch="8">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout" stretch="5,1"> <layout class="QVBoxLayout" name="verticalLayout" stretch="5,2">
<item> <item>
<layout class="QHBoxLayout" name="shuiping" stretch="3,5"> <layout class="QHBoxLayout" name="shuiping" stretch="3,5">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="8,1,1"> <layout class="QVBoxLayout" name="verticalLayout_2" stretch="8,1,0">
<item> <item>
<widget class="myVideoWidget" name="wgt_video" native="true"> <widget class="myVideoWidget" name="wgt_video" native="true">
<property name="minimumSize"> <property name="minimumSize">
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_5" stretch="2,1,2,1,1,1"> <layout class="QHBoxLayout" name="horizontalLayout_5" stretch="2,1,0,1,1,1">
<item> <item>
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="maximumSize"> <property name="maximumSize">
...@@ -324,18 +324,11 @@ ...@@ -324,18 +324,11 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_6" stretch="0,0"> <layout class="QHBoxLayout" name="horizontalLayout_6" stretch="0">
<item> <item>
<widget class="QPushButton" name="pickStart"> <widget class="QPushButton" name="insert_aside_from_now_btn">
<property name="text"> <property name="text">
<string>选择开始时间</string> <string>当前位置插入旁白</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pickEnd">
<property name="text">
<string>选择终止时间</string>
</property> </property>
</widget> </widget>
</item> </item>
...@@ -420,7 +413,7 @@ ...@@ -420,7 +413,7 @@
</item> </item>
<item> <item>
<widget class="QWidget" name="verticalWidget_2" native="true"> <widget class="QWidget" name="verticalWidget_2" native="true">
<layout class="QVBoxLayout" name="chuizhi"> <layout class="QVBoxLayout" name="chuizhi" stretch="1,2,1,2">
<item> <item>
<widget class="QLabel" name="zm_label"> <widget class="QLabel" name="zm_label">
<property name="sizePolicy"> <property name="sizePolicy">
...@@ -505,19 +498,6 @@ ...@@ -505,19 +498,6 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<widget class="QLabel" name="pb_label"> <widget class="QLabel" name="pb_label">
<property name="sizePolicy"> <property name="sizePolicy">
...@@ -584,8 +564,8 @@ ...@@ -584,8 +564,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>924</width> <width>944</width>
<height>22</height> <height>26</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menu"> <widget class="QMenu" name="menu">
...@@ -617,8 +597,8 @@ ...@@ -617,8 +597,8 @@
<property name="title"> <property name="title">
<string>功能按键</string> <string>功能按键</string>
</property> </property>
<addaction name="actiona_3"/> <addaction name="action_3"/>
<addaction name="actiona_4"/> <addaction name="action_4"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="action_refresh_tab"/> <addaction name="action_refresh_tab"/>
</widget> </widget>
...@@ -662,12 +642,12 @@ ...@@ -662,12 +642,12 @@
<string>重做</string> <string>重做</string>
</property> </property>
</action> </action>
<action name="actiona_3"> <action name="action_3">
<property name="text"> <property name="text">
<string>旁白区间检测</string> <string>旁白区间检测</string>
</property> </property>
</action> </action>
<action name="actiona_4"> <action name="action_4">
<property name="text"> <property name="text">
<string>旁白音频合成</string> <string>旁白音频合成</string>
</property> </property>
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'd:\AddCaption\cur_version\accessibility_movie_2\main_window_modified.ui' # Form implementation generated from reading ui file 'main_window.ui'
# #
# Created by: PyQt5 UI code generator 5.15.4 # Created by: PyQt5 UI code generator 5.12
# #
# WARNING: Any manual changes made to this file will be lost when pyuic5 is # WARNING! All changes made in this file will be lost!
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
from myVideoWidget import myVideoWidget
from myvideoslider import myVideoSlider
from mywidgetcontents import myWidgetContents
class Ui_MainWindow(object): class Ui_MainWindow(object):
def setupUi(self, MainWindow): def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow") MainWindow.setObjectName("MainWindow")
MainWindow.resize(939, 763) MainWindow.resize(944, 712)
MainWindow.setStyleSheet("QMainWindow:{\n" MainWindow.setStyleSheet("QMainWindow:{\n"
" border: 2px groove gray;\n" " border: 2px groove gray;\n"
" border-radius: 25px;\n" " border-radius: 25px;\n"
...@@ -38,15 +33,20 @@ class Ui_MainWindow(object): ...@@ -38,15 +33,20 @@ class Ui_MainWindow(object):
self.wgt_video = myVideoWidget(self.centralwidget) self.wgt_video = myVideoWidget(self.centralwidget)
self.wgt_video.setMinimumSize(QtCore.QSize(410, 200)) self.wgt_video.setMinimumSize(QtCore.QSize(410, 200))
self.wgt_video.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.wgt_video.setMaximumSize(QtCore.QSize(16777215, 16777215))
self.wgt_video.setStyleSheet("background-color: #000")
palette = QtGui.QPalette() palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern) brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern) brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern) brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
...@@ -54,12 +54,16 @@ class Ui_MainWindow(object): ...@@ -54,12 +54,16 @@ class Ui_MainWindow(object):
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern) brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern) brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
self.wgt_video.setPalette(palette) self.wgt_video.setPalette(palette)
self.wgt_video.setAutoFillBackground(True) self.wgt_video.setAutoFillBackground(False)
self.wgt_video.setStyleSheet("background-color: #000")
self.wgt_video.setObjectName("wgt_video") self.wgt_video.setObjectName("wgt_video")
self.verticalLayout_2.addWidget(self.wgt_video) self.verticalLayout_2.addWidget(self.wgt_video)
self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
...@@ -71,39 +75,39 @@ class Ui_MainWindow(object): ...@@ -71,39 +75,39 @@ class Ui_MainWindow(object):
spacerItem = QtWidgets.QSpacerItem(25, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) spacerItem = QtWidgets.QSpacerItem(25, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_5.addItem(spacerItem) self.horizontalLayout_5.addItem(spacerItem)
self.btn_play = QtWidgets.QPushButton(self.centralwidget) self.btn_play = QtWidgets.QPushButton(self.centralwidget)
# sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
# sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
# sizePolicy.setVerticalStretch(0) sizePolicy.setVerticalStretch(0)
# sizePolicy.setHeightForWidth(self.btn_play.sizePolicy().hasHeightForWidth()) sizePolicy.setHeightForWidth(self.btn_play.sizePolicy().hasHeightForWidth())
# self.btn_play.setSizePolicy(sizePolicy) self.btn_play.setSizePolicy(sizePolicy)
self.btn_play.setMinimumSize(QtCore.QSize(30, 30)) self.btn_play.setMinimumSize(QtCore.QSize(30, 30))
self.btn_play.setMaximumSize(QtCore.QSize(30, 30)) self.btn_play.setMaximumSize(QtCore.QSize(30, 30))
self.btn_play.setStyleSheet("QPushButton {\n" self.btn_play.setStyleSheet("QPushButton {\n"
" color: #fff;\n" " color: #fff;\n"
" border: 2px groove gray;\n" " border: 2px groove gray;\n"
" border-radius: 15px;\n" " border-radius: 15px;\n"
" border-style: outset;\n" " border-style: outset;\n"
" background: qradialgradient(\n" " background: qradialgradient(\n"
" cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,\n" " cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,\n"
" radius: 1.35, stop: 0 #fff, stop: 1 #888\n" " radius: 1.35, stop: 0 #fff, stop: 1 #888\n"
" );\n" " );\n"
" padding: 5px;\n" " padding: 5px;\n"
" }\n" " }\n"
"\n" "\n"
"QPushButton:hover {\n" " QPushButton:hover {\n"
" background: qradialgradient(\n" " background: qradialgradient(\n"
" cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,\n" " cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,\n"
" radius: 1.35, stop: 0 #fff, stop: 1 #bbb\n" " radius: 1.35, stop: 0 #fff, stop: 1 #bbb\n"
" );\n" " );\n"
" }\n" " }\n"
"\n" "\n"
"QPushButton:pressed {\n" " QPushButton:pressed {\n"
" border-style: inset;\n" " border-style: inset;\n"
" background: qradialgradient(\n" " background: qradialgradient(\n"
" cx: 0.4, cy: -0.1, fx: 0.4, fy: -0.1,\n" " cx: 0.4, cy: -0.1, fx: 0.4, fy: -0.1,\n"
" radius: 1.35, stop: 0 #fff, stop: 1 #ddd\n" " radius: 1.35, stop: 0 #fff, stop: 1 #ddd\n"
" );\n" " );\n"
" }") " }")
self.btn_play.setText("") self.btn_play.setText("")
icon = QtGui.QIcon() icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap("images/播放.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) icon.addPixmap(QtGui.QPixmap("images/播放.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
...@@ -117,53 +121,51 @@ class Ui_MainWindow(object): ...@@ -117,53 +121,51 @@ class Ui_MainWindow(object):
self.sld_audio = QtWidgets.QSlider(self.centralwidget) self.sld_audio = QtWidgets.QSlider(self.centralwidget)
self.sld_audio.setMinimumSize(QtCore.QSize(0, 24)) self.sld_audio.setMinimumSize(QtCore.QSize(0, 24))
self.sld_audio.setMaximumSize(QtCore.QSize(80, 24)) self.sld_audio.setMaximumSize(QtCore.QSize(80, 24))
self.sld_audio.setSingleStep(5)
self.sld_audio.setProperty("value", 100)
self.sld_audio.setStyleSheet("QSlider:horizontal {\n" self.sld_audio.setStyleSheet("QSlider:horizontal {\n"
" min-height: 24px;\n" " min-height: 24px;\n"
" max-height: 24px;\n" " max-height: 24px;\n"
"}\n" " }\n"
"\n" "\n"
"QSlider:vertical {\n" " QSlider:vertical {\n"
" min-width: 24px;\n" " min-width: 24px;\n"
" max-width: 24px;\n" " max-width: 24px;\n"
"}\n" " }\n"
"\n" "\n"
"QSlider::groove:horizontal {\n" " QSlider::groove:horizontal {\n"
" height: 4px;\n" " height: 4px;\n"
" background: #393939;\n" " background: #393939;\n"
" margin: 0 12px;\n" " margin: 0 12px;\n"
"}\n" " }\n"
"\n" "\n"
"QSlider::groove:vertical {\n" " QSlider::groove:vertical {\n"
" width: 4px;\n" " width: 4px;\n"
" background: #393939;\n" " background: #393939;\n"
" margin: 12px 0;\n" " margin: 12px 0;\n"
" border-radius: 24px;\n" " border-radius: 24px;\n"
"}\n" " }\n"
"\n" "\n"
"QSlider::handle:horizontal {\n" " QSlider::handle:horizontal {\n"
" image: url(images/slider.svg);\n" " image: url(images/slider.svg);\n"
" width: 12px;\n" " width: 12px;\n"
" height: 12px;\n" " height: 12px;\n"
" margin: -24px -12px;\n" " margin: -24px -12px;\n"
"}\n" " }\n"
"\n" "\n"
"QSlider::handle:vertical {\n" " QSlider::handle:vertical {\n"
" image: url(images/slider.svg);\n" " image: url(images/slider.svg);\n"
" border-radius: 24px;\n" " border-radius: 24px;\n"
" width: 12px;\n" " width: 12px;\n"
" height: 12px;\n" " height: 12px;\n"
" margin: -12px -24px;\n" " margin: -12px -24px;\n"
"}\n" " }\n"
"\n" "\n"
"QSlider::add-page {\n" " QSlider::add-page {\n"
"background: #232629;\n" " background: #232629;\n"
"}\n" " }\n"
"\n" "\n"
"QSlider::sub-page {\n" " QSlider::sub-page {\n"
"background: #ffd740;\n" " background: #ffd740;\n"
"}") " }")
self.sld_audio.setOrientation(QtCore.Qt.Horizontal) self.sld_audio.setOrientation(QtCore.Qt.Horizontal)
self.sld_audio.setObjectName("sld_audio") self.sld_audio.setObjectName("sld_audio")
self.horizontalLayout_5.addWidget(self.sld_audio) self.horizontalLayout_5.addWidget(self.sld_audio)
...@@ -172,23 +174,18 @@ class Ui_MainWindow(object): ...@@ -172,23 +174,18 @@ class Ui_MainWindow(object):
self.horizontalLayout_5.addWidget(self.lab_audio) self.horizontalLayout_5.addWidget(self.lab_audio)
self.horizontalLayout_5.setStretch(0, 2) self.horizontalLayout_5.setStretch(0, 2)
self.horizontalLayout_5.setStretch(1, 1) self.horizontalLayout_5.setStretch(1, 1)
self.horizontalLayout_5.setStretch(2, 2)
self.horizontalLayout_5.setStretch(3, 1) self.horizontalLayout_5.setStretch(3, 1)
self.horizontalLayout_5.setStretch(4, 1) self.horizontalLayout_5.setStretch(4, 1)
self.horizontalLayout_5.setStretch(5, 1) self.horizontalLayout_5.setStretch(5, 1)
self.verticalLayout_2.addLayout(self.horizontalLayout_5) self.verticalLayout_2.addLayout(self.horizontalLayout_5)
self.horizontalLayout_6 = QtWidgets.QHBoxLayout() self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
self.horizontalLayout_6.setObjectName("horizontalLayout_6") self.horizontalLayout_6.setObjectName("horizontalLayout_6")
self.pickStart = QtWidgets.QPushButton(self.centralwidget) self.insert_aside_from_now_btn = QtWidgets.QPushButton(self.centralwidget)
self.pickStart.setObjectName("pickStart") self.insert_aside_from_now_btn.setObjectName("insert_aside_from_now_btn")
self.horizontalLayout_6.addWidget(self.pickStart) self.horizontalLayout_6.addWidget(self.insert_aside_from_now_btn)
self.pickEnd = QtWidgets.QPushButton(self.centralwidget)
self.pickEnd.setObjectName("pickEnd")
self.horizontalLayout_6.addWidget(self.pickEnd)
self.verticalLayout_2.addLayout(self.horizontalLayout_6) self.verticalLayout_2.addLayout(self.horizontalLayout_6)
self.verticalLayout_2.setStretch(0, 8) self.verticalLayout_2.setStretch(0, 8)
self.verticalLayout_2.setStretch(1, 1) self.verticalLayout_2.setStretch(1, 1)
self.verticalLayout_2.setStretch(2, 1)
self.shuiping.addLayout(self.verticalLayout_2) self.shuiping.addLayout(self.verticalLayout_2)
self.tabWidget = QtWidgets.QTabWidget(self.centralwidget) self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)
self.tabWidget.setEnabled(True) self.tabWidget.setEnabled(True)
...@@ -256,10 +253,10 @@ class Ui_MainWindow(object): ...@@ -256,10 +253,10 @@ class Ui_MainWindow(object):
self.scrollArea.setWidgetResizable(False) self.scrollArea.setWidgetResizable(False)
self.scrollArea.setObjectName("scrollArea") self.scrollArea.setObjectName("scrollArea")
self.scrollAreaWidgetContents = myWidgetContents() self.scrollAreaWidgetContents = myWidgetContents()
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 800, 40)) self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 827, 64))
self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
self.sld_video = myVideoSlider(self.scrollAreaWidgetContents) self.sld_video = myVideoSlider(self.scrollAreaWidgetContents)
self.sld_video.setGeometry(QtCore.QRect(10, 20, 790, 30)) self.sld_video.setGeometry(QtCore.QRect(10, 30, 811, 20))
self.sld_video.setMinimumSize(QtCore.QSize(410, 0)) self.sld_video.setMinimumSize(QtCore.QSize(410, 0))
self.sld_video.setMaximumSize(QtCore.QSize(16777215, 20)) self.sld_video.setMaximumSize(QtCore.QSize(16777215, 20))
self.sld_video.setMaximum(100) self.sld_video.setMaximum(100)
...@@ -276,8 +273,6 @@ class Ui_MainWindow(object): ...@@ -276,8 +273,6 @@ class Ui_MainWindow(object):
self.zm_slider_layout.setStretch(0, 15) self.zm_slider_layout.setStretch(0, 15)
self.zm_slider_layout.setStretch(1, 1) self.zm_slider_layout.setStretch(1, 1)
self.chuizhi.addLayout(self.zm_slider_layout) self.chuizhi.addLayout(self.zm_slider_layout)
spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.chuizhi.addItem(spacerItem2)
self.pb_label = QtWidgets.QLabel(self.verticalWidget_2) self.pb_label = QtWidgets.QLabel(self.verticalWidget_2)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
...@@ -306,13 +301,18 @@ class Ui_MainWindow(object): ...@@ -306,13 +301,18 @@ class Ui_MainWindow(object):
self.kd_slider.setObjectName("kd_slider") self.kd_slider.setObjectName("kd_slider")
self.kd_slider_layout.addWidget(self.kd_slider) self.kd_slider_layout.addWidget(self.kd_slider)
self.chuizhi.addLayout(self.kd_slider_layout) self.chuizhi.addLayout(self.kd_slider_layout)
self.chuizhi.setStretch(0, 1)
self.chuizhi.setStretch(1, 2)
self.chuizhi.setStretch(2, 1)
self.chuizhi.setStretch(3, 2)
self.verticalLayout.addWidget(self.verticalWidget_2) self.verticalLayout.addWidget(self.verticalWidget_2)
self.verticalLayout.setStretch(0, 5) self.verticalLayout.setStretch(0, 5)
self.verticalLayout.setStretch(1, 1) self.verticalLayout.setStretch(1, 2)
self.horizontalLayout.addLayout(self.verticalLayout) self.horizontalLayout.addLayout(self.verticalLayout)
self.horizontalLayout.setStretch(0, 8)
MainWindow.setCentralWidget(self.centralwidget) MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 939, 26)) self.menubar.setGeometry(QtCore.QRect(0, 0, 944, 26))
self.menubar.setObjectName("menubar") self.menubar.setObjectName("menubar")
self.menu = QtWidgets.QMenu(self.menubar) self.menu = QtWidgets.QMenu(self.menubar)
self.menu.setObjectName("menu") self.menu.setObjectName("menu")
...@@ -344,8 +344,8 @@ class Ui_MainWindow(object): ...@@ -344,8 +344,8 @@ class Ui_MainWindow(object):
self.action_4.setObjectName("action_4") self.action_4.setObjectName("action_4")
self.action_view_history = QtWidgets.QAction(MainWindow) self.action_view_history = QtWidgets.QAction(MainWindow)
self.action_view_history.setObjectName("action_view_history") self.action_view_history.setObjectName("action_view_history")
# self.action_refresh_tab = QtWidgets.QAction(MainWindow) self.action_refresh_tab = QtWidgets.QAction(MainWindow)
# self.action_refresh_tab.setObjectName("action_refresh_tab") self.action_refresh_tab.setObjectName("action_refresh_tab")
self.action_operate = QtWidgets.QAction(MainWindow) self.action_operate = QtWidgets.QAction(MainWindow)
self.action_operate.setObjectName("action_operate") self.action_operate.setObjectName("action_operate")
self.action_export = QtWidgets.QAction(MainWindow) self.action_export = QtWidgets.QAction(MainWindow)
...@@ -366,15 +366,15 @@ class Ui_MainWindow(object): ...@@ -366,15 +366,15 @@ class Ui_MainWindow(object):
self.menu.addAction(self.setting) self.menu.addAction(self.setting)
self.menu_2.addAction(self.action_undo) self.menu_2.addAction(self.action_undo)
self.menu_2.addAction(self.action_redo) self.menu_2.addAction(self.action_redo)
# self.menu_2.addAction(self.action_view_history) self.menu_2.addAction(self.action_view_history)
self.menu_2.addSeparator() self.menu_2.addSeparator()
self.menu_2.addAction(self.action_insert_aside_from_now) self.menu_2.addAction(self.action_insert_aside_from_now)
self.menu_2.addAction(self.action_operate) self.menu_2.addAction(self.action_operate)
# self.menu_2.addAction(self.action_insert_subtitle_from_now) self.menu_2.addAction(self.action_insert_subtitle_from_now)
self.menu_3.addAction(self.action_3) self.menu_3.addAction(self.action_3)
self.menu_3.addAction(self.action_4) self.menu_3.addAction(self.action_4)
# self.menu_3.addSeparator() self.menu_3.addSeparator()
# self.menu_3.addAction(self.action_refresh_tab) self.menu_3.addAction(self.action_refresh_tab)
self.menubar.addAction(self.menu.menuAction()) self.menubar.addAction(self.menu.menuAction())
self.menubar.addAction(self.menu_2.menuAction()) self.menubar.addAction(self.menu_2.menuAction())
self.menubar.addAction(self.menu_3.menuAction()) self.menubar.addAction(self.menu_3.menuAction())
...@@ -388,8 +388,7 @@ class Ui_MainWindow(object): ...@@ -388,8 +388,7 @@ class Ui_MainWindow(object):
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.label_2.setText(_translate("MainWindow", "00:00/00:00")) self.label_2.setText(_translate("MainWindow", "00:00/00:00"))
self.lab_audio.setText(_translate("MainWindow", "音量:100%")) self.lab_audio.setText(_translate("MainWindow", "音量:100%"))
self.pickStart.setText(_translate("MainWindow", "选择开始时间")) self.insert_aside_from_now_btn.setText(_translate("MainWindow", "当前位置插入旁白"))
self.pickEnd.setText(_translate("MainWindow", "选择终止时间"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.all_tab), _translate("MainWindow", "字幕旁白")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.all_tab), _translate("MainWindow", "字幕旁白"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.zm_tab), _translate("MainWindow", "字幕")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.zm_tab), _translate("MainWindow", "字幕"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.pb_tab), _translate("MainWindow", "旁白")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.pb_tab), _translate("MainWindow", "旁白"))
...@@ -399,20 +398,24 @@ class Ui_MainWindow(object): ...@@ -399,20 +398,24 @@ class Ui_MainWindow(object):
self.menu.setTitle(_translate("MainWindow", "文件")) self.menu.setTitle(_translate("MainWindow", "文件"))
self.menu_2.setTitle(_translate("MainWindow", "编辑")) self.menu_2.setTitle(_translate("MainWindow", "编辑"))
self.menu_3.setTitle(_translate("MainWindow", "功能按键")) self.menu_3.setTitle(_translate("MainWindow", "功能按键"))
self.action_create.setText(_translate("MainWindow", "新建")) self.setting.setText(_translate("MainWindow", "设置"))
self.action_open_project.setText(_translate("MainWindow", "打开")) self.action_open_project.setText(_translate("MainWindow", "打开"))
self.import_movie.setText(_translate("MainWindow", "视频导入")) self.import_movie.setText(_translate("MainWindow", "视频导入"))
self.actions.setText(_translate("MainWindow", "内容导出")) self.actions.setText(_translate("MainWindow", "内容导出"))
self.action_save.setText(_translate("MainWindow", "保存并备份")) self.action_save.setText(_translate("MainWindow", "保存并备份"))
self.setting.setText(_translate("MainWindow", "设置"))
self.action_undo.setText(_translate("MainWindow", "撤销")) self.action_undo.setText(_translate("MainWindow", "撤销"))
self.action_redo.setText(_translate("MainWindow", "重做")) self.action_redo.setText(_translate("MainWindow", "重做"))
self.action_insert_aside_from_now.setText(_translate("MainWindow", "当前位置插入旁白"))
self.action_operate.setText(_translate("MainWindow", "操作表格"))
self.action_3.setText(_translate("MainWindow", "旁白区间检测")) self.action_3.setText(_translate("MainWindow", "旁白区间检测"))
self.action_4.setText(_translate("MainWindow", "旁白音频合成")) self.action_4.setText(_translate("MainWindow", "旁白音频合成"))
self.action_view_history.setText(_translate("MainWindow", "----")) self.action_view_history.setText(_translate("MainWindow", "----"))
# self.action_refresh_tab.setText(_translate("MainWindow", "刷新且保存表格")) self.action_refresh_tab.setText(_translate("MainWindow", "刷新且保存表格"))
self.action_operate.setText(_translate("MainWindow", "操作表格"))
self.action_export.setText(_translate("MainWindow", "导出")) self.action_export.setText(_translate("MainWindow", "导出"))
# self.action_insert_subtitle_from_now.setText(_translate("MainWindow", "当前位置插入字幕")) self.action_insert_aside_from_now.setText(_translate("MainWindow", "当前位置插入旁白"))
self.action_insert_subtitle_from_now.setText(_translate("MainWindow", "当前位置插入字幕"))
self.action_create.setText(_translate("MainWindow", "新建"))
from myVideoWidget import myVideoWidget
from myvideoslider import myVideoSlider
from mywidgetcontents import myWidgetContents
...@@ -160,6 +160,8 @@ class ProjectContext: ...@@ -160,6 +160,8 @@ class ProjectContext:
self.project_base_dir = project_dir self.project_base_dir = project_dir
self.load_conf() self.load_conf()
def load_conf(self): def load_conf(self):
this_conf_path = os.path.join(self.project_base_dir, 'conf.ini') if self.project_base_dir is not None else self.conf_path this_conf_path = os.path.join(self.project_base_dir, 'conf.ini') if self.project_base_dir is not None else self.conf_path
# 如果当前工程里还没有对应的配置文件,那么选择使用全局的配置文件进行初始化,否则就使用当前工程的配置文件 # 如果当前工程里还没有对应的配置文件,那么选择使用全局的配置文件进行初始化,否则就使用当前工程的配置文件
......
...@@ -20,14 +20,15 @@ class Prompt_Dialog(QDialog, Ui_Dialog): ...@@ -20,14 +20,15 @@ class Prompt_Dialog(QDialog, Ui_Dialog):
#开始检测信号,传参分别是movie路径和输出表格路径 #开始检测信号,传参分别是movie路径和输出表格路径
show_dialog_signal = pyqtSignal(str) show_dialog_signal = pyqtSignal(str)
def __init__(self): def __init__(self, ok_func = None):
super(Prompt_Dialog, self).__init__() super(Prompt_Dialog, self).__init__()
self.setupUi(self) self.setupUi(self)
self.setWindowTitle("提示框") self.setWindowTitle("提示框")
self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setText("确认") self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setText("确认")
self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setText("取消") self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setText("取消")
self.show_dialog_signal.connect(self.show_with_msg) self.show_dialog_signal.connect(self.show_with_msg)
if ok_func != None:
self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).clicked.connect(ok_func)
def show_with_msg(self, msg): def show_with_msg(self, msg):
self.label.setText(msg) self.label.setText(msg)
self.show() self.show()
\ No newline at end of file
...@@ -34,7 +34,11 @@ if __name__ == '__main__': ...@@ -34,7 +34,11 @@ if __name__ == '__main__':
app = QApplication(sys.argv) app = QApplication(sys.argv)
app.setWindowIcon(QIcon("./images/eagle_2.ico")) app.setWindowIcon(QIcon("./images/eagle_2.ico"))
mainWindow = MainWindow(project_path) mainWindow = MainWindow(project_path)
mainWindow.setWindowTitle("无障碍电影制作软件") if project_path == None or project_path == "":
mainWindow.setWindowTitle(f"无障碍电影制作软件(请打开或新建工程)")
else:
project_name = os.path.basename(project_path)
mainWindow.setWindowTitle(f"无障碍电影制作软件(当前工程为:{project_name})")
mainWindow.renew_signal.connect(change_project_path) mainWindow.renew_signal.connect(change_project_path)
apply_stylesheet(app, theme='dark_amber.xml') apply_stylesheet(app, theme='dark_amber.xml')
# app.setStyleSheet(qdarkstyle.load_stylesheet(qt_api=os.environ['PYQTGRAPH_QT_LIB'])) # app.setStyleSheet(qdarkstyle.load_stylesheet(qt_api=os.environ['PYQTGRAPH_QT_LIB']))
......
...@@ -51,9 +51,9 @@ class SynthesisProcessor(QWidget): ...@@ -51,9 +51,9 @@ class SynthesisProcessor(QWidget):
if len(audio_dir) == 0: if len(audio_dir) == 0:
self.show_warning_signal.emit("请选择音频存放路径") self.show_warning_signal.emit("请选择音频存放路径")
return return
elif not os.path.exists(audio_dir): # elif not os.path.exists(audio_dir):
self.show_warning_signal.emit("当前音频存放路径有误,请检查一遍") # self.show_warning_signal.emit("当前音频存放路径有误,请检查一遍")
return # return
if len(caption_path) == 0: if len(caption_path) == 0:
self.show_warning_signal.emit("请选择字幕文件存放路径") self.show_warning_signal.emit("请选择字幕文件存放路径")
return return
...@@ -76,7 +76,7 @@ class SynthesisProcessor(QWidget): ...@@ -76,7 +76,7 @@ class SynthesisProcessor(QWidget):
self.threads = threads self.threads = threads
from speech_synthesis import ss_and_export from speech_synthesis import ss_and_export
t = RunThread(funcName=ss_and_export, t = RunThread(funcName=ss_and_export,
args=(video_path, sheet_path, audio_dir + "output/", speed, args=(video_path, sheet_path, audio_dir, speed,
caption_path, speaker_name, state), caption_path, speaker_name, state),
name="ssAndExport") name="ssAndExport")
t.setDaemon(True) t.setDaemon(True)
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>924</width>
<height>763</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<property name="styleSheet">
<string notr="true">QMainWindow:{
border: 2px groove gray;
border-radius: 25px;
border-style: outset;
background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0 rgba(0, 0, 0, 0), stop:0.52 rgba(0, 0, 0, 0), stop:0.565 rgba(82, 121, 76, 33), stop:0.65 rgba(159, 235, 148, 64), stop:0.721925 rgba(255, 238, 150, 129), stop:0.77 rgba(255, 128, 128, 204), stop:0.89 rgba(191, 128, 255, 64), stop:1 rgba(0, 0, 0, 0));
padding: 5px;
}</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout" stretch="5,1">
<item>
<layout class="QHBoxLayout" name="shuiping" stretch="3,5">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="8,1,1">
<item>
<widget class="myVideoWidget" name="wgt_video" native="true">
<property name="minimumSize">
<size>
<width>410</width>
<height>200</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: #000</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5" stretch="2,1,2,1,1,1">
<item>
<widget class="QLabel" name="label_2">
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>00:00/00:00</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>25</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btn_play">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
color: #fff;
border: 2px groove gray;
border-radius: 15px;
border-style: outset;
background: qradialgradient(
cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,
radius: 1.35, stop: 0 #fff, stop: 1 #888
);
padding: 5px;
}
QPushButton:hover {
background: qradialgradient(
cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,
radius: 1.35, stop: 0 #fff, stop: 1 #bbb
);
}
QPushButton:pressed {
border-style: inset;
background: qradialgradient(
cx: 0.4, cy: -0.1, fx: 0.4, fy: -0.1,
radius: 1.35, stop: 0 #fff, stop: 1 #ddd
);
}</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>images/播放.svg</normaloff>
<selectedon>images/暂停.svg</selectedon>images/播放.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>30</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSlider" name="sld_audio">
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>24</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QSlider:horizontal {
min-height: 24px;
max-height: 24px;
}
QSlider:vertical {
min-width: 24px;
max-width: 24px;
}
QSlider::groove:horizontal {
height: 4px;
background: #393939;
margin: 0 12px;
}
QSlider::groove:vertical {
width: 4px;
background: #393939;
margin: 12px 0;
border-radius: 24px;
}
QSlider::handle:horizontal {
image: url(images/slider.svg);
width: 12px;
height: 12px;
margin: -24px -12px;
}
QSlider::handle:vertical {
image: url(images/slider.svg);
border-radius: 24px;
width: 12px;
height: 12px;
margin: -12px -24px;
}
QSlider::add-page {
background: #232629;
}
QSlider::sub-page {
background: #ffd740;
}</string>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lab_audio">
<property name="text">
<string>音量:100%</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6" stretch="5,5,1">
<item>
<widget class="QPushButton" name="pickStart">
<property name="text">
<string>选择开始时间</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pickEnd">
<property name="text">
<string>选择终止时间</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pickCancel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>取消</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="enabled">
<bool>true</bool>
</property>
<property name="contextMenuPolicy">
<enum>Qt::DefaultContextMenu</enum>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="tabPosition">
<enum>QTabWidget::North</enum>
</property>
<property name="tabShape">
<enum>QTabWidget::Triangular</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="elideMode">
<enum>Qt::ElideNone</enum>
</property>
<property name="movable">
<bool>false</bool>
</property>
<property name="tabBarAutoHide">
<bool>false</bool>
</property>
<widget class="QWidget" name="all_tab">
<property name="enabled">
<bool>true</bool>
</property>
<attribute name="title">
<string>字幕旁白</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QTableWidget" name="all_tableWidget"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="zm_tab">
<property name="enabled">
<bool>true</bool>
</property>
<attribute name="title">
<string>字幕</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QTableWidget" name="zm_tableWidget"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="pb_tab">
<attribute name="title">
<string>旁白</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QTableWidget" name="pb_tableWidget"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QWidget" name="verticalWidget_2" native="true">
<layout class="QVBoxLayout" name="chuizhi">
<item>
<widget class="QLabel" name="zm_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>时间轴</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="zm_slider_layout" stretch="15,1">
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="widgetResizable">
<bool>false</bool>
</property>
<widget class="myWidgetContents" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>827</width>
<height>64</height>
</rect>
</property>
<widget class="myVideoSlider" name="sld_video">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>811</width>
<height>20</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>410</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksAbove</enum>
</property>
<property name="tickInterval">
<number>1</number>
</property>
</widget>
</widget>
</widget>
</item>
<item>
<widget class="QLabel" name="lab_video">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>50</height>
</size>
</property>
<property name="text">
<string>00:00</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="pb_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>刻度</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="kd_slider_layout">
<item>
<widget class="QSlider" name="kd_slider">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="cursor">
<cursorShape>SizeHorCursor</cursorShape>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksAbove</enum>
</property>
<property name="tickInterval">
<number>1</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>924</width>
<height>26</height>
</rect>
</property>
<widget class="QMenu" name="menu">
<property name="title">
<string>文件</string>
</property>
<addaction name="action_create"/>
<addaction name="action_open_project"/>
<addaction name="separator"/>
<addaction name="import_movie"/>
<addaction name="action_export"/>
<addaction name="separator"/>
<addaction name="action_save"/>
<addaction name="setting"/>
</widget>
<widget class="QMenu" name="menu_2">
<property name="title">
<string>编辑</string>
</property>
<addaction name="action_undo"/>
<addaction name="action_redo"/>
<addaction name="action_view_history"/>
<addaction name="separator"/>
<addaction name="action_insert_aside_from_now"/>
<addaction name="action_operate"/>
<addaction name="action_insert_subtitle_from_now"/>
</widget>
<widget class="QMenu" name="menu_3">
<property name="title">
<string>功能按键</string>
</property>
<addaction name="action_3"/>
<addaction name="action_4"/>
<addaction name="separator"/>
<addaction name="action_refresh_tab"/>
</widget>
<addaction name="menu"/>
<addaction name="menu_2"/>
<addaction name="menu_3"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="setting">
<property name="text">
<string>设置</string>
</property>
</action>
<action name="action_open_project">
<property name="text">
<string>打开</string>
</property>
</action>
<action name="import_movie">
<property name="text">
<string>视频导入</string>
</property>
</action>
<action name="actions">
<property name="text">
<string>内容导出</string>
</property>
</action>
<action name="action_save">
<property name="text">
<string>保存并备份</string>
</property>
</action>
<action name="action_undo">
<property name="text">
<string>撤销</string>
</property>
</action>
<action name="action_redo">
<property name="text">
<string>重做</string>
</property>
</action>
<action name="action_3">
<property name="text">
<string>旁白区间检测</string>
</property>
</action>
<action name="action_4">
<property name="text">
<string>旁白音频合成</string>
</property>
</action>
<action name="action_view_history">
<property name="text">
<string>----</string>
</property>
</action>
<action name="action_refresh_tab">
<property name="text">
<string>刷新且保存表格</string>
</property>
</action>
<action name="action_operate">
<property name="text">
<string>操作表格</string>
</property>
</action>
<action name="action_export">
<property name="text">
<string>导出</string>
</property>
</action>
<action name="action_insert_aside_from_now">
<property name="text">
<string>当前位置插入旁白</string>
</property>
</action>
<action name="action_insert_subtitle_from_now">
<property name="text">
<string>当前位置插入字幕</string>
</property>
</action>
<action name="action_create">
<property name="text">
<string>新建</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>myVideoWidget</class>
<extends>QWidget</extends>
<header>myVideoWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>myVideoSlider</class>
<extends>QSlider</extends>
<header>myvideoslider.h</header>
</customwidget>
<customwidget>
<class>myWidgetContents</class>
<extends>QWidget</extends>
<header>mywidgetcontents.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment