X-Git-Url: https://git.ralfj.de/lilass.git/blobdiff_plain/6fd92bb21b1a743d0a794141277a7aea857d3c50..06344a9d0c2cbd40023d1db4ab966c0577234049:/question_frontend.py?ds=sidebyside diff --git a/question_frontend.py b/question_frontend.py index 4782ba1..fc9e8c6 100644 --- a/question_frontend.py +++ b/question_frontend.py @@ -34,10 +34,19 @@ class OperationMode(Enum): class QuestionFrontend: def userChoose (self, title, choices, returns, fallback): raise Exception("The abstract method 'userChoose' has not been implemented by %s"%str(self.__class__)) + def selectResolution(self, displayname, availablemodes): modedescs = list(map(str, availablemodes)) return self.userChoose("Select resolution for %s"%displayname, modedescs, availablemodes, None) + def setup (self, situation): + if situation.lastSetup: + applyLast = self.userChoose("This display is known. The last setup for it was like this:\n%s.\nApply the last used configuration?" % str(situation.lastSetup), ("Apply last setup", "Enter different setup"), (True,False), None) + if applyLast is None: + return None + if applyLast is True: + return situation.lastSetup + assert applyLast is False operationmodes = list(OperationMode) operationmodedescs = list(map(lambda x: x.text, operationmodes)) operationmode = self.userChoose ("Display setup", operationmodedescs, operationmodes, None)