File tree Expand file tree Collapse file tree 3 files changed +35
-2
lines changed
Expand file tree Collapse file tree 3 files changed +35
-2
lines changed Original file line number Diff line number Diff line change 1+ 2.0.2
2+ - fix: IndexError when removing a plot (#36)
132.0.1
24 - fix: correctly distinguish prereleases when checking for new versions
35 - enh: allow loading data via drag&drop
Original file line number Diff line number Diff line change @@ -186,11 +186,11 @@ def adopt_pipeline(self, pipeline_state):
186186 try :
187187 new_ncol , new_nrow = self .pipeline .get_plot_col_row_count (
188188 plot_id , pipeline_state )
189- except KeyError :
189+ lay = pipeline_state ["plots" ][plot_index ]["layout" ]
190+ except (KeyError , IndexError ):
190191 # the plot was removed
191192 continue
192193 else :
193- lay = pipeline_state ["plots" ][plot_index ]["layout" ]
194194 lay ["size x" ] += 200 * (new_ncol - old_ncol )
195195 lay ["size y" ] += 200 * (new_nrow - old_nrow )
196196 # set the new state of the pipeline
Original file line number Diff line number Diff line change @@ -68,3 +68,34 @@ def test_handle_empty_plots_issue_27(qtbot):
6868 with pytest .warns (pipeline .core .EmptyDatasetWarning ):
6969 # this now only throws a warning
7070 qtbot .mouseClick (pe , QtCore .Qt .LeftButton ) # activate (raises #27)
71+
72+
73+ def test_remove_plots_issue_36 (qtbot ):
74+ """Correctly handle empty plots
75+
76+ https://github.com/ZELLMECHANIK-DRESDEN/ShapeOut2/issues/36
77+
78+ Traceback (most recent call last):
79+ File "/home/paul/repos/ShapeOut2/shapeout2/gui/main.py",
80+ line 193, in adopt_pipeline
81+ lay = pipeline_state["plots"][plot_index]["layout"]
82+ IndexError: list index out of range
83+ """
84+ mw = ShapeOut2 ()
85+ qtbot .addWidget (mw )
86+
87+ # add a dataslots
88+ path = pathlib .Path (__file__ ).parent / "data" / "calibration_beads_47.rtdc"
89+ mw .add_dataslot (paths = [path , path , path ])
90+
91+ assert len (mw .pipeline .slot_ids ) == 3 , "we added those"
92+ assert len (mw .pipeline .filter_ids ) == 1 , "automatically added"
93+
94+ # now create a plot window
95+ plot_id = mw .add_plot ()
96+ # and another one
97+ mw .add_plot ()
98+
99+ # remove a plot
100+ pw = mw .block_matrix .get_widget (filt_plot_id = plot_id )
101+ pw .action_remove ()
You can’t perform that action at this time.
0 commit comments