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
103358ef
Commit
103358ef
authored
Aug 10, 2023
by
cxy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update menu
parent
d6ffde94
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
29 deletions
+77
-29
main_window.py
main_window.py
+36
-9
main_window.ui
main_window.ui
+2
-2
main_window_ui.py
main_window_ui.py
+37
-18
speech_synthesis.py
speech_synthesis.py
+2
-0
No files found.
main_window.py
View file @
103358ef
...
...
@@ -132,12 +132,16 @@ class MainWindow(QMainWindow, Ui_MainWindow):
"""
self
.
setting
.
triggered
.
connect
(
self
.
show_setting_dialog
)
# 设置
self
.
action_3
.
triggered
.
connect
(
self
.
show_detect_dialog
)
self
.
action_3
.
setEnabled
(
False
)
self
.
action_4
.
triggered
.
connect
(
self
.
show_assemble_dialog
)
self
.
action_4
.
setEnabled
(
False
)
self
.
action_5
.
triggered
.
connect
(
self
.
import_excel
)
self
.
action_5
.
setEnabled
(
False
)
# menu4_action = QtWidgets.QAction()
# menu4_action.setObjectName("menu4_action")
# self.menu_4.addAction(menu4_action)
# menu4_action.triggered.connect(self.show_detect_dialog)
# self.action_3.triggered.connect(self.show_detect_dialog)
# self.action_3.setEnabled(True)
# self.action_4.triggered.connect(self.show_assemble_dialog)
# self.action_4.setEnabled(False)
# self.action_5.triggered.connect(self.import_excel)
# self.action_5.setEnabled(False)
self
.
action_create
.
triggered
.
connect
(
self
.
show_create_dialog
)
# 新建工程
self
.
action_save
.
triggered
.
connect
(
self
.
save_project
)
self
.
action_save
.
setEnabled
(
False
)
...
...
@@ -317,6 +321,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# 如果选择的行索引小于2,弹出上下文菜单
menu
=
QMenu
()
item1
=
menu
.
addAction
(
"删除"
)
add_pb_item
=
menu
.
addAction
(
"新增旁白"
)
# 转换坐标系
screenPos
=
self
.
all_tableWidget
.
mapToGlobal
(
pos
)
...
...
@@ -329,6 +334,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
rowNum
,
1
)
.
text
(),
self
.
all_tableWidget
.
item
(
rowNum
,
2
)
.
text
())
self
.
del_line_operation_slot
(
rowNum
+
1
)
return
if
action
==
add_pb_item
:
to_be_delete_element
=
self
.
projectContext
.
all_elements
[
rowNum
]
self
.
insert_aside_from_cur_time
(
float
(
to_be_delete_element
.
st_time_sec
))
return
# 重写关闭Mmainwindow窗口
def
closeEvent
(
self
,
event
):
...
...
@@ -591,7 +600,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
projectContext
.
excel_path
=
book_path
# 获取视频的时长等信息,初始化开始结束时间
startTime
=
"00:00:
2
0"
startTime
=
"00:00:
0
0"
video
=
cv2
.
VideoCapture
(
video_path
)
fps
=
video
.
get
(
cv2
.
CAP_PROP_FPS
)
...
...
@@ -1685,6 +1694,26 @@ class MainWindow(QMainWindow, Ui_MainWindow):
else
:
self
.
add_line_operation_slot
(
idx
,
str
(
cur_time
),
str
(
cur_time
+
1
),
""
,
"插入旁白,推荐字数为0"
,
""
,
self
.
projectContext
.
speaker_speed
)
def
insert_aside_from_cur_time
(
self
,
cur_time
:
float
):
"""在当前位置插入旁白
根据当前时间找到表格中合适插入的位置,然后在对应位置添加旁白
"""
if
self
.
player
.
duration
()
==
0
or
self
.
projectContext
.
project_base_dir
in
[
None
,
""
]:
self
.
prompt_dialog
.
show_with_msg
(
"插入失败!未检测到视频或工程!"
)
return
print
(
"self.player.position()"
,
self
.
player
.
position
())
idx
=
self
.
calculate_element_row
(
cur_time
)
print
(
"idex :"
+
str
(
idx
))
print
(
"[insert_aside_from_now_slot] idx="
,
idx
)
# 其实end_time目前是没啥用的,可以删掉了
print
(
"cur_lens"
,
len
(
self
.
projectContext
.
all_elements
))
if
idx
<
len
(
self
.
projectContext
.
all_elements
)
-
1
:
self
.
add_line_operation_slot
(
idx
,
str
(
cur_time
),
self
.
projectContext
.
all_elements
[
idx
+
1
]
.
st_time_sec
,
""
,
"插入旁白,推荐字数为0"
,
""
,
self
.
projectContext
.
speaker_speed
)
else
:
self
.
add_line_operation_slot
(
idx
,
str
(
cur_time
),
str
(
cur_time
+
1
),
""
,
"插入旁白,推荐字数为0"
,
""
,
self
.
projectContext
.
speaker_speed
)
def
calculate_element_row
(
self
,
cur_time
:
float
):
"""确认表格中适合cur_time的插入位置
...
...
@@ -1824,7 +1853,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# new_list = []
for
new_element
in
elements
:
start_time_map
[
new_element
.
st_time_sec
]
=
""
# print(">>>>>>remove start")
for
aside
in
self
.
projectContext
.
aside_list
:
# 使用切片复制整个列表
aside
.
print_self
()
if
aside
.
aside
!=
None
and
aside
.
aside
!=
""
and
aside
.
st_time_sec
not
in
start_time_map
:
...
...
@@ -1835,7 +1863,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# new_list.append(aside)
# self.projectContext.aside_list=new_list
# self.refresh_tab_slot(True)
print
(
">>>>>>remove end"
)
for
item
in
remove_list
:
item
.
print_self
()
idx
=
0
...
...
main_window.ui
View file @
103358ef
<?xml version="1.0" encoding="UTF-8"?>
<
!-- <
?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
...
...
@@ -709,4 +709,4 @@
</customwidgets>
<resources/>
<connections/>
</ui>
</ui>
-->
main_window_ui.py
View file @
103358ef
...
...
@@ -327,8 +327,14 @@ class Ui_MainWindow(object):
self
.
menu
.
setObjectName
(
"menu"
)
self
.
menu_2
=
QtWidgets
.
QMenu
(
self
.
menubar
)
self
.
menu_2
.
setObjectName
(
"menu_2"
)
self
.
menu_3
=
QtWidgets
.
QMenu
(
self
.
menubar
)
self
.
menu_3
.
setObjectName
(
"menu_3"
)
# self.menu_3 = QtWidgets.QMenu(self.menubar)
# self.menu_3.setObjectName("menu_3")
self
.
menu_4
=
QtWidgets
.
QMenu
(
self
.
menubar
)
self
.
menu_4
.
setObjectName
(
"menu_4"
)
self
.
menu_5
=
QtWidgets
.
QMenu
(
self
.
menubar
)
self
.
menu_5
.
setObjectName
(
"menu_5"
)
self
.
menu_6
=
QtWidgets
.
QMenu
(
self
.
menubar
)
self
.
menu_6
.
setObjectName
(
"menu_6"
)
MainWindow
.
setMenuBar
(
self
.
menubar
)
self
.
statusbar
=
QtWidgets
.
QStatusBar
(
MainWindow
)
self
.
statusbar
.
setObjectName
(
"statusbar"
)
...
...
@@ -355,12 +361,18 @@ class Ui_MainWindow(object):
self
.
action_redo
=
QtWidgets
.
QAction
(
MainWindow
)
# self.action_redo.setFont(font)
self
.
action_redo
.
setObjectName
(
"action_redo"
)
self
.
action_3
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
action_3
.
setObjectName
(
"action_3"
)
self
.
action_4
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
action_4
.
setObjectName
(
"action_4"
)
self
.
action_5
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
action_5
.
setObjectName
(
"action_5"
)
self
.
action_3
=
QtWidgets
.
QAction
(
"旁白区间检测"
,
self
,
triggered
=
self
.
show_detect_dialog
)
self
.
action_3
.
setEnabled
(
False
)
self
.
action_4
=
QtWidgets
.
QAction
(
"旁白音频合成"
,
self
,
triggered
=
self
.
show_assemble_dialog
)
self
.
action_4
.
setEnabled
(
False
)
self
.
action_5
=
QtWidgets
.
QAction
(
"旁白导入"
,
self
,
triggered
=
self
.
import_excel
)
self
.
action_5
.
setEnabled
(
False
)
# self.action_3.setObjectName("action_3")
# self.action_4 = QtWidgets.QAction(MainWindow)
# self.action_4.setObjectName("action_4")
# self.action_5 = QtWidgets.QAction(MainWindow)
# self.action_5.setObjectName("action_5")
self
.
action_operate
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
action_operate
.
setObjectName
(
"action_operate"
)
self
.
action_export
=
QtWidgets
.
QAction
(
MainWindow
)
...
...
@@ -384,13 +396,18 @@ class Ui_MainWindow(object):
self
.
menu_2
.
addSeparator
()
self
.
menu_2
.
addAction
(
self
.
action_insert_aside_from_now
)
self
.
menu_2
.
addAction
(
self
.
action_operate
)
self
.
menu_3
.
addAction
(
self
.
action_3
)
self
.
menu_3
.
addAction
(
self
.
action_4
)
self
.
menu_3
.
addAction
(
self
.
action_5
)
self
.
menu_3
.
addSeparator
()
#
self.menu_3.addAction(self.action_3)
#
self.menu_3.addAction(self.action_4)
#
self.menu_3.addAction(self.action_5)
#
self.menu_3.addSeparator()
self
.
menubar
.
addAction
(
self
.
menu
.
menuAction
())
self
.
menubar
.
addAction
(
self
.
menu_2
.
menuAction
())
self
.
menubar
.
addAction
(
self
.
menu_3
.
menuAction
())
self
.
menubar
.
addAction
(
self
.
action_3
)
self
.
menubar
.
addAction
(
self
.
action_4
)
self
.
menubar
.
addAction
(
self
.
action_5
)
# self.menubar.addAction(self.menu_5.menuAction())
# self.menubar.addAction(self.menu_6.menuAction())
# self.menubar.addAction(self.menu_3.menuAction())
self
.
retranslateUi
(
MainWindow
)
self
.
tabWidget
.
setCurrentIndex
(
0
)
...
...
@@ -410,7 +427,10 @@ class Ui_MainWindow(object):
self
.
pb_label
.
setText
(
_translate
(
"MainWindow"
,
"刻度"
))
self
.
menu
.
setTitle
(
_translate
(
"MainWindow"
,
"文件"
))
self
.
menu_2
.
setTitle
(
_translate
(
"MainWindow"
,
"编辑"
))
self
.
menu_3
.
setTitle
(
_translate
(
"MainWindow"
,
"功能按键"
))
# self.menu_3.setTitle(_translate("MainWindow", "功能按键"))
self
.
menu_4
.
setTitle
(
_translate
(
"MainWindow"
,
"旁白区间检测"
))
self
.
menu_5
.
setTitle
(
_translate
(
"MainWindow"
,
"旁白音频合成"
))
self
.
menu_6
.
setTitle
(
_translate
(
"MainWindow"
,
"旁白导入"
))
self
.
setting
.
setText
(
_translate
(
"MainWindow"
,
"设置"
))
self
.
action_open_project
.
setText
(
_translate
(
"MainWindow"
,
"打开"
))
self
.
import_movie
.
setText
(
_translate
(
"MainWindow"
,
"视频导入"
))
...
...
@@ -418,15 +438,14 @@ class Ui_MainWindow(object):
self
.
action_save
.
setText
(
_translate
(
"MainWindow"
,
"保存并备份"
))
self
.
action_undo
.
setText
(
_translate
(
"MainWindow"
,
"撤销"
))
self
.
action_redo
.
setText
(
_translate
(
"MainWindow"
,
"重做"
))
self
.
action_3
.
setText
(
_translate
(
"MainWindow"
,
"旁白区间检测"
))
self
.
action_4
.
setText
(
_translate
(
"MainWindow"
,
"旁白音频合成"
))
self
.
action_5
.
setText
(
_translate
(
"MainWindow"
,
"旁白导入"
))
#
self.action_3.setText(_translate("MainWindow", "旁白区间检测"))
#
self.action_4.setText(_translate("MainWindow", "旁白音频合成"))
#
self.action_5.setText(_translate("MainWindow", "旁白导入"))
self
.
action_operate
.
setText
(
_translate
(
"MainWindow"
,
"操作表格"
))
self
.
action_export
.
setText
(
_translate
(
"MainWindow"
,
"导出"
))
self
.
action_insert_aside_from_now
.
setText
(
_translate
(
"MainWindow"
,
"当前位置插入旁白"
))
self
.
action_create
.
setText
(
_translate
(
"MainWindow"
,
"新建"
))
from
myVideoWidget
import
myVideoWidget
from
myvideoslider
import
myVideoSlider
from
mywidgetcontents
import
myWidgetContents
speech_synthesis.py
View file @
103358ef
...
...
@@ -68,6 +68,8 @@ def init_speakers():
global
speakers
for
speaker_info
in
content
[
"speaker_details"
]:
speakers
.
append
(
Speaker
(
speaker_info
))
for
speaker_info
in
content
[
"speaker_zju_details"
]:
speakers
.
append
(
Speaker
(
speaker_info
))
def
choose_speaker
(
speaker_name
:
str
)
->
Speaker
:
...
...
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