Skip to content
This repository was archived by the owner on Mar 31, 2020. It is now read-only.

Commit abbff79

Browse files
committed
Broken
1 parent 6487ed6 commit abbff79

File tree

5 files changed

+25
-34
lines changed

5 files changed

+25
-34
lines changed

src/animate.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@ def run(self):
3636
try:
3737
move = next(motion)
3838
move()
39+
self.canvas.update()
3940
except StopIteration:
4041
self._motions.remove(motion)
42+
self.canvas.update()
43+
# self.canvas.after(10, self.run)
4144

4245
def add(self, motion: Motion):
4346
self._motions.add(motion.start())
@@ -79,6 +82,7 @@ def start(self) -> Generator[Callable]:
7982
"""
8083
self.reset()
8184
while self.current != self.end:
85+
print(self.current, self.end)
8286
yield self.move
8387

8488
def reset(self):
@@ -135,14 +139,12 @@ def kick(self, direction: Point):
135139

136140
@property
137141
def increment(self):
138-
self.canvas.update()
139142
bounce = self.get_bounce()
140143
if bounce != Coord(0, 0):
141144
self.kick(bounce)
142145
return self.future - self.current
143146

144147
def get_bounce(self):
145-
self.canvas.update()
146148
x1, y1, x2, y2 = self.canvas.bbox(self.id)
147149
bounce = Coord(0, 0)
148150
if x1 <= self.bound_x1:
@@ -169,12 +171,10 @@ def bound_y1(self):
169171

170172
@property
171173
def bound_x2(self):
172-
# self.canvas.update()
173174
return self.bound_x1 + self.canvas.winfo_width()
174175

175176
@property
176177
def bound_y2(self):
177-
# self.canvas.update()
178178
return self.bound_y1 + self.canvas.winfo_height()
179179

180180

src/front.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ def __next(self, direction: Direction = None):
3030
data: dict = self.cache.next()
3131
image = process_image(
3232
data.pop('image'),
33-
self.window.winfo_width(),
34-
self.window.winfo_height()
33+
self.window.winfo_reqwidth(),
34+
self.window.winfo_reqheight()
3535
)
3636
name = data.pop('name')
3737
self.__load(name, image, data)
@@ -56,6 +56,7 @@ def __load(self, name, image, data):
5656
self.update()
5757

5858
def init(self):
59+
self.update()
5960
self.title = widget.PrimaryLabel(self)
6061
self.window = Window(self)
6162
self.commandbar = widget.SecondaryFrame(self)
@@ -75,7 +76,6 @@ def init(self):
7576
)
7677
self.update()
7778

78-
def build(self):
7979
self.title.pack(fill='x', expand=True)
8080
self.window.pack(fill='both', expand=True)
8181
self.commandbar.pack(side='bottom', fill='both', expand=True)

src/main.py

+15-25
Original file line numberDiff line numberDiff line change
@@ -21,46 +21,36 @@ def __init__(self, *args, **kwds):
2121
for name, val in parser['APP'].items():
2222
getattr(self, name)(val)
2323

24-
self.window = Window(self)
25-
self.window.pack(expand=True, fill='both')
24+
#self.window = Window(self)
25+
#self.window.pack(expand=True, fill='both')
26+
#elf.update()
27+
28+
# self.splash = Splash(self)
29+
self.front = Front(self)
30+
self.front.pack(fill='both', expand=True)
31+
# self.execution_order = iter((
32+
# # self.splash,
33+
# self.front,
34+
# # self.result
35+
# ))
2636
self.update()
2737

28-
self.splash = View(
29-
self.window,
30-
window=Splash(self.window),
31-
height=self.winfo_height(),
32-
width=self.winfo_width()
33-
)
34-
self.front = View(
35-
self.window,
36-
window=Front(self.window),
37-
height=self.winfo_height(),
38-
width=self.winfo_width()
39-
)
40-
self.execution_order = iter((
41-
self.splash,
42-
self.front,
43-
# self.result
44-
))
45-
self.update()
46-
self.current: View = None
47-
self.after(0, self.switch)
48-
4938
def switch(self):
5039
try:
5140
self.update()
5241
if self.current is not None:
5342
self.current.data.cleanup()
43+
self.current.data.pack_forget()
44+
self.current.data.destroy()
5445
self.current = next(self.execution_order)
5546
self.build(self.current)
5647
except StopIteration:
5748
self.cleanup()
5849

5950
def build(self, view):
60-
self.update()
61-
view.master.change_view(view, 'up')
6251
self.update()
6352
view.data.build()
53+
self.window.set_view(view)
6454

6555
def cleanup(self):
6656
with suppress(Exception):

src/view.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ def change_view(self, view: View, direction: Direction = None):
5656
last = self.current
5757

5858
self.move_in(self.current, direction.flip())
59-
self.move_out(last, direction)
59+
# self.move_out(last, direction)
60+
6061
self.animater.start()
6162

6263
def get_distance(self, direction: Direction):

src/widget.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class PrimaryCanvas(tk.Canvas):
8888
DEFAULT = {
8989
'bg': 'gray'
9090
}
91-
91+
9292
def __init__(self, *args, **kwds):
9393
super().__init__(*args, **{**self.DEFAULT, **kwds})
9494
if hasattr(self, 'init'):

0 commit comments

Comments
 (0)