Some work on time clipping, but I'm not sure if it works because it was a long time since I did that.

master
Jaka Perovšek 2024-05-10 22:12:22 +02:00
parent 6981f710be
commit 2e68a5eaf2
1 changed files with 30 additions and 16 deletions

View File

@ -21,6 +21,7 @@ class IdentifierEditWidget(QLineEdit):
change_font_size(self, 1.41) change_font_size(self, 1.41)
self.load() self.load()
self.textChanged.connect(self.save)
def load(self): def load(self):
self.setText(self.tape["identifier"]) self.setText(self.tape["identifier"])
@ -48,6 +49,7 @@ class NameEditWidget(QLineEdit):
super().__init__() super().__init__()
self.tape = tape self.tape = tape
self.load() self.load()
self.textChanged.connect(self.save)
def load(self): def load(self):
self.setText(self.tape["name"]) self.setText(self.tape["name"])
@ -61,6 +63,7 @@ class SourceEditWidget(UrlWidget):
super().__init__() super().__init__()
self.tape = tape self.tape = tape
self.load() self.load()
self.url_lineedit.textChanged.connect(self.save)
def load(self): def load(self):
self.url_lineedit.setText(self.tape["source"]) self.url_lineedit.setText(self.tape["source"])
@ -101,35 +104,46 @@ class ProcessEditWidget(QWidget):
layout.addWidget(self.volume_factor, 2, 1) layout.addWidget(self.volume_factor, 2, 1)
self.load() self.load()
self.clip_start.timeChanged.connect(self.save) self.clip_start.timeChanged.connect(self.save)
self.clip_end.timeChanged.connect(self.save)
self.volume_factor.valueChanged.connect(self.save)
self.cbox_clip_start.toggled.connect(self.save)
self.cbox_clip_end.toggled.connect(self.save)
self.cbox_volume_factor.toggled.connect(self.save)
self.save()
def load(self): def load(self):
clip_start, clip_end = self.tape["process"]["start"], self.tape["process"]["end"] clip_start, clip_end = self.tape["process"]["start"], self.tape["process"]["end"]
start, end = QTime(), QTime() start, end = QTime(), QTime()
start_time = datetime.datetime.strptime(clip_start, "%H:%M:%S.%f") if clip_start is not None:
end_time = datetime.datetime.strptime(clip_end, "%H:%M:%S.%f") start_time = datetime.datetime.strptime(clip_start, "%H:%M:%S.%f")
start.setHMS(start_time.hour, start_time.minute, start_time.second, ms=start_time.microsecond * 1e-3)
self.cbox_clip_start.setChecked(clip_start != "00:00:00.0")
self.clip_start.setTime(start)
start.setHMS(start_time.hour, start_time.minute, start_time.second, ms=start_time.microsecond * 1e-3) if clip_end is not None:
end.setHMS(end_time.hour, end_time.minute, end_time.second, ms=end_time.microsecond * 1e-3) end_time = datetime.datetime.strptime(clip_end, "%H:%M:%S.%f")
end.setHMS(end_time.hour, end_time.minute, end_time.second, ms=end_time.microsecond * 1e-3)
self.clip_start.setTime(start) self.cbox_clip_end.setChecked(clip_end != "00:00:00.0")
self.clip_end.setTime(end) self.clip_end.setTime(end)
self.cbox_clip_start.setChecked(clip_start != "00:00:00.0")
self.cbox_clip_end.setChecked(clip_end != "00:00:00.0")
volume_factor = self.tape["process"]["volume"] volume_factor = self.tape["process"]["volume"]
self.volume_factor.setValue(volume_factor)
self.cbox_volume_factor.setChecked(volume_factor != 0) if volume_factor is not None:
self.volume_factor.setValue(volume_factor)
self.cbox_volume_factor.setChecked(volume_factor != 0)
def save(self): def save(self):
start = self.clip_start.time() start = self.clip_start.time()
start = f"{start.hour():02}:{start.minute():02}:{start.second():02}.{start.msec():03}"
end = self.clip_end.time() end = self.clip_end.time()
self.tape["process"]["start"] = f"{start.hour():02}:{start.minute():02}:{start.second():02}.{start.msec():03}" end = f"{end.hour():02}:{end.minute():02}:{end.second():02}.{end.msec():03}"
self.tape["process"]["end"] = f"{end.hour():02}:{end.minute():02}:{end.second():02}.{end.msec():03}" volume = self.volume_factor.value()
self.tape["process"]["volume"] = self.volume_factor.value()
self.tape["process"]["start"] = start if self.cbox_clip_start.isChecked() else None
self.tape["process"]["end"] = end if self.cbox_clip_end.isChecked() else None
self.tape["process"]["volume"] = volume if self.cbox_volume_factor.isChecked() else None
class EconomyEditWidget(QWidget): class EconomyEditWidget(QWidget):