In #99 @kkiesling noted that a previous view appears in the Editmenu before any changes have been applied by the user.
The flow which causes this is:
- Model is loaded when initializing
MainWindow
PlotIndependent.masking is set to True for the initial current and active view.
- The GUI continues loading in
MainWindow.loadGui and MainWindow.updateEditMenu is called
- (The crux)
MainWindow.updateEditMenu calls the setChecked method of the masking check box to ensure it's state matches that of the view. If this call changes the state of that check box, then the callback method is going to trigger an applyChanges call and create a new view.
It seems to me that the default value of the masking check box in the color dialog doesn't match the view setting and results in the creation of a new view.
I verified this by adding this line in MainWindow.createMenuBar
self.maskingAction.setChecked(True)
before the item is connected to its callback method. This removed the superfluous previous view.
Because this mismatch in default value vs. widget state is subtle and likely to occur again, it might be good to consider a setting on the MainWindow class that disables the generation of new views until the GUI has finished loading.
In #99 @kkiesling noted that a previous view appears in the
Editmenu before any changes have been applied by the user.The flow which causes this is:
MainWindowPlotIndependent.maskingis set toTruefor the initial current and active view.MainWindow.loadGuiandMainWindow.updateEditMenuis calledMainWindow.updateEditMenucalls thesetCheckedmethod of the masking check box to ensure it's state matches that of the view. If this call changes the state of that check box, then the callback method is going to trigger anapplyChangescall and create a new view.It seems to me that the default value of the masking check box in the color dialog doesn't match the view setting and results in the creation of a new view.
I verified this by adding this line in
MainWindow.createMenuBarbefore the item is connected to its callback method. This removed the superfluous previous view.
Because this mismatch in default value vs. widget state is subtle and likely to occur again, it might be good to consider a setting on the
MainWindowclass that disables the generation of new views until the GUI has finished loading.