tui: Allow handlers to finalize() as well as initialize()

This commit is contained in:
Kovid Goyal
2018-04-22 13:14:25 +05:30
parent 8bbc2b82d4
commit 20c42ab519
5 changed files with 43 additions and 39 deletions

View File

@@ -5,11 +5,23 @@
class Handler:
def initialize(self, screen_size, quit_loop, wakeup, start_job):
def _initialize(self, screen_size, quit_loop, wakeup, start_job):
self.screen_size, self.quit_loop = screen_size, quit_loop
self.wakeup = wakeup
self.start_job = start_job
def __enter__(self):
self.initialize()
def __exit__(self, *a):
self.finalize()
def initialize(self):
pass
def finalize(self):
pass
def on_resize(self, screen_size):
self.screen_size = screen_size