we need to draw when choosing examples even if not data changed.

This commit is contained in:
Ozbolt Menegatti 2020-02-19 23:15:42 +01:00
parent c0ca84a901
commit 8128f885f6
3 changed files with 15 additions and 3 deletions

View File

@ -28,6 +28,9 @@ class Message:
def data_change(self): def data_change(self):
return True return True
def entry_redraw(self):
return self.data_change()
def add_arg(self, arg): def add_arg(self, arg):
self._args.append(arg) self._args.append(arg)

View File

@ -97,3 +97,8 @@ class ShowExampleMenu(KeyPlusClickMessage):
def reset(self): def reset(self):
# special case, when choosing messages dont reset # special case, when choosing messages dont reset
return not (self.ctrl or self.shift) return not (self.ctrl or self.shift)
def entry_redraw(self):
# when choosing messages we need to redraw
return self.ctrl or self.shift

View File

@ -7,7 +7,7 @@ class Update:
self.view = None self.view = None
def update_model(self): def update_model(self):
data_change = False entry_redraw = False
reset = False reset = False
# check if we need to reset the model # check if we need to reset the model
@ -20,12 +20,16 @@ class Update:
self.model.pre_reset() self.model.pre_reset()
# check if we need to signal the data change # check if we need to signal the data change
# and for entry redraw
for msg in self.message_queue: for msg in self.message_queue:
if msg.data_change(): if msg.data_change():
screenful.changed() screenful.changed()
data_change = True entry_redraw = True
break break
if msg.entry_redraw():
entry_redraw = True
# do update # do update
for msg in self.message_queue: for msg in self.message_queue:
msg.update_model(self.model) msg.update_model(self.model)
@ -34,7 +38,7 @@ class Update:
if reset: if reset:
self.model.post_reset() self.model.post_reset()
self.view.view(self.model, data_change) self.view.view(self.model, entry_redraw)
self.message_queue = [] self.message_queue = []
def schedule(self, msg): def schedule(self, msg):