Model Exercise SolutionΒΆ

The Model should now contain the following method in the ColourConvertor class:

def getColourSelection(self):
    return self.colour_table.keys()

The View should contain the following method:

def setColours(self,options):
    self.colours.clear()
    self.colours.addItems(options)

The Presenter initialisation should now be:

def __init__(self, view, data_model, colour_model):
   self.view = view
   self.data_model = data_model
   self.colour_model = colour_model

   colours = self.colour_model.getColourSelection()
   self.view.setColours(colours)
   # connect statements
   self.view.plotSignal.connect(self.updatePlot)