Пример #1
0
    def data_points_to_shapes(self):
        chunk = self.data_chunks[self.chunk_index]
        for data_point in chunk:
            size = self.get_size(data_point)
            width = size
            height = size
            x = self.get_x(data_point)
            y = self.get_y(data_point)

            shape_type = data_point['shape_type']
            fill_color = self.get_fill_color(data_point)
            outline_fill = self.get_outline_fill(data_point)
            outline_width = self.get_outline_width(data_point)
            frames_to_live = data_point['frames_to_live']

            shape_item = ShapeFrameItem(width=width,
                                        height=height,
                                        x=x,
                                        y=y,
                                        current_frame=self.current_frame,
                                        shape_type=shape_type,
                                        fill_color=fill_color,
                                        outline_fill=outline_fill,
                                        outline_width=outline_width,
                                        frames_to_live=frames_to_live)
            self.set_shape_effects(data_point, shape_item)

            self.shapes.append(shape_item)
Пример #2
0
 def test_shape_type(self):
     sfi = ShapeFrameItem(shape_type="Box")
     self.assertEqual(sfi.shape_type, "Box")
Пример #3
0
 def test_frame_added(self):
     sfi = ShapeFrameItem(frame_added=5)
     self.assertEqual(sfi.frame_added, 5)
Пример #4
0
 def test_default_x(self):
     sfi = ShapeFrameItem()
     self.assertEqual(sfi.x, 0)
Пример #5
0
 def test_current_frame(self):
     sfi = ShapeFrameItem(current_frame=5)
     self.assertEqual(sfi.current_frame, 5)
Пример #6
0
 def test_y(self):
     sfi = ShapeFrameItem(y=5)
     self.assertEqual(sfi.y, 5)
Пример #7
0
 def test_default_height(self):
     sfi = ShapeFrameItem()
     self.assertEqual(sfi.height, 0)
Пример #8
0
 def test_outline_width(self):
     sfi = ShapeFrameItem(outline_width=5)
     self.assertEqual(sfi.outline_width, 5)
Пример #9
0
 def test_default_frames_to_live(self):
     sfi = ShapeFrameItem()
     self.assertEqual(sfi.frames_to_live, -1)
Пример #10
0
 def test_default_outline_width(self):
     sfi = ShapeFrameItem()
     self.assertEqual(sfi.outline_width, 0)
Пример #11
0
 def test_default_outline_fill(self):
     sfi = ShapeFrameItem()
     self.assertEqual(sfi.outline_fill, None)
Пример #12
0
 def test_default_fill_color(self):
     sfi = ShapeFrameItem()
     self.assertEqual(sfi.fill_color, (255, 255, 255, 255))
Пример #13
0
 def test_default_frame_addded(self):
     sfi = ShapeFrameItem()
     self.assertEqual(sfi.frame_added, 0)
Пример #14
0
 def test_default_current_frame(self):
     sfi = ShapeFrameItem()
     self.assertEqual(sfi.current_frame, 0)
Пример #15
0
 def test_fill_color(self):
     sfi = ShapeFrameItem(fill_color=(255, 255, 255, 0))
     self.assertEqual(sfi.fill_color, (255, 255, 255, 0))
Пример #16
0
 def test_outline_fill(self):
     sfi = ShapeFrameItem(outline_fill=(255, 255, 255, 0))
     self.assertEqual(sfi.outline_fill, (255, 255, 255, 0))
Пример #17
0
 def test_current_frame_increment(self):
     sfi = ShapeFrameItem(current_frame=10)
     sfi.increment_current_frame()
     self.assertEqual(sfi.current_frame, 11)
Пример #18
0
 def test_frames_to_live(self):
     sfi = ShapeFrameItem(frames_to_live=10)
     self.assertEqual(sfi.frames_to_live, 10)
Пример #19
0
 def test_x(self):
     sfi = ShapeFrameItem(x=5)
     self.assertEqual(sfi.x, 5)