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
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
256 additions
and
205 deletions
+256
-205
constant.py
constant.py
+19
-10
main_window.py
main_window.py
+0
-0
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
+0
-0
utils.py
utils.py
+2
-4
No files found.
constant.py
View file @
1d2f2b64
import
os
class
Content
:
class
Content
:
StartTimeColumn
=
0
StartTimeColumn
=
0
AsideColumnNumber
=
2
AsideColumnNumber
=
2
SpeedColumnNumber
=
3
SpeedColumnNumber
=
3
ActivateColumns
=
[
2
,
3
]
ActivateColumns
=
[
2
,
3
]
# ColumnCount = 3
# ColumnCount = 3
ObjectName
=
"all_tableWidget"
ObjectName
=
"all_tableWidget"
TimeFormatColumns
=
[
0
]
TimeFormatColumns
=
[
0
]
class
Aside
:
class
Aside
:
StartTimeColumn
=
0
StartTimeColumn
=
0
AsideColumnNumber
=
3
AsideColumnNumber
=
2
SpeedColumnNumber
=
4
SpeedColumnNumber
=
3
ActivateColumns
=
[
3
,
4
]
ActivateColumns
=
[
2
,
3
]
ObjectName
=
"pb_tableWidget"
ObjectName
=
"pb_tableWidget"
TimeFormatColumns
=
[
0
,
1
]
TimeFormatColumns
=
[
0
]
PreviewColumnNumber
=
5
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
:
class
Subtitle
:
ObjectName
=
"zm_tableWidget"
ObjectName
=
"zm_tableWidget"
TimeFormatColumns
=
[
0
,
1
]
TimeFormatColumns
=
[
0
,
1
]
import
os
dir_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
dir_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
class
Pathes
:
class
Pathes
:
speaker_conf_path
=
os
.
path
.
join
(
dir_path
,
"speakers.json"
)
speaker_conf_path
=
os
.
path
.
join
(
dir_path
,
"speakers.json"
)
\ No newline at end of file
main_window.py
View file @
1d2f2b64
This diff is collapsed.
Click to expand it.
main_window.ui
View file @
1d2f2b64
...
@@ -309,8 +309,11 @@
...
@@ -309,8 +309,11 @@
background: #ffd740;
background: #ffd740;
}
</string>
}
</string>
</property>
</property>
<property
name=
"maximum"
>
<number>
100
</number>
</property>
<property
name=
"value"
>
<property
name=
"value"
>
<number>
99
</number>
<number>
100
</number>
</property>
</property>
<property
name=
"orientation"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
<enum>
Qt::Horizontal
</enum>
...
@@ -445,17 +448,17 @@
...
@@ -445,17 +448,17 @@
<rect>
<rect>
<x>
0
</x>
<x>
0
</x>
<y>
0
</y>
<y>
0
</y>
<width>
8
27
</width>
<width>
8
00
</width>
<height>
64
</height>
<height>
40
</height>
</rect>
</rect>
</property>
</property>
<widget
class=
"myVideoSlider"
name=
"sld_video"
>
<widget
class=
"myVideoSlider"
name=
"sld_video"
>
<property
name=
"geometry"
>
<property
name=
"geometry"
>
<rect>
<rect>
<x>
10
</x>
<x>
10
</x>
<y>
3
0
</y>
<y>
2
0
</y>
<width>
811
</width>
<width>
790
</width>
<height>
2
0
</height>
<height>
3
0
</height>
</rect>
</rect>
</property>
</property>
<property
name=
"minimumSize"
>
<property
name=
"minimumSize"
>
...
@@ -568,7 +571,7 @@
...
@@ -568,7 +571,7 @@
<x>
0
</x>
<x>
0
</x>
<y>
0
</y>
<y>
0
</y>
<width>
944
</width>
<width>
944
</width>
<height>
2
6
</height>
<height>
2
2
</height>
</rect>
</rect>
</property>
</property>
<widget
class=
"QMenu"
name=
"menu"
>
<widget
class=
"QMenu"
name=
"menu"
>
...
...
main_window_ui.py
View file @
1d2f2b64
...
@@ -121,6 +121,7 @@ class Ui_MainWindow(object):
...
@@ -121,6 +121,7 @@ class Ui_MainWindow(object):
self
.
sld_audio
=
QtWidgets
.
QSlider
(
self
.
centralwidget
)
self
.
sld_audio
=
QtWidgets
.
QSlider
(
self
.
centralwidget
)
self
.
sld_audio
.
setMinimumSize
(
QtCore
.
QSize
(
0
,
24
))
self
.
sld_audio
.
setMinimumSize
(
QtCore
.
QSize
(
0
,
24
))
self
.
sld_audio
.
setMaximumSize
(
QtCore
.
QSize
(
80
,
24
))
self
.
sld_audio
.
setMaximumSize
(
QtCore
.
QSize
(
80
,
24
))
self
.
sld_audio
.
setProperty
(
"value"
,
100
)
self
.
sld_audio
.
setStyleSheet
(
"QSlider:horizontal {
\n
"
self
.
sld_audio
.
setStyleSheet
(
"QSlider:horizontal {
\n
"
" min-height: 24px;
\n
"
" min-height: 24px;
\n
"
" max-height: 24px;
\n
"
" max-height: 24px;
\n
"
...
@@ -208,6 +209,7 @@ class Ui_MainWindow(object):
...
@@ -208,6 +209,7 @@ class Ui_MainWindow(object):
self
.
all_tableWidget
.
setObjectName
(
"all_tableWidget"
)
self
.
all_tableWidget
.
setObjectName
(
"all_tableWidget"
)
self
.
all_tableWidget
.
setColumnCount
(
0
)
self
.
all_tableWidget
.
setColumnCount
(
0
)
self
.
all_tableWidget
.
setRowCount
(
0
)
self
.
all_tableWidget
.
setRowCount
(
0
)
self
.
all_tableWidget
.
setSelectionBehavior
(
QtWidgets
.
QAbstractItemView
.
SelectRows
)
self
.
horizontalLayout_4
.
addWidget
(
self
.
all_tableWidget
)
self
.
horizontalLayout_4
.
addWidget
(
self
.
all_tableWidget
)
self
.
tabWidget
.
addTab
(
self
.
all_tab
,
""
)
self
.
tabWidget
.
addTab
(
self
.
all_tab
,
""
)
self
.
zm_tab
=
QtWidgets
.
QWidget
()
self
.
zm_tab
=
QtWidgets
.
QWidget
()
...
@@ -219,6 +221,7 @@ class Ui_MainWindow(object):
...
@@ -219,6 +221,7 @@ class Ui_MainWindow(object):
self
.
zm_tableWidget
.
setObjectName
(
"zm_tableWidget"
)
self
.
zm_tableWidget
.
setObjectName
(
"zm_tableWidget"
)
self
.
zm_tableWidget
.
setColumnCount
(
0
)
self
.
zm_tableWidget
.
setColumnCount
(
0
)
self
.
zm_tableWidget
.
setRowCount
(
0
)
self
.
zm_tableWidget
.
setRowCount
(
0
)
self
.
zm_tableWidget
.
setSelectionBehavior
(
QtWidgets
.
QAbstractItemView
.
SelectRows
)
self
.
horizontalLayout_2
.
addWidget
(
self
.
zm_tableWidget
)
self
.
horizontalLayout_2
.
addWidget
(
self
.
zm_tableWidget
)
self
.
tabWidget
.
addTab
(
self
.
zm_tab
,
""
)
self
.
tabWidget
.
addTab
(
self
.
zm_tab
,
""
)
self
.
pb_tab
=
QtWidgets
.
QWidget
()
self
.
pb_tab
=
QtWidgets
.
QWidget
()
...
@@ -229,6 +232,7 @@ class Ui_MainWindow(object):
...
@@ -229,6 +232,7 @@ class Ui_MainWindow(object):
self
.
pb_tableWidget
.
setObjectName
(
"pb_tableWidget"
)
self
.
pb_tableWidget
.
setObjectName
(
"pb_tableWidget"
)
self
.
pb_tableWidget
.
setColumnCount
(
0
)
self
.
pb_tableWidget
.
setColumnCount
(
0
)
self
.
pb_tableWidget
.
setRowCount
(
0
)
self
.
pb_tableWidget
.
setRowCount
(
0
)
self
.
pb_tableWidget
.
setSelectionBehavior
(
QtWidgets
.
QAbstractItemView
.
SelectRows
)
self
.
horizontalLayout_3
.
addWidget
(
self
.
pb_tableWidget
)
self
.
horizontalLayout_3
.
addWidget
(
self
.
pb_tableWidget
)
self
.
tabWidget
.
addTab
(
self
.
pb_tab
,
""
)
self
.
tabWidget
.
addTab
(
self
.
pb_tab
,
""
)
self
.
shuiping
.
addWidget
(
self
.
tabWidget
)
self
.
shuiping
.
addWidget
(
self
.
tabWidget
)
...
@@ -254,11 +258,11 @@ class Ui_MainWindow(object):
...
@@ -254,11 +258,11 @@ class Ui_MainWindow(object):
self
.
scrollArea
.
setWidgetResizable
(
False
)
self
.
scrollArea
.
setWidgetResizable
(
False
)
self
.
scrollArea
.
setObjectName
(
"scrollArea"
)
self
.
scrollArea
.
setObjectName
(
"scrollArea"
)
self
.
scrollAreaWidgetContents
=
myWidgetContents
()
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
.
scrollAreaWidgetContents
.
setObjectName
(
"scrollAreaWidgetContents"
)
self
.
sld_video
=
myVideoSlider
(
self
.
scrollAreaWidgetContents
)
self
.
sld_video
=
myVideoSlider
(
self
.
scrollAreaWidgetContents
)
self
.
sld_video
.
setGeometry
(
QtCore
.
QRect
(
10
,
30
,
811
,
2
0
))
self
.
sld_video
.
setGeometry
(
QtCore
.
QRect
(
10
,
20
,
780
,
3
0
))
self
.
sld_video
.
setMinimumSize
(
QtCore
.
QSize
(
41
0
,
0
))
self
.
sld_video
.
setMinimumSize
(
QtCore
.
QSize
(
77
0
,
0
))
self
.
sld_video
.
setMaximumSize
(
QtCore
.
QSize
(
16777215
,
20
))
self
.
sld_video
.
setMaximumSize
(
QtCore
.
QSize
(
16777215
,
20
))
self
.
sld_video
.
setMaximum
(
100
)
self
.
sld_video
.
setMaximum
(
100
)
self
.
sld_video
.
setOrientation
(
QtCore
.
Qt
.
Horizontal
)
self
.
sld_video
.
setOrientation
(
QtCore
.
Qt
.
Horizontal
)
...
...
management.py
View file @
1d2f2b64
...
@@ -97,7 +97,8 @@ class Element:
...
@@ -97,7 +97,8 @@ class Element:
def
to_short_list
(
self
):
def
to_short_list
(
self
):
return
[
self
.
st_time_sec
,
self
.
subtitle
,
self
.
aside
,
self
.
speed
]
return
[
self
.
st_time_sec
,
self
.
subtitle
,
self
.
aside
,
self
.
speed
]
def
to_aside_list
(
self
):
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
):
def
to_subtitle_list
(
self
):
return
[
self
.
st_time_sec
,
self
.
ed_time_sec
,
self
.
subtitle
]
return
[
self
.
st_time_sec
,
self
.
ed_time_sec
,
self
.
subtitle
]
...
@@ -119,9 +120,10 @@ class ProjectContext:
...
@@ -119,9 +120,10 @@ class ProjectContext:
self
.
all_elements
=
[]
self
.
all_elements
=
[]
self
.
speaker_info
=
None
self
.
speaker_info
=
None
self
.
speaker_speed
=
None
self
.
speaker_speed
=
None
self
.
duration
=
0
# 一些常量
# 一些常量
self
.
header
=
[
"起始时间"
,
"终止时间"
,
"字幕"
,
'建议'
,
'解说脚本'
,
"语速"
]
self
.
header
=
[
"起始时间"
,
"终止时间"
,
"字幕"
,
'建议'
,
'解说脚本'
,
"语速"
]
self
.
aside_header
=
[
"起始时间"
,
"终止时间"
,
'推荐插入字数'
,
'解说脚本'
,
"语速"
,
"预览音频"
]
self
.
aside_header
=
[
'起始时间'
,
'推荐插入字数'
,
'解说脚本'
,
"语速"
,
"预览音频"
]
self
.
subtitle_header
=
[
"起始时间"
,
"终止时间"
,
"字幕"
]
self
.
subtitle_header
=
[
"起始时间"
,
"终止时间"
,
"字幕"
]
self
.
contentHeader
=
[
"起始时间"
,
"字幕"
,
"解说脚本"
,
"语速"
]
self
.
contentHeader
=
[
"起始时间"
,
"字幕"
,
"解说脚本"
,
"语速"
]
...
@@ -264,20 +266,27 @@ class ProjectContext:
...
@@ -264,20 +266,27 @@ class ProjectContext:
self
.
subtitle_list
.
append
(
Element
(
st_time_sec
,
ed_time_sec
,
subtitle
,
suggest
,
aside
,
speed
))
self
.
subtitle_list
.
append
(
Element
(
st_time_sec
,
ed_time_sec
,
subtitle
,
suggest
,
aside
,
speed
))
self
.
all_elements
.
append
(
self
.
subtitle_list
[
-
1
])
self
.
all_elements
.
append
(
self
.
subtitle_list
[
-
1
])
else
:
else
:
if
i
==
0
:
if
d
[
"起始时间"
][
i
]
is
None
:
st_time_sec
=
"0.01"
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
:
else
:
try
:
st_time_sec
=
d
[
"起始时间"
][
i
]
st_time_sec
=
"
%.2
f"
%
(
float
(
d
[
"终止时间"
][
i
-
1
])
+
0.01
)
except
Exception
as
e
:
if
d
[
"终止时间"
][
i
]
is
None
:
# 如果是两端连续旁白,那是没有终止时间的,需要做微调,这里是直接用上一条旁白的起始时间。
# 如果是最后一条
st_time_sec
=
"
%.2
f"
%
(
float
(
d
[
"起始时间"
][
i
-
1
])
+
0.01
)
if
i
==
len
(
d
[
"字幕"
])
-
1
:
ed_time_sec
=
"360000"
if
self
.
duration
==
0
else
self
.
duration
# todo 默认最大时长是100h
# 如果是最后一条
else
:
if
i
==
len
(
d
[
"字幕"
])
-
1
:
ed_time_sec
=
"
%.2
f"
%
(
float
(
d
[
"起始时间"
][
i
+
1
])
-
0.01
)
ed_time_sec
=
"360000"
# todo 默认最大时长是100h
else
:
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
.
aside_list
.
append
(
Element
(
st_time_sec
,
ed_time_sec
,
subtitle
,
suggest
,
aside
,
speed
))
self
.
all_elements
.
append
(
self
.
aside_list
[
-
1
])
self
.
all_elements
.
append
(
self
.
aside_list
[
-
1
])
# print("[load_excel_from_path] ", end='')
# print("[load_excel_from_path] ", end='')
...
...
operation_dialog.py
View file @
1d2f2b64
...
@@ -31,11 +31,10 @@ class Operation_Dialog(QDialog, Ui_Dialog):
...
@@ -31,11 +31,10 @@ class Operation_Dialog(QDialog, Ui_Dialog):
self
.
pickStartPos
.
clicked
.
connect
(
self
.
pick_start_pos_slot
)
self
.
pickStartPos
.
clicked
.
connect
(
self
.
pick_start_pos_slot
)
self
.
pickEndPos
.
clicked
.
connect
(
self
.
pick_end_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
)
# 字幕/旁白 选择框
# 字幕/旁白 选择框
self
.
comboBox
.
currentIndexChanged
.
connect
(
self
.
zmpb_change_slot
)
self
.
comboBox
.
currentIndexChanged
.
connect
(
self
.
zmpb_change_slot
)
# 增加一行/删除一行 选择框
# 增加一行/删除一行 选择框
...
@@ -43,19 +42,23 @@ class Operation_Dialog(QDialog, Ui_Dialog):
...
@@ -43,19 +42,23 @@ class Operation_Dialog(QDialog, Ui_Dialog):
self
.
speed_list
=
[
"1.00(4字/秒)"
,
"1.10(4.5字/秒)"
,
"1.25(5字/秒)"
,
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字/秒)"
]
"1.50(6字/秒)"
,
"1.75(7字/秒)"
,
"2.00(8字/秒)"
,
"2.50(10字/秒)"
]
self
.
comboBox_3
.
addItems
(
self
.
speed_list
)
self
.
comboBox_3
.
addItems
(
self
.
speed_list
)
self
.
lineEdits
=
[
self
.
lineEdit
,
self
.
lineEdit_
2
,
self
.
lineEdit_3
,
self
.
lineEdits
=
[
self
.
lineEdit
,
self
.
lineEdit_
4
,
self
.
lineEdit_5
,
self
.
lineEdit_6
]
self
.
lineEdit_4
,
self
.
lineEdit_5
,
self
.
lineEdit_6
]
self
.
timeEdits
=
[
self
.
timeEdit
,
self
.
timeEdit_2
]
self
.
zmpb_change_slot
()
self
.
zmpb_change_slot
()
self
.
adddel_change_slot
()
self
.
adddel_change_slot
()
def
pick_start_pos_slot
(
self
):
def
pick_start_pos_slot
(
self
):
time
=
utils
.
transfer_second_to_time
(
str
(
self
.
mainWindow
.
player
.
position
()
/
1000
))
time
=
utils
.
transfer_second_to_time
(
self
.
lineEdit_2
.
setText
(
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
):
def
pick_end_pos_slot
(
self
):
time
=
utils
.
transfer_second_to_time
(
str
(
self
.
mainWindow
.
player
.
position
()
/
1000
))
time
=
utils
.
transfer_second_to_time
(
self
.
lineEdit_3
.
setText
(
time
)
str
(
self
.
mainWindow
.
player
.
position
()
/
1000
))
self
.
timeEdit_2
.
setTime
(
QTime
.
fromString
(
time
,
"hh:mm:ss.zzz"
))
def
zmpb_change_slot
(
self
):
def
zmpb_change_slot
(
self
):
# 如果是删除,则直接return
# 如果是删除,则直接return
...
@@ -67,7 +70,7 @@ class Operation_Dialog(QDialog, Ui_Dialog):
...
@@ -67,7 +70,7 @@ class Operation_Dialog(QDialog, Ui_Dialog):
self
.
lineEdit_5
.
setEnabled
(
False
)
self
.
lineEdit_5
.
setEnabled
(
False
)
self
.
lineEdit_6
.
setEnabled
(
False
)
self
.
lineEdit_6
.
setEnabled
(
False
)
else
:
else
:
self
.
lineEdit_3
.
setEnabled
(
False
)
self
.
timeEdit_2
.
setEnabled
(
False
)
self
.
lineEdit_4
.
setEnabled
(
False
)
self
.
lineEdit_4
.
setEnabled
(
False
)
self
.
lineEdit_5
.
setEnabled
(
False
)
self
.
lineEdit_5
.
setEnabled
(
False
)
...
@@ -96,20 +99,22 @@ class Operation_Dialog(QDialog, Ui_Dialog):
...
@@ -96,20 +99,22 @@ class Operation_Dialog(QDialog, Ui_Dialog):
return
False
return
False
# 校验时间填写是否是hh:mm:ss格式的
# 校验时间填写是否是hh:mm:ss格式的
try
:
try
:
time
=
self
.
timeEdit
.
time
()
import
re
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
(
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
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
(
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
assert
x
!=
None
except
Exception
as
e
:
except
Exception
as
e
:
self
.
mainWindow
.
prompt_dialog
.
show_with_msg
(
self
.
mainWindow
.
prompt_dialog
.
show_with_msg
(
"校验失败!起始或结束时间输入的格式有误!应该为hh:mm:ss
!!"
%
(
rowCount
,
self
.
lineEdit
.
text
())
)
"校验失败!起始或结束时间输入的格式有误!应该为hh:mm:ss
.zzz!!"
)
return
False
return
False
# 这些是只有【add】才需要检测的
# 这些是只有【add】才需要检测的
...
@@ -118,10 +123,10 @@ class Operation_Dialog(QDialog, Ui_Dialog):
...
@@ -118,10 +123,10 @@ class Operation_Dialog(QDialog, Ui_Dialog):
start_time_f
,
end_time_f
=
0.0
,
0.0
start_time_f
,
end_time_f
=
0.0
,
0.0
try
:
try
:
start_time_f
=
float
(
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
()
==
"字幕"
:
if
self
.
comboBox
.
currentText
()
==
"字幕"
:
end_time_f
=
float
(
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
assert
start_time_f
<
end_time_f
except
Exception
as
e
:
except
Exception
as
e
:
self
.
mainWindow
.
prompt_dialog
.
show_with_msg
(
self
.
mainWindow
.
prompt_dialog
.
show_with_msg
(
...
@@ -164,7 +169,9 @@ class Operation_Dialog(QDialog, Ui_Dialog):
...
@@ -164,7 +169,9 @@ class Operation_Dialog(QDialog, Ui_Dialog):
self
.
comboBox_2
.
setEnabled
(
status
)
self
.
comboBox_2
.
setEnabled
(
status
)
def
start_operation_slot
(
self
):
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
]
x
.
text
()
for
x
in
self
.
lineEdits
]
speed
=
self
.
comboBox_3
.
currentText
()
speed
=
self
.
comboBox_3
.
currentText
()
# 将hh:mm:ss转成秒的形式传给mainWindow
# 将hh:mm:ss转成秒的形式传给mainWindow
...
@@ -186,6 +193,8 @@ class Operation_Dialog(QDialog, Ui_Dialog):
...
@@ -186,6 +193,8 @@ class Operation_Dialog(QDialog, Ui_Dialog):
self
.
zmpb_change_slot
()
self
.
zmpb_change_slot
()
self
.
adddel_change_slot
()
self
.
adddel_change_slot
()
print
(
suggest
)
# 根据增删两种操作,分别触发不同信号。
# 根据增删两种操作,分别触发不同信号。
if
self
.
comboBox_2
.
currentText
()
==
"增加一行"
:
if
self
.
comboBox_2
.
currentText
()
==
"增加一行"
:
self
.
start_add_signal
.
emit
(
self
.
start_add_signal
.
emit
(
...
@@ -207,10 +216,13 @@ class Operation_Dialog(QDialog, Ui_Dialog):
...
@@ -207,10 +216,13 @@ class Operation_Dialog(QDialog, Ui_Dialog):
assert
1
<=
row_number
<=
rowCount
assert
1
<=
row_number
<=
rowCount
elem
=
self
.
mainWindow
.
projectContext
.
all_elements
[
int
(
elem
=
self
.
mainWindow
.
projectContext
.
all_elements
[
int
(
row_number
)
-
1
]
row_number
)
-
1
]
self
.
lineEdit_2
.
setText
(
str
(
utils
.
transfer_second_to_time
(
elem
.
st_time_sec
)))
# todo, 改成可以spinbox的那种形式
self
.
lineEdit_3
.
setText
(
str
(
utils
.
transfer_second_to_time
(
elem
.
ed_time_sec
)))
if
len
(
self
.
timeEdit
.
setTime
(
QTime
.
fromString
(
elem
.
ed_time_sec
)
>
0
else
self
.
lineEdit_3
.
setText
(
""
)
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_4
.
setText
(
elem
.
subtitle
)
self
.
lineEdit_6
.
setText
(
elem
.
aside
)
self
.
lineEdit_6
.
setText
(
elem
.
aside
)
self
.
comboBox_3
.
setCurrentIndex
(
self
.
comboBox_3
.
setCurrentIndex
(
...
...
operation_dialog.ui
View file @
1d2f2b64
...
@@ -14,11 +14,10 @@
...
@@ -14,11 +14,10 @@
<string>
Dialog
</string>
<string>
Dialog
</string>
</property>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
columnstretch=
"0,0,0,0,0"
>
<layout
class=
"QGridLayout"
name=
"gridLayout"
columnstretch=
"0,0,0,0,0"
>
<item
row=
"
1"
column=
"3"
colspa
n=
"2"
>
<item
row=
"
6"
colum
n=
"2"
>
<widget
class=
"Q
PushButton"
name=
"pushButton_3
"
>
<widget
class=
"Q
Label"
name=
"label_11
"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
填充
<string>
*请填文字
</string>
行信息
</string>
</property>
</property>
</widget>
</widget>
</item>
</item>
...
@@ -32,6 +31,121 @@
...
@@ -32,6 +31,121 @@
</property>
</property>
</widget>
</widget>
</item>
</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"
>
<item
row=
"8"
column=
"4"
>
<widget
class=
"QDialogButtonBox"
name=
"buttonBox"
>
<widget
class=
"QDialogButtonBox"
name=
"buttonBox"
>
<property
name=
"enabled"
>
<property
name=
"enabled"
>
...
@@ -66,10 +180,10 @@
...
@@ -66,10 +180,10 @@
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"
6"
column=
"3
"
>
<item
row=
"
2"
column=
"2
"
>
<widget
class=
"QLabel"
name=
"label_
14
"
>
<widget
class=
"QLabel"
name=
"label_
8
"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
语速:
</string>
<string>
*请填数字,最多保留两位小数
</string>
</property>
</property>
</widget>
</widget>
</item>
</item>
...
@@ -107,69 +221,20 @@
...
@@ -107,69 +221,20 @@
</item>
</item>
</layout>
</layout>
</item>
</item>
<item
row=
"6"
column=
"2"
>
<item
row=
"5"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_11"
>
<widget
class=
"QLabel"
name=
"label_6"
>
<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"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
*请填数字,必须是不超过100的正整数
</string>
<string>
推荐字数:
</string>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"
3"
column=
"2
"
>
<item
row=
"
4"
column=
"0
"
>
<widget
class=
"QLabel"
name=
"label_
9
"
>
<widget
class=
"QLabel"
name=
"label_
5
"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
*请填数字,最多保留两位小数
</string>
<string>
字幕:
</string>
</property>
</property>
</widget>
</widget>
</item>
</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"
>
<item
row=
"0"
column=
"1"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
stretch=
"1,1"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
stretch=
"1,1"
>
<item>
<item>
...
@@ -207,56 +272,23 @@
...
@@ -207,56 +272,23 @@
</item>
</item>
</layout>
</layout>
</item>
</item>
<item
row=
"5"
column=
"0"
>
<item
row=
"0"
column=
"2"
>
<widget
class=
"QLabel"
name=
"label_6"
>
<widget
class=
"QComboBox"
name=
"comboBox_2"
>
<property
name=
"text"
>
<item>
<string>
推荐字数:
</string>
<property
name=
"text"
>
</property>
<string>
增加一行
</string>
</widget>
</property>
</item>
</item>
<item
row=
"6"
column=
"1"
>
<item>
<widget
class=
"QLineEdit"
name=
"lineEdit_6"
>
<property
name=
"text"
>
<property
name=
"enabled"
>
<string>
修改一行
</string>
<bool>
true
</bool>
</property>
</property>
</item>
</widget>
<item>
</item>
<property
name=
"text"
>
<item
row=
"2"
column=
"1"
>
<string>
删除一行
</string>
<widget
class=
"QLineEdit"
name=
"lineEdit_2"
/>
</property>
</item>
</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>
</widget>
</widget>
</item>
</item>
<item
row=
"5"
column=
"1"
>
<item
row=
"5"
column=
"1"
>
...
@@ -266,48 +298,32 @@
...
@@ -266,48 +298,32 @@
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
我想操作第
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"1"
>
<item
row=
"1"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"lineEdit"
/>
<widget
class=
"QLineEdit"
name=
"lineEdit"
/>
</item>
</item>
<item
row=
"
3"
column=
"0
"
>
<item
row=
"
2"
column=
"1
"
>
<widget
class=
"Q
Label"
name=
"label_4
"
>
<widget
class=
"Q
TimeEdit"
name=
"timeEdit
"
>
<property
name=
"
text
"
>
<property
name=
"
currentSection
"
>
<
string>
结束时间:
</string
>
<
enum>
QDateTimeEdit::MinuteSection
</enum
>
</property>
</property>
</widget>
<property
name=
"displayFormat"
>
</item>
<string>
hh:mm:ss.zzz
</string>
<item
row=
"3"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"lineEdit_3"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
</property>
</widget>
<property
name=
"currentSectionIndex"
>
</item>
<number>
1
</number>
<item
row=
"6"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_7"
>
<property
name=
"text"
>
<string>
旁白:
</string>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"
2"
column=
"3
"
>
<item
row=
"
3"
column=
"1
"
>
<widget
class=
"Q
PushButton"
name=
"pickStartPos
"
>
<widget
class=
"Q
TimeEdit"
name=
"timeEdit_2
"
>
<property
name=
"
text
"
>
<property
name=
"
currentSection
"
>
<
string>
取当前位置
</string
>
<
enum>
QDateTimeEdit::SecondSection
</enum
>
</property>
</property>
</widget>
<property
name=
"displayFormat"
>
</item>
<string>
hh:mm:ss.zzz
</string>
<item
row=
"3"
column=
"3"
>
</property>
<widget
class=
"QPushButton"
name=
"pickEndPos"
>
<property
name=
"currentSectionIndex"
>
<property
name=
"text"
>
<number>
2
</number>
<string>
取当前位置
</string>
</property>
</property>
</widget>
</widget>
</item>
</item>
...
...
operation_dialog_ui.py
View file @
1d2f2b64
This diff is collapsed.
Click to expand it.
utils.py
View file @
1d2f2b64
...
@@ -40,10 +40,8 @@ def transfer_second_to_time(sec: str) -> str:
...
@@ -40,10 +40,8 @@ def transfer_second_to_time(sec: str) -> str:
hour
=
int
(
duration
/
3600
)
hour
=
int
(
duration
/
3600
)
minutes
=
int
((
duration
%
3600
)
/
60
)
minutes
=
int
((
duration
%
3600
)
/
60
)
seconds
=
int
(
duration
%
60
)
seconds
=
int
(
duration
%
60
)
idx
=
sec
.
find
(
'.'
)
msec
=
(
float
(
sec
)
-
hour
*
3600
-
minutes
*
60
-
seconds
)
*
1000
if
(
idx
==
-
1
):
time
=
"
%02
d:
%02
d:
%02
d.
%03
d"
%
(
hour
,
minutes
,
seconds
,
msec
)
idx
=
len
(
sec
)
time
=
"
%02
d:
%02
d:
%02
d
%
s"
%
(
hour
,
minutes
,
seconds
,
sec
[
idx
:
idx
+
3
])
return
time
return
time
def
replace_path_suffix
(
path
,
new_suffix
):
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