|
|
|
@ -814,11 +814,11 @@ class Video(Sprite):
|
|
|
|
|
Sprite.__init__(self, parent, 100)
|
|
|
|
|
self.next_video_chance = next_video_chance
|
|
|
|
|
pattern = join(self.get_resource("gif"), "Boarding_*.gif")
|
|
|
|
|
self.gifs = []
|
|
|
|
|
gifs = []
|
|
|
|
|
for path in iglob(pattern):
|
|
|
|
|
self.gifs.append(Image.open(path))
|
|
|
|
|
print(self.gifs[-1].info)
|
|
|
|
|
self.gif = self.gifs[1]
|
|
|
|
|
gifs.append(Image.open(path))
|
|
|
|
|
print(gifs[-1].info)
|
|
|
|
|
self.gif_index = 0
|
|
|
|
|
self.mask = Surface([diameter] * 2, SRCALPHA)
|
|
|
|
|
rect = self.mask.get_rect()
|
|
|
|
|
alpha = int(self.get_configuration("display", "attract-gif-alpha") * 255)
|
|
|
|
@ -827,25 +827,36 @@ class Video(Sprite):
|
|
|
|
|
self.add_frame(self.mask)
|
|
|
|
|
if not self.get_configuration("system", "minimize-load-time"):
|
|
|
|
|
self.play()
|
|
|
|
|
# preload GIF frames scaled instead of loading each frame like before
|
|
|
|
|
self.gif_frames_scaled = []
|
|
|
|
|
for gif in gifs:
|
|
|
|
|
self.gif_frames_scaled.append([])
|
|
|
|
|
for ii in range(0, gif.n_frames):
|
|
|
|
|
gif.seek(ii)
|
|
|
|
|
frame_scaled = smoothscale(
|
|
|
|
|
fromstring(gif.convert("RGBA").tobytes(), gif.size, "RGBA"),
|
|
|
|
|
(self.mask.get_width(), int(gif.width * gif.height / self.mask.get_width())))
|
|
|
|
|
copy = self.mask.copy()
|
|
|
|
|
rect = frame_scaled.get_rect()
|
|
|
|
|
rect.bottom = copy.get_rect().bottom
|
|
|
|
|
copy.blit(frame_scaled, rect, None, BLEND_RGBA_MIN)
|
|
|
|
|
self.gif_frames_scaled[-1].append(copy)
|
|
|
|
|
self.load_selection()
|
|
|
|
|
|
|
|
|
|
def load_selection(self):
|
|
|
|
|
self.clear_frames()
|
|
|
|
|
for frame in self.gif_frames_scaled[self.gif_index]:
|
|
|
|
|
self.add_frame(frame)
|
|
|
|
|
|
|
|
|
|
def shift_frame(self):
|
|
|
|
|
Sprite.shift_frame(self)
|
|
|
|
|
if random() < self.next_video_chance:
|
|
|
|
|
while True:
|
|
|
|
|
selection = choice(self.gifs)
|
|
|
|
|
if selection != self.gif:
|
|
|
|
|
self.gif = selection
|
|
|
|
|
selection = choice(range(0, len(self.gif_frames_scaled)))
|
|
|
|
|
if selection != self.gif_index:
|
|
|
|
|
self.gif_index = selection
|
|
|
|
|
self.load_selection()
|
|
|
|
|
break
|
|
|
|
|
self.gif.seek((self.gif.tell() + 1) % self.gif.n_frames)
|
|
|
|
|
frame = smoothscale(
|
|
|
|
|
fromstring(self.gif.convert("RGBA").tobytes(), self.gif.size, "RGBA"),
|
|
|
|
|
(self.mask.get_width(), int(self.gif.width * self.gif.height / self.mask.get_width())))
|
|
|
|
|
copy = self.mask.copy()
|
|
|
|
|
rect = frame.get_rect()
|
|
|
|
|
rect.bottom = copy.get_rect().bottom
|
|
|
|
|
copy.blit(frame, rect, None, BLEND_RGBA_MIN)
|
|
|
|
|
self.clear_frames()
|
|
|
|
|
self.add_frame(copy)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Logo(Sprite):
|
|
|
|
|