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
dcd386d9
Commit
dcd386d9
authored
Sep 30, 2022
by
xuanweiace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:对于连续两段[旁白段]的导入错误的问题
fix:对于双击无法跳转的问题 fix:对于保存工程虽然启用了异步但是依旧过慢的问题
parent
41a6db21
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
698 additions
and
14 deletions
+698
-14
main_window.py
main_window.py
+28
-5
main_window.ui
main_window.ui
+7
-1
main_window_ui.py
main_window_ui.py
+2
-1
main_window备份20220930.ui
main_window备份20220930.ui
+620
-0
management.py
management.py
+21
-7
mywidgetcontents.py
mywidgetcontents.py
+20
-0
No files found.
main_window.py
View file @
dcd386d9
...
...
@@ -59,7 +59,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
synthesis_timer
.
timeout
.
connect
(
self
.
check_if_synthesis_over_slot
)
self
.
video_timer
=
QTimer
()
self
.
video_timer
.
timeout
.
connect
(
self
.
change_videotime_label_slot
)
self
.
video_timer
.
start
(
100
)
self
.
video_timer
.
start
(
100
0
)
# todo 作为参数配置
"""
状态栏相关空间
"""
...
...
@@ -131,6 +131,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# 表格双击和发生change时的处理
self
.
zm_tableWidget
.
setEditTriggers
(
QAbstractItemView
.
NoEditTriggers
)
self
.
all_tableWidget
.
setEditTriggers
(
QAbstractItemView
.
NoEditTriggers
)
self
.
pb_tableWidget
.
itemDoubleClicked
.
connect
(
self
.
writeHistory
)
self
.
pb_tableWidget
.
itemChanged
.
connect
(
self
.
rewriteHistory
)
self
.
pb_tableWidget
.
itemChanged
.
connect
(
self
.
write2ProjectFromAside
)
...
...
@@ -143,6 +144,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# self.all_tableWidget.itemChanged.connect(self.rewriteHistoryFromContent)
# self.all_tableWidget.itemChanged.connect(self.write2ProjectFromContent)
# 其他变量
#在进行redo_undo时,会触发itemchange,但是这时候不能覆写历史。但是需要写入project。(注意命名思路:在进行redo的时候,会有两步操作,写入history和写入project。我们只希望他不写入history,所以命名中要带有history)
...
...
@@ -153,12 +157,22 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# 重写关闭Mmainwindow窗口
def
closeEvent
(
self
,
event
):
replp
=
QtWidgets
.
QMessageBox
.
question
(
self
,
u'警告'
,
u'确认退出?'
,
# buttonBox = QtWidgets.QMessageBox()
# btn_save_and_close = buttonBox.addButton("保存并退出", QtWidgets.QMessageBox.YesRole)
# btn_not_save_and_close = buttonBox.addButton("不保存并退出", QtWidgets.QMessageBox.YesRole)
# buttonBox.exec_()
replp
=
QtWidgets
.
QMessageBox
()
.
question
(
self
,
u'警告'
,
u'是否保存新的修改到Excel?'
,
QtWidgets
.
QMessageBox
.
Yes
|
QtWidgets
.
QMessageBox
.
No
)
if
replp
==
QtWidgets
.
QMessageBox
.
Yes
:
self
.
projectContext
.
save_project
(
False
)
event
.
accept
()
else
:
event
.
ignore
()
print
(
"emit close Event"
)
# 重写改变窗口大小事件
def
resizeEvent
(
self
,
*
args
,
**
kwargs
):
super
()
.
resizeEvent
(
*
args
,
**
kwargs
)
position
=
self
.
kd_slider
.
value
()
self
.
scale_change_slot
(
position
)
def
show_detect_dialog
(
self
):
self
.
detect_dialog
.
show
()
def
show_assemble_dialog
(
self
):
...
...
@@ -314,10 +328,14 @@ class MainWindow(QMainWindow, Ui_MainWindow):
"""
刻度相关
期望效果:
期望效果:
在最左刻度时,恰好打满【时间轴区】,当最右刻度时,时间轴上每一刻度对应的时间是1s.
"""
def
emit_scale_change_slot
(
self
):
position
=
self
.
kd_slider
.
value
()
self
.
scale_change_slot
(
position
)
def
scale_change_slot
(
self
,
position
):
if
self
.
player
.
duration
()
==
0
:
return
area_width
=
self
.
scrollArea
.
width
()
...
...
@@ -544,10 +562,13 @@ class MainWindow(QMainWindow, Ui_MainWindow):
print
(
"row, col =
%
s,
%
s"
%
(
row
,
col
))
text
=
item
.
text
()
# 获取内容
if
self
.
checkIfVideoTimeCanChange
(
row
,
col
):
self
.
video_timer
.
stop
()
self
.
video_timer
.
start
(
1000
)
# 双击的时候,就重启计时器,避免他跳转回video.position的地方去。
self
.
player
.
setPosition
(
int
(
float
(
text
)
*
1000
))
def
checkIfVideoTimeCanChange
(
self
,
row
,
col
):
if
col
==
constant
.
Aside
.
StartTimeColumn
:
return
True
...
...
@@ -721,10 +742,12 @@ class MainWindow(QMainWindow, Ui_MainWindow):
print
(
"=="
*
10
)
def
change_videotime_label_slot
(
self
):
# print("in [change_videotime_label_slot]")
if
self
.
player
.
duration
()
>
0
:
# 开始播放后才执行
self
.
change_videotime_label
()
self
.
change_table_select_rows
()
def
change_videotime_label
(
self
):
position
=
self
.
player
.
position
()
/
1000
duration
=
self
.
player
.
duration
()
/
1000
...
...
main_window.ui
View file @
dcd386d9
...
...
@@ -362,7 +362,7 @@ QPushButton:pressed {
<property
name=
"widgetResizable"
>
<bool>
false
</bool>
</property>
<widget
class=
"
QWidget
"
name=
"scrollAreaWidgetContents"
>
<widget
class=
"
myWidgetContents
"
name=
"scrollAreaWidgetContents"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
...
...
@@ -614,6 +614,12 @@ QPushButton:pressed {
<extends>
QSlider
</extends>
<header>
myvideoslider.h
</header>
</customwidget>
<customwidget>
<class>
myWidgetContents
</class>
<extends>
QWidget
</extends>
<header>
mywidgetcontents.h
</header>
<container>
1
</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
...
...
main_window_ui.py
View file @
dcd386d9
...
...
@@ -207,7 +207,7 @@ class Ui_MainWindow(object):
self
.
scrollArea
.
setHorizontalScrollBarPolicy
(
QtCore
.
Qt
.
ScrollBarAlwaysOn
)
self
.
scrollArea
.
setWidgetResizable
(
False
)
self
.
scrollArea
.
setObjectName
(
"scrollArea"
)
self
.
scrollAreaWidgetContents
=
QtWidgets
.
QWidget
()
self
.
scrollAreaWidgetContents
=
myWidgetContents
()
self
.
scrollAreaWidgetContents
.
setGeometry
(
QtCore
.
QRect
(
0
,
0
,
827
,
64
))
self
.
scrollAreaWidgetContents
.
setObjectName
(
"scrollAreaWidgetContents"
)
self
.
sld_video
=
myVideoSlider
(
self
.
scrollAreaWidgetContents
)
...
...
@@ -356,3 +356,4 @@ class Ui_MainWindow(object):
from
myVideoWidget
import
myVideoWidget
from
myvideoslider
import
myVideoSlider
from
mywidgetcontents
import
myWidgetContents
main_window备份20220930.ui
0 → 100644
View file @
dcd386d9
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
MainWindow
</class>
<widget
class=
"QMainWindow"
name=
"MainWindow"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
939
</width>
<height>
763
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
MainWindow
</string>
</property>
<property
name=
"styleSheet"
>
<string
notr=
"true"
>
QMainWindow:{
border: 2px groove gray;
border-radius: 25px;
border-style: outset;
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));
padding: 5px;
}
</string>
</property>
<widget
class=
"QWidget"
name=
"centralwidget"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<item>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
stretch=
"5,1"
>
<item>
<layout
class=
"QHBoxLayout"
name=
"shuiping"
stretch=
"2,1"
>
<item>
<widget
class=
"QWidget"
name=
"verticalWidget_3"
native=
"true"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_3"
stretch=
"8,0"
>
<item>
<widget
class=
"myVideoWidget"
name=
"wgt_video"
native=
"true"
>
<property
name=
"minimumSize"
>
<size>
<width>
410
</width>
<height>
200
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
16777215
</width>
<height>
16777215
</height>
</size>
</property>
<property
name=
"palette"
>
<palette>
<active>
<colorrole
role=
"Base"
>
<brush
brushstyle=
"SolidPattern"
>
<color
alpha=
"255"
>
<red>
255
</red>
<green>
255
</green>
<blue>
255
</blue>
</color>
</brush>
</colorrole>
<colorrole
role=
"Window"
>
<brush
brushstyle=
"SolidPattern"
>
<color
alpha=
"255"
>
<red>
0
</red>
<green>
0
</green>
<blue>
0
</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole
role=
"Base"
>
<brush
brushstyle=
"SolidPattern"
>
<color
alpha=
"255"
>
<red>
255
</red>
<green>
255
</green>
<blue>
255
</blue>
</color>
</brush>
</colorrole>
<colorrole
role=
"Window"
>
<brush
brushstyle=
"SolidPattern"
>
<color
alpha=
"255"
>
<red>
0
</red>
<green>
0
</green>
<blue>
0
</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole
role=
"Base"
>
<brush
brushstyle=
"SolidPattern"
>
<color
alpha=
"255"
>
<red>
0
</red>
<green>
0
</green>
<blue>
0
</blue>
</color>
</brush>
</colorrole>
<colorrole
role=
"Window"
>
<brush
brushstyle=
"SolidPattern"
>
<color
alpha=
"255"
>
<red>
0
</red>
<green>
0
</green>
<blue>
0
</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property
name=
"autoFillBackground"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QSplitter"
name=
"splitter"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<widget
class=
"QPushButton"
name=
"btn_open"
>
<property
name=
"maximumSize"
>
<size>
<width>
100
</width>
<height>
25
</height>
</size>
</property>
<property
name=
"text"
>
<string>
打开表格文件
</string>
</property>
</widget>
<widget
class=
"QPushButton"
name=
"btn_play"
>
<property
name=
"minimumSize"
>
<size>
<width>
50
</width>
<height>
50
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
50
</width>
<height>
50
</height>
</size>
</property>
<property
name=
"styleSheet"
>
<string
notr=
"true"
>
QPushButton {
color: #333;
border: 2px groove gray;
border-radius: 25px;
border-style: outset;
background: qradialgradient(
cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,
radius: 1.35, stop: 0 #fff, stop: 1 #888
);
padding: 5px;
}
QPushButton:hover {
background: qradialgradient(
cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,
radius: 1.35, stop: 0 #fff, stop: 1 #bbb
);
}
QPushButton:pressed {
border-style: inset;
background: qradialgradient(
cx: 0.4, cy: -0.1, fx: 0.4, fy: -0.1,
radius: 1.35, stop: 0 #fff, stop: 1 #ddd
);
}
</string>
</property>
<property
name=
"text"
>
<string>
播放
</string>
</property>
</widget>
<widget
class=
"QPushButton"
name=
"btn_stop"
>
<property
name=
"minimumSize"
>
<size>
<width>
50
</width>
<height>
50
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
50
</width>
<height>
50
</height>
</size>
</property>
<property
name=
"styleSheet"
>
<string
notr=
"true"
>
QPushButton {
color: #333;
border: 2px groove gray;
border-radius: 25px;
border-style: outset;
background: qradialgradient(
cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,
radius: 1.35, stop: 0 #fff, stop: 1 #888
);
padding: 5px;
}
QPushButton:hover {
background: qradialgradient(
cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,
radius: 1.35, stop: 0 #fff, stop: 1 #bbb
);
}
QPushButton:pressed {
border-style: inset;
background: qradialgradient(
cx: 0.4, cy: -0.1, fx: 0.4, fy: -0.1,
radius: 1.35, stop: 0 #fff, stop: 1 #ddd
);
}
</string>
</property>
<property
name=
"text"
>
<string>
暂停
</string>
</property>
</widget>
<widget
class=
"QSlider"
name=
"sld_audio"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Expanding"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
50
</width>
<height>
25
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
150
</width>
<height>
25
</height>
</size>
</property>
<property
name=
"value"
>
<number>
99
</number>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
</widget>
<widget
class=
"QLabel"
name=
"lab_audio"
>
<property
name=
"text"
>
<string>
volume:100%
</string>
</property>
</widget>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"text"
>
<string>
00:00/12:34
</string>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget
class=
"QTabWidget"
name=
"tabWidget"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
<property
name=
"contextMenuPolicy"
>
<enum>
Qt::DefaultContextMenu
</enum>
</property>
<property
name=
"styleSheet"
>
<string
notr=
"true"
/>
</property>
<property
name=
"tabPosition"
>
<enum>
QTabWidget::North
</enum>
</property>
<property
name=
"tabShape"
>
<enum>
QTabWidget::Triangular
</enum>
</property>
<property
name=
"currentIndex"
>
<number>
2
</number>
</property>
<property
name=
"iconSize"
>
<size>
<width>
20
</width>
<height>
20
</height>
</size>
</property>
<property
name=
"elideMode"
>
<enum>
Qt::ElideNone
</enum>
</property>
<property
name=
"movable"
>
<bool>
false
</bool>
</property>
<property
name=
"tabBarAutoHide"
>
<bool>
false
</bool>
</property>
<widget
class=
"QWidget"
name=
"all_tab"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
<attribute
name=
"title"
>
<string>
字幕旁白
</string>
</attribute>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_4"
>
<item>
<widget
class=
"QTableWidget"
name=
"all_tableWidget"
/>
</item>
</layout>
</widget>
<widget
class=
"QWidget"
name=
"zm_tab"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
<attribute
name=
"title"
>
<string>
字幕
</string>
</attribute>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<item>
<widget
class=
"QTableWidget"
name=
"zm_tableWidget"
/>
</item>
</layout>
</widget>
<widget
class=
"QWidget"
name=
"pb_tab"
>
<attribute
name=
"title"
>
<string>
旁白
</string>
</attribute>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_3"
>
<item>
<widget
class=
"QTableWidget"
name=
"pb_tableWidget"
/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</item>
<item>
<widget
class=
"QWidget"
name=
"verticalWidget_2"
native=
"true"
>
<layout
class=
"QVBoxLayout"
name=
"chuizhi"
>
<item>
<widget
class=
"QLabel"
name=
"zm_label"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Preferred"
vsizetype=
"Preferred"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"text"
>
<string>
时间轴
</string>
</property>
</widget>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"zm_slider_layout"
stretch=
"15,1"
>
<item>
<widget
class=
"QScrollArea"
name=
"scrollArea"
>
<property
name=
"horizontalScrollBarPolicy"
>
<enum>
Qt::ScrollBarAlwaysOn
</enum>
</property>
<property
name=
"widgetResizable"
>
<bool>
false
</bool>
</property>
<widget
class=
"QWidget"
name=
"scrollAreaWidgetContents"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
827
</width>
<height>
64
</height>
</rect>
</property>
<widget
class=
"myVideoSlider"
name=
"sld_video"
>
<property
name=
"geometry"
>
<rect>
<x>
10
</x>
<y>
30
</y>
<width>
811
</width>
<height>
20
</height>
</rect>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
410
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
16777215
</width>
<height>
20
</height>
</size>
</property>
<property
name=
"maximum"
>
<number>
100
</number>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"tickPosition"
>
<enum>
QSlider::TicksAbove
</enum>
</property>
<property
name=
"tickInterval"
>
<number>
1
</number>
</property>
</widget>
</widget>
</widget>
</item>
<item>
<widget
class=
"QLabel"
name=
"lab_video"
>
<property
name=
"maximumSize"
>
<size>
<width>
16777215
</width>
<height>
50
</height>
</size>
</property>
<property
name=
"text"
>
<string>
00:00
</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
</item>
<item>
<widget
class=
"QLabel"
name=
"pb_label"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Preferred"
vsizetype=
"Preferred"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"text"
>
<string>
刻度
</string>
</property>
</widget>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"kd_slider_layout"
>
<item>
<widget
class=
"QSlider"
name=
"kd_slider"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Expanding"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"cursor"
>
<cursorShape>
SizeHorCursor
</cursorShape>
</property>
<property
name=
"mouseTracking"
>
<bool>
false
</bool>
</property>
<property
name=
"focusPolicy"
>
<enum>
Qt::NoFocus
</enum>
</property>
<property
name=
"minimum"
>
<number>
1
</number>
</property>
<property
name=
"maximum"
>
<number>
100
</number>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"tickPosition"
>
<enum>
QSlider::TicksAbove
</enum>
</property>
<property
name=
"tickInterval"
>
<number>
1
</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget
class=
"QMenuBar"
name=
"menubar"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
939
</width>
<height>
26
</height>
</rect>
</property>
<widget
class=
"QMenu"
name=
"menu"
>
<property
name=
"title"
>
<string>
文件
</string>
</property>
<addaction
name=
"actionxinjian"
/>
<addaction
name=
"action_open_project"
/>
<addaction
name=
"separator"
/>
<addaction
name=
"import_movie"
/>
<addaction
name=
"separator"
/>
<addaction
name=
"action_save"
/>
</widget>
<widget
class=
"QMenu"
name=
"menu_2"
>
<property
name=
"title"
>
<string>
编辑
</string>
</property>
<addaction
name=
"action_undo"
/>
<addaction
name=
"action_redo"
/>
<addaction
name=
"action_view_history"
/>
<addaction
name=
"separator"
/>
<addaction
name=
"action_operate"
/>
</widget>
<widget
class=
"QMenu"
name=
"menu_3"
>
<property
name=
"title"
>
<string>
功能按键
</string>
</property>
<addaction
name=
"actiona_3"
/>
<addaction
name=
"actiona_4"
/>
<addaction
name=
"separator"
/>
<addaction
name=
"action_refresh_tab"
/>
</widget>
<addaction
name=
"menu"
/>
<addaction
name=
"menu_2"
/>
<addaction
name=
"menu_3"
/>
</widget>
<widget
class=
"QStatusBar"
name=
"statusbar"
/>
<action
name=
"actionxinjian"
>
<property
name=
"text"
>
<string>
设置
</string>
</property>
</action>
<action
name=
"action_open_project"
>
<property
name=
"text"
>
<string>
打开
</string>
</property>
</action>
<action
name=
"import_movie"
>
<property
name=
"text"
>
<string>
视频导入
</string>
</property>
</action>
<action
name=
"actions"
>
<property
name=
"text"
>
<string>
内容导出
</string>
</property>
</action>
<action
name=
"action_save"
>
<property
name=
"text"
>
<string>
保存并备份
</string>
</property>
</action>
<action
name=
"action_undo"
>
<property
name=
"text"
>
<string>
撤销
</string>
</property>
</action>
<action
name=
"action_redo"
>
<property
name=
"text"
>
<string>
重做
</string>
</property>
</action>
<action
name=
"actiona_3"
>
<property
name=
"text"
>
<string>
旁白区间检测
</string>
</property>
</action>
<action
name=
"actiona_4"
>
<property
name=
"text"
>
<string>
旁白音频合成
</string>
</property>
</action>
<action
name=
"action_view_history"
>
<property
name=
"text"
>
<string>
history
</string>
</property>
</action>
<action
name=
"action_refresh_tab"
>
<property
name=
"text"
>
<string>
刷新且保存表格
</string>
</property>
</action>
<action
name=
"action_operate"
>
<property
name=
"text"
>
<string>
增删行
</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>
myVideoWidget
</class>
<extends>
QWidget
</extends>
<header>
myVideoWidget.h
</header>
<container>
1
</container>
</customwidget>
<customwidget>
<class>
myVideoSlider
</class>
<extends>
QSlider
</extends>
<header>
myvideoslider.h
</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
management.py
View file @
dcd386d9
...
...
@@ -175,6 +175,9 @@ class ProjectContext:
def
save_project
(
self
,
need_save_new
:
bool
=
False
)
->
str
:
# all_element = sorted(all_element, key=lambda x: float(x.st_time_sec))
print
(
"current excel_path:"
,
self
.
excel_path
)
if
self
.
excel_path
==
None
:
return
"保存路径为空"
if
need_save_new
:
new_excel_path
=
replace_path_suffix
(
self
.
excel_path
,
datetime
.
datetime
.
now
()
.
strftime
(
'
%
Y
%
m
%
d
%
H
%
M
%
S'
)
+
'.xlsx'
)
err_info
=
save_excel_to_to_path
(
self
.
all_elements
,
new_excel_path
,
self
.
header
,
self
.
excel_sheet_name
)
...
...
@@ -199,6 +202,7 @@ class ProjectContext:
def
load_project
(
self
):
pass
# todo: 其实现在ed_time_sec基本没有用到,所以可以忽略不计。
def
load_excel_from_path
(
self
):
d
=
read_sheet
(
self
.
excel_path
)
self
.
clear
()
...
...
@@ -213,7 +217,13 @@ class ProjectContext:
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
)
# 如果是最后一条
if
i
==
len
(
d
[
"字幕"
])
-
1
:
ed_time_sec
=
"360000"
# todo 默认最大时长是100h
else
:
...
...
@@ -295,9 +305,9 @@ def save_excel_to_to_path(all_element, new_excel_path, header, excel_sheet_name)
try
:
create_sheet
(
new_excel_path
,
"旁白插入位置建议"
,
[
header
])
for
element
in
all_element
:
# element.print_self(
)
write_to_sheet
(
new_excel_path
,
excel_sheet_name
,
element
.
to_list
()
)
#
for element in all_element:
# write_to_sheet(new_excel_path, excel_sheet_name, element.to_list()
)
write_to_sheet
(
new_excel_path
,
excel_sheet_name
,
all_element
)
except
:
exception_info
=
''
.
join
(
traceback
.
format_exception
(
*
sys
.
exc_info
()))
...
...
@@ -311,10 +321,10 @@ def save_excel_to_to_path(all_element, new_excel_path, header, excel_sheet_name)
t
=
RunThread
(
funcName
=
save_excel_thread
,
args
=
(
all_element
,
new_excel_path
,
header
,
excel_sheet_name
),
name
=
"save_excel"
)
t
.
setDaemon
(
True
)
#
t.setDaemon(True)
t
.
start
()
def
write_to_sheet
(
path
:
str
,
sheet_name
:
str
,
value
:
list
):
def
write_to_sheet
(
path
:
str
,
sheet_name
:
str
,
value
list
:
list
):
"""向已存在的表格中写入一行数据
Args:
...
...
@@ -322,12 +332,16 @@ def write_to_sheet(path: str, sheet_name: str, value: list):
sheet_name (str): excel表内的表(sheet)的名字
value (list): 要插入表内的一行数据
"""
workbook
=
openpyxl
.
load_workbook
(
path
)
sheet
=
workbook
.
get_sheet_by_name
(
sheet_name
)
for
value_element
in
valuelist
:
value
=
value_element
.
to_list
()
index
=
len
(
value
)
# 把None换成空串
value
=
[
""
if
x
==
None
else
x
for
x
in
value
]
workbook
=
openpyxl
.
load_workbook
(
path
)
sheet
=
workbook
.
get_sheet_by_name
(
sheet_name
)
cur_row
=
sheet
.
max_row
# print("cur_row:", cur_row)
for
j
in
range
(
0
,
index
):
sheet
.
cell
(
row
=
cur_row
+
1
,
column
=
j
+
1
,
value
=
str
(
value
[
j
]))
if
value
[
j
]
==
''
or
'插入旁白'
in
str
(
value
[
j
]):
...
...
mywidgetcontents.py
0 → 100644
View file @
dcd386d9
from
PyQt5.QtCore
import
*
from
PyQt5.QtWidgets
import
QWidget
# 不需要他了
class
myWidgetContents
(
QWidget
):
# resize_signal = pyqtSignal() # 创建双击信号
def
__init__
(
self
,
parent
=
None
):
super
(
QWidget
,
self
)
.
__init__
(
parent
)
# def changeEvent(self, QEvent):
# print("触发了changeEvent")
# super().changeEvent(QEvent)
# self.resize_signal.emit()
# def moveEvent(self, QMoveEvent):
# print("触发了moveEvent")
# super().moveEvent(QMoveEvent)
# self.resize_signal.emit()
\ No newline at end of file
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