Closed ilastikdev closed 7 years ago
Right now your exportStep
and exportProgress
default to nothing, and that clutters the code with if not self.exportStep==None
(which should have been if self.exportStep is not None
btw.).
For one, this should default to the command line progress bar as before. And I'm not really happy with the way the code looks. Perhaps it is because the variable names are a little confusing.
Do you know the visitor design pattern? To make this nice from a software design perspective, you should call the exportStep
things something like a progressVisitor
. Then create a base class for the visitor that defines which methods it provides, make a default implementation (e.g. CommandLineProgressVisitor
) to which this is set by default, and in the hypotheses graph provide a method to set a user defined visitor (e.g. HypothesesGraph.setProgressVisitor
). And lastly on the ilastik side you can derive the IlastikProgressVisitor
and pass that in as needed.
And to get rid of all the is not None
checks throughout the code we should not allow the visitor to be set to None
within HypothesesGraph.setProgressVisitor
.
visitor functions changed to visitor class DefaultProgressVisitor and CommandLineProgressVisitor are defined in hytra one can also setProgressVisitor from frontend
removed... just a left over from the time I planed to use setProgressVisitor ... but that is actually not needed
if gui is present it displays a progress dialog box if not it will display progress on command line