class SplashContainer(object): """ I act as a Container for all the splash stuff """ def __init__(self): self.ctrl = SplashController(Model()) self.view = SplashView(self.ctrl) self.loop = None self.view.show() def pulse(self): # TODO self.view['splash_progress_bar'].pulse() def start_pulse(self): # TODO if not self.loop: self.loop = LoopingCall(self.pulse) self.loop.start(.2, now=True) else: raise Exception("Can't start loop twice") def stop_pulse(self): # TODO if self.loop: self.loop.stop() self.loop = None else: raise Exception("Can't stop a loop that hasn't started") def set_fraction(self, fraction): # TODO """Sets the given fraction in the progress bar""" try: self.view['splash_progress_bar'].set_fraction(fraction) except: pass def set_text(self, text): # TODO """Sets the given text in the progress bar""" try: self.view['splash_progress_bar'].set_text(text) except: pass def close(self): self.ctrl.model.unregister_observer(self.ctrl) self.view.get_top_widget().destroy() self.ctrl = None self.view = None
def __init__(self): self.ctrl = SplashController(Model()) self.view = SplashView(self.ctrl) self.loop = None self.view.show()