Skip to content

Commit dd84ebb

Browse files
MartinThomaferdnyc
andauthored
Apply suggestions from code review
Thank you, ferdnyc! Co-authored-by: Frank Dana <[email protected]>
1 parent b19593f commit dd84ebb

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

src/windows/main_window.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ def promptImageSequence(self, filename=None):
751751
_("Would you like to import %s as an image sequence?") % filename,
752752
QMessageBox.No | QMessageBox.Yes
753753
)
754-
return ret == QMessageBox.Yes
754+
return bool(ret == QMessageBox.Yes)
755755

756756
def actionAdd_to_Timeline_trigger(self, event):
757757
# Loop through selected files

src/windows/models/files_model.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ def filterAcceptsRow(self, sourceRow, sourceParent):
6969
index = self.sourceModel().index(sourceRow, 2, sourceParent)
7070
tags = self.sourceModel().data(index) # tags (i.e. intro, custom, etc...)
7171

72-
if get_app().window.actionFilesShowVideo.isChecked() and media_type != "video":
73-
return False
74-
elif get_app().window.actionFilesShowAudio.isChecked() and media_type != "audio":
75-
return False
76-
elif get_app().window.actionFilesShowImage.isChecked() and media_type != "image":
72+
if any(
73+
get_app().window.actionFilesShowVideo.isChecked() and media_type != "video",
74+
get_app().window.actionFilesShowAudio.isChecked() and media_type != "audio",
75+
get_app().window.actionFilesShowImage.isChecked() and media_type != "image",
76+
):
7777
return False
7878

7979
# Match against regex pattern

src/windows/views/timeline_webview.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -2372,12 +2372,14 @@ def Time_Triggered(self, action, clip_ids, speed="1X", playhead_position=0.0):
23722372
clip.data["reader"]["video_length"] = self.round_to_multiple(
23732373
float(clip.data["reader"]["video_length"]) / speed_factor, even_multiple)
23742374

2375-
if action == MENU_TIME_NONE and "original_data" in clip.data.keys():
2375+
if action == MENU_TIME_NONE and "original_data" in clip.data:
23762376
# Reset original end & duration (if available)
2377-
clip.data["end"] = clip.data["original_data"]["end"]
2378-
clip.data["duration"] = clip.data["original_data"]["duration"]
2379-
clip.data["reader"]["video_length"] = clip.data["original_data"]["video_length"]
2380-
clip.data.pop("original_data")
2377+
orig = clip.data.pop("original_data")
2378+
clip.data.update({
2379+
"end": orig["end"],
2380+
"duration": orig["duration"],
2381+
})
2382+
clip.data["reader"]["video_length"] = orig["video_length"]
23812383

23822384
# Save changes
23832385
self.update_clip_data(clip.data, only_basic_props=False, ignore_reader=True)

0 commit comments

Comments
 (0)