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
d949532b
Commit
d949532b
authored
Nov 12, 2022
by
xuanweiace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:在【操作表格】中可以获取当前电影时间作为起始时间或者终止时间
fix: 若干bug和体验问题
parent
4cab3e60
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
25 deletions
+31
-25
main_window.py
main_window.py
+13
-5
main_window.ui
main_window.ui
+3
-12
main_window_ui.py
main_window_ui.py
+1
-8
operation_dialog.py
operation_dialog.py
+14
-0
operation_dialog.ui
operation_dialog.ui
+0
-0
operation_dialog_ui.py
operation_dialog_ui.py
+0
-0
No files found.
main_window.py
View file @
d949532b
...
@@ -133,13 +133,14 @@ class MainWindow(QMainWindow, Ui_MainWindow):
...
@@ -133,13 +133,14 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
action_undo
.
setEnabled
(
False
)
self
.
action_undo
.
setEnabled
(
False
)
self
.
action_redo
.
triggered
.
connect
(
self
.
redo_slot
)
self
.
action_redo
.
triggered
.
connect
(
self
.
redo_slot
)
self
.
action_redo
.
setEnabled
(
False
)
self
.
action_redo
.
setEnabled
(
False
)
self
.
action_view_history
.
triggered
.
connect
(
self
.
view_history_slot
)
# 暂时去掉了
# self.action_view_history.triggered.connect(self.view_history_slot)
self
.
action_operate
.
triggered
.
connect
(
self
.
operate_slot
)
self
.
action_operate
.
triggered
.
connect
(
self
.
operate_slot
)
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
)
self
.
insert_aside_from_now_btn
.
clicked
.
connect
(
self
.
insert_aside_from_now_slot
)
self
.
insert_aside_from_now_btn
.
setEnabled
(
False
)
"""
"""
视频相关信息
视频相关信息
"""
"""
...
@@ -253,10 +254,11 @@ class MainWindow(QMainWindow, Ui_MainWindow):
...
@@ -253,10 +254,11 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# 更新工程信息
# 更新工程信息
self
.
projectContext
.
Init
(
project_path
)
self
.
projectContext
.
Init
(
project_path
)
self
.
update_ui
()
# 如果嗅探到旁白检测未完成,则询问是否继续
# 如果嗅探到旁白检测未完成,则询问是否继续
if
self
.
projectContext
.
detected
==
True
and
self
.
projectContext
.
nd_process
<
1
:
if
self
.
projectContext
.
detected
==
True
and
self
.
projectContext
.
nd_process
<
1
:
self
.
continue_detect_prompt_dialog
.
show_with_msg
(
"您的上次任务未完成,是否继续检测?"
)
self
.
continue_detect_prompt_dialog
.
show_with_msg
(
"您的上次任务未完成,是否继续检测?"
)
self
.
update_ui
()
# 重写关闭Mmainwindow窗口
# 重写关闭Mmainwindow窗口
def
closeEvent
(
self
,
event
):
def
closeEvent
(
self
,
event
):
...
@@ -341,6 +343,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
...
@@ -341,6 +343,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
action_export
.
setEnabled
(
True
)
self
.
action_export
.
setEnabled
(
True
)
self
.
action_operate
.
setEnabled
(
True
)
self
.
action_operate
.
setEnabled
(
True
)
self
.
action_insert_aside_from_now
.
setEnabled
(
True
)
self
.
action_insert_aside_from_now
.
setEnabled
(
True
)
self
.
insert_aside_from_now_btn
.
setEnabled
(
True
)
# todo: 后续这段代码公共的可以抽出来
# todo: 后续这段代码公共的可以抽出来
...
@@ -375,7 +378,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
...
@@ -375,7 +378,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
player
.
setMedia
(
QMediaContent
(
QUrl
(
video_path
)))
# 选取视频文件
self
.
player
.
setMedia
(
QMediaContent
(
QUrl
(
video_path
)))
# 选取视频文件
self
.
playVideo
()
# 播放视频
self
.
playVideo
()
# 播放视频
self
.
action_insert_aside_from_now
.
setEnabled
(
True
)
self
.
action_insert_aside_from_now
.
setEnabled
(
True
)
self
.
insert_aside_from_now_btn
.
setEnabled
(
True
)
self
.
continue_detect_prompt_dialog
.
setModal
(
True
)
def
continue_detect
(
self
):
def
continue_detect
(
self
):
print
(
f
"继续检测,video_path={self.projectContext.video_path}, book_path={self.projectContext.excel_path}"
)
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
)
self
.
start_detect
(
self
.
projectContext
.
video_path
,
self
.
projectContext
.
excel_path
)
...
@@ -712,7 +716,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
...
@@ -712,7 +716,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
user_operation=True的情况:用户双击操作表格,通过【操作表格】进行增删改,通过【在此处添加旁白】来添加一行
user_operation=True的情况:用户双击操作表格,通过【操作表格】进行增删改,通过【在此处添加旁白】来添加一行
initial_ing为true时,不会生成音频,不会写入历史记录
initial_ing为true时,不会生成音频,不会写入历史记录
"""
"""
print
(
"set一次"
)
if
not
user_operation
:
if
not
user_operation
:
self
.
projectContext
.
initial_ing
=
True
self
.
projectContext
.
initial_ing
=
True
subtitle_list
=
self
.
projectContext
.
subtitle_list
subtitle_list
=
self
.
projectContext
.
subtitle_list
...
@@ -1076,6 +1079,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
...
@@ -1076,6 +1079,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
pb_tableWidget
.
setItem
(
self
.
pb_tableWidget
.
setItem
(
row
,
constant
.
Aside
.
AsideColumnNumber
,
item
)
row
,
constant
.
Aside
.
AsideColumnNumber
,
item
)
# debug用的,现在暂时没啥用
def
view_history_slot
(
self
):
def
view_history_slot
(
self
):
print
(
"=="
*
10
)
print
(
"=="
*
10
)
print
(
"self.sld_video.maximumSize"
,
self
.
sld_video
.
maximumSize
(),
print
(
"self.sld_video.maximumSize"
,
self
.
sld_video
.
maximumSize
(),
...
@@ -1151,6 +1155,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
...
@@ -1151,6 +1155,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
operation_dialog
.
show
()
self
.
operation_dialog
.
show
()
def
insert_aside_from_now_slot
(
self
):
def
insert_aside_from_now_slot
(
self
):
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
())
cur_time
=
round
(
self
.
player
.
position
()
/
1000
,
2
)
cur_time
=
round
(
self
.
player
.
position
()
/
1000
,
2
)
idx
=
self
.
calculate_element_row
(
cur_time
)
idx
=
self
.
calculate_element_row
(
cur_time
)
print
(
"[insert_aside_from_now_slot] idx="
,
idx
)
print
(
"[insert_aside_from_now_slot] idx="
,
idx
)
...
...
main_window.ui
View file @
d949532b
...
@@ -309,6 +309,9 @@
...
@@ -309,6 +309,9 @@
background: #ffd740;
background: #ffd740;
}
</string>
}
</string>
</property>
</property>
<property
name=
"value"
>
<number>
99
</number>
</property>
<property
name=
"orientation"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
<enum>
Qt::Horizontal
</enum>
</property>
</property>
...
@@ -587,11 +590,9 @@
...
@@ -587,11 +590,9 @@
</property>
</property>
<addaction
name=
"action_undo"
/>
<addaction
name=
"action_undo"
/>
<addaction
name=
"action_redo"
/>
<addaction
name=
"action_redo"
/>
<addaction
name=
"action_view_history"
/>
<addaction
name=
"separator"
/>
<addaction
name=
"separator"
/>
<addaction
name=
"action_insert_aside_from_now"
/>
<addaction
name=
"action_insert_aside_from_now"
/>
<addaction
name=
"action_operate"
/>
<addaction
name=
"action_operate"
/>
<addaction
name=
"action_insert_subtitle_from_now"
/>
</widget>
</widget>
<widget
class=
"QMenu"
name=
"menu_3"
>
<widget
class=
"QMenu"
name=
"menu_3"
>
<property
name=
"title"
>
<property
name=
"title"
>
...
@@ -652,11 +653,6 @@
...
@@ -652,11 +653,6 @@
<string>
旁白音频合成
</string>
<string>
旁白音频合成
</string>
</property>
</property>
</action>
</action>
<action
name=
"action_view_history"
>
<property
name=
"text"
>
<string>
----
</string>
</property>
</action>
<action
name=
"action_refresh_tab"
>
<action
name=
"action_refresh_tab"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
刷新且保存表格
</string>
<string>
刷新且保存表格
</string>
...
@@ -677,11 +673,6 @@
...
@@ -677,11 +673,6 @@
<string>
当前位置插入旁白
</string>
<string>
当前位置插入旁白
</string>
</property>
</property>
</action>
</action>
<action
name=
"action_insert_subtitle_from_now"
>
<property
name=
"text"
>
<string>
当前位置插入字幕
</string>
</property>
</action>
<action
name=
"action_create"
>
<action
name=
"action_create"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
新建
</string>
<string>
新建
</string>
...
...
main_window_ui.py
View file @
d949532b
...
@@ -166,6 +166,7 @@ class Ui_MainWindow(object):
...
@@ -166,6 +166,7 @@ class Ui_MainWindow(object):
" QSlider::sub-page {
\n
"
" QSlider::sub-page {
\n
"
" background: #ffd740;
\n
"
" background: #ffd740;
\n
"
" }"
)
" }"
)
self
.
sld_audio
.
setProperty
(
"value"
,
99
)
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
)
...
@@ -342,8 +343,6 @@ class Ui_MainWindow(object):
...
@@ -342,8 +343,6 @@ class Ui_MainWindow(object):
self
.
action_3
.
setObjectName
(
"action_3"
)
self
.
action_3
.
setObjectName
(
"action_3"
)
self
.
action_4
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
action_4
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
action_4
.
setObjectName
(
"action_4"
)
self
.
action_4
.
setObjectName
(
"action_4"
)
self
.
action_view_history
=
QtWidgets
.
QAction
(
MainWindow
)
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
)
...
@@ -352,8 +351,6 @@ class Ui_MainWindow(object):
...
@@ -352,8 +351,6 @@ class Ui_MainWindow(object):
self
.
action_export
.
setObjectName
(
"action_export"
)
self
.
action_export
.
setObjectName
(
"action_export"
)
self
.
action_insert_aside_from_now
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
action_insert_aside_from_now
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
action_insert_aside_from_now
.
setObjectName
(
"action_insert_aside_from_now"
)
self
.
action_insert_aside_from_now
.
setObjectName
(
"action_insert_aside_from_now"
)
self
.
action_insert_subtitle_from_now
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
action_insert_subtitle_from_now
.
setObjectName
(
"action_insert_subtitle_from_now"
)
self
.
action_create
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
action_create
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
action_create
.
setObjectName
(
"action_create"
)
self
.
action_create
.
setObjectName
(
"action_create"
)
self
.
menu
.
addAction
(
self
.
action_create
)
self
.
menu
.
addAction
(
self
.
action_create
)
...
@@ -366,11 +363,9 @@ class Ui_MainWindow(object):
...
@@ -366,11 +363,9 @@ 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
.
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_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
()
...
@@ -407,12 +402,10 @@ class Ui_MainWindow(object):
...
@@ -407,12 +402,10 @@ class Ui_MainWindow(object):
self
.
action_redo
.
setText
(
_translate
(
"MainWindow"
,
"重做"
))
self
.
action_redo
.
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_refresh_tab
.
setText
(
_translate
(
"MainWindow"
,
"刷新且保存表格"
))
self
.
action_refresh_tab
.
setText
(
_translate
(
"MainWindow"
,
"刷新且保存表格"
))
self
.
action_operate
.
setText
(
_translate
(
"MainWindow"
,
"操作表格"
))
self
.
action_operate
.
setText
(
_translate
(
"MainWindow"
,
"操作表格"
))
self
.
action_export
.
setText
(
_translate
(
"MainWindow"
,
"导出"
))
self
.
action_export
.
setText
(
_translate
(
"MainWindow"
,
"导出"
))
self
.
action_insert_aside_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"
,
"新建"
))
self
.
action_create
.
setText
(
_translate
(
"MainWindow"
,
"新建"
))
...
...
operation_dialog.py
View file @
d949532b
...
@@ -6,6 +6,7 @@ from PyQt5.QtWidgets import *
...
@@ -6,6 +6,7 @@ from PyQt5.QtWidgets import *
import
utils
import
utils
from
operation_dialog_ui
import
Ui_Dialog
from
operation_dialog_ui
import
Ui_Dialog
# from main_window import MainWindow
# todo 注意,删除行,添加行,暂不支持【撤销与重做】功能!!!
# todo 注意,删除行,添加行,暂不支持【撤销与重做】功能!!!
...
@@ -28,6 +29,11 @@ class Operation_Dialog(QDialog, Ui_Dialog):
...
@@ -28,6 +29,11 @@ class Operation_Dialog(QDialog, Ui_Dialog):
# 如果是【修改一行】,选择行的时候要瞬间更新成目前行的内容
# 如果是【修改一行】,选择行的时候要瞬间更新成目前行的内容
self
.
pushButton_3
.
clicked
.
connect
(
self
.
fill_row_info_slot
)
self
.
pushButton_3
.
clicked
.
connect
(
self
.
fill_row_info_slot
)
self
.
pickStartPos
.
clicked
.
connect
(
self
.
pick_start_pos_slot
)
self
.
pickEndPos
.
clicked
.
connect
(
self
.
pick_end_pos_slot
)
self
.
buttonBox
.
setEnabled
(
False
)
self
.
buttonBox
.
setEnabled
(
False
)
self
.
buttonBox
.
button
(
QDialogButtonBox
.
StandardButton
.
Ok
)
.
clicked
.
connect
(
self
.
buttonBox
.
button
(
QDialogButtonBox
.
StandardButton
.
Ok
)
.
clicked
.
connect
(
self
.
start_operation_slot
)
self
.
start_operation_slot
)
...
@@ -44,6 +50,14 @@ class Operation_Dialog(QDialog, Ui_Dialog):
...
@@ -44,6 +50,14 @@ class Operation_Dialog(QDialog, Ui_Dialog):
self
.
zmpb_change_slot
()
self
.
zmpb_change_slot
()
self
.
adddel_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
)
def
pick_end_pos_slot
(
self
):
time
=
utils
.
transfer_second_to_time
(
str
(
self
.
mainWindow
.
player
.
position
()
/
1000
))
self
.
lineEdit_3
.
setText
(
time
)
def
zmpb_change_slot
(
self
):
def
zmpb_change_slot
(
self
):
# 如果是删除,则直接return
# 如果是删除,则直接return
if
self
.
comboBox_2
.
currentText
()
==
"删除一行"
:
if
self
.
comboBox_2
.
currentText
()
==
"删除一行"
:
...
...
operation_dialog.ui
View file @
d949532b
This diff is collapsed.
Click to expand it.
operation_dialog_ui.py
View file @
d949532b
This diff is collapsed.
Click to expand it.
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