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

Commit 2152fc1

Browse files
committed
Main page flow
1 parent 141b2a3 commit 2152fc1

File tree

3 files changed

+36
-14
lines changed

3 files changed

+36
-14
lines changed

src/front.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,17 @@ def init(self):
7373
self.btn_like = widget.PrimaryButton(
7474
self.commandbar, text='Yep', bg='green', command=self.cmd_like
7575
)
76+
self.update()
77+
78+
def build(self):
7679
self.title.pack(fill='x', expand=True)
7780
self.window.pack(fill='both', expand=True)
7881
self.commandbar.pack(side='bottom', fill='both', expand=True)
7982

8083
self.btn_dislike.pack(side='left', padx=10)
8184
self.btn_like.pack(side='right', padx=10)
8285
self.btn_bio.pack(pady=10)
86+
self.update()
8387

8488
self.cache = ImageCache(self.cachesize)
8589
self.cache.start()

src/main.py

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
import tkinter as tk
33
from contextlib import suppress
44

5-
# from .front import Front
5+
from .view import Window, View
6+
from .front import Front
67
from .splash import Splash
78
from . import SETTINGS, widget
89

@@ -17,19 +18,36 @@ class App(tk.Tk):
1718
def __init__(self, *args, **kwds):
1819
super().__init__(*args, **kwds)
1920
self.resizable(False, False)
20-
2121
for name, val in parser['APP'].items():
2222
getattr(self, name)(val)
2323

24-
self.frame = widget.PrimaryFrame(self)
25-
self.frame.pack(expand=True, fill='both')
26-
27-
self.splash = Splash(self.frame)
28-
self.splash.pack(expand=True, fill='both')
29-
# self.front = Front(self.frame)
30-
# self.front.pack(fill='both', expand=True)
24+
# self.frame = widget.PrimaryFrame(self)
25+
self.window = Window(self)
26+
27+
# self.frame.pack(expand=True, fill='both')
28+
self.window.pack(expand=True, fill='both')
29+
30+
self.update()
31+
self.splash = View(
32+
self.window,
33+
window=Splash(self.window),
34+
height=self.winfo_height(),
35+
width=self.winfo_width()
36+
)
37+
self.front = View(
38+
self.window,
39+
window=Front(self.window),
40+
height=self.winfo_height(),
41+
width=self.winfo_width()
42+
)
43+
self.after(0, self.build, self.splash)
44+
45+
def build(self, view):
46+
self.update()
47+
view.master.set_view(view)
48+
view.data.build()
3149

3250
def cleanup(self):
3351
with suppress(Exception):
34-
# self.front.cleanup()
52+
self.front.cleanup()
3553
self.destroy()

src/splash.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ def init(self):
1515
self.intro.pack(fill='both', expand=True)
1616

1717
self.btn_confirm = widget.PrimaryButton(self.intro.window, command=self.next, text='Okay')
18-
bouncer = View(self.intro.window, window=self.btn_confirm)
1918

19+
def build(self):
20+
self.intro.build()
21+
bouncer = View(self.intro.window, window=self.btn_confirm)
2022
self.bounce(bouncer)
2123

2224
def bounce(self, view):
@@ -27,7 +29,7 @@ def bounce(self, view):
2729
self.after(0, view.master.run, motion)
2830

2931
def next(self):
30-
pass
32+
self.master.master.switch()
3133

3234

3335
class Intro(widget.PrimaryFrame):
@@ -53,8 +55,6 @@ def init(self):
5355
)
5456
self.update()
5557

56-
self.after(0, self.build)
57-
5858
def build(self):
5959
self.window.set_view(self.title)
6060
adjust = (Direction.LEFT * 175) + (Direction.DOWN * 100)

0 commit comments

Comments
 (0)