2587
2587
elif position_name == "mnu_center_1_4":
2588
2588
start.set_all(50.0, 50.0, 25.0, 25.0, None)
2589
2589
end.set_all(50.0, 50.0, 25.0, 25.0, None)
2591
elif position_name == "mnu_show_all_stretch":
2592
# Show All Clips at the same time
2593
self.show_all_clips(stretch=True)
2595
elif position_name == "mnu_show_all_nostretch":
2596
# Show All Clips at the same time
2597
self.show_all_clips(stretch=False)
2591
2599
# update clip properties
2592
2600
self.selected_clip.halign = halign
2595
2603
# mark project as modified
2596
2604
self.project.set_project_modified(is_modified=True, refresh_xml=True, type="Changed clip layout")
2606
def show_all_clips(self, stretch=False):
2607
""" Show all clips """
2608
from math import sqrt
2610
# get starting position
2611
start_position = self.selected_clip.position_on_track
2612
available_clips = []
2614
# Get the number of clips that start near the start of this clip (on any track)
2615
for track in self.project.sequences[0].tracks:
2616
# loop through clips
2617
for clip in track.clips:
2618
# only look at images, videos, and image sequences
2619
if clip.file_object.file_type in ["image", "video", "image sequence"]:
2620
# only look at clips that start near this clip
2621
if clip.position_on_track >= (start_position - 0.5) and clip.position_on_track <= (start_position + 0.5):
2623
available_clips.append(clip)
2625
# Get the number of rows
2626
number_of_clips = len(available_clips)
2627
number_of_rows = int(sqrt(number_of_clips))
2628
max_clips_on_row = float(number_of_clips) / float(number_of_rows)
2630
# Determine how many clips per row
2631
if max_clips_on_row > float(int(max_clips_on_row)):
2632
max_clips_on_row = int(max_clips_on_row + 1)
2634
max_clips_on_row = int(max_clips_on_row)
2636
# Calculate Height & Width
2637
height = 100.0 / float(number_of_rows)
2638
width = 100.0 / float(max_clips_on_row)
2642
# Loop through each row of clips
2643
for row in range(0, number_of_rows):
2645
# Loop through clips on this row
2646
column_string = " - - - "
2647
for col in range(0, max_clips_on_row):
2648
if clip_index < number_of_clips:
2650
X = float(col) * width
2651
Y = float(row) * height
2653
# Modify clip layout settings
2654
selected_clip = available_clips[clip_index]
2655
selected_clip.halign = "centre"
2656
selected_clip.valign = "centre"
2659
selected_clip.distort = True
2660
selected_clip.fill = True
2662
selected_clip.distort = False
2663
selected_clip.fill = True
2665
start = selected_clip.keyframes["start"]
2666
end = selected_clip.keyframes["end"]
2667
start.set_all(height, width, X, Y, None)
2668
end.set_all(height, width, X, Y, None)
2670
# Increment Clip Index
2600
2676
class mnuClip(SimpleGladeApp):