fix RepeatedController

a snap update was offered the second time even if it had been
offered already
This commit is contained in:
Michael Hudson-Doyle 2019-12-14 21:44:10 +13:00
parent 2ad6f0b2ee
commit 0090aec3be
2 changed files with 6 additions and 6 deletions

View File

@ -69,7 +69,10 @@ class BaseController(ABC):
@property
def showing(self):
return self.app.controllers.cur is self
inst = self.app.controllers.cur
while isinstance(inst, RepeatedController):
inst = inst.orig
return inst is self
@abstractmethod
def start_ui(self):

View File

@ -298,7 +298,7 @@ class ControllerSet:
log.debug("Importing controller: %s", name)
klass = getattr(controllers_mod, name+"Controller")
if hasattr(self, name):
c = 0
c = 1
for instance in self.instances:
if isinstance(instance, klass):
c += 1
@ -313,10 +313,7 @@ class ControllerSet:
def cur(self):
if self.out_of_bounds():
return None
inst = self.instances[self.index]
while isinstance(inst, RepeatedController):
inst = inst.orig
return inst
return self.instances[self.index]
def out_of_bounds(self):
return self.index < 0 or self.index >= len(self.instances)