add the loading screen
This commit is contained in:
@@ -6,7 +6,7 @@ from PIL import ImageChops
|
||||
|
||||
from ..config import DISPLAY_TYPES, DISPLAY_MODES
|
||||
from .draw_utils import draw_clock, draw_bluetooth_icon
|
||||
from . import NumberView, CircleView, TimerView, TextView
|
||||
from . import NumberView, CircleView, TimerView, TextView, LoadingView
|
||||
|
||||
from .button_interface import ButtonInterface
|
||||
from .buttons_manager import ButtonsManager
|
||||
@@ -24,7 +24,7 @@ class MainView(tk.Frame, ButtonInterface):
|
||||
bt_stop_pairing_command=None,
|
||||
**kwargs):
|
||||
super().__init__(parent, **kwargs)
|
||||
self.curr_mode = DISPLAY_MODES.MAIN
|
||||
self.curr_mode = DISPLAY_MODES.LOADING
|
||||
self.views = []
|
||||
self.timer_view = None # Timer view is always active
|
||||
self.tare_command = tare_command
|
||||
@@ -51,6 +51,7 @@ class MainView(tk.Frame, ButtonInterface):
|
||||
self.text_view = TextView(self.actions, self.im_size, self.center)
|
||||
self.buttons = ButtonsManager(self, self.im_size, self.center,
|
||||
curr_view=self)
|
||||
self.loading_view = LoadingView(self.im_size, self.center)
|
||||
self.recipes_manager = RecipeManager()
|
||||
self.current_steps = [None] * 3
|
||||
self.tare_buffer = []
|
||||
@@ -280,7 +281,13 @@ class MainView(tk.Frame, ButtonInterface):
|
||||
def refresh(self, weight: float):
|
||||
ims = []
|
||||
|
||||
if self.curr_mode == DISPLAY_MODES.MAIN or self.curr_mode == DISPLAY_MODES.DO_RECIPE:
|
||||
if self.curr_mode == DISPLAY_MODES.LOADING:
|
||||
frame, done = self.loading_view.get_frame()
|
||||
ims.append(frame)
|
||||
if done:
|
||||
self.curr_mode = DISPLAY_MODES.MAIN
|
||||
|
||||
elif self.curr_mode == DISPLAY_MODES.MAIN or self.curr_mode == DISPLAY_MODES.DO_RECIPE:
|
||||
# Always include timer and button view
|
||||
if self.curr_mode == DISPLAY_MODES.MAIN or \
|
||||
(self.current_steps[1] is not None and \
|
||||
|
||||
Reference in New Issue
Block a user