plotter icon indicating copy to clipboard operation
plotter copied to clipboard

Previous view present for first-time load

Open pshriwise opened this issue 3 years ago • 0 comments

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:

  1. Model is loaded when initializing MainWindow
  2. PlotIndependent.masking is set to True for the initial current and active view.
  3. The GUI continues loading in MainWindow.loadGui and MainWindow.updateEditMenu is called
  4. (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.

pshriwise avatar Jul 18 '22 02:07 pshriwise