dont fail if cut_width is 0, fixme: it should never be 0 in the first place

This commit is contained in:
j 2012-05-16 15:25:11 +02:00
parent dcd68133af
commit 2ad9961d59

View file

@ -436,6 +436,8 @@ class Timelines():
wide = 1 if mode == 'keyframes' else self.wide wide = 1 if mode == 'keyframes' else self.wide
frame_ratio = self.frame_ratio * wide frame_ratio = self.frame_ratio * wide
cut_images = int(math.ceil(cut_width / (frame_ratio * self.large_tile_h))) cut_images = int(math.ceil(cut_width / (frame_ratio * self.large_tile_h)))
if cut_width == cut_images == 0:
print 'ERROR division by zerro', cut_width, cut_images
image_widths = self._divide(cut_width, cut_images) image_widths = self._divide(cut_width, cut_images)
image_i = self.cuts[-2] image_i = self.cuts[-2]
large_keyframes_tile_i = self.large_keyframes_tile_i large_keyframes_tile_i = self.large_keyframes_tile_i
@ -506,6 +508,8 @@ class Timelines():
def _divide(self, num, by): def _divide(self, num, by):
# divide(100, 3) -> [33, 33, 34] # divide(100, 3) -> [33, 33, 34]
arr = [] arr = []
if by == 0:
return arr
div = int(num / by) div = int(num / by)
mod = num % by mod = num % by
for i in range(int(by)): for i in range(int(by)):