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
b20c1c20
Commit
b20c1c20
authored
Aug 25, 2023
by
陈晓勇(工程师)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update ui
parent
db7d6ee9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
86 additions
and
9 deletions
+86
-9
create_dialog.py
create_dialog.py
+11
-1
create_dialog_ui.py
create_dialog_ui.py
+13
-0
detect_with_ocr.py
detect_with_ocr.py
+1
-0
main_window.py
main_window.py
+30
-3
main_window_ui.py
main_window_ui.py
+30
-4
operation_dialog.py
operation_dialog.py
+1
-1
No files found.
create_dialog.py
View file @
b20c1c20
...
...
@@ -16,14 +16,23 @@ from prompt_dialog import Prompt_Dialog
class
Create_Dialog
(
QDialog
,
Ui_Dialog
):
init_project_signal
=
pyqtSignal
(
str
)
def
__init__
(
self
):
def
__init__
(
self
,
mainWindow
):
super
(
Create_Dialog
,
self
)
.
__init__
()
self
.
mainWindow
=
mainWindow
self
.
setupUi
(
self
)
self
.
setWindowTitle
(
"新建工程"
)
self
.
get_dir
.
clicked
.
connect
(
self
.
choose_root
)
self
.
confirm
.
clicked
.
connect
(
self
.
create_project
)
self
.
get_video_dir
.
clicked
.
connect
(
self
.
choose_video
)
self
.
prompt_dialog
=
Prompt_Dialog
()
self
.
cancel
.
clicked
.
connect
(
self
.
close_dialog
)
self
.
video_path
=
None
def
choose_video
(
self
):
path
=
QFileDialog
.
getOpenFileUrl
(
self
,
"选择待导入视频"
,
QUrl
(
os
.
getcwd
()),
"Video Files(*.mp4 *.rmvb *mkv *avi *.);; 所有文件(*.*)"
)[
0
]
self
.
video_input
.
setText
(
path
.
path
()[
1
:])
self
.
video_path
=
path
def
choose_root
(
self
):
"""选择存放新工程的文件夹
...
...
@@ -54,6 +63,7 @@ class Create_Dialog(QDialog, Ui_Dialog):
self
.
prompt_dialog
.
show_with_msg
(
"请输入工程名称"
)
else
:
self
.
prompt_dialog
.
show_with_msg
(
"请输入合法文件夹路径"
)
self
.
mainWindow
.
play_video
(
self
.
video_path
)
def
close_dialog
(
self
):
"""关闭窗口
...
...
create_dialog_ui.py
View file @
b20c1c20
...
...
@@ -29,6 +29,13 @@ class Ui_Dialog(object):
self
.
get_dir
.
setObjectName
(
"get_dir"
)
self
.
gridLayout
.
addWidget
(
self
.
get_dir
,
0
,
2
,
1
,
1
)
self
.
video_input
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
video_input
.
setObjectName
(
"video_input"
)
self
.
gridLayout
.
addWidget
(
self
.
video_input
,
2
,
1
,
1
,
1
)
self
.
get_video_dir
=
QtWidgets
.
QPushButton
(
Dialog
)
self
.
get_video_dir
.
setObjectName
(
"get_video_dir"
)
self
.
gridLayout
.
addWidget
(
self
.
get_video_dir
,
2
,
2
,
1
,
1
)
self
.
rootLabel
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
rootLabel
.
setObjectName
(
"rootLabel"
)
self
.
gridLayout
.
addWidget
(
self
.
rootLabel
,
0
,
0
,
1
,
1
)
...
...
@@ -37,6 +44,10 @@ class Ui_Dialog(object):
self
.
nameLabel
.
setObjectName
(
"nameLabel"
)
self
.
gridLayout
.
addWidget
(
self
.
nameLabel
,
1
,
0
,
1
,
1
)
self
.
videoPath
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
videoPath
.
setObjectName
(
"videoPath"
)
self
.
gridLayout
.
addWidget
(
self
.
videoPath
,
2
,
0
,
1
,
1
)
self
.
gridLayout
.
addWidget
(
self
.
name_input
,
1
,
1
,
1
,
1
)
self
.
gridLayout_2
.
addLayout
(
self
.
gridLayout
,
0
,
0
,
1
,
1
)
self
.
horizontalLayout
=
QtWidgets
.
QHBoxLayout
()
...
...
@@ -68,6 +79,8 @@ class Ui_Dialog(object):
Dialog
.
setWindowTitle
(
_translate
(
"Dialog"
,
"Dialog"
))
self
.
nameLabel
.
setText
(
_translate
(
"Dialog"
,
"工程名称"
))
self
.
rootLabel
.
setText
(
_translate
(
"Dialog"
,
"目标路径"
))
self
.
videoPath
.
setText
(
_translate
(
"Dialog"
,
"视频路径"
))
self
.
get_dir
.
setText
(
_translate
(
"Dialog"
,
"打开文件夹"
))
self
.
get_video_dir
.
setText
(
_translate
(
"Dialog"
,
"导入视频"
))
self
.
confirm
.
setText
(
_translate
(
"Dialog"
,
"确认"
))
self
.
cancel
.
setText
(
_translate
(
"Dialog"
,
"取消"
))
detect_with_ocr.py
View file @
b20c1c20
...
...
@@ -55,6 +55,7 @@ def get_position(video_path: str, start_time: float, rate: float, rate_bottom: f
Returns:
Tuple[float, float]: 字幕在整个画面中的上下边界位置
"""
print
(
">>>>>>>>>>open"
)
print
(
"video_path:"
,
video_path
)
video
=
cv2
.
VideoCapture
(
video_path
)
# print("video:", video)
...
...
main_window.py
View file @
b20c1c20
...
...
@@ -116,7 +116,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
assemble_dialog
.
start_assemble_signal
.
connect
(
self
.
synthesis
.
synthesis_slot
)
self
.
create_dialog
=
Create_Dialog
()
self
.
create_dialog
=
Create_Dialog
(
self
)
self
.
create_dialog
.
init_project_signal
.
connect
(
self
.
init_project
)
# 工程导出相关组件
...
...
@@ -219,6 +219,17 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
insert_aside_from_now_btn
.
clicked
.
connect
(
self
.
insert_aside_from_now_slot
)
self
.
insert_aside_from_now_btn
.
setEnabled
(
False
)
self
.
up_ocr_btn
.
clicked
.
connect
(
self
.
up_ocr
)
self
.
down_ocr_btn
.
clicked
.
connect
(
self
.
down_ocr
)
self
.
up_ocr_bottom_btn
.
clicked
.
connect
(
self
.
up_ocr_bottom
)
self
.
down_ocr_bottom_btn
.
clicked
.
connect
(
self
.
down_ocr_bottom
)
self
.
confirm_head_aside_btn
.
clicked
.
connect
(
self
.
confirm_head_aside
)
"""视频预览相关信息
...
...
@@ -576,6 +587,19 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# print(">>>>>>>>>>>>>>>start detect")
# self.start_detect_direct()
def
play_video
(
self
,
path
):
self
.
player
.
setMedia
(
QMediaContent
(
path
))
# 选取视频文件
self
.
playVideo
()
video_path
=
path
.
path
()
self
.
projectContext
.
video_path
=
video_path
[
1
:]
excel_name
=
os
.
path
.
splitext
(
os
.
path
.
basename
(
video_path
))[
0
]
self
.
projectContext
.
excel_path
=
os
.
path
.
join
(
self
.
projectContext
.
project_base_dir
,
excel_name
+
".xlsx"
)
self
.
action_export
.
setEnabled
(
True
)
self
.
action_operate
.
setEnabled
(
True
)
self
.
action_insert_aside_from_now
.
setEnabled
(
True
)
self
.
insert_aside_from_now_btn
.
setEnabled
(
True
)
def
up_ocr
(
self
):
self
.
widget
.
change_painter_flag
(
True
)
h
=
self
.
widget
.
up
(
3
)
...
...
@@ -758,6 +782,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
show_warning_msg_box
(
"请输入视频文件路径"
)
return
elif
not
os
.
path
.
exists
(
video_path
):
print
(
">>>>>>>>>>>video path:"
+
video_path
)
self
.
show_warning_msg_box
(
"请确认视频文件是否存在"
)
return
if
len
(
book_path
)
==
0
:
...
...
@@ -2382,4 +2407,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
(
position
/
self
.
sld_video
.
maximum
())
*
self
.
player
.
duration
())
self
.
aside_head_time
=
utils
.
transfer_second_to_time
(
str
(
round
(
video_position
/
1000
,
2
)))
self
.
import_excel_dialog
.
show_with_msg
(
"定位成功:"
+
self
.
aside_head_time
)
\ No newline at end of file
self
.
import_excel_dialog
.
show_with_msg
(
"定位成功:"
+
self
.
aside_head_time
)
\ No newline at end of file
main_window_ui.py
View file @
b20c1c20
...
...
@@ -309,7 +309,27 @@ class Ui_MainWindow(object):
self
.
insert_aside_from_now_btn
=
QtWidgets
.
QPushButton
(
self
.
centralwidget
)
self
.
insert_aside_from_now_btn
.
setObjectName
(
"insert_aside_from_now_btn"
)
self
.
horizontalLayout_6
.
addWidget
(
self
.
insert_aside_from_now_btn
)
self
.
horizontalLayout_7
=
QtWidgets
.
QHBoxLayout
()
self
.
horizontalLayout_7
.
setObjectName
(
"horizontalLayout_7"
)
self
.
up_ocr_btn
=
QtWidgets
.
QPushButton
(
self
.
centralwidget
)
self
.
up_ocr_btn
.
setObjectName
(
"up_ocr_btn"
)
self
.
horizontalLayout_7
.
addWidget
(
self
.
up_ocr_btn
)
self
.
down_ocr_btn
=
QtWidgets
.
QPushButton
(
self
.
centralwidget
)
self
.
down_ocr_btn
.
setObjectName
(
"down_ocr_btn"
)
self
.
horizontalLayout_7
.
addWidget
(
self
.
down_ocr_btn
)
self
.
up_ocr_bottom_btn
=
QtWidgets
.
QPushButton
(
self
.
centralwidget
)
self
.
up_ocr_bottom_btn
.
setObjectName
(
"up_ocr_bottom_btn"
)
self
.
horizontalLayout_7
.
addWidget
(
self
.
up_ocr_bottom_btn
)
self
.
down_ocr_bottom_btn
=
QtWidgets
.
QPushButton
(
self
.
centralwidget
)
self
.
down_ocr_bottom_btn
.
setObjectName
(
"down_ocr_bottom_btn"
)
self
.
horizontalLayout_7
.
addWidget
(
self
.
down_ocr_bottom_btn
)
self
.
confirm_head_aside_btn
=
QtWidgets
.
QPushButton
(
self
.
centralwidget
)
self
.
confirm_head_aside_btn
.
setObjectName
(
"confirm_head_aside_btn"
)
self
.
horizontalLayout_7
.
addWidget
(
self
.
confirm_head_aside_btn
)
self
.
verticalLayout_2
.
addLayout
(
self
.
horizontalLayout_6
)
self
.
verticalLayout_2
.
addLayout
(
self
.
horizontalLayout_7
)
self
.
verticalLayout_2
.
setStretch
(
0
,
8
)
self
.
verticalLayout_2
.
setStretch
(
1
,
1
)
self
.
shuiping
.
addLayout
(
self
.
verticalLayout_2
)
...
...
@@ -531,7 +551,7 @@ class Ui_MainWindow(object):
self
.
menu
.
addAction
(
self
.
action_create
)
self
.
menu
.
addAction
(
self
.
action_open_project
)
self
.
menu
.
addSeparator
()
self
.
menu
.
addAction
(
self
.
import_movie
)
#
self.menu.addAction(self.import_movie)
self
.
menu
.
addAction
(
self
.
action_export
)
self
.
menu
.
addSeparator
()
self
.
menu
.
addAction
(
self
.
action_save
)
...
...
@@ -546,8 +566,8 @@ class Ui_MainWindow(object):
# 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_7
.
menuAction
())
#
self.menubar.addAction(self.menu_2.menuAction())
#
self.menubar.addAction(self.menu_7.menuAction())
self
.
menubar
.
addAction
(
self
.
action_3
)
self
.
menubar
.
addAction
(
self
.
action_4
)
self
.
menubar
.
addAction
(
self
.
action_5
)
...
...
@@ -572,6 +592,11 @@ class Ui_MainWindow(object):
self
.
lab_audio
.
setText
(
_translate
(
"MainWindow"
,
"音量:100
%
"
))
self
.
pb_audio
.
setText
(
_translate
(
"MainWindow"
,
"旁白音量:100
%
"
))
self
.
insert_aside_from_now_btn
.
setText
(
_translate
(
"MainWindow"
,
"当前位置插入旁白"
))
self
.
up_ocr_btn
.
setText
(
_translate
(
"MainWindow"
,
"字幕上边界上移"
))
self
.
down_ocr_btn
.
setText
(
_translate
(
"MainWindow"
,
"字幕上边界下移"
))
self
.
up_ocr_bottom_btn
.
setText
(
_translate
(
"MainWindow"
,
"字幕下边界上移"
))
self
.
down_ocr_bottom_btn
.
setText
(
_translate
(
"MainWindow"
,
"字幕下边界下移"
))
self
.
confirm_head_aside_btn
.
setText
(
_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
.
pb_tab
),
_translate
(
"MainWindow"
,
"旁白"
))
...
...
@@ -586,7 +611,8 @@ class Ui_MainWindow(object):
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.action_open_project.setText(_translate("MainWindow", "打开"))
self
.
action_open_project
.
setText
(
_translate
(
"MainWindow"
,
"加载"
))
self
.
import_movie
.
setText
(
_translate
(
"MainWindow"
,
"视频导入"
))
self
.
actions
.
setText
(
_translate
(
"MainWindow"
,
"内容导出"
))
self
.
action_save
.
setText
(
_translate
(
"MainWindow"
,
"保存并备份"
))
...
...
operation_dialog.py
View file @
b20c1c20
...
...
@@ -265,7 +265,7 @@ class Operation_Dialog(QDialog, Ui_Dialog):
# suggest = "插入旁白,推荐字数为0"
suggest
=
suggest
if
self
.
comboBox_2
.
currentText
()
==
"增加一行"
:
suggest
=
"0"
suggest
=
"0
/100
"
# 别忘复原
self
.
buttonBox
.
setEnabled
(
False
)
self
.
zmpb_change_slot
()
...
...
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