Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
accessibility_movie_2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵心治
accessibility_movie_2
Commits
1d2f2b64
Commit
1d2f2b64
authored
Nov 15, 2022
by
xuanweiace
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat_1' of
http://gitlab.uiiai.com/xuanweiace/accessibility_movie_2
into feat_1
parents
24ee251e
ee4f5e81
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
552 additions
and
457 deletions
+552
-457
constant.py
constant.py
+19
-10
main_window.py
main_window.py
+106
-67
main_window.ui
main_window.ui
+10
-7
main_window_ui.py
main_window_ui.py
+7
-3
management.py
management.py
+23
-14
operation_dialog.py
operation_dialog.py
+34
-22
operation_dialog.ui
operation_dialog.ui
+161
-145
operation_dialog_ui.py
operation_dialog_ui.py
+190
-185
utils.py
utils.py
+2
-4
No files found.
constant.py
View file @
1d2f2b64
import
os
class
Content
:
StartTimeColumn
=
0
AsideColumnNumber
=
2
SpeedColumnNumber
=
3
ActivateColumns
=
[
2
,
3
]
ActivateColumns
=
[
2
,
3
]
# ColumnCount = 3
ObjectName
=
"all_tableWidget"
TimeFormatColumns
=
[
0
]
class
Aside
:
StartTimeColumn
=
0
AsideColumnNumber
=
3
SpeedColumnNumber
=
4
ActivateColumns
=
[
3
,
4
]
AsideColumnNumber
=
2
SpeedColumnNumber
=
3
ActivateColumns
=
[
2
,
3
]
ObjectName
=
"pb_tableWidget"
TimeFormatColumns
=
[
0
,
1
]
PreviewColumnNumber
=
5
TimeFormatColumns
=
[
0
]
PreviewColumnNumber
=
4
SpeedList
=
[
"1.00(4字/秒)"
,
"1.10(4.5字/秒)"
,
"1.25(5字/秒)"
,
"1.50(6字/秒)"
,
"1.75(7字/秒)"
,
"2.00(8字/秒)"
,
"2.50(10字/秒)"
]
class
Subtitle
:
ObjectName
=
"zm_tableWidget"
TimeFormatColumns
=
[
0
,
1
]
import
os
TimeFormatColumns
=
[
0
,
1
]
dir_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
class
Pathes
:
speaker_conf_path
=
os
.
path
.
join
(
dir_path
,
"speakers.json"
)
\ No newline at end of file
speaker_conf_path
=
os
.
path
.
join
(
dir_path
,
"speakers.json"
)
main_window.py
View file @
1d2f2b64
...
...
@@ -27,6 +27,7 @@ import time
import
constant
import
copy
import
sys
import
re
class
MainWindow
(
QMainWindow
,
Ui_MainWindow
):
...
...
@@ -66,6 +67,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# 提示框
self
.
prompt_dialog
=
Prompt_Dialog
()
self
.
prompt_dialog
.
setModal
(
True
)
self
.
continue_detect_prompt_dialog
=
Prompt_Dialog
(
self
.
continue_detect
)
# 操作框
...
...
@@ -170,6 +172,13 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
sld_audio
.
valueChanged
.
connect
(
self
.
volumeChange
)
# 控制声音播放
self
.
kd_slider
.
valueChanged
.
connect
(
self
.
scale_change_slot
)
"""
旁白音频预览相关信息
"""
self
.
audio_player
=
QMediaPlayer
()
# self.audio_player.stateChanged.connect(self.release_audio_file)
"""
表格相关信息
"""
...
...
@@ -199,9 +208,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
pb_tableHead
=
self
.
pb_tableWidget
.
horizontalHeader
()
pb_tableHead
.
setSectionResizeMode
(
0
,
QtWidgets
.
QHeaderView
.
ResizeToContents
)
pb_tableHead
.
setSectionResizeMode
(
1
,
QtWidgets
.
QHeaderView
.
ResizeToContents
)
pb_tableHead
.
setSectionResizeMode
(
2
,
QtWidgets
.
QHeaderView
.
ResizeToContents
)
pb_tableHead
.
setSectionResizeMode
(
3
,
QtWidgets
.
QHeaderView
.
Stretch
)
pb_tableHead
.
setSectionResizeMode
(
4
,
QtWidgets
.
QHeaderView
.
ResizeToContents
)
#
pb_tableHead.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents)
pb_tableHead
.
setSectionResizeMode
(
2
,
QtWidgets
.
QHeaderView
.
Stretch
)
pb_tableHead
.
setSectionResizeMode
(
3
,
QtWidgets
.
QHeaderView
.
ResizeToContents
)
self
.
all_tableWidget
.
resizeRowsToContents
()
self
.
pb_tableWidget
.
resizeRowsToContents
()
self
.
zm_tableWidget
.
resizeRowsToContents
()
...
...
@@ -213,6 +222,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# 表格双击和发生change时的处理
self
.
zm_tableWidget
.
setEditTriggers
(
QAbstractItemView
.
NoEditTriggers
)
self
.
zm_tableWidget
.
itemDoubleClicked
.
connect
(
self
.
change_video_time
)
self
.
all_tableWidget
.
itemDoubleClicked
.
connect
(
self
.
change_video_time
)
self
.
all_tableWidget
.
setEditTriggers
(
QAbstractItemView
.
NoEditTriggers
)
self
.
all_tableWidget
.
itemDoubleClicked
.
connect
(
self
.
all_item_changed_by_double_clicked_slot
)
...
...
@@ -222,13 +233,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
pb_tableWidget
.
itemChanged
.
connect
(
self
.
generate_audio_slot
)
# todo 现在只在【旁白】tab上双击修改,会保存表格到本地,【字幕旁白】tab上不行。(【字幕旁白】tab上无法修改旁白)
self
.
pb_tableWidget
.
itemChanged
.
connect
(
self
.
write2ProjectFromAside
)
self
.
zm_tableWidget
.
itemDoubleClicked
.
connect
(
self
.
change_video_time
)
self
.
pb_tableWidget
.
itemDoubleClicked
.
connect
(
self
.
change_video_time
)
self
.
all_tableWidget
.
itemDoubleClicked
.
connect
(
self
.
change_video_time
)
# self.all_tableWidget.itemDoubleClicked.connect(self.writeHistoryFromContent)
# self.all_tableWidget.itemChanged.connect(self.rewriteHistoryFromContent)
# self.all_tableWidget.itemChanged.connect(self.write2ProjectFromContent)
# 其他变量
...
...
@@ -256,10 +261,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
projectContext
.
Init
(
project_path
)
self
.
update_ui
()
# 如果嗅探到旁白检测未完成,则询问是否继续
if
self
.
projectContext
.
detected
==
True
and
self
.
projectContext
.
nd_process
<
1
:
self
.
continue_detect_prompt_dialog
.
show_with_msg
(
"您的上次任务未完成,是否继续检测?"
)
# 重写关闭Mmainwindow窗口
def
closeEvent
(
self
,
event
):
# buttonBox = QtWidgets.QMessageBox()
...
...
@@ -324,8 +325,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
project_name
=
os
.
path
.
basename
(
project_path
)
self
.
setWindowTitle
(
f
"无障碍电影制作软件(当前工程为:{project_name})"
)
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
()
...
...
@@ -363,9 +362,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
action_3
.
setEnabled
(
True
)
self
.
action_4
.
setEnabled
(
True
)
self
.
action_save
.
setEnabled
(
True
)
self
.
action_operate
.
setEnabled
(
True
)
if
self
.
projectContext
.
excel_path
is
not
None
:
self
.
open_excel_with_project_path
()
self
.
action_operate
.
setEnabled
(
True
)
# 如果这个工程之前没有检测的视频,那么就需要将导入视频的按钮设置为可点,否则就直接导入对应的视频
video_path
=
self
.
projectContext
.
video_path
if
video_path
is
None
:
...
...
@@ -379,7 +378,11 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
playVideo
()
# 播放视频
self
.
action_insert_aside_from_now
.
setEnabled
(
True
)
self
.
insert_aside_from_now_btn
.
setEnabled
(
True
)
self
.
continue_detect_prompt_dialog
.
setModal
(
True
)
if
self
.
projectContext
.
detected
==
True
and
self
.
projectContext
.
nd_process
<
1
:
self
.
continue_detect_prompt_dialog
.
setModal
(
True
)
self
.
continue_detect_prompt_dialog
.
show_with_msg
(
"您的上次任务未完成,是否继续检测?"
)
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
)
...
...
@@ -419,6 +422,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# self.projectContext.Init(os.path.dirname(
# book_path), os.path.basename(video_path))
if
self
.
projectContext
.
excel_path
is
None
:
self
.
projectContext
.
excel_path
=
book_path
# 获取视频的时长等信息,初始化开始结束时间
startTime
=
"00:00:00"
...
...
@@ -637,19 +642,18 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.all_threads.append(t)
print("previewed_audio:", self.previewed_audio)
"""
@staticmethod
# 一条语音的最长播放时间是10秒
def
play_audio
(
path
,
previewed_audio
):
def
play_audio
(
self
,
path
,
previewed_audio
):
# 如果没有该音频,则直接return
if
not
os
.
path
.
exists
(
path
):
return
file
=
QUrl
.
fromLocalFile
(
path
)
# 音频文件路径
content
=
QMediaContent
(
file
)
player
=
QMediaPlayer
(
)
player
.
setMedia
(
content
)
p
layer
.
play
(
)
self
.
audio_player
.
setMedia
(
content
)
self
.
audio_player
.
play
(
)
p
rint
(
"播放"
,
path
)
previewed_audio
[
os
.
path
.
basename
(
path
)]
=
1
time
.
sleep
(
10
)
def
openVideoFile
(
self
):
path
=
QFileDialog
.
getOpenFileUrl
(
self
,
"选择待导入视频"
,
QUrl
(
os
.
getcwd
()),
"Video Files(*.mp4 *.rmvb *mkv *avi)"
)[
0
]
...
...
@@ -772,41 +776,43 @@ class MainWindow(QMainWindow, Ui_MainWindow):
for
j
in
range
(
len
(
elem_list
)):
text
=
elem_list
[
j
]
if
type
(
text
)
==
str
and
'插入旁白,推荐'
in
text
:
text
=
text
[
text
.
index
(
'推荐'
):]
text
=
re
.
findall
(
"
\
d+"
,
text
)[
0
]
# text = text[text.index('推荐'):]
# 需要格式化成hh:mm:ss格式
if
j
in
time_format_col_list
and
type
(
text
)
==
str
and
len
(
text
)
!=
0
:
text
=
utils
.
transfer_second_to_time
(
text
)
item
=
QTableWidgetItem
(
text
)
# 设置为不可编辑
if
self
.
checkIfTableItemCanChange
(
table
,
idx
,
j
)
==
False
:
item
.
setFlags
(
Qt
.
ItemIsEnabled
)
table
.
setItem
(
idx
,
j
,
item
)
if
table
.
objectName
()
==
constant
.
Aside
.
ObjectName
and
j
==
constant
.
Aside
.
SpeedColumnNumber
:
qcombo
=
QtWidgets
.
QComboBox
()
qcombo
.
addItems
(
constant
.
Aside
.
SpeedList
)
qcombo
.
setCurrentIndex
(
constant
.
Aside
.
SpeedList
.
index
(
text
))
qcombo
.
currentIndexChanged
.
connect
(
self
.
change_audio_speed
)
table
.
setCellWidget
(
idx
,
j
,
qcombo
)
else
:
item
=
QTableWidgetItem
(
text
)
# 设置为不可编辑
if
self
.
checkIfTableItemCanChange
(
table
,
idx
,
j
)
==
False
:
item
.
setFlags
(
Qt
.
ItemIsEnabled
)
table
.
setItem
(
idx
,
j
,
item
)
# 只有Content页的字幕列和 Aside页的字幕列 可编辑
def
btn_pressed_preview_audio_slot
(
self
):
for
t
in
self
.
all_threads
:
if
t
.
name
==
"single_speech_synthesis"
and
t
.
is_alive
():
self
.
prompt_dialog
.
show_with_msg
(
"音频正在合成,请稍候"
)
return
btn
=
self
.
sender
()
# 法1:按照物理位置。这样的结果不太对
# index = self.pb_tableWidget.indexAt(btn.pos())
# print("index:", index.row())
# 法2:遍历所有button,比较是否是同一对象。注意sender不能强转成btn类型,这样就变成新对象了
idx
=
0
for
i
in
range
(
self
.
pb_tableWidget
.
rowCount
()):
if
id
(
self
.
pb_tableWidget
.
cellWidget
(
i
,
constant
.
Aside
.
PreviewColumnNumber
))
==
id
(
btn
):
idx
=
i
break
item
=
self
.
pb_tableWidget
.
item
(
idx
,
0
)
print
(
"当前起始时间:"
,
item
.
text
())
print
(
"index:"
,
idx
)
idx
=
self
.
pb_tableWidget
.
indexAt
(
btn
.
pos
())
print
(
"index:"
,
idx
.
row
())
# 获取时间
item
=
self
.
pb_tableWidget
.
item
(
idx
.
row
(),
0
)
audio_path
=
None
pos_sec
=
utils
.
trans_to_seconds
(
item
.
text
())
for
i
in
range
(
len
(
self
.
projectContext
.
aside_list
)
-
1
,
-
1
,
-
1
):
# print(f"pos_sec:{pos_sec}, st_time_sec:{float(self.projectContext.aside_list[i].st_time_sec)}")
if
pos_sec
>=
float
(
self
.
projectContext
.
aside_list
[
i
]
.
st_time_sec
):
audio_path
=
os
.
path
.
dirname
(
self
.
projectContext
.
excel_path
)
+
(
"/tmp/
%.2
f.wav"
%
float
(
self
.
projectContext
.
aside_list
[
i
]
.
st_time_sec
))
break
audio_path
=
os
.
path
.
dirname
(
self
.
projectContext
.
excel_path
)
+
(
"/tmp/
%.2
f.wav"
%
pos_sec
)
print
(
"待播放的音频文件为"
,
audio_path
)
# 2、如果找到了该音频,则新起一个线程播放
if
audio_path
!=
None
and
os
.
path
.
exists
(
audio_path
):
t
=
RunThread
(
funcName
=
self
.
play_audio
,
...
...
@@ -899,13 +905,16 @@ class MainWindow(QMainWindow, Ui_MainWindow):
if
self
.
is_user_editing
()
==
False
:
return
# 不需要set为False
row
=
item
.
row
()
# 获取行数
col
=
item
.
column
()
# 获取列数 注意是column而不是col
# 只有更新语速或者更新旁白,才需要重新生成音频
if
col
not
in
constant
.
Aside
.
ActivateColumns
:
return
# 停止预览,释放当前占用的音频文件
self
.
audio_player
.
setMedia
(
QMediaContent
())
# 合成这一段语音
self
.
do_generate_audio_by_aside_row
(
int
(
row
))
...
...
@@ -921,21 +930,27 @@ class MainWindow(QMainWindow, Ui_MainWindow):
print
(
"wav_path:"
,
wav_path
)
# speed_info = self.projectContext.speaker_speed
# 使用私有 语速
speed_info
=
self
.
pb_tableWidget
.
item
(
int
(
row
),
constant
.
Aside
.
SpeedColumnNumber
)
.
t
ext
()
speed_info
=
self
.
pb_tableWidget
.
cellWidget
(
int
(
row
),
constant
.
Aside
.
SpeedColumnNumber
)
.
currentT
ext
()
speaker_info
=
self
.
projectContext
.
speaker_info
speed
=
float
(
speed_info
.
split
(
'('
)[
0
])
speaker_name
=
speaker_info
.
split
(
","
)[
0
]
speaker
=
self
.
projectContext
.
choose_speaker
(
speaker_name
)
text
=
self
.
p
b_tableWidget
.
item
(
int
(
row
),
constant
.
Aside
.
AsideColumnNumber
)
.
text
()
text
=
self
.
p
rojectContext
.
aside_list
[
int
(
row
)]
.
aside
# 如果目前wav_path存在,且旁白字数清空了,那就把已生成wav删掉
if
len
(
text
)
==
0
:
if
os
.
path
.
exists
(
wav_path
):
os
.
remove
(
wav_path
)
return
# 把目前在执行的单条语音的合成线程先停掉
for
t
in
self
.
all_threads
:
if
wav_path
in
t
.
_args
and
t
.
name
==
"single_speech_synthesis"
and
t
.
is_alive
():
stop_thread
(
t
)
t
=
RunThread
(
funcName
=
speech_synthesis
,
args
=
(
text
,
wav_path
,
speaker
,
speed
),
name
=
"speech_synthesis"
)
name
=
"s
ingle_s
peech_synthesis"
)
t
.
setDaemon
(
True
)
t
.
start
()
self
.
all_threads
.
append
(
t
)
...
...
@@ -1032,9 +1047,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
if
col
not
in
constant
.
Aside
.
ActivateColumns
:
return
# 更新【字幕旁白】这个tab里的字,如果是语速,那就更新语速这一列,如果是旁白,那就更新旁白这一列
start_time
=
self
.
pb_tableWidget
.
item
(
int
(
row
),
constant
.
Aside
.
StartTimeColumn
)
.
text
()
start_time
=
utils
.
trans_to_seconds
(
start_time
)
idx
=
self
.
projectContext
.
aside_subtitle_2contentId
(
Element
(
str
(
start_time
),
0
,
0
,
0
,
0
))
print
(
"行号"
,
row
)
print
(
"开始时间"
,
self
.
projectContext
.
aside_list
[
row
]
.
st_time_sec
)
idx
=
self
.
projectContext
.
aside_subtitle_2contentId
(
self
.
projectContext
.
aside_list
[
row
])
print
(
"对应index"
,
idx
)
if
col
==
constant
.
Aside
.
AsideColumnNumber
:
self
.
all_tableWidget
.
setItem
(
int
(
idx
),
constant
.
Content
.
AsideColumnNumber
,
QTableWidgetItem
(
text
))
self
.
projectContext
.
refresh_aside
(
row
,
text
)
...
...
@@ -1190,7 +1206,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
break
idx
+=
1
self
.
projectContext
.
aside_list
.
insert
(
idx
,
new_element
)
self
.
pb_tableWidget_idx
=
idx
self
.
pb_tableWidget_idx
=
idx
self
.
do_generate_audio_by_aside_row
(
idx
)
else
:
idx
=
0
...
...
@@ -1208,14 +1224,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# 保留原来的element
to_be_modify_element
=
copy
.
deepcopy
(
self
.
projectContext
.
all_elements
[
int
(
row
)
-
1
])
# 更新element
elem
=
self
.
projectContext
.
all_elements
[
int
(
row
)
-
1
]
elem
.
st_time_sec
=
start_time
elem
.
ed_time_sec
=
end_time
elem
.
subtitle
=
subtitle
elem
.
suggest
=
suggest
elem
.
aside
=
aside
elem
.
speed
=
speed
# 新的element
elem
=
Element
(
start_time
,
end_time
,
subtitle
,
suggest
,
aside
,
speed
)
if
suggest
is
not
None
and
"插入旁白,推荐字数为"
in
suggest
:
for
i
in
range
(
len
(
self
.
projectContext
.
aside_list
)):
...
...
@@ -1224,6 +1234,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
pb_tableWidget_idx
=
i
# 更新
self
.
setElememtToTable
(
self
.
pb_tableWidget
,
elem
,
i
)
self
.
projectContext
.
aside_list
[
i
]
=
elem
self
.
do_generate_audio_by_aside_row
(
i
)
break
else
:
...
...
@@ -1231,21 +1242,26 @@ class MainWindow(QMainWindow, Ui_MainWindow):
if
to_be_modify_element
.
equalTo
(
self
.
projectContext
.
subtitle_list
[
i
]):
self
.
zm_tableWidget_idx
=
i
self
.
setElememtToTable
(
self
.
zm_tableWidget
,
elem
,
i
)
self
.
projectContext
.
subtitle_list
[
i
]
=
elem
break
self
.
setElememtToTable
(
self
.
all_tableWidget
,
elem
,
int
(
row
)
-
1
)
self
.
projectContext
.
save_project
()
self
.
projectContext
.
all_elements
[
int
(
row
)
-
1
]
=
elem
self
.
refresh_tab_slot
()
self
.
prompt_dialog
.
show_with_msg
(
"操作成功!!请查看变化"
)
# 只有row起作用
def
del_line_operation_slot
(
self
,
row
,
start_time
,
end_time
,
subtitle
,
suggest
,
aside
):
def
del_line_operation_slot
(
self
,
row
,
start_time
,
end_time
,
subtitle
,
suggest
,
aside
,
speed
):
to_be_delete_element
=
self
.
projectContext
.
all_elements
[
int
(
row
)
-
1
]
if
self
.
projectContext
.
all_elements
[
int
(
row
)
-
1
]
.
suggest
is
not
None
\
and
"插入旁白,推荐字数为"
in
self
.
projectContext
.
all_elements
[
int
(
row
)
-
1
]
.
suggest
:
for
i
in
range
(
len
(
self
.
projectContext
.
aside_list
)):
if
to_be_delete_element
.
equalTo
(
self
.
projectContext
.
aside_list
[
i
]):
self
.
pb_tableWidget_idx
=
i
# 将对应音频删除
wav_path
=
self
.
projectContext
.
project_base_dir
+
'/tmp/
%.2
f.wav'
%
float
(
self
.
projectContext
.
aside_list
[
i
]
.
st_time_sec
)
if
os
.
path
.
exists
(
wav_path
):
os
.
remove
(
wav_path
)
self
.
projectContext
.
aside_list
.
pop
(
i
)
break
else
:
...
...
@@ -1286,4 +1302,27 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
user_editing_content
=
True
def
getTabId
(
self
,
x
):
self
.
curTab
=
int
(
x
)
\ No newline at end of file
self
.
curTab
=
int
(
x
)
# 切换的时候,自动高亮一行
cur_time
=
self
.
player
.
position
()
/
1000
if
self
.
curTab
==
1
:
subtitle_list
=
self
.
projectContext
.
subtitle_list
for
i
in
range
(
len
(
subtitle_list
)
-
1
,
-
1
,
-
1
):
if
utils
.
trans_to_seconds
(
subtitle_list
[
i
]
.
st_time_sec
)
<=
cur_time
:
self
.
zm_tableWidget
.
selectRow
(
i
)
break
elif
self
.
curTab
==
2
:
aside_list
=
self
.
projectContext
.
aside_list
for
i
in
range
(
len
(
aside_list
)
-
1
,
-
1
,
-
1
):
if
utils
.
trans_to_seconds
(
aside_list
[
i
]
.
st_time_sec
)
<=
cur_time
:
self
.
pb_tableWidget
.
selectRow
(
i
)
break
def
change_audio_speed
(
self
):
combo
=
self
.
sender
()
idx
=
self
.
pb_tableWidget
.
indexAt
(
combo
.
pos
())
print
(
"index:"
,
idx
.
row
())
# 将audio_player的资源置空
print
(
"释放当前播放的音频文件"
)
self
.
audio_player
.
setMedia
(
QMediaContent
())
self
.
do_generate_audio_by_aside_row
(
idx
.
row
())
\ No newline at end of file
main_window.ui
View file @
1d2f2b64
...
...
@@ -309,8 +309,11 @@
background: #ffd740;
}
</string>
</property>
<property
name=
"maximum"
>
<number>
100
</number>
</property>
<property
name=
"value"
>
<number>
99
</number>
<number>
100
</number>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
...
...
@@ -445,17 +448,17 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
8
27
</width>
<height>
64
</height>
<width>
8
00
</width>
<height>
40
</height>
</rect>
</property>
<widget
class=
"myVideoSlider"
name=
"sld_video"
>
<property
name=
"geometry"
>
<rect>
<x>
10
</x>
<y>
3
0
</y>
<width>
811
</width>
<height>
2
0
</height>
<y>
2
0
</y>
<width>
790
</width>
<height>
3
0
</height>
</rect>
</property>
<property
name=
"minimumSize"
>
...
...
@@ -568,7 +571,7 @@
<x>
0
</x>
<y>
0
</y>
<width>
944
</width>
<height>
2
6
</height>
<height>
2
2
</height>
</rect>
</property>
<widget
class=
"QMenu"
name=
"menu"
>
...
...
main_window_ui.py
View file @
1d2f2b64
...
...
@@ -121,6 +121,7 @@ class Ui_MainWindow(object):
self
.
sld_audio
=
QtWidgets
.
QSlider
(
self
.
centralwidget
)
self
.
sld_audio
.
setMinimumSize
(
QtCore
.
QSize
(
0
,
24
))
self
.
sld_audio
.
setMaximumSize
(
QtCore
.
QSize
(
80
,
24
))
self
.
sld_audio
.
setProperty
(
"value"
,
100
)
self
.
sld_audio
.
setStyleSheet
(
"QSlider:horizontal {
\n
"
" min-height: 24px;
\n
"
" max-height: 24px;
\n
"
...
...
@@ -208,6 +209,7 @@ class Ui_MainWindow(object):
self
.
all_tableWidget
.
setObjectName
(
"all_tableWidget"
)
self
.
all_tableWidget
.
setColumnCount
(
0
)
self
.
all_tableWidget
.
setRowCount
(
0
)
self
.
all_tableWidget
.
setSelectionBehavior
(
QtWidgets
.
QAbstractItemView
.
SelectRows
)
self
.
horizontalLayout_4
.
addWidget
(
self
.
all_tableWidget
)
self
.
tabWidget
.
addTab
(
self
.
all_tab
,
""
)
self
.
zm_tab
=
QtWidgets
.
QWidget
()
...
...
@@ -219,6 +221,7 @@ class Ui_MainWindow(object):
self
.
zm_tableWidget
.
setObjectName
(
"zm_tableWidget"
)
self
.
zm_tableWidget
.
setColumnCount
(
0
)
self
.
zm_tableWidget
.
setRowCount
(
0
)
self
.
zm_tableWidget
.
setSelectionBehavior
(
QtWidgets
.
QAbstractItemView
.
SelectRows
)
self
.
horizontalLayout_2
.
addWidget
(
self
.
zm_tableWidget
)
self
.
tabWidget
.
addTab
(
self
.
zm_tab
,
""
)
self
.
pb_tab
=
QtWidgets
.
QWidget
()
...
...
@@ -229,6 +232,7 @@ class Ui_MainWindow(object):
self
.
pb_tableWidget
.
setObjectName
(
"pb_tableWidget"
)
self
.
pb_tableWidget
.
setColumnCount
(
0
)
self
.
pb_tableWidget
.
setRowCount
(
0
)
self
.
pb_tableWidget
.
setSelectionBehavior
(
QtWidgets
.
QAbstractItemView
.
SelectRows
)
self
.
horizontalLayout_3
.
addWidget
(
self
.
pb_tableWidget
)
self
.
tabWidget
.
addTab
(
self
.
pb_tab
,
""
)
self
.
shuiping
.
addWidget
(
self
.
tabWidget
)
...
...
@@ -254,11 +258,11 @@ class Ui_MainWindow(object):
self
.
scrollArea
.
setWidgetResizable
(
False
)
self
.
scrollArea
.
setObjectName
(
"scrollArea"
)
self
.
scrollAreaWidgetContents
=
myWidgetContents
()
self
.
scrollAreaWidgetContents
.
setGeometry
(
QtCore
.
QRect
(
0
,
0
,
8
27
,
64
))
self
.
scrollAreaWidgetContents
.
setGeometry
(
QtCore
.
QRect
(
0
,
0
,
8
00
,
40
))
self
.
scrollAreaWidgetContents
.
setObjectName
(
"scrollAreaWidgetContents"
)
self
.
sld_video
=
myVideoSlider
(
self
.
scrollAreaWidgetContents
)
self
.
sld_video
.
setGeometry
(
QtCore
.
QRect
(
10
,
30
,
811
,
2
0
))
self
.
sld_video
.
setMinimumSize
(
QtCore
.
QSize
(
41
0
,
0
))
self
.
sld_video
.
setGeometry
(
QtCore
.
QRect
(
10
,
20
,
780
,
3
0
))
self
.
sld_video
.
setMinimumSize
(
QtCore
.
QSize
(
77
0
,
0
))
self
.
sld_video
.
setMaximumSize
(
QtCore
.
QSize
(
16777215
,
20
))
self
.
sld_video
.
setMaximum
(
100
)
self
.
sld_video
.
setOrientation
(
QtCore
.
Qt
.
Horizontal
)
...
...
management.py
View file @
1d2f2b64
...
...
@@ -97,7 +97,8 @@ class Element:
def
to_short_list
(
self
):
return
[
self
.
st_time_sec
,
self
.
subtitle
,
self
.
aside
,
self
.
speed
]
def
to_aside_list
(
self
):
return
[
self
.
st_time_sec
,
self
.
ed_time_sec
,
self
.
suggest
,
self
.
aside
,
self
.
speed
]
# return [self.st_time_sec, self.ed_time_sec, self.suggest, self.aside, self.speed]
return
[
self
.
st_time_sec
,
self
.
suggest
,
self
.
aside
,
self
.
speed
]
def
to_subtitle_list
(
self
):
return
[
self
.
st_time_sec
,
self
.
ed_time_sec
,
self
.
subtitle
]
...
...
@@ -119,9 +120,10 @@ class ProjectContext:
self
.
all_elements
=
[]
self
.
speaker_info
=
None
self
.
speaker_speed
=
None
self
.
duration
=
0
# 一些常量
self
.
header
=
[
"起始时间"
,
"终止时间"
,
"字幕"
,
'建议'
,
'解说脚本'
,
"语速"
]
self
.
aside_header
=
[
"起始时间"
,
"终止时间"
,
'推荐插入字数'
,
'解说脚本'
,
"语速"
,
"预览音频"
]
self
.
aside_header
=
[
'起始时间'
,
'推荐插入字数'
,
'解说脚本'
,
"语速"
,
"预览音频"
]
self
.
subtitle_header
=
[
"起始时间"
,
"终止时间"
,
"字幕"
]
self
.
contentHeader
=
[
"起始时间"
,
"字幕"
,
"解说脚本"
,
"语速"
]
...
...
@@ -264,20 +266,27 @@ class ProjectContext:
self
.
subtitle_list
.
append
(
Element
(
st_time_sec
,
ed_time_sec
,
subtitle
,
suggest
,
aside
,
speed
))
self
.
all_elements
.
append
(
self
.
subtitle_list
[
-
1
])
else
:
if
i
==
0
:
st_time_sec
=
"0.01"
if
d
[
"起始时间"
][
i
]
is
None
:
if
i
==
0
:
st_time_sec
=
"0.01"
else
:
try
:
st_time_sec
=
"
%.2
f"
%
(
float
(
d
[
"终止时间"
][
i
-
1
])
+
0.01
)
except
Exception
as
e
:
# 如果是两端连续旁白,那是没有终止时间的,需要做微调,这里是直接用上一条旁白的起始时间。
st_time_sec
=
"
%.2
f"
%
(
float
(
d
[
"起始时间"
][
i
-
1
])
+
0.01
)
else
:
try
:
st_time_sec
=
"
%.2
f"
%
(
float
(
d
[
"终止时间"
][
i
-
1
])
+
0.01
)
except
Exception
as
e
:
# 如果是两端连续旁白,那是没有终止时间的,需要做微调,这里是直接用上一条旁白的起始时间。
st_time_sec
=
"
%.2
f"
%
(
float
(
d
[
"起始时间"
][
i
-
1
])
+
0.01
)
# 如果是最后一条
if
i
==
len
(
d
[
"字幕"
])
-
1
:
ed_time_sec
=
"360000"
# todo 默认最大时长是100h
st_time_sec
=
d
[
"起始时间"
][
i
]
if
d
[
"终止时间"
][
i
]
is
None
:
# 如果是最后一条
if
i
==
len
(
d
[
"字幕"
])
-
1
:
ed_time_sec
=
"360000"
if
self
.
duration
==
0
else
self
.
duration
# todo 默认最大时长是100h
else
:
ed_time_sec
=
"
%.2
f"
%
(
float
(
d
[
"起始时间"
][
i
+
1
])
-
0.01
)
else
:
ed_time_sec
=
"
%.2
f"
%
(
float
(
d
[
"起始时间"
][
i
+
1
])
-
0.01
)
ed_time_sec
=
d
[
"终止时间"
][
i
]
self
.
aside_list
.
append
(
Element
(
st_time_sec
,
ed_time_sec
,
subtitle
,
suggest
,
aside
,
speed
))
self
.
all_elements
.
append
(
self
.
aside_list
[
-
1
])
# print("[load_excel_from_path] ", end='')
...
...
operation_dialog.py
View file @
1d2f2b64
...
...
@@ -31,11 +31,10 @@ class Operation_Dialog(QDialog, Ui_Dialog):
self
.
pickStartPos
.
clicked
.
connect
(
self
.
pick_start_pos_slot
)
self
.
pickEndPos
.
clicked
.
connect
(
self
.
pick_end_pos_slot
)
self
.
buttonBox
.
setEnabled
(
False
)
self
.
buttonBox
.
button
(
QDialogButtonBox
.
StandardButton
.
Ok
)
.
clicked
.
connect
(
self
.
start_operation_slot
)
# 字幕/旁白 选择框
self
.
comboBox
.
currentIndexChanged
.
connect
(
self
.
zmpb_change_slot
)
# 增加一行/删除一行 选择框
...
...
@@ -43,19 +42,23 @@ class Operation_Dialog(QDialog, Ui_Dialog):
self
.
speed_list
=
[
"1.00(4字/秒)"
,
"1.10(4.5字/秒)"
,
"1.25(5字/秒)"
,
"1.50(6字/秒)"
,
"1.75(7字/秒)"
,
"2.00(8字/秒)"
,
"2.50(10字/秒)"
]
self
.
comboBox_3
.
addItems
(
self
.
speed_list
)
self
.
lineEdits
=
[
self
.
lineEdit
,
self
.
lineEdit_
2
,
self
.
lineEdit_3
,
self
.
lineEdit_4
,
self
.
lineEdit_5
,
self
.
lineEdit_6
]
self
.
lineEdits
=
[
self
.
lineEdit
,
self
.
lineEdit_
4
,
self
.
lineEdit_5
,
self
.
lineEdit_6
]
self
.
timeEdits
=
[
self
.
timeEdit
,
self
.
timeEdit_2
]
self
.
zmpb_change_slot
()
self
.
adddel_change_slot
()
def
pick_start_pos_slot
(
self
):
time
=
utils
.
transfer_second_to_time
(
str
(
self
.
mainWindow
.
player
.
position
()
/
1000
))
self
.
lineEdit_2
.
setText
(
time
)
time
=
utils
.
transfer_second_to_time
(
str
(
self
.
mainWindow
.
player
.
position
()
/
1000
))
st_time
=
QTime
.
fromString
(
time
,
"hh:mm:ss.zzz"
)
print
(
"st_time"
,
st_time
.
hour
(),
st_time
.
minute
(),
st_time
.
second
(),
st_time
.
msec
())
self
.
timeEdit
.
setTime
(
st_time
)
def
pick_end_pos_slot
(
self
):
time
=
utils
.
transfer_second_to_time
(
str
(
self
.
mainWindow
.
player
.
position
()
/
1000
))
self
.
lineEdit_3
.
setText
(
time
)
time
=
utils
.
transfer_second_to_time
(
str
(
self
.
mainWindow
.
player
.
position
()
/
1000
))
self
.
timeEdit_2
.
setTime
(
QTime
.
fromString
(
time
,
"hh:mm:ss.zzz"
))
def
zmpb_change_slot
(
self
):
# 如果是删除,则直接return
...
...
@@ -67,7 +70,7 @@ class Operation_Dialog(QDialog, Ui_Dialog):
self
.
lineEdit_5
.
setEnabled
(
False
)
self
.
lineEdit_6
.
setEnabled
(
False
)
else
:
self
.
lineEdit_3
.
setEnabled
(
False
)
self
.
timeEdit_2
.
setEnabled
(
False
)
self
.
lineEdit_4
.
setEnabled
(
False
)
self
.
lineEdit_5
.
setEnabled
(
False
)
...
...
@@ -96,20 +99,22 @@ class Operation_Dialog(QDialog, Ui_Dialog):
return
False
# 校验时间填写是否是hh:mm:ss格式的
try
:
time
=
self
.
timeEdit
.
time
()
import
re
if
type
(
self
.
lineEdit_2
.
text
())
==
str
and
len
(
self
.
lineEdit_2
.
text
(
))
>
0
:
if
type
(
time
)
==
QTime
and
len
(
time
.
toString
(
"hh:mm:ss.zzz"
))
>
0
:
x
=
re
.
match
(
"^(([0-1]
\
d)|(2[0-4])):[0-5]
\
d:[0-5]
\
d(.
\
d{1,
2})?$"
,
self
.
lineEdit_2
.
text
(
))
"^(([0-1]
\
d)|(2[0-4])):[0-5]
\
d:[0-5]
\
d(.
\
d{1,
3})?$"
,
time
.
toString
(
"hh:mm:ss.zzz"
))
assert
x
!=
None
if
type
(
self
.
lineEdit_3
.
text
())
==
str
and
len
(
self
.
lineEdit_3
.
text
())
>
0
:
time
=
self
.
timeEdit_2
.
time
()
if
type
(
time
)
==
QTime
and
len
(
time
.
toString
(
"hh:mm:ss.zzz"
))
>
0
:
x
=
re
.
match
(
"^(([0-1]
\
d)|(2[0-4])):[0-5]
\
d:[0-5]
\
d(.
\
d{1,
2})?$"
,
self
.
lineEdit_3
.
text
(
))
"^(([0-1]
\
d)|(2[0-4])):[0-5]
\
d:[0-5]
\
d(.
\
d{1,
3})?$"
,
time
.
toString
(
"hh:mm:ss.zzz"
))
assert
x
!=
None
except
Exception
as
e
:
self
.
mainWindow
.
prompt_dialog
.
show_with_msg
(
"校验失败!起始或结束时间输入的格式有误!应该为hh:mm:ss
!!"
%
(
rowCount
,
self
.
lineEdit
.
text
())
)
"校验失败!起始或结束时间输入的格式有误!应该为hh:mm:ss
.zzz!!"
)
return
False
# 这些是只有【add】才需要检测的
...
...
@@ -118,10 +123,10 @@ class Operation_Dialog(QDialog, Ui_Dialog):
start_time_f
,
end_time_f
=
0.0
,
0.0
try
:
start_time_f
=
float
(
utils
.
trans_to_seconds
(
self
.
lineEdit_2
.
text
(
)))
utils
.
trans_to_seconds
(
self
.
timeEdit
.
time
()
.
toString
(
"hh:mm:ss"
)))
if
self
.
comboBox
.
currentText
()
==
"字幕"
:
end_time_f
=
float
(
utils
.
trans_to_seconds
(
self
.
lineEdit_3
.
text
(
)))
utils
.
trans_to_seconds
(
self
.
timeEdit_2
.
time
()
.
toString
(
"hh:mm:ss"
)))
assert
start_time_f
<
end_time_f
except
Exception
as
e
:
self
.
mainWindow
.
prompt_dialog
.
show_with_msg
(
...
...
@@ -164,7 +169,9 @@ class Operation_Dialog(QDialog, Ui_Dialog):
self
.
comboBox_2
.
setEnabled
(
status
)
def
start_operation_slot
(
self
):
row
,
start_time
,
end_time
,
subtitle
,
suggest
,
aside
=
[
print
(
"operation 触发"
)
start_time
,
end_time
=
[
"
%02
d:
%02
d:
%02
d.
%03
d"
%
(
x
.
time
()
.
hour
(),
x
.
time
()
.
minute
(),
x
.
time
()
.
second
(),
x
.
time
()
.
msec
())
for
x
in
self
.
timeEdits
]
row
,
subtitle
,
suggest
,
aside
=
[
x
.
text
()
for
x
in
self
.
lineEdits
]
speed
=
self
.
comboBox_3
.
currentText
()
# 将hh:mm:ss转成秒的形式传给mainWindow
...
...
@@ -186,6 +193,8 @@ class Operation_Dialog(QDialog, Ui_Dialog):
self
.
zmpb_change_slot
()
self
.
adddel_change_slot
()
print
(
suggest
)
# 根据增删两种操作,分别触发不同信号。
if
self
.
comboBox_2
.
currentText
()
==
"增加一行"
:
self
.
start_add_signal
.
emit
(
...
...
@@ -207,10 +216,13 @@ class Operation_Dialog(QDialog, Ui_Dialog):
assert
1
<=
row_number
<=
rowCount
elem
=
self
.
mainWindow
.
projectContext
.
all_elements
[
int
(
row_number
)
-
1
]
self
.
lineEdit_2
.
setText
(
str
(
utils
.
transfer_second_to_time
(
elem
.
st_time_sec
)))
self
.
lineEdit_3
.
setText
(
str
(
utils
.
transfer_second_to_time
(
elem
.
ed_time_sec
)))
if
len
(
elem
.
ed_time_sec
)
>
0
else
self
.
lineEdit_3
.
setText
(
""
)
# todo, 改成可以spinbox的那种形式
self
.
timeEdit
.
setTime
(
QTime
.
fromString
(
str
(
utils
.
transfer_second_to_time
(
elem
.
st_time_sec
)),
"hh:mm:ss.zzz"
))
self
.
timeEdit_2
.
setTime
(
QTime
.
fromString
(
str
(
utils
.
transfer_second_to_time
(
elem
.
ed_time_sec
)),
"hh:mm:ss.zzz"
))
if
len
(
elem
.
ed_time_sec
)
>
0
else
self
.
timeEdit_2
.
setEnabled
(
False
)
self
.
lineEdit_4
.
setText
(
elem
.
subtitle
)
self
.
lineEdit_6
.
setText
(
elem
.
aside
)
self
.
comboBox_3
.
setCurrentIndex
(
...
...
operation_dialog.ui
View file @
1d2f2b64
...
...
@@ -14,11 +14,10 @@
<string>
Dialog
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
columnstretch=
"0,0,0,0,0"
>
<item
row=
"
1"
column=
"3"
colspa
n=
"2"
>
<widget
class=
"Q
PushButton"
name=
"pushButton_3
"
>
<item
row=
"
6"
colum
n=
"2"
>
<widget
class=
"Q
Label"
name=
"label_11
"
>
<property
name=
"text"
>
<string>
填充
行信息
</string>
<string>
*请填文字
</string>
</property>
</widget>
</item>
...
...
@@ -32,6 +31,121 @@
</property>
</widget>
</item>
<item
row=
"3"
column=
"2"
>
<widget
class=
"QLabel"
name=
"label_9"
>
<property
name=
"text"
>
<string>
*请填数字,最多保留两位小数
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"2"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"text"
>
<string>
行(如果操作是增加,则在该行后面增加)
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QLabel"
name=
"label_13"
>
<property
name=
"font"
>
<font>
<pointsize>
8
</pointsize>
</font>
</property>
<property
name=
"text"
>
<string>
*需要填在【字幕旁白】页面中的行数
</string>
</property>
</widget>
</item>
</layout>
</item>
<item
row=
"3"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_4"
>
<property
name=
"text"
>
<string>
结束时间:
</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"3"
>
<widget
class=
"QPushButton"
name=
"pickStartPos"
>
<property
name=
"text"
>
<string>
取当前位置
</string>
</property>
</widget>
</item>
<item
row=
"4"
column=
"2"
>
<widget
class=
"QLabel"
name=
"label_10"
>
<property
name=
"text"
>
<string>
*请填文字
</string>
</property>
</widget>
</item>
<item
row=
"6"
column=
"3"
>
<widget
class=
"QLabel"
name=
"label_14"
>
<property
name=
"text"
>
<string>
语速:
</string>
</property>
</widget>
</item>
<item
row=
"6"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_7"
>
<property
name=
"text"
>
<string>
旁白:
</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_3"
>
<property
name=
"text"
>
<string>
起始时间:
</string>
</property>
</widget>
</item>
<item
row=
"3"
column=
"3"
>
<widget
class=
"QPushButton"
name=
"pickEndPos"
>
<property
name=
"text"
>
<string>
取当前位置
</string>
</property>
</widget>
</item>
<item
row=
"5"
column=
"2"
>
<widget
class=
"QLabel"
name=
"label_12"
>
<property
name=
"text"
>
<string>
*请填数字,必须是不超过100的正整数
</string>
</property>
</widget>
</item>
<item
row=
"6"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"lineEdit_6"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item
row=
"4"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"lineEdit_4"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
我想操作第
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"3"
colspan=
"2"
>
<widget
class=
"QPushButton"
name=
"pushButton_3"
>
<property
name=
"text"
>
<string>
填充
行信息
</string>
</property>
</widget>
</item>
<item
row=
"8"
column=
"4"
>
<widget
class=
"QDialogButtonBox"
name=
"buttonBox"
>
<property
name=
"enabled"
>
...
...
@@ -66,10 +180,10 @@
</property>
</widget>
</item>
<item
row=
"
6"
column=
"3
"
>
<widget
class=
"QLabel"
name=
"label_
14
"
>
<item
row=
"
2"
column=
"2
"
>
<widget
class=
"QLabel"
name=
"label_
8
"
>
<property
name=
"text"
>
<string>
语速:
</string>
<string>
*请填数字,最多保留两位小数
</string>
</property>
</widget>
</item>
...
...
@@ -107,69 +221,20 @@
</item>
</layout>
</item>
<item
row=
"6"
column=
"2"
>
<widget
class=
"QLabel"
name=
"label_11"
>
<property
name=
"text"
>
<string>
*请填文字
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"2"
>
<widget
class=
"QComboBox"
name=
"comboBox_2"
>
<item>
<property
name=
"text"
>
<string>
增加一行
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
修改一行
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
删除一行
</string>
</property>
</item>
</widget>
</item>
<item
row=
"5"
column=
"2"
>
<widget
class=
"QLabel"
name=
"label_12"
>
<item
row=
"5"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_6"
>
<property
name=
"text"
>
<string>
*请填数字,必须是不超过100的正整数
</string>
<string>
推荐字数:
</string>
</property>
</widget>
</item>
<item
row=
"
3"
column=
"2
"
>
<widget
class=
"QLabel"
name=
"label_
9
"
>
<item
row=
"
4"
column=
"0
"
>
<widget
class=
"QLabel"
name=
"label_
5
"
>
<property
name=
"text"
>
<string>
*请填数字,最多保留两位小数
</string>
<string>
字幕:
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"2"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"text"
>
<string>
行(如果操作是增加,则在该行后面增加)
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QLabel"
name=
"label_13"
>
<property
name=
"font"
>
<font>
<pointsize>
8
</pointsize>
</font>
</property>
<property
name=
"text"
>
<string>
*需要填在【字幕旁白】页面中的行数
</string>
</property>
</widget>
</item>
</layout>
</item>
<item
row=
"0"
column=
"1"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
stretch=
"1,1"
>
<item>
...
...
@@ -207,56 +272,23 @@
</item>
</layout>
</item>
<item
row=
"5"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_6"
>
<property
name=
"text"
>
<string>
推荐字数:
</string>
</property>
</widget>
</item>
<item
row=
"6"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"lineEdit_6"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item
row=
"2"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"lineEdit_2"
/>
</item>
<item
row=
"2"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_3"
>
<property
name=
"text"
>
<string>
起始时间:
</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"2"
>
<widget
class=
"QLabel"
name=
"label_8"
>
<property
name=
"text"
>
<string>
*请填数字,最多保留两位小数
</string>
</property>
</widget>
</item>
<item
row=
"4"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_5"
>
<property
name=
"text"
>
<string>
字幕:
</string>
</property>
</widget>
</item>
<item
row=
"4"
column=
"2"
>
<widget
class=
"QLabel"
name=
"label_10"
>
<property
name=
"text"
>
<string>
*请填文字
</string>
</property>
</widget>
</item>
<item
row=
"4"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"lineEdit_4"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
<item
row=
"0"
column=
"2"
>
<widget
class=
"QComboBox"
name=
"comboBox_2"
>
<item>
<property
name=
"text"
>
<string>
增加一行
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
修改一行
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
删除一行
</string>
</property>
</item>
</widget>
</item>
<item
row=
"5"
column=
"1"
>
...
...
@@ -266,48 +298,32 @@
</property>
</widget>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
我想操作第
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"lineEdit"
/>
</item>
<item
row=
"
3"
column=
"0
"
>
<widget
class=
"Q
Label"
name=
"label_4
"
>
<property
name=
"
text
"
>
<
string>
结束时间:
</string
>
<item
row=
"
2"
column=
"1
"
>
<widget
class=
"Q
TimeEdit"
name=
"timeEdit
"
>
<property
name=
"
currentSection
"
>
<
enum>
QDateTimeEdit::MinuteSection
</enum
>
</property>
</widget>
</item>
<item
row=
"3"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"lineEdit_3"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
<property
name=
"displayFormat"
>
<string>
hh:mm:ss.zzz
</string>
</property>
</widget>
</item>
<item
row=
"6"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_7"
>
<property
name=
"text"
>
<string>
旁白:
</string>
<property
name=
"currentSectionIndex"
>
<number>
1
</number>
</property>
</widget>
</item>
<item
row=
"
2"
column=
"3
"
>
<widget
class=
"Q
PushButton"
name=
"pickStartPos
"
>
<property
name=
"
text
"
>
<
string>
取当前位置
</string
>
<item
row=
"
3"
column=
"1
"
>
<widget
class=
"Q
TimeEdit"
name=
"timeEdit_2
"
>
<property
name=
"
currentSection
"
>
<
enum>
QDateTimeEdit::SecondSection
</enum
>
</property>
</widget>
</item>
<item
row=
"3"
column=
"3"
>
<widget
class=
"QPushButton"
name=
"pickEndPos"
>
<property
name=
"text"
>
<string>
取当前位置
</string>
<property
name=
"displayFormat"
>
<string>
hh:mm:ss.zzz
</string>
</property>
<property
name=
"currentSectionIndex"
>
<number>
2
</number>
</property>
</widget>
</item>
...
...
operation_dialog_ui.py
View file @
1d2f2b64
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'operation_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.12
#
# WARNING! All changes made in this file will be lost!
from
PyQt5
import
QtCore
,
QtGui
,
QtWidgets
class
Ui_Dialog
(
object
):
def
setupUi
(
self
,
Dialog
):
Dialog
.
setObjectName
(
"Dialog"
)
Dialog
.
resize
(
711
,
502
)
self
.
gridLayout
=
QtWidgets
.
QGridLayout
(
Dialog
)
self
.
gridLayout
.
setObjectName
(
"gridLayout"
)
self
.
pushButton_3
=
QtWidgets
.
QPushButton
(
Dialog
)
self
.
pushButton_3
.
setObjectName
(
"pushButton_3"
)
self
.
gridLayout
.
addWidget
(
self
.
pushButton_3
,
1
,
3
,
1
,
2
)
self
.
comboBox_3
=
QtWidgets
.
QComboBox
(
Dialog
)
self
.
comboBox_3
.
setEnabled
(
True
)
self
.
comboBox_3
.
setEditable
(
False
)
self
.
comboBox_3
.
setObjectName
(
"comboBox_3"
)
self
.
gridLayout
.
addWidget
(
self
.
comboBox_3
,
6
,
4
,
1
,
1
)
self
.
buttonBox
=
QtWidgets
.
QDialogButtonBox
(
Dialog
)
self
.
buttonBox
.
setEnabled
(
False
)
sizePolicy
=
QtWidgets
.
QSizePolicy
(
QtWidgets
.
QSizePolicy
.
Minimum
,
QtWidgets
.
QSizePolicy
.
Fixed
)
sizePolicy
.
setHorizontalStretch
(
0
)
sizePolicy
.
setVerticalStretch
(
0
)
sizePolicy
.
setHeightForWidth
(
self
.
buttonBox
.
sizePolicy
()
.
hasHeightForWidth
())
self
.
buttonBox
.
setSizePolicy
(
sizePolicy
)
self
.
buttonBox
.
setMinimumSize
(
QtCore
.
QSize
(
0
,
0
))
self
.
buttonBox
.
setToolTip
(
""
)
self
.
buttonBox
.
setToolTipDuration
(
-
1
)
self
.
buttonBox
.
setOrientation
(
QtCore
.
Qt
.
Horizontal
)
self
.
buttonBox
.
setStandardButtons
(
QtWidgets
.
QDialogButtonBox
.
Ok
)
self
.
buttonBox
.
setCenterButtons
(
False
)
self
.
buttonBox
.
setObjectName
(
"buttonBox"
)
self
.
gridLayout
.
addWidget
(
self
.
buttonBox
,
8
,
4
,
1
,
1
)
self
.
label_14
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_14
.
setObjectName
(
"label_14"
)
self
.
gridLayout
.
addWidget
(
self
.
label_14
,
6
,
3
,
1
,
1
)
self
.
horizontalLayout_2
=
QtWidgets
.
QHBoxLayout
()
self
.
horizontalLayout_2
.
setContentsMargins
(
-
1
,
0
,
-
1
,
-
1
)
self
.
horizontalLayout_2
.
setObjectName
(
"horizontalLayout_2"
)
self
.
pushButton_2
=
QtWidgets
.
QPushButton
(
Dialog
)
self
.
pushButton_2
.
setObjectName
(
"pushButton_2"
)
self
.
horizontalLayout_2
.
addWidget
(
self
.
pushButton_2
)
spacerItem
=
QtWidgets
.
QSpacerItem
(
40
,
20
,
QtWidgets
.
QSizePolicy
.
Expanding
,
QtWidgets
.
QSizePolicy
.
Minimum
)
self
.
horizontalLayout_2
.
addItem
(
spacerItem
)
self
.
pushButton
=
QtWidgets
.
QPushButton
(
Dialog
)
self
.
pushButton
.
setObjectName
(
"pushButton"
)
self
.
horizontalLayout_2
.
addWidget
(
self
.
pushButton
)
self
.
horizontalLayout_2
.
setStretch
(
0
,
1
)
self
.
horizontalLayout_2
.
setStretch
(
1
,
1
)
self
.
horizontalLayout_2
.
setStretch
(
2
,
1
)
self
.
gridLayout
.
addLayout
(
self
.
horizontalLayout_2
,
8
,
1
,
1
,
2
)
self
.
label_11
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_11
.
setObjectName
(
"label_11"
)
self
.
gridLayout
.
addWidget
(
self
.
label_11
,
6
,
2
,
1
,
1
)
self
.
comboBox_2
=
QtWidgets
.
QComboBox
(
Dialog
)
self
.
comboBox_2
.
setObjectName
(
"comboBox_2"
)
self
.
comboBox_2
.
addItem
(
""
)
self
.
comboBox_2
.
addItem
(
""
)
self
.
comboBox_2
.
addItem
(
""
)
self
.
gridLayout
.
addWidget
(
self
.
comboBox_2
,
0
,
2
,
1
,
1
)
self
.
label_12
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_12
.
setObjectName
(
"label_12"
)
self
.
gridLayout
.
addWidget
(
self
.
label_12
,
5
,
2
,
1
,
1
)
self
.
label_9
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_9
.
setObjectName
(
"label_9"
)
self
.
gridLayout
.
addWidget
(
self
.
label_9
,
3
,
2
,
1
,
1
)
self
.
verticalLayout
=
QtWidgets
.
QVBoxLayout
()
self
.
verticalLayout
.
setObjectName
(
"verticalLayout"
)
self
.
label_2
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_2
.
setObjectName
(
"label_2"
)
self
.
verticalLayout
.
addWidget
(
self
.
label_2
)
self
.
label_13
=
QtWidgets
.
QLabel
(
Dialog
)
font
=
QtGui
.
QFont
()
font
.
setPointSize
(
8
)
self
.
label_13
.
setFont
(
font
)
self
.
label_13
.
setObjectName
(
"label_13"
)
self
.
verticalLayout
.
addWidget
(
self
.
label_13
)
self
.
gridLayout
.
addLayout
(
self
.
verticalLayout
,
1
,
2
,
1
,
1
)
self
.
horizontalLayout
=
QtWidgets
.
QHBoxLayout
()
self
.
horizontalLayout
.
setObjectName
(
"horizontalLayout"
)
self
.
comboBox
=
QtWidgets
.
QComboBox
(
Dialog
)
self
.
comboBox
.
setEnabled
(
True
)
self
.
comboBox
.
setEditable
(
False
)
self
.
comboBox
.
setObjectName
(
"comboBox"
)
self
.
comboBox
.
addItem
(
""
)
self
.
comboBox
.
addItem
(
""
)
self
.
horizontalLayout
.
addWidget
(
self
.
comboBox
)
spacerItem1
=
QtWidgets
.
QSpacerItem
(
40
,
20
,
QtWidgets
.
QSizePolicy
.
Expanding
,
QtWidgets
.
QSizePolicy
.
Minimum
)
self
.
horizontalLayout
.
addItem
(
spacerItem1
)
self
.
horizontalLayout
.
setStretch
(
0
,
1
)
self
.
horizontalLayout
.
setStretch
(
1
,
1
)
self
.
gridLayout
.
addLayout
(
self
.
horizontalLayout
,
0
,
1
,
1
,
1
)
self
.
label_6
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_6
.
setObjectName
(
"label_6"
)
self
.
gridLayout
.
addWidget
(
self
.
label_6
,
5
,
0
,
1
,
1
)
self
.
lineEdit_6
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
lineEdit_6
.
setEnabled
(
True
)
self
.
lineEdit_6
.
setObjectName
(
"lineEdit_6"
)
self
.
gridLayout
.
addWidget
(
self
.
lineEdit_6
,
6
,
1
,
1
,
1
)
self
.
lineEdit_2
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
lineEdit_2
.
setObjectName
(
"lineEdit_2"
)
self
.
gridLayout
.
addWidget
(
self
.
lineEdit_2
,
2
,
1
,
1
,
1
)
self
.
label_3
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_3
.
setObjectName
(
"label_3"
)
self
.
gridLayout
.
addWidget
(
self
.
label_3
,
2
,
0
,
1
,
1
)
self
.
label_8
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_8
.
setObjectName
(
"label_8"
)
self
.
gridLayout
.
addWidget
(
self
.
label_8
,
2
,
2
,
1
,
1
)
self
.
label_5
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_5
.
setObjectName
(
"label_5"
)
self
.
gridLayout
.
addWidget
(
self
.
label_5
,
4
,
0
,
1
,
1
)
self
.
label_10
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_10
.
setObjectName
(
"label_10"
)
self
.
gridLayout
.
addWidget
(
self
.
label_10
,
4
,
2
,
1
,
1
)
self
.
lineEdit_4
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
lineEdit_4
.
setEnabled
(
True
)
self
.
lineEdit_4
.
setObjectName
(
"lineEdit_4"
)
self
.
gridLayout
.
addWidget
(
self
.
lineEdit_4
,
4
,
1
,
1
,
1
)
self
.
lineEdit_5
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
lineEdit_5
.
setEnabled
(
True
)
self
.
lineEdit_5
.
setObjectName
(
"lineEdit_5"
)
self
.
gridLayout
.
addWidget
(
self
.
lineEdit_5
,
5
,
1
,
1
,
1
)
self
.
label
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label
.
setObjectName
(
"label"
)
self
.
gridLayout
.
addWidget
(
self
.
label
,
1
,
0
,
1
,
1
)
self
.
lineEdit
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
lineEdit
.
setObjectName
(
"lineEdit"
)
self
.
gridLayout
.
addWidget
(
self
.
lineEdit
,
1
,
1
,
1
,
1
)
self
.
label_4
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_4
.
setObjectName
(
"label_4"
)
self
.
gridLayout
.
addWidget
(
self
.
label_4
,
3
,
0
,
1
,
1
)
self
.
lineEdit_3
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
lineEdit_3
.
setEnabled
(
True
)
self
.
lineEdit_3
.
setObjectName
(
"lineEdit_3"
)
self
.
gridLayout
.
addWidget
(
self
.
lineEdit_3
,
3
,
1
,
1
,
1
)
self
.
label_7
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_7
.
setObjectName
(
"label_7"
)
self
.
gridLayout
.
addWidget
(
self
.
label_7
,
6
,
0
,
1
,
1
)
self
.
pickStartPos
=
QtWidgets
.
QPushButton
(
Dialog
)
self
.
pickStartPos
.
setObjectName
(
"pickStartPos"
)
self
.
gridLayout
.
addWidget
(
self
.
pickStartPos
,
2
,
3
,
1
,
1
)
self
.
pickEndPos
=
QtWidgets
.
QPushButton
(
Dialog
)
self
.
pickEndPos
.
setObjectName
(
"pickEndPos"
)
self
.
gridLayout
.
addWidget
(
self
.
pickEndPos
,
3
,
3
,
1
,
1
)
self
.
retranslateUi
(
Dialog
)
QtCore
.
QMetaObject
.
connectSlotsByName
(
Dialog
)
def
retranslateUi
(
self
,
Dialog
):
_translate
=
QtCore
.
QCoreApplication
.
translate
Dialog
.
setWindowTitle
(
_translate
(
"Dialog"
,
"Dialog"
))
self
.
pushButton_3
.
setText
(
_translate
(
"Dialog"
,
"填充
\n
"
"行信息"
))
self
.
label_14
.
setText
(
_translate
(
"Dialog"
,
"语速:"
))
self
.
pushButton_2
.
setText
(
_translate
(
"Dialog"
,
"修改"
))
self
.
pushButton
.
setText
(
_translate
(
"Dialog"
,
"检测"
))
self
.
label_11
.
setText
(
_translate
(
"Dialog"
,
"*请填文字"
))
self
.
comboBox_2
.
setItemText
(
0
,
_translate
(
"Dialog"
,
"增加一行"
))
self
.
comboBox_2
.
setItemText
(
1
,
_translate
(
"Dialog"
,
"修改一行"
))
self
.
comboBox_2
.
setItemText
(
2
,
_translate
(
"Dialog"
,
"删除一行"
))
self
.
label_12
.
setText
(
_translate
(
"Dialog"
,
"*请填数字,必须是不超过100的正整数"
))
self
.
label_9
.
setText
(
_translate
(
"Dialog"
,
"*请填数字,最多保留两位小数"
))
self
.
label_2
.
setText
(
_translate
(
"Dialog"
,
"行(如果操作是增加,则在该行后面增加)"
))
self
.
label_13
.
setText
(
_translate
(
"Dialog"
,
"*需要填在【字幕旁白】页面中的行数"
))
self
.
comboBox
.
setItemText
(
0
,
_translate
(
"Dialog"
,
"字幕"
))
self
.
comboBox
.
setItemText
(
1
,
_translate
(
"Dialog"
,
"旁白"
))
self
.
label_6
.
setText
(
_translate
(
"Dialog"
,
"推荐字数:"
))
self
.
label_3
.
setText
(
_translate
(
"Dialog"
,
"起始时间:"
))
self
.
label_8
.
setText
(
_translate
(
"Dialog"
,
"*请填数字,最多保留两位小数"
))
self
.
label_5
.
setText
(
_translate
(
"Dialog"
,
"字幕:"
))
self
.
label_10
.
setText
(
_translate
(
"Dialog"
,
"*请填文字"
))
self
.
label
.
setText
(
_translate
(
"Dialog"
,
"我想操作第"
))
self
.
label_4
.
setText
(
_translate
(
"Dialog"
,
"结束时间:"
))
self
.
label_7
.
setText
(
_translate
(
"Dialog"
,
"旁白:"
))
self
.
pickStartPos
.
setText
(
_translate
(
"Dialog"
,
"取当前位置"
))
self
.
pickEndPos
.
setText
(
_translate
(
"Dialog"
,
"取当前位置"
))
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'd:\AddCaption\cur_version\accessibility_movie_2\operation_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from
PyQt5
import
QtCore
,
QtGui
,
QtWidgets
class
Ui_Dialog
(
object
):
def
setupUi
(
self
,
Dialog
):
Dialog
.
setObjectName
(
"Dialog"
)
Dialog
.
resize
(
711
,
502
)
self
.
gridLayout
=
QtWidgets
.
QGridLayout
(
Dialog
)
self
.
gridLayout
.
setObjectName
(
"gridLayout"
)
self
.
label_11
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_11
.
setObjectName
(
"label_11"
)
self
.
gridLayout
.
addWidget
(
self
.
label_11
,
6
,
2
,
1
,
1
)
self
.
comboBox_3
=
QtWidgets
.
QComboBox
(
Dialog
)
self
.
comboBox_3
.
setEnabled
(
True
)
self
.
comboBox_3
.
setEditable
(
False
)
self
.
comboBox_3
.
setObjectName
(
"comboBox_3"
)
self
.
gridLayout
.
addWidget
(
self
.
comboBox_3
,
6
,
4
,
1
,
1
)
self
.
label_9
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_9
.
setObjectName
(
"label_9"
)
self
.
gridLayout
.
addWidget
(
self
.
label_9
,
3
,
2
,
1
,
1
)
self
.
verticalLayout
=
QtWidgets
.
QVBoxLayout
()
self
.
verticalLayout
.
setObjectName
(
"verticalLayout"
)
self
.
label_2
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_2
.
setObjectName
(
"label_2"
)
self
.
verticalLayout
.
addWidget
(
self
.
label_2
)
self
.
label_13
=
QtWidgets
.
QLabel
(
Dialog
)
font
=
QtGui
.
QFont
()
font
.
setPointSize
(
8
)
self
.
label_13
.
setFont
(
font
)
self
.
label_13
.
setObjectName
(
"label_13"
)
self
.
verticalLayout
.
addWidget
(
self
.
label_13
)
self
.
gridLayout
.
addLayout
(
self
.
verticalLayout
,
1
,
2
,
1
,
1
)
self
.
label_4
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_4
.
setObjectName
(
"label_4"
)
self
.
gridLayout
.
addWidget
(
self
.
label_4
,
3
,
0
,
1
,
1
)
self
.
pickStartPos
=
QtWidgets
.
QPushButton
(
Dialog
)
self
.
pickStartPos
.
setObjectName
(
"pickStartPos"
)
self
.
gridLayout
.
addWidget
(
self
.
pickStartPos
,
2
,
3
,
1
,
1
)
self
.
label_10
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_10
.
setObjectName
(
"label_10"
)
self
.
gridLayout
.
addWidget
(
self
.
label_10
,
4
,
2
,
1
,
1
)
self
.
label_14
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_14
.
setObjectName
(
"label_14"
)
self
.
gridLayout
.
addWidget
(
self
.
label_14
,
6
,
3
,
1
,
1
)
self
.
label_7
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_7
.
setObjectName
(
"label_7"
)
self
.
gridLayout
.
addWidget
(
self
.
label_7
,
6
,
0
,
1
,
1
)
self
.
label_3
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_3
.
setObjectName
(
"label_3"
)
self
.
gridLayout
.
addWidget
(
self
.
label_3
,
2
,
0
,
1
,
1
)
self
.
pickEndPos
=
QtWidgets
.
QPushButton
(
Dialog
)
self
.
pickEndPos
.
setObjectName
(
"pickEndPos"
)
self
.
gridLayout
.
addWidget
(
self
.
pickEndPos
,
3
,
3
,
1
,
1
)
self
.
label_12
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_12
.
setObjectName
(
"label_12"
)
self
.
gridLayout
.
addWidget
(
self
.
label_12
,
5
,
2
,
1
,
1
)
self
.
lineEdit_6
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
lineEdit_6
.
setEnabled
(
True
)
self
.
lineEdit_6
.
setObjectName
(
"lineEdit_6"
)
self
.
gridLayout
.
addWidget
(
self
.
lineEdit_6
,
6
,
1
,
1
,
1
)
self
.
lineEdit_4
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
lineEdit_4
.
setEnabled
(
True
)
self
.
lineEdit_4
.
setObjectName
(
"lineEdit_4"
)
self
.
gridLayout
.
addWidget
(
self
.
lineEdit_4
,
4
,
1
,
1
,
1
)
self
.
label
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label
.
setObjectName
(
"label"
)
self
.
gridLayout
.
addWidget
(
self
.
label
,
1
,
0
,
1
,
1
)
self
.
pushButton_3
=
QtWidgets
.
QPushButton
(
Dialog
)
self
.
pushButton_3
.
setObjectName
(
"pushButton_3"
)
self
.
gridLayout
.
addWidget
(
self
.
pushButton_3
,
1
,
3
,
1
,
2
)
self
.
buttonBox
=
QtWidgets
.
QDialogButtonBox
(
Dialog
)
self
.
buttonBox
.
setEnabled
(
False
)
sizePolicy
=
QtWidgets
.
QSizePolicy
(
QtWidgets
.
QSizePolicy
.
Minimum
,
QtWidgets
.
QSizePolicy
.
Fixed
)
sizePolicy
.
setHorizontalStretch
(
0
)
sizePolicy
.
setVerticalStretch
(
0
)
sizePolicy
.
setHeightForWidth
(
self
.
buttonBox
.
sizePolicy
()
.
hasHeightForWidth
())
self
.
buttonBox
.
setSizePolicy
(
sizePolicy
)
self
.
buttonBox
.
setMinimumSize
(
QtCore
.
QSize
(
0
,
0
))
self
.
buttonBox
.
setToolTip
(
""
)
self
.
buttonBox
.
setToolTipDuration
(
-
1
)
self
.
buttonBox
.
setOrientation
(
QtCore
.
Qt
.
Horizontal
)
self
.
buttonBox
.
setStandardButtons
(
QtWidgets
.
QDialogButtonBox
.
Ok
)
self
.
buttonBox
.
setCenterButtons
(
False
)
self
.
buttonBox
.
setObjectName
(
"buttonBox"
)
self
.
gridLayout
.
addWidget
(
self
.
buttonBox
,
8
,
4
,
1
,
1
)
self
.
label_8
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_8
.
setObjectName
(
"label_8"
)
self
.
gridLayout
.
addWidget
(
self
.
label_8
,
2
,
2
,
1
,
1
)
self
.
horizontalLayout_2
=
QtWidgets
.
QHBoxLayout
()
self
.
horizontalLayout_2
.
setContentsMargins
(
-
1
,
0
,
-
1
,
-
1
)
self
.
horizontalLayout_2
.
setObjectName
(
"horizontalLayout_2"
)
self
.
pushButton_2
=
QtWidgets
.
QPushButton
(
Dialog
)
self
.
pushButton_2
.
setObjectName
(
"pushButton_2"
)
self
.
horizontalLayout_2
.
addWidget
(
self
.
pushButton_2
)
spacerItem
=
QtWidgets
.
QSpacerItem
(
40
,
20
,
QtWidgets
.
QSizePolicy
.
Expanding
,
QtWidgets
.
QSizePolicy
.
Minimum
)
self
.
horizontalLayout_2
.
addItem
(
spacerItem
)
self
.
pushButton
=
QtWidgets
.
QPushButton
(
Dialog
)
self
.
pushButton
.
setObjectName
(
"pushButton"
)
self
.
horizontalLayout_2
.
addWidget
(
self
.
pushButton
)
self
.
horizontalLayout_2
.
setStretch
(
0
,
1
)
self
.
horizontalLayout_2
.
setStretch
(
1
,
1
)
self
.
horizontalLayout_2
.
setStretch
(
2
,
1
)
self
.
gridLayout
.
addLayout
(
self
.
horizontalLayout_2
,
8
,
1
,
1
,
2
)
self
.
label_6
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_6
.
setObjectName
(
"label_6"
)
self
.
gridLayout
.
addWidget
(
self
.
label_6
,
5
,
0
,
1
,
1
)
self
.
label_5
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_5
.
setObjectName
(
"label_5"
)
self
.
gridLayout
.
addWidget
(
self
.
label_5
,
4
,
0
,
1
,
1
)
self
.
horizontalLayout
=
QtWidgets
.
QHBoxLayout
()
self
.
horizontalLayout
.
setObjectName
(
"horizontalLayout"
)
self
.
comboBox
=
QtWidgets
.
QComboBox
(
Dialog
)
self
.
comboBox
.
setEnabled
(
True
)
self
.
comboBox
.
setEditable
(
False
)
self
.
comboBox
.
setObjectName
(
"comboBox"
)
self
.
comboBox
.
addItem
(
""
)
self
.
comboBox
.
addItem
(
""
)
self
.
horizontalLayout
.
addWidget
(
self
.
comboBox
)
spacerItem1
=
QtWidgets
.
QSpacerItem
(
40
,
20
,
QtWidgets
.
QSizePolicy
.
Expanding
,
QtWidgets
.
QSizePolicy
.
Minimum
)
self
.
horizontalLayout
.
addItem
(
spacerItem1
)
self
.
horizontalLayout
.
setStretch
(
0
,
1
)
self
.
horizontalLayout
.
setStretch
(
1
,
1
)
self
.
gridLayout
.
addLayout
(
self
.
horizontalLayout
,
0
,
1
,
1
,
1
)
self
.
comboBox_2
=
QtWidgets
.
QComboBox
(
Dialog
)
self
.
comboBox_2
.
setObjectName
(
"comboBox_2"
)
self
.
comboBox_2
.
addItem
(
""
)
self
.
comboBox_2
.
addItem
(
""
)
self
.
comboBox_2
.
addItem
(
""
)
self
.
gridLayout
.
addWidget
(
self
.
comboBox_2
,
0
,
2
,
1
,
1
)
self
.
lineEdit_5
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
lineEdit_5
.
setEnabled
(
True
)
self
.
lineEdit_5
.
setObjectName
(
"lineEdit_5"
)
self
.
gridLayout
.
addWidget
(
self
.
lineEdit_5
,
5
,
1
,
1
,
1
)
self
.
lineEdit
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
lineEdit
.
setObjectName
(
"lineEdit"
)
self
.
gridLayout
.
addWidget
(
self
.
lineEdit
,
1
,
1
,
1
,
1
)
self
.
timeEdit
=
QtWidgets
.
QTimeEdit
(
Dialog
)
self
.
timeEdit
.
setCurrentSection
(
QtWidgets
.
QDateTimeEdit
.
SecondSection
)
self
.
timeEdit
.
setCurrentSectionIndex
(
2
)
self
.
timeEdit
.
setObjectName
(
"timeEdit"
)
self
.
gridLayout
.
addWidget
(
self
.
timeEdit
,
2
,
1
,
1
,
1
)
self
.
timeEdit_2
=
QtWidgets
.
QTimeEdit
(
Dialog
)
self
.
timeEdit_2
.
setCurrentSection
(
QtWidgets
.
QDateTimeEdit
.
SecondSection
)
self
.
timeEdit_2
.
setCurrentSectionIndex
(
2
)
self
.
timeEdit_2
.
setObjectName
(
"timeEdit_2"
)
self
.
gridLayout
.
addWidget
(
self
.
timeEdit_2
,
3
,
1
,
1
,
1
)
self
.
retranslateUi
(
Dialog
)
QtCore
.
QMetaObject
.
connectSlotsByName
(
Dialog
)
def
retranslateUi
(
self
,
Dialog
):
_translate
=
QtCore
.
QCoreApplication
.
translate
Dialog
.
setWindowTitle
(
_translate
(
"Dialog"
,
"Dialog"
))
self
.
label_11
.
setText
(
_translate
(
"Dialog"
,
"*请填文字"
))
self
.
label_9
.
setText
(
_translate
(
"Dialog"
,
"*请填数字,最多保留两位小数"
))
self
.
label_2
.
setText
(
_translate
(
"Dialog"
,
"行(如果操作是增加,则在该行后面增加)"
))
self
.
label_13
.
setText
(
_translate
(
"Dialog"
,
"*需要填在【字幕旁白】页面中的行数"
))
self
.
label_4
.
setText
(
_translate
(
"Dialog"
,
"结束时间:"
))
self
.
pickStartPos
.
setText
(
_translate
(
"Dialog"
,
"取当前位置"
))
self
.
label_10
.
setText
(
_translate
(
"Dialog"
,
"*请填文字"
))
self
.
label_14
.
setText
(
_translate
(
"Dialog"
,
"语速:"
))
self
.
label_7
.
setText
(
_translate
(
"Dialog"
,
"旁白:"
))
self
.
label_3
.
setText
(
_translate
(
"Dialog"
,
"起始时间:"
))
self
.
pickEndPos
.
setText
(
_translate
(
"Dialog"
,
"取当前位置"
))
self
.
label_12
.
setText
(
_translate
(
"Dialog"
,
"*请填数字,必须是不超过100的正整数"
))
self
.
label
.
setText
(
_translate
(
"Dialog"
,
"我想操作第"
))
self
.
pushButton_3
.
setText
(
_translate
(
"Dialog"
,
"填充
\n
"
"行信息"
))
self
.
label_8
.
setText
(
_translate
(
"Dialog"
,
"*请填数字,最多保留两位小数"
))
self
.
pushButton_2
.
setText
(
_translate
(
"Dialog"
,
"修改"
))
self
.
pushButton
.
setText
(
_translate
(
"Dialog"
,
"检测"
))
self
.
label_6
.
setText
(
_translate
(
"Dialog"
,
"推荐字数:"
))
self
.
label_5
.
setText
(
_translate
(
"Dialog"
,
"字幕:"
))
self
.
comboBox
.
setItemText
(
0
,
_translate
(
"Dialog"
,
"字幕"
))
self
.
comboBox
.
setItemText
(
1
,
_translate
(
"Dialog"
,
"旁白"
))
self
.
comboBox_2
.
setItemText
(
0
,
_translate
(
"Dialog"
,
"增加一行"
))
self
.
comboBox_2
.
setItemText
(
1
,
_translate
(
"Dialog"
,
"修改一行"
))
self
.
comboBox_2
.
setItemText
(
2
,
_translate
(
"Dialog"
,
"删除一行"
))
self
.
timeEdit
.
setDisplayFormat
(
_translate
(
"Dialog"
,
"hh:mm:ss.zzz"
))
self
.
timeEdit_2
.
setDisplayFormat
(
_translate
(
"Dialog"
,
"hh:mm:ss.zzz"
))
utils.py
View file @
1d2f2b64
...
...
@@ -40,10 +40,8 @@ def transfer_second_to_time(sec: str) -> str:
hour
=
int
(
duration
/
3600
)
minutes
=
int
((
duration
%
3600
)
/
60
)
seconds
=
int
(
duration
%
60
)
idx
=
sec
.
find
(
'.'
)
if
(
idx
==
-
1
):
idx
=
len
(
sec
)
time
=
"
%02
d:
%02
d:
%02
d
%
s"
%
(
hour
,
minutes
,
seconds
,
sec
[
idx
:
idx
+
3
])
msec
=
(
float
(
sec
)
-
hour
*
3600
-
minutes
*
60
-
seconds
)
*
1000
time
=
"
%02
d:
%02
d:
%02
d.
%03
d"
%
(
hour
,
minutes
,
seconds
,
msec
)
return
time
def
replace_path_suffix
(
path
,
new_suffix
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment