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
dbd553fd
Commit
dbd553fd
authored
Nov 10, 2022
by
翟艳秋(20软)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: make the dialogs adaptive and modify the reaction of create project
parent
3f1a5604
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
739 additions
and
1235 deletions
+739
-1235
Ui_create_dialog.py
Ui_create_dialog.py
+0
-65
create_dialog.py
create_dialog.py
+2
-0
create_dialog.ui
create_dialog.ui
+93
-81
create_dialog_ui.py
create_dialog_ui.py
+27
-22
detect_dialog.ui
detect_dialog.ui
+59
-98
detect_dialog_ui.py
detect_dialog_ui.py
+28
-25
main_window.py
main_window.py
+62
-18
main_window_ui.py
main_window_ui.py
+9
-9
main_window_ui_origin.py
main_window_ui_origin.py
+0
-384
management.py
management.py
+8
-9
operation_dialog.ui
operation_dialog.ui
+282
-424
operation_dialog_ui.py
operation_dialog_ui.py
+121
-92
start.py
start.py
+25
-8
utils.py
utils.py
+23
-0
No files found.
Ui_create_dialog.py
deleted
100644 → 0
View file @
3f1a5604
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'd:\AddCaption\cur_version\accessibility_movie_2\create_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from
PyQt5
import
QtCore
,
QtGui
,
QtWidgets
class
Ui_Dialog
(
object
):
def
setupUi
(
self
,
Dialog
):
Dialog
.
setObjectName
(
"Dialog"
)
Dialog
.
resize
(
408
,
238
)
self
.
gridLayoutWidget
=
QtWidgets
.
QWidget
(
Dialog
)
self
.
gridLayoutWidget
.
setGeometry
(
QtCore
.
QRect
(
20
,
50
,
361
,
91
))
self
.
gridLayoutWidget
.
setObjectName
(
"gridLayoutWidget"
)
self
.
gridLayout
=
QtWidgets
.
QGridLayout
(
self
.
gridLayoutWidget
)
self
.
gridLayout
.
setContentsMargins
(
0
,
0
,
0
,
0
)
self
.
gridLayout
.
setObjectName
(
"gridLayout"
)
self
.
root_input
=
QtWidgets
.
QLineEdit
(
self
.
gridLayoutWidget
)
self
.
root_input
.
setObjectName
(
"root_input"
)
self
.
gridLayout
.
addWidget
(
self
.
root_input
,
1
,
1
,
1
,
1
)
self
.
get_dir
=
QtWidgets
.
QPushButton
(
self
.
gridLayoutWidget
)
self
.
get_dir
.
setObjectName
(
"get_dir"
)
self
.
gridLayout
.
addWidget
(
self
.
get_dir
,
1
,
2
,
1
,
1
)
self
.
rootLabel
=
QtWidgets
.
QLabel
(
self
.
gridLayoutWidget
)
self
.
rootLabel
.
setObjectName
(
"rootLabel"
)
self
.
gridLayout
.
addWidget
(
self
.
rootLabel
,
1
,
0
,
1
,
1
)
self
.
nameLabel
=
QtWidgets
.
QLabel
(
self
.
gridLayoutWidget
)
self
.
nameLabel
.
setObjectName
(
"nameLabel"
)
self
.
gridLayout
.
addWidget
(
self
.
nameLabel
,
0
,
0
,
1
,
1
)
self
.
name_input
=
QtWidgets
.
QLineEdit
(
self
.
gridLayoutWidget
)
self
.
name_input
.
setObjectName
(
"name_input"
)
self
.
gridLayout
.
addWidget
(
self
.
name_input
,
0
,
1
,
1
,
1
)
self
.
widget
=
QtWidgets
.
QWidget
(
Dialog
)
self
.
widget
.
setGeometry
(
QtCore
.
QRect
(
90
,
180
,
201
,
25
))
self
.
widget
.
setObjectName
(
"widget"
)
self
.
horizontalLayout
=
QtWidgets
.
QHBoxLayout
(
self
.
widget
)
self
.
horizontalLayout
.
setContentsMargins
(
0
,
0
,
0
,
0
)
self
.
horizontalLayout
.
setObjectName
(
"horizontalLayout"
)
self
.
confirm
=
QtWidgets
.
QPushButton
(
self
.
widget
)
self
.
confirm
.
setObjectName
(
"confirm"
)
self
.
horizontalLayout
.
addWidget
(
self
.
confirm
)
spacerItem
=
QtWidgets
.
QSpacerItem
(
40
,
20
,
QtWidgets
.
QSizePolicy
.
Expanding
,
QtWidgets
.
QSizePolicy
.
Minimum
)
self
.
horizontalLayout
.
addItem
(
spacerItem
)
self
.
cancel
=
QtWidgets
.
QPushButton
(
self
.
widget
)
self
.
cancel
.
setObjectName
(
"cancel"
)
self
.
horizontalLayout
.
addWidget
(
self
.
cancel
)
self
.
horizontalLayout
.
setStretch
(
0
,
1
)
self
.
retranslateUi
(
Dialog
)
QtCore
.
QMetaObject
.
connectSlotsByName
(
Dialog
)
def
retranslateUi
(
self
,
Dialog
):
_translate
=
QtCore
.
QCoreApplication
.
translate
Dialog
.
setWindowTitle
(
_translate
(
"Dialog"
,
"Dialog"
))
self
.
get_dir
.
setText
(
_translate
(
"Dialog"
,
"打开文件夹"
))
self
.
rootLabel
.
setText
(
_translate
(
"Dialog"
,
"工程文件夹"
))
self
.
nameLabel
.
setText
(
_translate
(
"Dialog"
,
"工程名称"
))
self
.
confirm
.
setText
(
_translate
(
"Dialog"
,
"确认"
))
self
.
cancel
.
setText
(
_translate
(
"Dialog"
,
"取消"
))
create_dialog.py
View file @
dbd553fd
...
...
@@ -18,6 +18,8 @@ class Create_Dialog(QDialog, Ui_Dialog):
def
choose_root
(
self
):
root_info
=
QFileDialog
.
getExistingDirectory
(
self
,
"选择工程文件夹"
,
os
.
getcwd
())
if
len
(
self
.
root_input
.
text
())
!=
0
and
len
(
root_info
)
==
0
:
return
self
.
root_input
.
setText
(
root_info
)
def
create_project
(
self
):
...
...
create_dialog.ui
View file @
dbd553fd
...
...
@@ -13,87 +13,99 @@
<property
name=
"windowTitle"
>
<string>
Dialog
</string>
</property>
<widget
class=
"QWidget"
name=
"gridLayoutWidget"
>
<property
name=
"geometry"
>
<rect>
<x>
20
</x>
<y>
50
</y>
<width>
361
</width>
<height>
91
</height>
</rect>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<property
name=
"topMargin"
>
<number>
0
</number>
</property>
<item
row=
"1"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"root_input"
/>
</item>
<item
row=
"1"
column=
"2"
>
<widget
class=
"QPushButton"
name=
"get_dir"
>
<property
name=
"text"
>
<string>
打开文件夹
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"rootLabel"
>
<property
name=
"text"
>
<string>
工程文件夹
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"nameLabel"
>
<property
name=
"text"
>
<string>
工程名称
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"name_input"
/>
</item>
</layout>
</widget>
<widget
class=
"QWidget"
name=
""
>
<property
name=
"geometry"
>
<rect>
<x>
90
</x>
<y>
180
</y>
<width>
201
</width>
<height>
25
</height>
</rect>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
stretch=
"1,0,0"
>
<item>
<widget
class=
"QPushButton"
name=
"confirm"
>
<property
name=
"text"
>
<string>
确认
</string>
</property>
</widget>
</item>
<item>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item>
<widget
class=
"QPushButton"
name=
"cancel"
>
<property
name=
"text"
>
<string>
取消
</string>
</property>
</widget>
</item>
</layout>
</widget>
<layout
class=
"QGridLayout"
name=
"gridLayout_2"
>
<item
row=
"0"
column=
"0"
>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<property
name=
"topMargin"
>
<number>
0
</number>
</property>
<item
row=
"1"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"root_input"
/>
</item>
<item
row=
"1"
column=
"2"
>
<widget
class=
"QPushButton"
name=
"get_dir"
>
<property
name=
"text"
>
<string>
打开文件夹
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"rootLabel"
>
<property
name=
"text"
>
<string>
工程文件夹
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"nameLabel"
>
<property
name=
"text"
>
<string>
工程名称
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"name_input"
/>
</item>
</layout>
</item>
<item
row=
"1"
column=
"0"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
stretch=
"1,1,1,1,1"
>
<item>
<spacer
name=
"horizontalSpacer_2"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item>
<widget
class=
"QPushButton"
name=
"confirm"
>
<property
name=
"text"
>
<string>
确认
</string>
</property>
</widget>
</item>
<item>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item>
<widget
class=
"QPushButton"
name=
"cancel"
>
<property
name=
"text"
>
<string>
取消
</string>
</property>
</widget>
</item>
<item>
<spacer
name=
"horizontalSpacer_3"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
...
...
create_dialog_ui.py
View file @
dbd553fd
...
...
@@ -15,42 +15,47 @@ class Ui_Dialog(object):
def
setupUi
(
self
,
Dialog
):
Dialog
.
setObjectName
(
"Dialog"
)
Dialog
.
resize
(
408
,
238
)
self
.
gridLayoutWidget
=
QtWidgets
.
QWidget
(
Dialog
)
self
.
gridLayoutWidget
.
setGeometry
(
QtCore
.
QRect
(
20
,
50
,
361
,
91
))
self
.
gridLayoutWidget
.
setObjectName
(
"gridLayoutWidget"
)
self
.
gridLayout
=
QtWidgets
.
QGridLayout
(
self
.
gridLayoutWidget
)
self
.
gridLayout
.
setContentsMargins
(
0
,
0
,
0
,
0
)
self
.
gridLayout_2
=
QtWidgets
.
QGridLayout
(
Dialog
)
self
.
gridLayout_2
.
setObjectName
(
"gridLayout_2"
)
self
.
gridLayout
=
QtWidgets
.
QGridLayout
()
self
.
gridLayout
.
setContentsMargins
(
-
1
,
0
,
-
1
,
-
1
)
self
.
gridLayout
.
setObjectName
(
"gridLayout"
)
self
.
root_input
=
QtWidgets
.
QLineEdit
(
self
.
gridLayoutWidget
)
self
.
name_input
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
name_input
.
setObjectName
(
"name_input"
)
self
.
root_input
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
root_input
.
setObjectName
(
"root_input"
)
self
.
gridLayout
.
addWidget
(
self
.
root_input
,
1
,
1
,
1
,
1
)
self
.
get_dir
=
QtWidgets
.
QPushButton
(
self
.
gridLayoutWidget
)
self
.
get_dir
=
QtWidgets
.
QPushButton
(
Dialog
)
self
.
get_dir
.
setObjectName
(
"get_dir"
)
self
.
gridLayout
.
addWidget
(
self
.
get_dir
,
1
,
2
,
1
,
1
)
self
.
rootLabel
=
QtWidgets
.
QLabel
(
self
.
gridLayoutWidget
)
self
.
rootLabel
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
rootLabel
.
setObjectName
(
"rootLabel"
)
self
.
gridLayout
.
addWidget
(
self
.
rootLabel
,
1
,
0
,
1
,
1
)
self
.
nameLabel
=
QtWidgets
.
QLabel
(
self
.
gridLayoutWidget
)
self
.
nameLabel
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
nameLabel
.
setObjectName
(
"nameLabel"
)
self
.
gridLayout
.
addWidget
(
self
.
nameLabel
,
0
,
0
,
1
,
1
)
self
.
name_input
=
QtWidgets
.
QLineEdit
(
self
.
gridLayoutWidget
)
self
.
name_input
.
setObjectName
(
"name_input"
)
self
.
gridLayout
.
addWidget
(
self
.
name_input
,
0
,
1
,
1
,
1
)
self
.
widget
=
QtWidgets
.
QWidget
(
Dialog
)
self
.
widget
.
setGeometry
(
QtCore
.
QRect
(
90
,
180
,
201
,
25
))
self
.
widget
.
setObjectName
(
"widget"
)
self
.
horizontalLayout
=
QtWidgets
.
QHBoxLayout
(
self
.
widget
)
self
.
horizontalLayout
.
setContentsMargins
(
0
,
0
,
0
,
0
)
self
.
gridLayout_2
.
addLayout
(
self
.
gridLayout
,
0
,
0
,
1
,
1
)
self
.
horizontalLayout
=
QtWidgets
.
QHBoxLayout
()
self
.
horizontalLayout
.
setObjectName
(
"horizontalLayout"
)
self
.
confirm
=
QtWidgets
.
QPushButton
(
self
.
widget
)
self
.
confirm
.
setObjectName
(
"confirm"
)
self
.
horizontalLayout
.
addWidget
(
self
.
confirm
)
spacerItem
=
QtWidgets
.
QSpacerItem
(
40
,
20
,
QtWidgets
.
QSizePolicy
.
Expanding
,
QtWidgets
.
QSizePolicy
.
Minimum
)
self
.
horizontalLayout
.
addItem
(
spacerItem
)
self
.
cancel
=
QtWidgets
.
QPushButton
(
self
.
widget
)
self
.
confirm
=
QtWidgets
.
QPushButton
(
Dialog
)
self
.
confirm
.
setObjectName
(
"confirm"
)
self
.
horizontalLayout
.
addWidget
(
self
.
confirm
)
spacerItem1
=
QtWidgets
.
QSpacerItem
(
40
,
20
,
QtWidgets
.
QSizePolicy
.
Expanding
,
QtWidgets
.
QSizePolicy
.
Minimum
)
self
.
horizontalLayout
.
addItem
(
spacerItem1
)
self
.
cancel
=
QtWidgets
.
QPushButton
(
Dialog
)
self
.
cancel
.
setObjectName
(
"cancel"
)
self
.
horizontalLayout
.
addWidget
(
self
.
cancel
)
spacerItem2
=
QtWidgets
.
QSpacerItem
(
40
,
20
,
QtWidgets
.
QSizePolicy
.
Expanding
,
QtWidgets
.
QSizePolicy
.
Minimum
)
self
.
horizontalLayout
.
addItem
(
spacerItem2
)
self
.
horizontalLayout
.
setStretch
(
0
,
1
)
self
.
horizontalLayout
.
setStretch
(
1
,
1
)
self
.
horizontalLayout
.
setStretch
(
2
,
1
)
self
.
horizontalLayout
.
setStretch
(
3
,
1
)
self
.
horizontalLayout
.
setStretch
(
4
,
1
)
self
.
gridLayout_2
.
addLayout
(
self
.
horizontalLayout
,
1
,
0
,
1
,
1
)
self
.
retranslateUi
(
Dialog
)
QtCore
.
QMetaObject
.
connectSlotsByName
(
Dialog
)
...
...
@@ -58,8 +63,8 @@ class Ui_Dialog(object):
def
retranslateUi
(
self
,
Dialog
):
_translate
=
QtCore
.
QCoreApplication
.
translate
Dialog
.
setWindowTitle
(
_translate
(
"Dialog"
,
"Dialog"
))
self
.
get_dir
.
setText
(
_translate
(
"Dialog"
,
"打开文件夹"
))
self
.
rootLabel
.
setText
(
_translate
(
"Dialog"
,
"工程文件夹"
))
self
.
nameLabel
.
setText
(
_translate
(
"Dialog"
,
"工程名称"
))
self
.
rootLabel
.
setText
(
_translate
(
"Dialog"
,
"工程文件夹"
))
self
.
get_dir
.
setText
(
_translate
(
"Dialog"
,
"打开文件夹"
))
self
.
confirm
.
setText
(
_translate
(
"Dialog"
,
"确认"
))
self
.
cancel
.
setText
(
_translate
(
"Dialog"
,
"取消"
))
detect_dialog.ui
View file @
dbd553fd
...
...
@@ -6,110 +6,71 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
632
</width>
<width>
436
</width>
<height>
300
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Dialog
</string>
</property>
<widget
class=
"QDialogButtonBox"
name=
"buttonBox"
>
<property
name=
"geometry"
>
<rect>
<x>
30
</x>
<y>
240
</y>
<width>
341
</width>
<height>
32
</height>
</rect>
</property>
<property
name=
"toolTip"
>
<string/>
</property>
<property
name=
"toolTipDuration"
>
<number>
-1
</number>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"standardButtons"
>
<set>
QDialogButtonBox::Cancel|QDialogButtonBox::Ok
</set>
</property>
<property
name=
"centerButtons"
>
<bool>
false
</bool>
</property>
</widget>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"geometry"
>
<rect>
<x>
20
</x>
<y>
70
</y>
<width>
72
</width>
<height>
16
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
视频路径:
</string>
</property>
</widget>
<widget
class=
"QLineEdit"
name=
"lineEdit"
>
<property
name=
"geometry"
>
<rect>
<x>
100
</x>
<y>
68
</y>
<width>
211
</width>
<height>
20
</height>
</rect>
</property>
</widget>
<widget
class=
"QPushButton"
name=
"pushButton"
>
<property
name=
"geometry"
>
<rect>
<x>
390
</x>
<y>
63
</y>
<width>
110
</width>
<height>
30
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
选择文件
</string>
</property>
</widget>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"geometry"
>
<rect>
<x>
20
</x>
<y>
130
</y>
<width>
72
</width>
<height>
16
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
输出表格:
</string>
</property>
</widget>
<widget
class=
"QLineEdit"
name=
"lineEdit_2"
>
<property
name=
"geometry"
>
<rect>
<x>
100
</x>
<y>
128
</y>
<width>
211
</width>
<height>
20
</height>
</rect>
</property>
</widget>
<widget
class=
"QPushButton"
name=
"pushButton_2"
>
<property
name=
"geometry"
>
<rect>
<x>
390
</x>
<y>
123
</y>
<width>
110
</width>
<height>
30
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
输出表格路径
</string>
</property>
</widget>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"0"
column=
"2"
>
<widget
class=
"QPushButton"
name=
"pushButton"
>
<property
name=
"text"
>
<string>
选择文件
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"text"
>
<string>
输出表格:
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"lineEdit_2"
/>
</item>
<item
row=
"1"
column=
"2"
>
<widget
class=
"QPushButton"
name=
"pushButton_2"
>
<property
name=
"text"
>
<string>
输出表格路径
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"lineEdit"
/>
</item>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
视频路径:
</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"1"
alignment=
"Qt::AlignHCenter"
>
<widget
class=
"QDialogButtonBox"
name=
"buttonBox"
>
<property
name=
"toolTip"
>
<string/>
</property>
<property
name=
"toolTipDuration"
>
<number>
-1
</number>
</property>
<property
name=
"layoutDirection"
>
<enum>
Qt::LeftToRight
</enum>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"standardButtons"
>
<set>
QDialogButtonBox::Cancel|QDialogButtonBox::Ok
</set>
</property>
<property
name=
"centerButtons"
>
<bool>
false
</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
...
...
detect_dialog_ui.py
View file @
dbd553fd
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'detect_dialog.ui'
# Form implementation generated from reading ui file 'd
:\AddCaption\cur_version\accessibility_movie_2\d
etect_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.1
2
# Created by: PyQt5 UI code generator 5.1
5.4
#
# WARNING! All changes made in this file will be lost!
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from
PyQt5
import
QtCore
,
QtGui
,
QtWidgets
...
...
@@ -12,33 +14,36 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class
Ui_Dialog
(
object
):
def
setupUi
(
self
,
Dialog
):
Dialog
.
setObjectName
(
"Dialog"
)
Dialog
.
resize
(
632
,
300
)
self
.
buttonBox
=
QtWidgets
.
QDialogButtonBox
(
Dialog
)
self
.
buttonBox
.
setGeometry
(
QtCore
.
QRect
(
30
,
240
,
341
,
32
))
self
.
buttonBox
.
setToolTip
(
""
)
self
.
buttonBox
.
setToolTipDuration
(
-
1
)
self
.
buttonBox
.
setOrientation
(
QtCore
.
Qt
.
Horizontal
)
self
.
buttonBox
.
setStandardButtons
(
QtWidgets
.
QDialogButtonBox
.
Cancel
|
QtWidgets
.
QDialogButtonBox
.
Ok
)
self
.
buttonBox
.
setCenterButtons
(
False
)
self
.
buttonBox
.
setObjectName
(
"buttonBox"
)
self
.
label
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label
.
setGeometry
(
QtCore
.
QRect
(
20
,
70
,
72
,
15
))
self
.
label
.
setObjectName
(
"label"
)
self
.
lineEdit
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
lineEdit
.
setGeometry
(
QtCore
.
QRect
(
100
,
70
,
211
,
21
))
self
.
lineEdit
.
setObjectName
(
"lineEdit"
)
Dialog
.
resize
(
436
,
300
)
self
.
gridLayout
=
QtWidgets
.
QGridLayout
(
Dialog
)
self
.
gridLayout
.
setObjectName
(
"gridLayout"
)
self
.
pushButton
=
QtWidgets
.
QPushButton
(
Dialog
)
self
.
pushButton
.
setGeometry
(
QtCore
.
QRect
(
390
,
60
,
93
,
28
))
self
.
pushButton
.
setObjectName
(
"pushButton"
)
self
.
gridLayout
.
addWidget
(
self
.
pushButton
,
0
,
2
,
1
,
1
)
self
.
label_2
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_2
.
setGeometry
(
QtCore
.
QRect
(
20
,
130
,
72
,
15
))
self
.
label_2
.
setObjectName
(
"label_2"
)
self
.
gridLayout
.
addWidget
(
self
.
label_2
,
1
,
0
,
1
,
1
)
self
.
lineEdit_2
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
lineEdit_2
.
setGeometry
(
QtCore
.
QRect
(
100
,
130
,
211
,
21
))
self
.
lineEdit_2
.
setObjectName
(
"lineEdit_2"
)
self
.
gridLayout
.
addWidget
(
self
.
lineEdit_2
,
1
,
1
,
1
,
1
)
self
.
pushButton_2
=
QtWidgets
.
QPushButton
(
Dialog
)
self
.
pushButton_2
.
setGeometry
(
QtCore
.
QRect
(
390
,
130
,
101
,
31
))
self
.
pushButton_2
.
setObjectName
(
"pushButton_2"
)
self
.
gridLayout
.
addWidget
(
self
.
pushButton_2
,
1
,
2
,
1
,
1
)
self
.
lineEdit
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
lineEdit
.
setObjectName
(
"lineEdit"
)
self
.
gridLayout
.
addWidget
(
self
.
lineEdit
,
0
,
1
,
1
,
1
)
self
.
label
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label
.
setObjectName
(
"label"
)
self
.
gridLayout
.
addWidget
(
self
.
label
,
0
,
0
,
1
,
1
)
self
.
buttonBox
=
QtWidgets
.
QDialogButtonBox
(
Dialog
)
self
.
buttonBox
.
setToolTip
(
""
)
self
.
buttonBox
.
setToolTipDuration
(
-
1
)
self
.
buttonBox
.
setLayoutDirection
(
QtCore
.
Qt
.
LeftToRight
)
self
.
buttonBox
.
setOrientation
(
QtCore
.
Qt
.
Horizontal
)
self
.
buttonBox
.
setStandardButtons
(
QtWidgets
.
QDialogButtonBox
.
Cancel
|
QtWidgets
.
QDialogButtonBox
.
Ok
)
self
.
buttonBox
.
setCenterButtons
(
False
)
self
.
buttonBox
.
setObjectName
(
"buttonBox"
)
self
.
gridLayout
.
addWidget
(
self
.
buttonBox
,
2
,
1
,
1
,
1
,
QtCore
.
Qt
.
AlignHCenter
)
self
.
retranslateUi
(
Dialog
)
self
.
buttonBox
.
accepted
.
connect
(
Dialog
.
accept
)
...
...
@@ -47,10 +52,8 @@ class Ui_Dialog(object):
def
retranslateUi
(
self
,
Dialog
):
_translate
=
QtCore
.
QCoreApplication
.
translate
Dialog
.
setWindowTitle
(
_translate
(
"Dialog"
,
"
Dialog
"
))
Dialog
.
setWindowTitle
(
_translate
(
"Dialog"
,
"
检测
"
))
self
.
label
.
setText
(
_translate
(
"Dialog"
,
"视频路径:"
))
self
.
pushButton
.
setText
(
_translate
(
"Dialog"
,
"选择文件"
))
self
.
label_2
.
setText
(
_translate
(
"Dialog"
,
"输出表格:"
))
self
.
pushButton_2
.
setText
(
_translate
(
"Dialog"
,
"输出表格路径"
))
main_window.py
View file @
dbd553fd
...
...
@@ -5,12 +5,12 @@ import cv2
import
qtawesome
from
PyQt5
import
QtWidgets
from
PyQt5.QtWidgets
import
QMainWindow
,
QFileDialog
,
QTableWidget
,
QTableWidgetItem
,
QAbstractItemView
,
QProgressBar
,
QLabel
from
PyQt5.QtCore
import
QUrl
,
Qt
,
QTimer
,
QRect
from
PyQt5.QtWidgets
import
QMainWindow
,
QFileDialog
,
QTableWidget
,
QTableWidgetItem
,
QAbstractItemView
,
QProgressBar
,
QLabel
,
QApplication
from
PyQt5.QtCore
import
QUrl
,
Qt
,
QTimer
,
QRect
,
pyqtSignal
from
PyQt5.QtMultimedia
import
*
from
PyQt5.QtGui
import
QIcon
import
utils
from
utils
import
validate_and_get_filepath
from
utils
import
validate_and_get_filepath
,
stop_thread
from
management
import
RunThread
,
ProjectContext
,
Element
from
detect_dialog
import
Detect_Dialog
from
assemble_dialog
import
Assemble_Dialog
...
...
@@ -28,13 +28,15 @@ import constant
class
MainWindow
(
QMainWindow
,
Ui_MainWindow
):
def
__init__
(
self
):
EXIT_CODE_REBOOT
=
-
12345678
renew_signal
=
pyqtSignal
(
str
)
def
__init__
(
self
,
project_path
):
super
(
MainWindow
,
self
)
.
__init__
()
self
.
setupUi
(
self
)
self
.
statusbar
.
showMessage
(
"hello"
,
5000
)
self
.
projectContext
=
ProjectContext
()
# 当前主执行的线程
self
.
threads
=
[]
# 语音合成相关组件
# todo:后续改成QThread的组件
self
.
synthesis
=
SynthesisProcessor
()
...
...
@@ -85,6 +87,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
video_timer
.
start
(
1000
)
# todo 作为参数配置
self
.
refresh_tab_timer
=
QTimer
()
self
.
refresh_tab_timer
.
timeout
.
connect
(
self
.
refresh_tab_slot
)
"""
状态栏相关空间
...
...
@@ -119,7 +122,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
import_movie
.
triggered
.
connect
(
self
.
import_slot
)
self
.
import_movie
.
setEnabled
(
False
)
self
.
action_open_project
.
triggered
.
connect
(
self
.
open_project_slot
)
self
.
action_refresh_tab
.
triggered
.
connect
(
self
.
refresh_tab_slot
)
#
self.action_refresh_tab.triggered.connect(self.refresh_tab_slot)
self
.
action_export
.
triggered
.
connect
(
self
.
export_all
)
self
.
action_export
.
setEnabled
(
False
)
...
...
@@ -129,7 +132,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
action_redo
.
setEnabled
(
False
)
self
.
action_view_history
.
triggered
.
connect
(
self
.
view_history_slot
)
self
.
action_operate
.
triggered
.
connect
(
self
.
operate_slot
)
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
.
setEnabled
(
False
)
# 状态栏的动作
# self.statusbar.addPermanentWidget(self.statusbarButton, stretch=0)
...
...
@@ -236,6 +241,13 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
user_editing_aside
=
False
self
.
user_editing_content
=
False
# 记录当前的所有进程
self
.
all_threads
=
[]
# 更新工程信息
self
.
projectContext
.
Init
(
project_path
)
self
.
update_ui
()
# 重写关闭Mmainwindow窗口
def
closeEvent
(
self
,
event
):
# buttonBox = QtWidgets.QMessageBox()
...
...
@@ -276,10 +288,24 @@ class MainWindow(QMainWindow, Ui_MainWindow):
replp
=
QtWidgets
.
QMessageBox
.
question
(
self
,
u'警告'
,
msg
,
QtWidgets
.
QMessageBox
.
Yes
)
# 新建工程后,初始化
工程
# 新建工程后,初始化
界面
def
init_project
(
self
,
project_path
):
self
.
projectContext
.
Init
(
project_path
)
self
.
import_movie
.
setEnabled
(
True
)
# 如果目前界面中正在处理其他工程,需要让用户确认是否退出当前界面
replp
=
QtWidgets
.
QMessageBox
.
question
(
self
,
u'警告'
,
u'是否退出当前工程?'
,
QtWidgets
.
QMessageBox
.
Yes
|
QtWidgets
.
QMessageBox
.
No
)
if
replp
==
QtWidgets
.
QMessageBox
.
Yes
:
self
.
projectContext
.
save_project
(
False
)
print
(
"emit close Event"
)
# 把其他进程结束掉
for
t
in
self
.
all_threads
:
if
t
.
is_alive
():
stop_thread
(
t
)
# 把project_path传递给start,在mainwindow初始化的时候传参进来
self
.
renew_signal
.
emit
(
project_path
)
# 关闭当前窗口,刷新得到一个新窗口
QApplication
.
exit
(
MainWindow
.
EXIT_CODE_REBOOT
)
# 导入视频
def
import_slot
(
self
):
...
...
@@ -293,24 +319,39 @@ class MainWindow(QMainWindow, Ui_MainWindow):
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
)
# todo: 后续这段代码公共的可以抽出来
# 打开某个工程
def
open_project_slot
(
self
):
project_path
=
QFileDialog
.
getExistingDirectory
(
self
,
"选择工程文件夹"
,
os
.
getcwd
())
print
(
"[import_slot] project_path="
+
project_path
)
if
project_path
==
""
or
project_path
==
None
:
return
self
.
projectContext
.
Init
(
project_path
)
self
.
update_ui
()
def
update_ui
(
self
):
if
self
.
projectContext
.
project_base_dir
is
None
:
return
self
.
action_export
.
setEnabled
(
True
)
if
self
.
projectContext
.
excel_path
is
not
None
:
self
.
open_excel_with_project_path
()
if
self
.
projectContext
.
video_path
is
None
:
self
.
action_operate
.
setEnabled
(
True
)
# 如果这个工程之前没有检测的视频,那么就需要将导入视频的按钮设置为可点,否则就直接导入对应的视频
video_path
=
self
.
projectContext
.
video_path
if
video_path
is
None
:
self
.
import_movie
.
setEnabled
(
True
)
else
:
self
.
player
.
setMedia
(
QMediaContent
(
path
))
# 选取视频文件
self
.
playVideo
()
# 播放视频
if
not
os
.
path
.
exists
(
video_path
):
self
.
prompt_dialog
.
show_dialog_signal
.
emit
(
f
"该工程原检测的视频对应路径{video_path}目前已失效,请导入新的视频重新开始检测或移动视频到对应位置,并重新启动工程"
)
self
.
import_movie
.
setEnabled
(
True
)
else
:
self
.
player
.
setMedia
(
QMediaContent
(
QUrl
(
video_path
)))
# 选取视频文件
self
.
playVideo
()
# 播放视频
self
.
action_insert_aside_from_now
.
setEnabled
(
True
)
def
start_detect
(
self
,
video_path
,
book_path
):
"""检测旁白
...
...
@@ -387,6 +428,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
name
=
"detect"
)
t
.
setDaemon
(
True
)
self
.
threads
.
append
(
t
)
self
.
all_threads
.
append
(
t
)
for
t
in
self
.
threads
:
t
.
start
()
...
...
@@ -549,12 +591,14 @@ class MainWindow(QMainWindow, Ui_MainWindow):
audio_path
=
os
.
path
.
dirname
(
self
.
projectContext
.
excel_path
)
+
(
"/tmp/
%.2
f.wav"
%
float
(
self
.
projectContext
.
aside_list
[
i
]
.
st_time_sec
))
break
print
(
"previewed_audio:"
,
self
.
previewed_audio
)
# 2、如果找到了该音频并且该次预览中没有播放过,则新起一个线程播放
if
audio_path
!=
None
and
os
.
path
.
basename
(
audio_path
)
not
in
self
.
previewed_audio
:
RunThread
(
funcName
=
self
.
play_audio
,
if
audio_path
!=
None
and
os
.
path
.
exists
(
audio_path
)
and
os
.
path
.
basename
(
audio_path
)
not
in
self
.
previewed_audio
:
t
=
RunThread
(
funcName
=
self
.
play_audio
,
args
=
(
audio_path
,
self
.
previewed_audio
),
name
=
"play_audio"
)
.
start
()
name
=
"play_audio"
)
t
.
start
()
self
.
all_threads
.
append
(
t
)
print
(
"previewed_audio:"
,
self
.
previewed_audio
)
@staticmethod
# 一条语音的最长播放时间是10秒
...
...
@@ -829,6 +873,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
name
=
"speech_synthesis"
)
t
.
setDaemon
(
True
)
t
.
start
()
self
.
all_threads
.
append
(
t
)
def
is_user_editing
(
self
):
return
self
.
user_editing_content
or
self
.
user_editing_aside
...
...
@@ -1017,7 +1062,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
刷新整个表格
"""
self
.
set_table_to_window
(
need_refresh_all
=
False
)
# 不需要加这个,因为只要itemchange,就会触发保存的
self
.
projectContext
.
save_project
(
False
)
def
export_all
(
self
):
...
...
main_window_ui.py
View file @
dbd553fd
...
...
@@ -344,8 +344,8 @@ class Ui_MainWindow(object):
self
.
actiona_4
.
setObjectName
(
"actiona_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
.
setObjectName
(
"action_refresh_tab"
)
#
self.action_refresh_tab = QtWidgets.QAction(MainWindow)
#
self.action_refresh_tab.setObjectName("action_refresh_tab")
self
.
action_operate
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
action_operate
.
setObjectName
(
"action_operate"
)
self
.
action_export
=
QtWidgets
.
QAction
(
MainWindow
)
...
...
@@ -373,8 +373,8 @@ class Ui_MainWindow(object):
# self.menu_2.addAction(self.action_insert_subtitle_from_now)
self
.
menu_3
.
addAction
(
self
.
actiona_3
)
self
.
menu_3
.
addAction
(
self
.
actiona_4
)
self
.
menu_3
.
addSeparator
()
self
.
menu_3
.
addAction
(
self
.
action_refresh_tab
)
#
self.menu_3.addSeparator()
#
self.menu_3.addAction(self.action_refresh_tab)
self
.
menubar
.
addAction
(
self
.
menu
.
menuAction
())
self
.
menubar
.
addAction
(
self
.
menu_2
.
menuAction
())
self
.
menubar
.
addAction
(
self
.
menu_3
.
menuAction
())
...
...
@@ -399,20 +399,20 @@ class Ui_MainWindow(object):
self
.
menu
.
setTitle
(
_translate
(
"MainWindow"
,
"文件"
))
self
.
menu_2
.
setTitle
(
_translate
(
"MainWindow"
,
"编辑"
))
self
.
menu_3
.
setTitle
(
_translate
(
"MainWindow"
,
"功能按键"
))
self
.
setting
.
setText
(
_translate
(
"MainWindow"
,
"设置
"
))
self
.
action_create
.
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"
,
"保存并备份"
))
self
.
setting
.
setText
(
_translate
(
"MainWindow"
,
"设置"
))
self
.
action_undo
.
setText
(
_translate
(
"MainWindow"
,
"撤销"
))
self
.
action_redo
.
setText
(
_translate
(
"MainWindow"
,
"重做"
))
self
.
action_insert_aside_from_now
.
setText
(
_translate
(
"MainWindow"
,
"当前位置插入旁白"
))
self
.
action_operate
.
setText
(
_translate
(
"MainWindow"
,
"操作表格"
))
self
.
actiona_3
.
setText
(
_translate
(
"MainWindow"
,
"旁白区间检测"
))
self
.
actiona_4
.
setText
(
_translate
(
"MainWindow"
,
"旁白音频合成"
))
self
.
action_view_history
.
setText
(
_translate
(
"MainWindow"
,
"----"
))
self
.
action_refresh_tab
.
setText
(
_translate
(
"MainWindow"
,
"刷新且保存表格"
))
self
.
action_operate
.
setText
(
_translate
(
"MainWindow"
,
"操作表格"
))
# self.action_refresh_tab.setText(_translate("MainWindow", "刷新且保存表格"))
self
.
action_export
.
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"
,
"新建"
))
main_window_ui_origin.py
deleted
100644 → 0
View file @
3f1a5604
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'main_window.ui'
#
# Created by: PyQt5 UI code generator 5.12
#
# WARNING! All changes made in this file will be lost!
from
PyQt5
import
QtCore
,
QtGui
,
QtWidgets
from
myVideoWidget
import
myVideoWidget
from
myvideoslider
import
myVideoSlider
from
mywidgetcontents
import
myWidgetContents
class
Ui_MainWindow
(
object
):
def
setupUi
(
self
,
MainWindow
):
MainWindow
.
setObjectName
(
"MainWindow"
)
MainWindow
.
resize
(
939
,
763
)
MainWindow
.
setStyleSheet
(
"QMainWindow:{
\n
"
" border: 2px groove gray;
\n
"
" border-radius: 25px;
\n
"
" border-style: outset;
\n
"
" background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0 rgba(0, 0, 0, 0), stop:0.52 rgba(0, 0, 0, 0), stop:0.565 rgba(82, 121, 76, 33), stop:0.65 rgba(159, 235, 148, 64), stop:0.721925 rgba(255, 238, 150, 129), stop:0.77 rgba(255, 128, 128, 204), stop:0.89 rgba(191, 128, 255, 64), stop:1 rgba(0, 0, 0, 0));
\n
"
" padding: 5px;
\n
"
"}"
)
self
.
centralwidget
=
QtWidgets
.
QWidget
(
MainWindow
)
self
.
centralwidget
.
setObjectName
(
"centralwidget"
)
self
.
horizontalLayout
=
QtWidgets
.
QHBoxLayout
(
self
.
centralwidget
)
self
.
horizontalLayout
.
setObjectName
(
"horizontalLayout"
)
self
.
verticalLayout
=
QtWidgets
.
QVBoxLayout
()
self
.
verticalLayout
.
setObjectName
(
"verticalLayout"
)
self
.
shuiping
=
QtWidgets
.
QHBoxLayout
()
self
.
shuiping
.
setObjectName
(
"shuiping"
)
self
.
verticalWidget_3
=
QtWidgets
.
QWidget
(
self
.
centralwidget
)
self
.
verticalWidget_3
.
setObjectName
(
"verticalWidget_3"
)
self
.
verticalLayout_3
=
QtWidgets
.
QVBoxLayout
(
self
.
verticalWidget_3
)
self
.
verticalLayout_3
.
setObjectName
(
"verticalLayout_3"
)
self
.
wgt_video
=
myVideoWidget
(
self
.
verticalWidget_3
)
self
.
wgt_video
.
setMinimumSize
(
QtCore
.
QSize
(
410
,
200
))
self
.
wgt_video
.
setMaximumSize
(
QtCore
.
QSize
(
16777215
,
16777215
))
palette
=
QtGui
.
QPalette
()
brush
=
QtGui
.
QBrush
(
QtGui
.
QColor
(
255
,
255
,
255
))
brush
.
setStyle
(
QtCore
.
Qt
.
SolidPattern
)
palette
.
setBrush
(
QtGui
.
QPalette
.
Active
,
QtGui
.
QPalette
.
Base
,
brush
)
brush
=
QtGui
.
QBrush
(
QtGui
.
QColor
(
0
,
0
,
0
))
brush
.
setStyle
(
QtCore
.
Qt
.
SolidPattern
)
palette
.
setBrush
(
QtGui
.
QPalette
.
Active
,
QtGui
.
QPalette
.
Window
,
brush
)
brush
=
QtGui
.
QBrush
(
QtGui
.
QColor
(
255
,
255
,
255
))
brush
.
setStyle
(
QtCore
.
Qt
.
SolidPattern
)
palette
.
setBrush
(
QtGui
.
QPalette
.
Inactive
,
QtGui
.
QPalette
.
Base
,
brush
)
brush
=
QtGui
.
QBrush
(
QtGui
.
QColor
(
0
,
0
,
0
))
brush
.
setStyle
(
QtCore
.
Qt
.
SolidPattern
)
palette
.
setBrush
(
QtGui
.
QPalette
.
Inactive
,
QtGui
.
QPalette
.
Window
,
brush
)
brush
=
QtGui
.
QBrush
(
QtGui
.
QColor
(
0
,
0
,
0
))
brush
.
setStyle
(
QtCore
.
Qt
.
SolidPattern
)
palette
.
setBrush
(
QtGui
.
QPalette
.
Disabled
,
QtGui
.
QPalette
.
Base
,
brush
)
brush
=
QtGui
.
QBrush
(
QtGui
.
QColor
(
0
,
0
,
0
))
brush
.
setStyle
(
QtCore
.
Qt
.
SolidPattern
)
palette
.
setBrush
(
QtGui
.
QPalette
.
Disabled
,
QtGui
.
QPalette
.
Window
,
brush
)
self
.
wgt_video
.
setPalette
(
palette
)
self
.
wgt_video
.
setAutoFillBackground
(
True
)
self
.
wgt_video
.
setObjectName
(
"wgt_video"
)
self
.
verticalLayout_3
.
addWidget
(
self
.
wgt_video
)
self
.
splitter
=
QtWidgets
.
QSplitter
(
self
.
verticalWidget_3
)
self
.
splitter
.
setOrientation
(
QtCore
.
Qt
.
Horizontal
)
self
.
splitter
.
setObjectName
(
"splitter"
)
self
.
label_2
=
QtWidgets
.
QLabel
(
self
.
splitter
)
self
.
label_2
.
setObjectName
(
"label_2"
)
# self.btn_open = QtWidgets.QPushButton(self.splitter)
# self.btn_open.setMaximumSize(QtCore.QSize(100, 25))
# self.btn_open.setObjectName("btn_open")
self
.
btn_play
=
QtWidgets
.
QPushButton
(
""
,
self
.
splitter
)
self
.
btn_play
.
setIcon
(
QtGui
.
QIcon
(
"images
\
播放.svg"
))
self
.
btn_play
.
setIconSize
(
QtCore
.
QSize
(
30
,
30
))
self
.
btn_play
.
setMinimumSize
(
QtCore
.
QSize
(
30
,
30
))
self
.
btn_play
.
setMaximumSize
(
QtCore
.
QSize
(
30
,
30
))
self
.
btn_play
.
setStyleSheet
(
"QPushButton {
\n
"
" color: #fff;
\n
"
" border: 2px groove gray;
\n
"
" border-radius: 15px;
\n
"
" border-style: outset;
\n
"
" background: qradialgradient(
\n
"
" cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,
\n
"
" radius: 1.35, stop: 0 #fff, stop: 1 #888
\n
"
" );
\n
"
" padding: 5px;
\n
"
" }
\n
"
"
\n
"
"QPushButton:hover {
\n
"
" background: qradialgradient(
\n
"
" cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,
\n
"
" radius: 1.35, stop: 0 #fff, stop: 1 #bbb
\n
"
" );
\n
"
" }
\n
"
"
\n
"
"QPushButton:pressed {
\n
"
" border-style: inset;
\n
"
" background: qradialgradient(
\n
"
" cx: 0.4, cy: -0.1, fx: 0.4, fy: -0.1,
\n
"
" radius: 1.35, stop: 0 #fff, stop: 1 #ddd
\n
"
" );
\n
"
" }"
)
self
.
btn_play
.
setObjectName
(
"btn_play"
)
self
.
sld_audio
=
QtWidgets
.
QSlider
(
self
.
splitter
)
sizePolicy
=
QtWidgets
.
QSizePolicy
(
QtWidgets
.
QSizePolicy
.
Expanding
,
QtWidgets
.
QSizePolicy
.
Fixed
)
sizePolicy
.
setHorizontalStretch
(
0
)
sizePolicy
.
setVerticalStretch
(
0
)
sizePolicy
.
setHeightForWidth
(
self
.
sld_audio
.
sizePolicy
()
.
hasHeightForWidth
())
self
.
sld_audio
.
setSizePolicy
(
sizePolicy
)
self
.
sld_audio
.
setMinimumSize
(
QtCore
.
QSize
(
50
,
25
))
self
.
sld_audio
.
setMaximumSize
(
QtCore
.
QSize
(
150
,
25
))
self
.
sld_audio
.
setSingleStep
(
5
)
# self.sld_audio.setTickPosition(QtWidgets.QSlider.TicksBelow)
# self.sld_audio.setTickInterval(5)
self
.
sld_audio
.
setProperty
(
"value"
,
100
)
self
.
sld_audio
.
setOrientation
(
QtCore
.
Qt
.
Horizontal
)
self
.
sld_audio
.
setObjectName
(
"sld_audio"
)
self
.
sld_audio
.
setStyleSheet
(
'''
QSlider:horizontal {
min-height: 24px;
max-height: 24px;
}
QSlider:vertical {
min-width: 24px;
max-width: 24px;
}
QSlider::groove:horizontal {
height: 4px;
background: #393939;
margin: 0 12px;
}
QSlider::groove:vertical {
width: 4px;
background: #393939;
margin: 12px 0;
border-radius: 24px;
}
QSlider::handle:horizontal {
image: url(images/slider.svg);
width: 12px;
height: 12px;
margin: -24px -12px;
}
QSlider::handle:vertical {
image: url(images/slider.svg);
border-radius: 24px;
width: 12px;
height: 12px;
margin: -12px -24px;
}
QSlider::add-page {
background: #232629;
}
QSlider::sub-page {
background: #ffd740;
}
'''
)
self
.
lab_audio
=
QtWidgets
.
QLabel
(
self
.
splitter
)
self
.
lab_audio
.
setObjectName
(
"lab_audio"
)
self
.
verticalLayout_3
.
addWidget
(
self
.
splitter
)
self
.
verticalLayout_3
.
setStretch
(
0
,
8
)
self
.
shuiping
.
addWidget
(
self
.
verticalWidget_3
)
self
.
tabWidget
=
QtWidgets
.
QTabWidget
(
self
.
centralwidget
)
self
.
tabWidget
.
setEnabled
(
True
)
self
.
tabWidget
.
setContextMenuPolicy
(
QtCore
.
Qt
.
DefaultContextMenu
)
self
.
tabWidget
.
setStyleSheet
(
""
)
self
.
tabWidget
.
setTabPosition
(
QtWidgets
.
QTabWidget
.
North
)
self
.
tabWidget
.
setTabShape
(
QtWidgets
.
QTabWidget
.
Triangular
)
self
.
tabWidget
.
setIconSize
(
QtCore
.
QSize
(
20
,
20
))
self
.
tabWidget
.
setElideMode
(
QtCore
.
Qt
.
ElideNone
)
self
.
tabWidget
.
setMovable
(
False
)
self
.
tabWidget
.
setTabBarAutoHide
(
False
)
self
.
tabWidget
.
setObjectName
(
"tabWidget"
)
self
.
all_tab
=
QtWidgets
.
QWidget
()
self
.
all_tab
.
setEnabled
(
True
)
self
.
all_tab
.
setObjectName
(
"all_tab"
)
self
.
horizontalLayout_4
=
QtWidgets
.
QHBoxLayout
(
self
.
all_tab
)
self
.
horizontalLayout_4
.
setObjectName
(
"horizontalLayout_4"
)
self
.
all_tableWidget
=
QtWidgets
.
QTableWidget
(
self
.
all_tab
)
self
.
all_tableWidget
.
setObjectName
(
"all_tableWidget"
)
self
.
all_tableWidget
.
setColumnCount
(
0
)
self
.
all_tableWidget
.
setRowCount
(
0
)
self
.
horizontalLayout_4
.
addWidget
(
self
.
all_tableWidget
)
self
.
tabWidget
.
addTab
(
self
.
all_tab
,
""
)
self
.
zm_tab
=
QtWidgets
.
QWidget
()
self
.
zm_tab
.
setEnabled
(
True
)
self
.
zm_tab
.
setObjectName
(
"zm_tab"
)
self
.
horizontalLayout_2
=
QtWidgets
.
QHBoxLayout
(
self
.
zm_tab
)
self
.
horizontalLayout_2
.
setObjectName
(
"horizontalLayout_2"
)
self
.
zm_tableWidget
=
QtWidgets
.
QTableWidget
(
self
.
zm_tab
)
self
.
zm_tableWidget
.
setObjectName
(
"zm_tableWidget"
)
self
.
zm_tableWidget
.
setColumnCount
(
0
)
self
.
zm_tableWidget
.
setRowCount
(
0
)
self
.
horizontalLayout_2
.
addWidget
(
self
.
zm_tableWidget
)
self
.
tabWidget
.
addTab
(
self
.
zm_tab
,
""
)
self
.
pb_tab
=
QtWidgets
.
QWidget
()
self
.
pb_tab
.
setObjectName
(
"pb_tab"
)
self
.
horizontalLayout_3
=
QtWidgets
.
QHBoxLayout
(
self
.
pb_tab
)
self
.
horizontalLayout_3
.
setObjectName
(
"horizontalLayout_3"
)
self
.
pb_tableWidget
=
QtWidgets
.
QTableWidget
(
self
.
pb_tab
)
self
.
pb_tableWidget
.
setObjectName
(
"pb_tableWidget"
)
self
.
pb_tableWidget
.
setColumnCount
(
0
)
self
.
pb_tableWidget
.
setRowCount
(
0
)
self
.
horizontalLayout_3
.
addWidget
(
self
.
pb_tableWidget
)
self
.
tabWidget
.
addTab
(
self
.
pb_tab
,
""
)
self
.
shuiping
.
addWidget
(
self
.
tabWidget
)
self
.
shuiping
.
setStretch
(
0
,
2
)
self
.
shuiping
.
setStretch
(
1
,
1
)
self
.
verticalLayout
.
addLayout
(
self
.
shuiping
)
self
.
verticalWidget_2
=
QtWidgets
.
QWidget
(
self
.
centralwidget
)
self
.
verticalWidget_2
.
setObjectName
(
"verticalWidget_2"
)
self
.
chuizhi
=
QtWidgets
.
QVBoxLayout
(
self
.
verticalWidget_2
)
self
.
chuizhi
.
setObjectName
(
"chuizhi"
)
self
.
zm_label
=
QtWidgets
.
QLabel
(
self
.
verticalWidget_2
)
sizePolicy
=
QtWidgets
.
QSizePolicy
(
QtWidgets
.
QSizePolicy
.
Preferred
,
QtWidgets
.
QSizePolicy
.
Preferred
)
sizePolicy
.
setHorizontalStretch
(
0
)
sizePolicy
.
setVerticalStretch
(
0
)
sizePolicy
.
setHeightForWidth
(
self
.
zm_label
.
sizePolicy
()
.
hasHeightForWidth
())
self
.
zm_label
.
setSizePolicy
(
sizePolicy
)
self
.
zm_label
.
setObjectName
(
"zm_label"
)
self
.
chuizhi
.
addWidget
(
self
.
zm_label
)
self
.
zm_slider_layout
=
QtWidgets
.
QHBoxLayout
()
self
.
zm_slider_layout
.
setObjectName
(
"zm_slider_layout"
)
self
.
scrollArea
=
QtWidgets
.
QScrollArea
(
self
.
verticalWidget_2
)
self
.
scrollArea
.
setHorizontalScrollBarPolicy
(
QtCore
.
Qt
.
ScrollBarAlwaysOn
)
self
.
scrollArea
.
setWidgetResizable
(
False
)
self
.
scrollArea
.
setObjectName
(
"scrollArea"
)
self
.
scrollAreaWidgetContents
=
myWidgetContents
()
self
.
scrollAreaWidgetContents
.
setGeometry
(
QtCore
.
QRect
(
0
,
0
,
800
,
40
))
self
.
scrollAreaWidgetContents
.
setObjectName
(
"scrollAreaWidgetContents"
)
self
.
sld_video
=
myVideoSlider
(
self
.
scrollAreaWidgetContents
)
self
.
sld_video
.
setGeometry
(
QtCore
.
QRect
(
10
,
20
,
790
,
30
))
self
.
sld_video
.
setMinimumSize
(
QtCore
.
QSize
(
410
,
0
))
self
.
sld_video
.
setMaximumSize
(
QtCore
.
QSize
(
16777215
,
20
))
self
.
sld_video
.
setMaximum
(
100
)
self
.
sld_video
.
setOrientation
(
QtCore
.
Qt
.
Horizontal
)
self
.
sld_video
.
setTickPosition
(
QtWidgets
.
QSlider
.
TicksAbove
)
self
.
sld_video
.
setTickInterval
(
1
)
self
.
sld_video
.
setObjectName
(
"sld_video"
)
self
.
scrollArea
.
setWidget
(
self
.
scrollAreaWidgetContents
)
self
.
zm_slider_layout
.
addWidget
(
self
.
scrollArea
)
self
.
lab_video
=
QtWidgets
.
QLabel
(
self
.
verticalWidget_2
)
self
.
lab_video
.
setMaximumSize
(
QtCore
.
QSize
(
16777215
,
50
))
self
.
lab_video
.
setObjectName
(
"lab_video"
)
self
.
zm_slider_layout
.
addWidget
(
self
.
lab_video
)
self
.
zm_slider_layout
.
setStretch
(
0
,
15
)
self
.
zm_slider_layout
.
setStretch
(
1
,
1
)
self
.
chuizhi
.
addLayout
(
self
.
zm_slider_layout
)
spacerItem
=
QtWidgets
.
QSpacerItem
(
20
,
40
,
QtWidgets
.
QSizePolicy
.
Minimum
,
QtWidgets
.
QSizePolicy
.
Expanding
)
self
.
chuizhi
.
addItem
(
spacerItem
)
self
.
pb_label
=
QtWidgets
.
QLabel
(
self
.
verticalWidget_2
)
sizePolicy
=
QtWidgets
.
QSizePolicy
(
QtWidgets
.
QSizePolicy
.
Preferred
,
QtWidgets
.
QSizePolicy
.
Preferred
)
sizePolicy
.
setHorizontalStretch
(
0
)
sizePolicy
.
setVerticalStretch
(
0
)
sizePolicy
.
setHeightForWidth
(
self
.
pb_label
.
sizePolicy
()
.
hasHeightForWidth
())
self
.
pb_label
.
setSizePolicy
(
sizePolicy
)
self
.
pb_label
.
setObjectName
(
"pb_label"
)
self
.
chuizhi
.
addWidget
(
self
.
pb_label
)
self
.
kd_slider_layout
=
QtWidgets
.
QHBoxLayout
()
self
.
kd_slider_layout
.
setObjectName
(
"kd_slider_layout"
)
self
.
kd_slider
=
QtWidgets
.
QSlider
(
self
.
verticalWidget_2
)
self
.
kd_slider
.
setEnabled
(
True
)
sizePolicy
=
QtWidgets
.
QSizePolicy
(
QtWidgets
.
QSizePolicy
.
Expanding
,
QtWidgets
.
QSizePolicy
.
Fixed
)
sizePolicy
.
setHorizontalStretch
(
0
)
sizePolicy
.
setVerticalStretch
(
0
)
sizePolicy
.
setHeightForWidth
(
self
.
kd_slider
.
sizePolicy
()
.
hasHeightForWidth
())
self
.
kd_slider
.
setSizePolicy
(
sizePolicy
)
self
.
kd_slider
.
setCursor
(
QtGui
.
QCursor
(
QtCore
.
Qt
.
SizeHorCursor
))
self
.
kd_slider
.
setMouseTracking
(
False
)
self
.
kd_slider
.
setFocusPolicy
(
QtCore
.
Qt
.
NoFocus
)
self
.
kd_slider
.
setMinimum
(
1
)
self
.
kd_slider
.
setMaximum
(
100
)
self
.
kd_slider
.
setOrientation
(
QtCore
.
Qt
.
Horizontal
)
self
.
kd_slider
.
setTickPosition
(
QtWidgets
.
QSlider
.
TicksAbove
)
self
.
kd_slider
.
setTickInterval
(
1
)
self
.
kd_slider
.
setObjectName
(
"kd_slider"
)
self
.
kd_slider_layout
.
addWidget
(
self
.
kd_slider
)
self
.
chuizhi
.
addLayout
(
self
.
kd_slider_layout
)
self
.
verticalLayout
.
addWidget
(
self
.
verticalWidget_2
)
self
.
verticalLayout
.
setStretch
(
0
,
5
)
self
.
verticalLayout
.
setStretch
(
1
,
1
)
self
.
horizontalLayout
.
addLayout
(
self
.
verticalLayout
)
MainWindow
.
setCentralWidget
(
self
.
centralwidget
)
self
.
menubar
=
QtWidgets
.
QMenuBar
(
MainWindow
)
self
.
menubar
.
setGeometry
(
QtCore
.
QRect
(
0
,
0
,
939
,
26
))
self
.
menubar
.
setObjectName
(
"menubar"
)
self
.
menu
=
QtWidgets
.
QMenu
(
self
.
menubar
)
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"
)
MainWindow
.
setMenuBar
(
self
.
menubar
)
self
.
statusbar
=
QtWidgets
.
QStatusBar
(
MainWindow
)
self
.
statusbar
.
setObjectName
(
"statusbar"
)
MainWindow
.
setStatusBar
(
self
.
statusbar
)
self
.
actionxinjian
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
actionxinjian
.
setObjectName
(
"actionxinjian"
)
self
.
action_open_project
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
action_open_project
.
setObjectName
(
"action_open_project"
)
self
.
import_movie
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
import_movie
.
setObjectName
(
"import_movie"
)
self
.
actions
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
actions
.
setObjectName
(
"actions"
)
self
.
action_save
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
action_save
.
setObjectName
(
"action_save"
)
self
.
action_undo
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
action_undo
.
setObjectName
(
"action_undo"
)
self
.
action_redo
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
action_redo
.
setObjectName
(
"action_redo"
)
self
.
actiona_3
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
actiona_3
.
setObjectName
(
"actiona_3"
)
self
.
actiona_4
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
actiona_4
.
setObjectName
(
"actiona_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
.
setObjectName
(
"action_refresh_tab"
)
self
.
action_operate
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
action_operate
.
setObjectName
(
"action_operate"
)
self
.
action_export
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
action_export
.
setObjectName
(
"action_export"
)
self
.
action_insert_aside_from_now
=
QtWidgets
.
QAction
(
MainWindow
)
self
.
action_insert_aside_from_now
.
setObjectName
(
"action_insert_aside_from_now"
)
self
.
menu
.
addAction
(
self
.
actionxinjian
)
self
.
menu
.
addAction
(
self
.
action_open_project
)
self
.
menu
.
addSeparator
()
self
.
menu
.
addAction
(
self
.
import_movie
)
self
.
menu
.
addAction
(
self
.
action_export
)
self
.
menu
.
addSeparator
()
self
.
menu
.
addAction
(
self
.
action_save
)
self
.
menu_2
.
addAction
(
self
.
action_undo
)
self
.
menu_2
.
addAction
(
self
.
action_redo
)
# self.menu_2.addAction(self.action_view_history)
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
.
actiona_3
)
self
.
menu_3
.
addAction
(
self
.
actiona_4
)
self
.
menu_3
.
addSeparator
()
self
.
menu_3
.
addAction
(
self
.
action_refresh_tab
)
self
.
menubar
.
addAction
(
self
.
menu
.
menuAction
())
self
.
menubar
.
addAction
(
self
.
menu_2
.
menuAction
())
self
.
menubar
.
addAction
(
self
.
menu_3
.
menuAction
())
self
.
retranslateUi
(
MainWindow
)
self
.
tabWidget
.
setCurrentIndex
(
0
)
QtCore
.
QMetaObject
.
connectSlotsByName
(
MainWindow
)
def
retranslateUi
(
self
,
MainWindow
):
_translate
=
QtCore
.
QCoreApplication
.
translate
MainWindow
.
setWindowTitle
(
_translate
(
"MainWindow"
,
"MainWindow"
))
self
.
lab_audio
.
setText
(
_translate
(
"MainWindow"
,
"音量:100
%
"
))
self
.
label_2
.
setText
(
_translate
(
"MainWindow"
,
"00:00/00:00"
))
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"
,
"旁白"
))
self
.
zm_label
.
setText
(
_translate
(
"MainWindow"
,
"时间轴"
))
self
.
lab_video
.
setText
(
_translate
(
"MainWindow"
,
"00:00"
))
self
.
pb_label
.
setText
(
_translate
(
"MainWindow"
,
"刻度"
))
self
.
menu
.
setTitle
(
_translate
(
"MainWindow"
,
"文件"
))
self
.
menu_2
.
setTitle
(
_translate
(
"MainWindow"
,
"编辑"
))
self
.
menu_3
.
setTitle
(
_translate
(
"MainWindow"
,
"功能按键"
))
self
.
actionxinjian
.
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"
,
"保存并备份"
))
self
.
action_undo
.
setText
(
_translate
(
"MainWindow"
,
"撤销"
))
self
.
action_redo
.
setText
(
_translate
(
"MainWindow"
,
"重做"
))
self
.
actiona_3
.
setText
(
_translate
(
"MainWindow"
,
"旁白区间检测"
))
self
.
actiona_4
.
setText
(
_translate
(
"MainWindow"
,
"旁白音频合成"
))
self
.
action_view_history
.
setText
(
_translate
(
"MainWindow"
,
"----"
))
self
.
action_refresh_tab
.
setText
(
_translate
(
"MainWindow"
,
"刷新且保存表格"
))
self
.
action_operate
.
setText
(
_translate
(
"MainWindow"
,
"操作表格"
))
self
.
action_export
.
setText
(
_translate
(
"MainWindow"
,
"导出"
))
self
.
action_insert_aside_from_now
.
setText
(
_translate
(
"MainWindow"
,
"当前位置插入旁白"
))
management.py
View file @
dbd553fd
...
...
@@ -152,7 +152,7 @@ class ProjectContext:
self
.
records_pos
=
0
def
Init
(
self
,
project_dir
):
if
len
(
project_dir
)
==
0
or
project_dir
is
None
:
if
project_dir
is
None
or
not
os
.
path
.
exists
(
project_dir
)
:
return
# 有的时候路径是 '/F:/out1/test.xlsx',有的时候是'F:/out1/test.xlsx'
if
project_dir
[
0
]
==
'/'
:
...
...
@@ -170,16 +170,15 @@ class ProjectContext:
return
with
open
(
self
.
conf_path
,
'r'
,
encoding
=
'utf8'
)
as
f
:
info
=
json
.
load
(
f
)
video_path
=
info
[
"video_path"
]
excel_path
=
info
[
"excel_path"
]
self
.
video_path
=
info
[
"video_path"
]
self
.
excel_path
=
info
[
"excel_path"
]
self
.
speaker_info
=
info
[
"speaker_info"
][
"speaker_id"
]
self
.
speaker_speed
=
info
[
"speaker_info"
][
"speaker_speed"
]
if
video_path
==
self
.
video_path
and
excel_path
==
self
.
excel_path
:
self
.
detected
=
info
[
"detection_info"
][
"detected"
]
self
.
nd_process
=
info
[
"detection_info"
][
"nd_process"
]
self
.
last_time
=
info
[
"detection_info"
][
"last_time"
]
self
.
caption_boundings
=
info
[
"detection_info"
][
"caption_boundings"
]
self
.
has_subtitle
=
info
[
"detection_info"
][
"has_subtitle"
]
self
.
detected
=
info
[
"detection_info"
][
"detected"
]
self
.
nd_process
=
info
[
"detection_info"
][
"nd_process"
]
self
.
last_time
=
info
[
"detection_info"
][
"last_time"
]
self
.
caption_boundings
=
info
[
"detection_info"
][
"caption_boundings"
]
self
.
has_subtitle
=
info
[
"detection_info"
][
"has_subtitle"
]
# 当前工程下没有配置文件,就初始化一份
if
self
.
conf_path
!=
this_conf_path
:
self
.
conf_path
=
this_conf_path
...
...
operation_dialog.ui
View file @
dbd553fd
...
...
@@ -6,441 +6,299 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
737
</width>
<height>
437
</height>
<width>
574
</width>
<height>
384
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Dialog
</string>
</property>
<widget
class=
"QDialogButtonBox"
name=
"buttonBox"
>
<property
name=
"enabled"
>
<bool>
false
</bool>
</property>
<property
name=
"geometry"
>
<rect>
<x>
480
</x>
<y>
380
</y>
<width>
101
</width>
<height>
32
</height>
</rect>
</property>
<property
name=
"toolTip"
>
<string/>
</property>
<property
name=
"toolTipDuration"
>
<number>
-1
</number>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"standardButtons"
>
<set>
QDialogButtonBox::Ok
</set>
</property>
<property
name=
"centerButtons"
>
<bool>
false
</bool>
</property>
</widget>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"geometry"
>
<rect>
<x>
60
</x>
<y>
70
</y>
<width>
81
</width>
<height>
20
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
我想操作第
</string>
</property>
</widget>
<widget
class=
"QLineEdit"
name=
"lineEdit"
>
<property
name=
"geometry"
>
<rect>
<x>
140
</x>
<y>
70
</y>
<width>
101
</width>
<height>
21
</height>
</rect>
</property>
</widget>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"geometry"
>
<rect>
<x>
250
</x>
<y>
70
</y>
<width>
311
</width>
<height>
21
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
行(如果操作是增加,则在该行后面增加)
</string>
</property>
</widget>
<widget
class=
"QLineEdit"
name=
"lineEdit_2"
>
<property
name=
"geometry"
>
<rect>
<x>
140
</x>
<y>
130
</y>
<width>
101
</width>
<height>
21
</height>
</rect>
</property>
</widget>
<widget
class=
"QLabel"
name=
"label_3"
>
<property
name=
"geometry"
>
<rect>
<x>
60
</x>
<y>
130
</y>
<width>
71
</width>
<height>
16
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
起始时间:
</string>
</property>
</widget>
<widget
class=
"QLabel"
name=
"label_4"
>
<property
name=
"geometry"
>
<rect>
<x>
60
</x>
<y>
180
</y>
<width>
71
</width>
<height>
16
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
结束时间:
</string>
</property>
</widget>
<widget
class=
"QLineEdit"
name=
"lineEdit_3"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
<property
name=
"geometry"
>
<rect>
<x>
140
</x>
<y>
180
</y>
<width>
101
</width>
<height>
21
</height>
</rect>
</property>
</widget>
<widget
class=
"QLineEdit"
name=
"lineEdit_4"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
<property
name=
"geometry"
>
<rect>
<x>
140
</x>
<y>
230
</y>
<width>
231
</width>
<height>
21
</height>
</rect>
</property>
</widget>
<widget
class=
"QComboBox"
name=
"comboBox"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
<property
name=
"geometry"
>
<rect>
<x>
140
</x>
<y>
20
</y>
<width>
87
</width>
<height>
22
</height>
</rect>
</property>
<property
name=
"editable"
>
<bool>
false
</bool>
</property>
<item>
<property
name=
"text"
>
<string>
字幕
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
columnstretch=
"0,1,0,0,0"
>
<item
row=
"0"
column=
"1"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
stretch=
"1,1"
>
<item>
<widget
class=
"QComboBox"
name=
"comboBox"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
<property
name=
"editable"
>
<bool>
false
</bool>
</property>
<item>
<property
name=
"text"
>
<string>
字幕
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
旁白
</string>
</property>
</item>
</widget>
</item>
<item>
<spacer
name=
"horizontalSpacer_2"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<property
name=
"text"
>
<string>
旁白
</string>
</property>
<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>
</widget>
<widget
class=
"QComboBox"
name=
"comboBox_2"
>
<property
name=
"geometry"
>
<rect>
<x>
260
</x>
<y>
20
</y>
<width>
87
</width>
<height>
22
</height>
</rect>
</property>
<item>
<property
name=
"text"
>
<string>
增加一行
</string>
</property>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
我想操作第
</string>
</property>
</widget>
</item>
<item>
<property
name=
"text"
>
<string>
修改一行
</string>
</property>
<item
row=
"1"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"lineEdit"
/>
</item>
<item>
<property
name=
"text"
>
<string>
删除一行
</string>
</property>
<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>
</widget>
<widget
class=
"QLineEdit"
name=
"lineEdit_5"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
<property
name=
"geometry"
>
<rect>
<x>
140
</x>
<y>
270
</y>
<width>
101
</width>
<height>
21
</height>
</rect>
</property>
</widget>
<widget
class=
"QLineEdit"
name=
"lineEdit_6"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
<property
name=
"geometry"
>
<rect>
<x>
140
</x>
<y>
310
</y>
<width>
231
</width>
<height>
21
</height>
</rect>
</property>
</widget>
<widget
class=
"QLabel"
name=
"label_5"
>
<property
name=
"geometry"
>
<rect>
<x>
60
</x>
<y>
230
</y>
<width>
71
</width>
<height>
16
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
字幕:
</string>
</property>
</widget>
<widget
class=
"QLabel"
name=
"label_6"
>
<property
name=
"geometry"
>
<rect>
<x>
60
</x>
<y>
270
</y>
<width>
71
</width>
<height>
16
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
推荐字数:
</string>
</property>
</widget>
<widget
class=
"QLabel"
name=
"label_7"
>
<property
name=
"geometry"
>
<rect>
<x>
60
</x>
<y>
310
</y>
<width>
71
</width>
<height>
16
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
旁白:
</string>
</property>
</widget>
<widget
class=
"QLabel"
name=
"label_8"
>
<property
name=
"geometry"
>
<rect>
<x>
250
</x>
<y>
130
</y>
<width>
251
</width>
<height>
20
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
*请填数字,最多保留两位小数
</string>
</property>
</widget>
<widget
class=
"QLabel"
name=
"label_9"
>
<property
name=
"geometry"
>
<rect>
<x>
250
</x>
<y>
180
</y>
<width>
251
</width>
<height>
20
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
*请填数字,最多保留两位小数
</string>
</property>
</widget>
<widget
class=
"QLabel"
name=
"label_10"
>
<property
name=
"geometry"
>
<rect>
<x>
380
</x>
<y>
230
</y>
<width>
81
</width>
<height>
20
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
*请填文字
</string>
</property>
</widget>
<widget
class=
"QLabel"
name=
"label_11"
>
<property
name=
"geometry"
>
<rect>
<x>
380
</x>
<y>
310
</y>
<width>
81
</width>
<height>
20
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
*请填文字
</string>
</property>
</widget>
<widget
class=
"QLabel"
name=
"label_12"
>
<property
name=
"geometry"
>
<rect>
<x>
250
</x>
<y>
270
</y>
<width>
251
</width>
<height>
20
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
*请填数字,必须是不超过100的正整数
</string>
</property>
</widget>
<widget
class=
"QPushButton"
name=
"pushButton"
>
<property
name=
"geometry"
>
<rect>
<x>
350
</x>
<y>
380
</y>
<width>
93
</width>
<height>
28
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
检测
</string>
</property>
</widget>
<widget
class=
"QPushButton"
name=
"pushButton_2"
>
<property
name=
"geometry"
>
<rect>
<x>
230
</x>
<y>
380
</y>
<width>
93
</width>
<height>
28
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
修改
</string>
</property>
</widget>
<widget
class=
"QLabel"
name=
"label_13"
>
<property
name=
"geometry"
>
<rect>
<x>
250
</x>
<y>
90
</y>
<width>
311
</width>
<height>
21
</height>
</rect>
</property>
<property
name=
"font"
>
<font>
<pointsize>
8
</pointsize>
</font>
</property>
<property
name=
"text"
>
<string>
*需要填在【字幕旁白】页面中的行数
</string>
</property>
</widget>
<widget
class=
"QPushButton"
name=
"pushButton_3"
>
<property
name=
"geometry"
>
<rect>
<x>
540
</x>
<y>
60
</y>
<width>
71
</width>
<height>
61
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
填充
<item
row=
"2"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_3"
>
<property
name=
"text"
>
<string>
起始时间:
</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"lineEdit_2"
/>
</item>
<item
row=
"2"
column=
"2"
>
<widget
class=
"QLabel"
name=
"label_8"
>
<property
name=
"text"
>
<string>
*请填数字,最多保留两位小数
</string>
</property>
</widget>
</item>
<item
row=
"3"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_4"
>
<property
name=
"text"
>
<string>
结束时间:
</string>
</property>
</widget>
</item>
<item
row=
"3"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"lineEdit_3"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item
row=
"3"
column=
"2"
>
<widget
class=
"QLabel"
name=
"label_9"
>
<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=
"1"
>
<widget
class=
"QLineEdit"
name=
"lineEdit_4"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item
row=
"4"
column=
"2"
>
<widget
class=
"QLabel"
name=
"label_10"
>
<property
name=
"text"
>
<string>
*请填文字
</string>
</property>
</widget>
</item>
<item
row=
"5"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_6"
>
<property
name=
"text"
>
<string>
推荐字数:
</string>
</property>
</widget>
</item>
<item
row=
"5"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"lineEdit_5"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</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=
"0"
>
<widget
class=
"QLabel"
name=
"label_7"
>
<property
name=
"text"
>
<string>
旁白:
</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=
"6"
column=
"2"
>
<widget
class=
"QLabel"
name=
"label_11"
>
<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=
"4"
>
<widget
class=
"QComboBox"
name=
"comboBox_3"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
<property
name=
"editable"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item
row=
"8"
column=
"4"
>
<widget
class=
"QDialogButtonBox"
name=
"buttonBox"
>
<property
name=
"enabled"
>
<bool>
false
</bool>
</property>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Minimum"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"toolTip"
>
<string/>
</property>
<property
name=
"toolTipDuration"
>
<number>
-1
</number>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"standardButtons"
>
<set>
QDialogButtonBox::Ok
</set>
</property>
<property
name=
"centerButtons"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item
row=
"8"
column=
"1"
colspan=
"2"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
stretch=
"1,1,1"
>
<property
name=
"topMargin"
>
<number>
0
</number>
</property>
<item>
<widget
class=
"QPushButton"
name=
"pushButton_2"
>
<property
name=
"text"
>
<string>
修改
</string>
</property>
</widget>
</item>
<item>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item>
<widget
class=
"QPushButton"
name=
"pushButton"
>
<property
name=
"text"
>
<string>
检测
</string>
</property>
</widget>
</item>
</layout>
</item>
<item
row=
"1"
column=
"3"
colspan=
"2"
>
<widget
class=
"QPushButton"
name=
"pushButton_3"
>
<property
name=
"text"
>
<string>
填充
行信息
</string>
</property>
</widget>
<widget
class=
"QComboBox"
name=
"comboBox_3"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
<property
name=
"geometry"
>
<rect>
<x>
540
</x>
<y>
310
</y>
<width>
101
</width>
<height>
22
</height>
</rect>
</property>
<property
name=
"editable"
>
<bool>
false
</bool>
</property>
</widget>
<widget
class=
"QLabel"
name=
"label_14"
>
<property
name=
"geometry"
>
<rect>
<x>
480
</x>
<y>
310
</y>
<width>
41
</width>
<height>
20
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
语速:
</string>
</property>
</widget>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>
buttonBox
</sender>
<signal>
rejected()
</signal>
<receiver>
Dialog
</receiver>
<slot>
reject()
</slot>
<hints>
<hint
type=
"sourcelabel"
>
<x>
316
</x>
<y>
260
</y>
</hint>
<hint
type=
"destinationlabel"
>
<x>
286
</x>
<y>
274
</y>
</hint>
</hints>
</connection>
<connection>
<sender>
buttonBox
</sender>
<signal>
accepted()
</signal>
<receiver>
Dialog
</receiver>
<slot>
accept()
</slot>
<hints>
<hint
type=
"sourcelabel"
>
<x>
248
</x>
<y>
254
</y>
</hint>
<hint
type=
"destinationlabel"
>
<x>
157
</x>
<y>
274
</y>
</hint>
</hints>
</connection>
</connections>
<connections/>
</ui>
operation_dialog_ui.py
View file @
dbd553fd
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'operation_dialog.ui'
# Form implementation generated from reading ui file '
d:\AddCaption\cur_version\accessibility_movie_2\
operation_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.1
2
# Created by: PyQt5 UI code generator 5.1
5.4
#
# WARNING! All changes made in this file will be lost!
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from
PyQt5
import
QtCore
,
QtGui
,
QtWidgets
...
...
@@ -12,137 +14,164 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class
Ui_Dialog
(
object
):
def
setupUi
(
self
,
Dialog
):
Dialog
.
setObjectName
(
"Dialog"
)
Dialog
.
resize
(
737
,
437
)
self
.
buttonBox
=
QtWidgets
.
QDialogButtonBox
(
Dialog
)
self
.
buttonBox
.
setEnabled
(
False
)
self
.
buttonBox
.
setGeometry
(
QtCore
.
QRect
(
480
,
380
,
101
,
32
))
self
.
buttonBox
.
setToolTip
(
""
)
self
.
buttonBox
.
setToolTipDuration
(
-
1
)
self
.
buttonBox
.
setOrientation
(
QtCore
.
Qt
.
Horizontal
)
self
.
buttonBox
.
setStandardButtons
(
QtWidgets
.
QDialogButtonBox
.
Ok
)
self
.
buttonBox
.
setCenterButtons
(
False
)
self
.
buttonBox
.
setObjectName
(
"buttonBox"
)
Dialog
.
resize
(
734
,
437
)
self
.
gridLayout
=
QtWidgets
.
QGridLayout
(
Dialog
)
self
.
gridLayout
.
setObjectName
(
"gridLayout"
)
self
.
horizontalLayout
=
QtWidgets
.
QHBoxLayout
()
self
.
horizontalLayout
.
setObjectName
(
"horizontalLayout"
)
self
.
comboBox
=
QtWidgets
.
QComboBox
(
Dialog
)
self
.
comboBox
.
setEnabled
(
True
)
self
.
comboBox
.
setEditable
(
False
)
self
.
comboBox
.
setObjectName
(
"comboBox"
)
self
.
comboBox
.
addItem
(
""
)
self
.
comboBox
.
addItem
(
""
)
self
.
horizontalLayout
.
addWidget
(
self
.
comboBox
)
spacerItem
=
QtWidgets
.
QSpacerItem
(
40
,
20
,
QtWidgets
.
QSizePolicy
.
Expanding
,
QtWidgets
.
QSizePolicy
.
Minimum
)
self
.
horizontalLayout
.
addItem
(
spacerItem
)
self
.
horizontalLayout
.
setStretch
(
0
,
1
)
self
.
horizontalLayout
.
setStretch
(
1
,
1
)
self
.
gridLayout
.
addLayout
(
self
.
horizontalLayout
,
0
,
1
,
1
,
1
)
self
.
comboBox_2
=
QtWidgets
.
QComboBox
(
Dialog
)
self
.
comboBox_2
.
setObjectName
(
"comboBox_2"
)
self
.
comboBox_2
.
addItem
(
""
)
self
.
comboBox_2
.
addItem
(
""
)
self
.
comboBox_2
.
addItem
(
""
)
self
.
gridLayout
.
addWidget
(
self
.
comboBox_2
,
0
,
2
,
1
,
1
)
self
.
label
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label
.
setGeometry
(
QtCore
.
QRect
(
60
,
70
,
81
,
20
))
self
.
label
.
setObjectName
(
"label"
)
self
.
gridLayout
.
addWidget
(
self
.
label
,
1
,
0
,
1
,
1
)
self
.
lineEdit
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
lineEdit
.
setGeometry
(
QtCore
.
QRect
(
140
,
70
,
101
,
21
))
self
.
lineEdit
.
setObjectName
(
"lineEdit"
)
self
.
gridLayout
.
addWidget
(
self
.
lineEdit
,
1
,
1
,
1
,
1
)
self
.
verticalLayout
=
QtWidgets
.
QVBoxLayout
()
self
.
verticalLayout
.
setObjectName
(
"verticalLayout"
)
self
.
label_2
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_2
.
setGeometry
(
QtCore
.
QRect
(
250
,
70
,
311
,
21
))
self
.
label_2
.
setObjectName
(
"label_2"
)
self
.
lineEdit_2
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
lineEdit_2
.
setGeometry
(
QtCore
.
QRect
(
140
,
130
,
101
,
21
))
self
.
lineEdit_2
.
setObjectName
(
"lineEdit_2"
)
self
.
verticalLayout
.
addWidget
(
self
.
label_2
)
self
.
label_13
=
QtWidgets
.
QLabel
(
Dialog
)
font
=
QtGui
.
QFont
()
font
.
setPointSize
(
8
)
self
.
label_13
.
setFont
(
font
)
self
.
label_13
.
setObjectName
(
"label_13"
)
self
.
verticalLayout
.
addWidget
(
self
.
label_13
)
self
.
gridLayout
.
addLayout
(
self
.
verticalLayout
,
1
,
2
,
1
,
1
)
self
.
label_3
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_3
.
setGeometry
(
QtCore
.
QRect
(
60
,
130
,
71
,
16
))
self
.
label_3
.
setObjectName
(
"label_3"
)
self
.
gridLayout
.
addWidget
(
self
.
label_3
,
2
,
0
,
1
,
1
)
self
.
lineEdit_2
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
lineEdit_2
.
setObjectName
(
"lineEdit_2"
)
self
.
gridLayout
.
addWidget
(
self
.
lineEdit_2
,
2
,
1
,
1
,
1
)
self
.
label_8
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_8
.
setObjectName
(
"label_8"
)
self
.
gridLayout
.
addWidget
(
self
.
label_8
,
2
,
2
,
1
,
1
)
self
.
label_4
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_4
.
setGeometry
(
QtCore
.
QRect
(
60
,
180
,
71
,
16
))
self
.
label_4
.
setObjectName
(
"label_4"
)
self
.
gridLayout
.
addWidget
(
self
.
label_4
,
3
,
0
,
1
,
1
)
self
.
lineEdit_3
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
lineEdit_3
.
setEnabled
(
True
)
self
.
lineEdit_3
.
setGeometry
(
QtCore
.
QRect
(
140
,
180
,
101
,
21
))
self
.
lineEdit_3
.
setObjectName
(
"lineEdit_3"
)
self
.
gridLayout
.
addWidget
(
self
.
lineEdit_3
,
3
,
1
,
1
,
1
)
self
.
label_9
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_9
.
setObjectName
(
"label_9"
)
self
.
gridLayout
.
addWidget
(
self
.
label_9
,
3
,
2
,
1
,
1
)
self
.
label_5
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_5
.
setObjectName
(
"label_5"
)
self
.
gridLayout
.
addWidget
(
self
.
label_5
,
4
,
0
,
1
,
1
)
self
.
lineEdit_4
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
lineEdit_4
.
setEnabled
(
True
)
self
.
lineEdit_4
.
setGeometry
(
QtCore
.
QRect
(
140
,
230
,
231
,
21
))
self
.
lineEdit_4
.
setObjectName
(
"lineEdit_4"
)
self
.
comboBox
=
QtWidgets
.
QComboBox
(
Dialog
)
self
.
comboBox
.
setEnabled
(
True
)
self
.
comboBox
.
setGeometry
(
QtCore
.
QRect
(
140
,
20
,
87
,
22
))
self
.
comboBox
.
setEditable
(
False
)
self
.
comboBox
.
setObjectName
(
"comboBox"
)
self
.
comboBox
.
addItem
(
""
)
self
.
comboBox
.
addItem
(
""
)
self
.
comboBox_2
=
QtWidgets
.
QComboBox
(
Dialog
)
self
.
comboBox_2
.
setGeometry
(
QtCore
.
QRect
(
260
,
20
,
87
,
22
))
self
.
comboBox_2
.
setObjectName
(
"comboBox_2"
)
self
.
comboBox_2
.
addItem
(
""
)
self
.
comboBox_2
.
addItem
(
""
)
self
.
comboBox_2
.
addItem
(
""
)
self
.
gridLayout
.
addWidget
(
self
.
lineEdit_4
,
4
,
1
,
1
,
1
)
self
.
label_10
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_10
.
setObjectName
(
"label_10"
)
self
.
gridLayout
.
addWidget
(
self
.
label_10
,
4
,
2
,
1
,
1
)
self
.
label_6
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_6
.
setObjectName
(
"label_6"
)
self
.
gridLayout
.
addWidget
(
self
.
label_6
,
5
,
0
,
1
,
1
)
self
.
lineEdit_5
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
lineEdit_5
.
setEnabled
(
True
)
self
.
lineEdit_5
.
setGeometry
(
QtCore
.
QRect
(
140
,
270
,
101
,
21
))
self
.
lineEdit_5
.
setObjectName
(
"lineEdit_5"
)
self
.
gridLayout
.
addWidget
(
self
.
lineEdit_5
,
5
,
1
,
1
,
1
)
self
.
label_12
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_12
.
setObjectName
(
"label_12"
)
self
.
gridLayout
.
addWidget
(
self
.
label_12
,
5
,
2
,
1
,
1
)
self
.
label_7
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_7
.
setObjectName
(
"label_7"
)
self
.
gridLayout
.
addWidget
(
self
.
label_7
,
6
,
0
,
1
,
1
)
self
.
lineEdit_6
=
QtWidgets
.
QLineEdit
(
Dialog
)
self
.
lineEdit_6
.
setEnabled
(
True
)
self
.
lineEdit_6
.
setGeometry
(
QtCore
.
QRect
(
140
,
310
,
231
,
21
))
self
.
lineEdit_6
.
setObjectName
(
"lineEdit_6"
)
self
.
label_5
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_5
.
setGeometry
(
QtCore
.
QRect
(
60
,
230
,
71
,
16
))
self
.
label_5
.
setObjectName
(
"label_5"
)
self
.
label_6
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_6
.
setGeometry
(
QtCore
.
QRect
(
60
,
270
,
71
,
16
))
self
.
label_6
.
setObjectName
(
"label_6"
)
self
.
label_7
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_7
.
setGeometry
(
QtCore
.
QRect
(
60
,
310
,
71
,
16
))
self
.
label_7
.
setObjectName
(
"label_7"
)
self
.
label_8
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_8
.
setGeometry
(
QtCore
.
QRect
(
250
,
130
,
251
,
20
))
self
.
label_8
.
setObjectName
(
"label_8"
)
self
.
label_9
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_9
.
setGeometry
(
QtCore
.
QRect
(
250
,
180
,
251
,
20
))
self
.
label_9
.
setObjectName
(
"label_9"
)
self
.
label_10
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_10
.
setGeometry
(
QtCore
.
QRect
(
380
,
230
,
81
,
20
))
self
.
label_10
.
setObjectName
(
"label_10"
)
self
.
gridLayout
.
addWidget
(
self
.
lineEdit_6
,
6
,
1
,
1
,
1
)
self
.
label_11
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_11
.
setGeometry
(
QtCore
.
QRect
(
380
,
310
,
81
,
20
))
self
.
label_11
.
setObjectName
(
"label_11"
)
self
.
pushButton
=
QtWidgets
.
QPushButton
(
Dialog
)
self
.
pushButton
.
setGeometry
(
QtCore
.
QRect
(
350
,
380
,
93
,
28
))
self
.
pushButton
.
setObjectName
(
"pushButton"
)
self
.
pushButton_2
=
QtWidgets
.
QPushButton
(
Dialog
)
self
.
pushButton_2
.
setGeometry
(
QtCore
.
QRect
(
230
,
380
,
93
,
28
))
self
.
pushButton_2
.
setObjectName
(
"pushButton_2"
)
self
.
label_13
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_13
.
setGeometry
(
QtCore
.
QRect
(
250
,
90
,
311
,
21
))
font
=
QtGui
.
QFont
()
font
.
setPointSize
(
8
)
self
.
label_13
.
setFont
(
font
)
self
.
label_13
.
setObjectName
(
"label_13"
)
self
.
pushButton_3
=
QtWidgets
.
QPushButton
(
Dialog
)
self
.
pushButton_3
.
setGeometry
(
QtCore
.
QRect
(
540
,
60
,
71
,
61
))
self
.
pushButton_3
.
setObjectName
(
"pushButton_3"
)
self
.
gridLayout
.
addWidget
(
self
.
label_11
,
6
,
2
,
1
,
1
)
self
.
label_14
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_14
.
setObjectName
(
"label_14"
)
self
.
gridLayout
.
addWidget
(
self
.
label_14
,
6
,
3
,
1
,
1
)
self
.
comboBox_3
=
QtWidgets
.
QComboBox
(
Dialog
)
self
.
comboBox_3
.
setEnabled
(
True
)
self
.
comboBox_3
.
setGeometry
(
QtCore
.
QRect
(
540
,
310
,
101
,
22
))
self
.
comboBox_3
.
setEditable
(
False
)
self
.
comboBox_3
.
setObjectName
(
"comboBox_3"
)
self
.
label_14
=
QtWidgets
.
QLabel
(
Dialog
)
self
.
label_14
.
setGeometry
(
QtCore
.
QRect
(
480
,
310
,
41
,
20
))
self
.
label_14
.
setObjectName
(
"label_14"
)
self
.
gridLayout
.
addWidget
(
self
.
comboBox_3
,
6
,
4
,
1
,
1
)
self
.
buttonBox
=
QtWidgets
.
QDialogButtonBox
(
Dialog
)
self
.
buttonBox
.
setEnabled
(
False
)
sizePolicy
=
QtWidgets
.
QSizePolicy
(
QtWidgets
.
QSizePolicy
.
Minimum
,
QtWidgets
.
QSizePolicy
.
Fixed
)
sizePolicy
.
setHorizontalStretch
(
0
)
sizePolicy
.
setVerticalStretch
(
0
)
sizePolicy
.
setHeightForWidth
(
self
.
buttonBox
.
sizePolicy
()
.
hasHeightForWidth
())
self
.
buttonBox
.
setSizePolicy
(
sizePolicy
)
self
.
buttonBox
.
setMinimumSize
(
QtCore
.
QSize
(
0
,
0
))
self
.
buttonBox
.
setToolTip
(
""
)
self
.
buttonBox
.
setToolTipDuration
(
-
1
)
self
.
buttonBox
.
setOrientation
(
QtCore
.
Qt
.
Horizontal
)
self
.
buttonBox
.
setStandardButtons
(
QtWidgets
.
QDialogButtonBox
.
Ok
)
self
.
buttonBox
.
setCenterButtons
(
False
)
self
.
buttonBox
.
setObjectName
(
"buttonBox"
)
self
.
gridLayout
.
addWidget
(
self
.
buttonBox
,
8
,
4
,
1
,
1
)
self
.
horizontalLayout_2
=
QtWidgets
.
QHBoxLayout
()
self
.
horizontalLayout_2
.
setContentsMargins
(
-
1
,
0
,
-
1
,
-
1
)
self
.
horizontalLayout_2
.
setObjectName
(
"horizontalLayout_2"
)
self
.
pushButton_2
=
QtWidgets
.
QPushButton
(
Dialog
)
self
.
pushButton_2
.
setObjectName
(
"pushButton_2"
)
self
.
horizontalLayout_2
.
addWidget
(
self
.
pushButton_2
)
spacerItem1
=
QtWidgets
.
QSpacerItem
(
40
,
20
,
QtWidgets
.
QSizePolicy
.
Expanding
,
QtWidgets
.
QSizePolicy
.
Minimum
)
self
.
horizontalLayout_2
.
addItem
(
spacerItem1
)
self
.
pushButton
=
QtWidgets
.
QPushButton
(
Dialog
)
self
.
pushButton
.
setObjectName
(
"pushButton"
)
self
.
horizontalLayout_2
.
addWidget
(
self
.
pushButton
)
self
.
horizontalLayout_2
.
setStretch
(
0
,
1
)
self
.
horizontalLayout_2
.
setStretch
(
1
,
1
)
self
.
horizontalLayout_2
.
setStretch
(
2
,
1
)
self
.
gridLayout
.
addLayout
(
self
.
horizontalLayout_2
,
8
,
1
,
1
,
2
)
self
.
pushButton_3
=
QtWidgets
.
QPushButton
(
Dialog
)
self
.
pushButton_3
.
setObjectName
(
"pushButton_3"
)
self
.
gridLayout
.
addWidget
(
self
.
pushButton_3
,
1
,
3
,
1
,
2
)
self
.
gridLayout
.
setColumnStretch
(
1
,
1
)
self
.
retranslateUi
(
Dialog
)
self
.
buttonBox
.
rejected
.
connect
(
Dialog
.
reject
)
self
.
buttonBox
.
accepted
.
connect
(
Dialog
.
accept
)
QtCore
.
QMetaObject
.
connectSlotsByName
(
Dialog
)
def
retranslateUi
(
self
,
Dialog
):
_translate
=
QtCore
.
QCoreApplication
.
translate
Dialog
.
setWindowTitle
(
_translate
(
"Dialog"
,
"Dialog"
))
self
.
label
.
setText
(
_translate
(
"Dialog"
,
"我想操作第"
))
self
.
label_2
.
setText
(
_translate
(
"Dialog"
,
"行(如果操作是增加,则在该行后面增加)"
))
self
.
label_3
.
setText
(
_translate
(
"Dialog"
,
"起始时间:"
))
self
.
label_4
.
setText
(
_translate
(
"Dialog"
,
"结束时间:"
))
self
.
comboBox
.
setItemText
(
0
,
_translate
(
"Dialog"
,
"字幕"
))
self
.
comboBox
.
setItemText
(
1
,
_translate
(
"Dialog"
,
"旁白"
))
self
.
comboBox_2
.
setItemText
(
0
,
_translate
(
"Dialog"
,
"增加一行"
))
self
.
comboBox_2
.
setItemText
(
1
,
_translate
(
"Dialog"
,
"修改一行"
))
self
.
comboBox_2
.
setItemText
(
2
,
_translate
(
"Dialog"
,
"删除一行"
))
self
.
label_5
.
setText
(
_translate
(
"Dialog"
,
"字幕:"
))
self
.
label_6
.
setText
(
_translate
(
"Dialog"
,
"推荐字数:"
))
self
.
label_7
.
setText
(
_translate
(
"Dialog"
,
"旁白:"
))
self
.
label
.
setText
(
_translate
(
"Dialog"
,
"我想操作第"
))
self
.
label_2
.
setText
(
_translate
(
"Dialog"
,
"行(如果操作是增加,则在该行后面增加)"
))
self
.
label_13
.
setText
(
_translate
(
"Dialog"
,
"*需要填在【字幕旁白】页面中的行数"
))
self
.
label_3
.
setText
(
_translate
(
"Dialog"
,
"起始时间:"
))
self
.
label_8
.
setText
(
_translate
(
"Dialog"
,
"*请填数字,最多保留两位小数"
))
self
.
label_4
.
setText
(
_translate
(
"Dialog"
,
"结束时间:"
))
self
.
label_9
.
setText
(
_translate
(
"Dialog"
,
"*请填数字,最多保留两位小数"
))
self
.
label_5
.
setText
(
_translate
(
"Dialog"
,
"字幕:"
))
self
.
label_10
.
setText
(
_translate
(
"Dialog"
,
"*请填文字"
))
self
.
label_6
.
setText
(
_translate
(
"Dialog"
,
"推荐字数:"
))
self
.
label_12
.
setText
(
_translate
(
"Dialog"
,
"*请填数字,必须是不超过100的正整数"
))
self
.
label_7
.
setText
(
_translate
(
"Dialog"
,
"旁白:"
))
self
.
label_11
.
setText
(
_translate
(
"Dialog"
,
"*请填文字"
))
self
.
pushButton
.
setText
(
_translate
(
"Dialog"
,
"检测"
))
self
.
pushButton_2
.
setText
(
_translate
(
"Dialog"
,
"修改"
))
self
.
label_13
.
setText
(
_translate
(
"Dialog"
,
"*需要填在【字幕旁白】页面中的行数"
))
self
.
pushButton_3
.
setText
(
_translate
(
"Dialog"
,
"填充
\n
"
"行信息"
))
self
.
label_14
.
setText
(
_translate
(
"Dialog"
,
"语速:"
))
self
.
pushButton_2
.
setText
(
_translate
(
"Dialog"
,
"修改"
))
self
.
pushButton
.
setText
(
_translate
(
"Dialog"
,
"检测"
))
self
.
pushButton_3
.
setText
(
_translate
(
"Dialog"
,
"填充
\n
行信息"
))
start.py
View file @
dbd553fd
...
...
@@ -11,19 +11,36 @@ import qdarkstyle
import
os
os
.
environ
[
'PYQTGRAPH_QT_LIB'
]
=
'PyQt5'
project_path
=
None
def
change_project_path
(
path
):
global
project_path
project_path
=
path
if
__name__
==
'__main__'
:
try
:
QCoreApplication
.
setAttribute
(
Qt
.
AA_EnableHighDpiScaling
)
QCoreApplication
.
setAttribute
(
Qt
.
AA_UseHighDpiPixmaps
)
app
=
QApplication
(
sys
.
argv
)
app
.
setWindowIcon
(
QIcon
(
"./images/eagle_2.ico"
))
mainWindow
=
MainWindow
()
mainWindow
.
setWindowTitle
(
"无障碍电影制作软件"
)
apply_stylesheet
(
app
,
theme
=
'dark_amber.xml'
)
# app.setStyleSheet(qdarkstyle.load_stylesheet(qt_api=os.environ['PYQTGRAPH_QT_LIB']))
mainWindow
.
show
()
# app = QApplication(sys.argv)
# app.setWindowIcon(QIcon("./images/eagle_2.ico"))
# mainWindow = MainWindow()
# mainWindow.setWindowTitle("无障碍电影制作软件")
# apply_stylesheet(app, theme='dark_amber.xml')
# # app.setStyleSheet(qdarkstyle.load_stylesheet(qt_api=os.environ['PYQTGRAPH_QT_LIB']))
# mainWindow.show()
# sys.exit(app.exec_())
currentExitCode
=
MainWindow
.
EXIT_CODE_REBOOT
sys
.
exit
(
app
.
exec_
())
while
currentExitCode
==
MainWindow
.
EXIT_CODE_REBOOT
:
app
=
QApplication
(
sys
.
argv
)
app
.
setWindowIcon
(
QIcon
(
"./images/eagle_2.ico"
))
mainWindow
=
MainWindow
(
project_path
)
mainWindow
.
setWindowTitle
(
"无障碍电影制作软件"
)
mainWindow
.
renew_signal
.
connect
(
change_project_path
)
apply_stylesheet
(
app
,
theme
=
'dark_amber.xml'
)
# app.setStyleSheet(qdarkstyle.load_stylesheet(qt_api=os.environ['PYQTGRAPH_QT_LIB']))
mainWindow
.
show
()
currentExitCode
=
app
.
exec_
()
app
=
None
except
Exception
as
e
:
exc_traceback
=
''
.
join
(
traceback
.
format_exception
(
*
sys
.
exc_info
()))
...
...
utils.py
View file @
dbd553fd
...
...
@@ -2,6 +2,10 @@ import os, sys
import
openpyxl
import
subprocess
import
re
import
threading
import
time
import
inspect
import
ctypes
def
validate_and_get_filepath
(
file_info
):
if
type
(
file_info
[
0
])
==
str
:
...
...
@@ -107,6 +111,25 @@ def get_progress_with_cmd(cmd: str, state=None):
print
(
progress
)
print
(
"进度:
%3.2
f"
%
(
progress
*
100
)
+
"
%
"
)
def
_async_raise
(
tid
,
exctype
):
"""raises the exception, performs cleanup if needed"""
tid
=
ctypes
.
c_long
(
tid
)
if
not
inspect
.
isclass
(
exctype
):
exctype
=
type
(
exctype
)
res
=
ctypes
.
pythonapi
.
PyThreadState_SetAsyncExc
(
tid
,
ctypes
.
py_object
(
exctype
))
if
res
==
0
:
raise
ValueError
(
"invalid thread id"
)
elif
res
!=
1
:
# """if it returns a number greater than one, you're in trouble,
# and you should call it again with exc=NULL to revert the effect"""
ctypes
.
pythonapi
.
PyThreadState_SetAsyncExc
(
tid
,
None
)
raise
SystemError
(
"PyThreadState_SetAsyncExc failed"
)
def
stop_thread
(
thread
):
_async_raise
(
thread
.
ident
,
SystemExit
)
if
__name__
==
'__main__'
:
x
=
transfer_second_to_time
(
"12000.923"
)
print
(
x
)
...
...
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