Skip to content

Commit eacf652

Browse files
committed
rework: remove Scene inheritance
1 parent 0f7685b commit eacf652

File tree

5 files changed

+16
-41
lines changed

5 files changed

+16
-41
lines changed

frontend/Scene.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

frontend/Serialize.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,18 @@ def commentsToLabel(s: str) -> str:
2626

2727
def serializeScene(filepath: str) -> str:
2828
"""
29-
Serialiaze the `Scenes` of a file.
29+
Serialiaze a file representing a `Scene`.
3030
"""
3131

3232
# Read the content of the file
3333
with open(filepath, "r") as file:
3434
content = file.read() # TODO: Replace comments with labels
3535

36-
# Exec the file to register the `Scene`
36+
# Exec the file representing the `Scene`. It will update the globals in `Global`.
3737
global __name__
3838
__name__ = "Scene"
3939
exec(content, globals())
4040

41-
# Filter out anything other that the `Scenes`
42-
scenes: list[Type[Scene]] = [v for _, v in globals().items() if inspect.isclass(v) and Scene in v.__bases__]
43-
44-
# Temporary load the first `Scene` found. TODO: load the desired scene in the future
45-
scenes[0]().scene()
46-
4741
# Access Globals: `variable` and `stack`
4842
g = Global()
4943

frontend/VideoCode.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
# Transformations
1111
from frontend.transformation._AllTransformation import *
1212

13-
# Scenes
14-
from frontend.Scene import *
15-
1613
# Global
1714
from frontend.Global import *
1815

frontend/transformation/color/Fade.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def __init__(self, side: Optional[side] = None, opacity: Tuple[uint, uint] = (25
1111
"""
1212
`Fade` from `side`.
1313
14-
Modify `opacity` for a `Fade In` or a `Fade out`.
14+
Modify `opacity` for a `Fade in` or a `Fade out`.
1515
"""
1616
self.side = side
1717
self.opacity = opacity

video.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,25 @@
44
from frontend.VideoCode import *
55

66

7-
class MyVideo(Scene):
8-
def scene(self) -> None:
9-
v1 = video("video/v.mp4")
10-
v2 = v1.copy()
7+
# import the video
8+
v1 = video("video/v.mp4")
9+
v2 = v1.copy()
1110

12-
# translation
13-
v2.apply(
14-
translate(50, 50),
15-
)
11+
# translation
12+
v2.apply(
13+
translate(50, 50),
14+
)
1615

17-
# overlay
18-
v1.apply(
19-
overlay(v2),
20-
)
16+
# overlay
17+
v1.apply(
18+
overlay(v2),
19+
)
2120

22-
v1.add()
21+
# add
22+
v1.add()
2323

2424

2525
if __name__ == "__main__":
26-
MyVideo().scene()
2726
print(Global())
2827

2928
# TODO: remove the scene, the code can be in nothing

0 commit comments

Comments
 (0)