Commit 19ad4f0e authored by 翟艳秋(20软)'s avatar 翟艳秋(20软)

'

fix: 1.修复调整语速没变化的bug;2.修复旁白栏里写文本后不生成的bug;3. 修复通过操作表格插入旁白时,推荐字数为空会报错的bug '
parent ee4f5e81
......@@ -230,9 +230,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.pb_tableWidget.itemDoubleClicked.connect(self.writeHistory)
self.pb_tableWidget.itemDoubleClicked.connect(self.pb_item_changed_by_double_clicked_slot)
self.pb_tableWidget.itemChanged.connect(self.rewriteHistory)
self.pb_tableWidget.itemChanged.connect(self.generate_audio_slot)
# todo 现在只在【旁白】tab上双击修改,会保存表格到本地,【字幕旁白】tab上不行。(【字幕旁白】tab上无法修改旁白)
self.pb_tableWidget.itemChanged.connect(self.write2ProjectFromAside)
self.pb_tableWidget.itemChanged.connect(self.generate_audio_slot)
self.pb_tableWidget.itemDoubleClicked.connect(self.change_video_time)
# 其他变量
......@@ -776,7 +776,11 @@ class MainWindow(QMainWindow, Ui_MainWindow):
for j in range(len(elem_list)):
text = elem_list[j]
if type(text) == str and '插入旁白,推荐' in text:
text = re.findall("\d+", text)[0]
text = re.findall("\d+", text)
if len(text) == 0:
text = 0
else:
text = text[0]
# text = text[text.index('推荐'):]
# 需要格式化成hh:mm:ss格式
if j in time_format_col_list and type(text)==str and len(text) != 0:
......@@ -904,6 +908,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
if self.is_user_editing() == False:
return
self.set_user_edit(False)
# 不需要set为False
row = item.row() # 获取行数
col = item.column() # 获取列数 注意是column而不是col
......@@ -930,7 +936,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
print("wav_path:", wav_path)
# speed_info = self.projectContext.speaker_speed
# 使用私有 语速
speed_info = self.pb_tableWidget.cellWidget(int(row), constant.Aside.SpeedColumnNumber).currentText()
speed_info = self.projectContext.aside_list[int(row)].speed
speaker_info = self.projectContext.speaker_info
speed = float(speed_info.split('(')[0])
speaker_name = speaker_info.split(",")[0]
......@@ -938,7 +944,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
speaker = self.projectContext.choose_speaker(speaker_name)
text = self.projectContext.aside_list[int(row)].aside
# 如果目前wav_path存在,且旁白字数清空了,那就把已生成wav删掉
if len(text) == 0:
if text is None or len(text) == 0:
if os.path.exists(wav_path):
os.remove(wav_path)
return
......@@ -1035,7 +1041,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
return
if self.is_user_editing() == False:
return
self.set_user_edit(False)
if item is None:
print("WRONG!!!! item Is None")
return
......@@ -1325,4 +1330,5 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# 将audio_player的资源置空
print("释放当前播放的音频文件")
self.audio_player.setMedia(QMediaContent())
self.projectContext.aside_list[idx.row()].speed = combo.currentText()
self.do_generate_audio_by_aside_row(idx.row())
\ No newline at end of file
......@@ -143,8 +143,8 @@ class Operation_Dialog(QDialog, Ui_Dialog):
# self.mainWindow.prompt_dialog.show_with_msg(
# "校验失败!推荐字数填入有误!!")
# return False
# 这些是只有【modify】才需要检测的
if self.comboBox_2.currentText() == "修改一行":
# 这些是只有 [modify] | [delete]才需要检测的
if self.comboBox_2.currentText() != "增加一行":
try:
suggest = self.mainWindow.projectContext.all_elements[row_number-1].suggest
print("suggest:", suggest)
......@@ -155,7 +155,7 @@ class Operation_Dialog(QDialog, Ui_Dialog):
assert self.comboBox.currentText() == "字幕"
except Exception as e:
self.mainWindow.prompt_dialog.show_with_msg(
"校验失败!待修改的行不是[%s]" % (self.comboBox.currentText()))
"校验失败!待操作的行不是[%s]" % (self.comboBox.currentText()))
return False
# 检测通过
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment