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

Commit c4f4281

Browse files
committed
Motion bug fix
1 parent f35950d commit c4f4281

4 files changed

Lines changed: 9 additions & 31 deletions

File tree

src/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .mainwindow import App
1+
from .main import App
22

33
if __name__ == "__main__":
44
App().mainloop()

src/animate.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import operator
55
import time
66
from . import widget
7-
from typing import NamedTuple, Callable, TypeVar, Generator, Tuple, Iterable
7+
from typing import NamedTuple, Callable, TypeVar, Generator, Tuple
88
from enum import Enum
99
from dataclasses import dataclass
1010
from functools import partialmethod, partial
@@ -145,11 +145,8 @@ def run(self):
145145
def add(self, motion: Motion):
146146
self._motions.add(iter(motion))
147147

148-
def add_motion(self, id: int, endpoints: Iterable[Coord], **kwargs):
149-
if not isinstance(endpoints, Iterable):
150-
endpoints = (endpoints,)
151-
152-
motion = Motion(self.canvas, id, endpoints, **kwargs)
148+
def add_motion(self, id: int, end: Coord, **kwargs):
149+
motion = Motion(self.canvas, id, (end,), **kwargs)
153150
self.add(motion)
154151

155152
def clear(self):
@@ -257,7 +254,7 @@ def clear(self):
257254

258255
def set_view(self, view: tk.Widget):
259256
self.clear()
260-
self.current = self.create_window(self.origin, view)
257+
self.current = self.create_window(self.origin, window=view)
261258

262259
def change_view(self, view: tk.Widget, direction: Direction):
263260
if self.current is None:
@@ -277,11 +274,11 @@ def change_view(self, view: tk.Widget, direction: Direction):
277274
pos = self.__coord(self.current)
278275
end = pos + edge
279276
beg = pos - edge
280-
wid = self.create_window(beg, view)
277+
wid = self.create_window(beg, window=view)
281278

282279
self.animater.clear()
283-
self.animater.add_motion(self.current, end)
284-
self.animater.add_motion(wid, self.origin)
280+
self.animater.add_motion(self.current, end, speed=self.animation_speed)
281+
self.animater.add_motion(wid, self.origin, speed=self.animation_speed)
285282

286283
self.animater.start()
287284
self.current = wid

src/front.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ def __load(self, name, image, data):
1717
self.title.config(text=name)
1818
self.bio.load(data)
1919

20-
test = tk.Frame(self.window)
21-
self.image = widget.PrimaryLabel(test, image=image)
22-
self.image.pack()
23-
self.image = test
20+
self.image = widget.PrimaryLabel(self.window, image=image)
2421
self.update()
2522

2623
def __change_image(self, direction: Direction):

src/widget.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,71 +39,55 @@ class Primary(Base):
3939

4040

4141
class SecondaryFrame(tk.Frame, Secondary):
42-
__qualname__ = tk.Frame.__qualname__
43-
4442
def __init__(self, *args, **kwargs):
4543
super().__init__(*args, **kwargs)
4644
if hasattr(self, 'init'):
4745
self.init()
4846

4947

5048
class SecondaryButton(tk.Button, Secondary):
51-
__qualname__ = tk.Button.__qualname__
52-
5349
def __init__(self, *args, **kwargs):
5450
super().__init__(*args, **kwargs)
5551
if hasattr(self, 'init'):
5652
self.init()
5753

5854

5955
class SecondaryLabel(tk.Label, Secondary):
60-
__qualname__ = tk.Label.__qualname__
61-
6256
def __init__(self, *args, **kwargs):
6357
super().__init__(*args, **kwargs)
6458
if hasattr(self, 'init'):
6559
self.init()
6660

6761

6862
class SecondaryCanvas(tk.Canvas, Secondary):
69-
__qualname__ = tk.Canvas.__qualname__
70-
7163
def __init__(self, *args, **kwargs):
7264
super().__init__(*args, **kwargs)
7365
if hasattr(self, 'init'):
7466
self.init()
7567

7668

7769
class PrimaryFrame(tk.Frame, Primary):
78-
__qualname__ = tk.Frame.__qualname__
79-
8070
def __init__(self, *args, **kwargs):
8171
super().__init__(*args, **kwargs)
8272
if hasattr(self, 'init'):
8373
self.init()
8474

8575

8676
class PrimaryButton(tk.Button, Primary):
87-
__qualname__ = tk.Button.__qualname__
88-
8977
def __init__(self, *args, **kwargs):
9078
super().__init__(*args, **kwargs)
9179
if hasattr(self, 'init'):
9280
self.init()
9381

9482

9583
class PrimaryLabel(tk.Label, Primary):
96-
__qualname__ = tk.Label.__qualname__
97-
9884
def __init__(self, *args, **kwargs):
9985
super().__init__(*args, **kwargs)
10086
if hasattr(self, 'init'):
10187
self.init()
10288

10389

10490
class PrimaryCanvas(tk.Canvas, Primary):
105-
__qualname__ = tk.Canvas.__qualname__
106-
10791
def __init__(self, *args, **kwargs):
10892
super().__init__(*args, **kwargs)
10993
if hasattr(self, 'init'):

0 commit comments

Comments
 (0)