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
826eb33f
Commit
826eb33f
authored
Oct 03, 2022
by
xuanweiace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: 增加【修改一行】的操作功能
parent
dcd386d9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
main_window.py
main_window.py
+13
-0
operation_dialog.py
operation_dialog.py
+7
-2
No files found.
main_window.py
View file @
826eb33f
...
...
@@ -49,6 +49,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
#操作框
self
.
operation_dialog
=
Operation_Dialog
(
self
)
self
.
operation_dialog
.
start_add_signal
.
connect
(
self
.
add_line_operation_slot
)
self
.
operation_dialog
.
start_mod_signal
.
connect
(
self
.
mod_line_operation_slot
)
self
.
operation_dialog
.
start_del_signal
.
connect
(
self
.
del_line_operation_slot
)
...
...
@@ -798,7 +800,18 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
prompt_dialog
.
show_with_msg
(
"操作成功!!请刷新表格查看变化"
)
#只需要改all_elements就可以了,因为是同一对象
def
mod_line_operation_slot
(
self
,
row
,
start_time
,
end_time
,
subtitle
,
suggest
,
aside
):
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
self
.
prompt_dialog
.
show_with_msg
(
"操作成功!!请刷新表格查看变化"
)
# 只有row起作用
def
del_line_operation_slot
(
self
,
row
,
start_time
,
end_time
,
subtitle
,
suggest
,
aside
):
to_be_delete_element
=
self
.
projectContext
.
all_elements
[
int
(
row
)
-
1
]
...
...
operation_dialog.py
View file @
826eb33f
...
...
@@ -12,6 +12,7 @@ class Operation_Dialog(QDialog, Ui_Dialog):
#开始检测信号,传参分别是movie路径和输出表格路径
start_add_signal
=
pyqtSignal
(
str
,
str
,
str
,
str
,
str
,
str
)
start_mod_signal
=
pyqtSignal
(
str
,
str
,
str
,
str
,
str
,
str
)
start_del_signal
=
pyqtSignal
(
str
,
str
,
str
,
str
,
str
,
str
)
def
__init__
(
self
,
mainWindow
):
super
(
Operation_Dialog
,
self
)
.
__init__
()
...
...
@@ -103,7 +104,7 @@ class Operation_Dialog(QDialog, Ui_Dialog):
else
:
assert
self
.
comboBox
.
currentText
()
==
"字幕"
except
Exception
as
e
:
self
.
mainWindow
.
prompt_dialog
.
show_with_msg
(
"校验失败!待修改的行不是[
%
s]"
,
self
.
comboBox
.
currentText
(
))
self
.
mainWindow
.
prompt_dialog
.
show_with_msg
(
"校验失败!待修改的行不是[
%
s]"
%
(
self
.
comboBox
.
currentText
()
))
return
False
# 检测通过
...
...
@@ -138,6 +139,8 @@ class Operation_Dialog(QDialog, Ui_Dialog):
# 根据增删两种操作,分别触发不同信号。
if
self
.
comboBox_2
.
currentText
()
==
"增加一行"
:
self
.
start_add_signal
.
emit
(
row
,
start_time
,
end_time
,
subtitle
,
suggest
,
aside
)
elif
self
.
comboBox_2
.
currentText
()
==
"修改一行"
:
self
.
start_mod_signal
.
emit
(
row
,
start_time
,
end_time
,
subtitle
,
suggest
,
aside
)
else
:
self
.
start_del_signal
.
emit
(
row
,
start_time
,
end_time
,
subtitle
,
suggest
,
aside
)
...
...
@@ -153,8 +156,10 @@ class Operation_Dialog(QDialog, Ui_Dialog):
self
.
lineEdit_2
.
setText
(
elem
.
st_time_sec
)
self
.
lineEdit_3
.
setText
(
elem
.
ed_time_sec
)
self
.
lineEdit_4
.
setText
(
elem
.
subtitle
)
self
.
lineEdit_5
.
setText
(
elem
.
suggest
s
[
elem
.
suggests
.
index
(
"推荐字数为"
)
+
5
:])
self
.
lineEdit_5
.
setText
(
elem
.
suggest
[
elem
.
suggest
.
index
(
"推荐字数为"
)
+
5
:])
self
.
lineEdit_6
.
setText
(
elem
.
aside
)
if
elem
.
suggest
is
not
None
and
"推荐字数为"
in
elem
.
suggest
:
self
.
lineEdit_5
.
setText
(
elem
.
suggest
[
elem
.
suggest
.
index
(
"推荐字数为"
)
+
5
:])
except
Exception
as
e
:
print
(
"exception:"
,
e
)
pass
...
...
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