mantidproject / mantidimaging

Graphical toolkit for neutron imaging.
https://mantidproject.github.io/mantidimaging
GNU General Public License v3.0
10 stars 6 forks source link

Type checking in TableModel #2238

Closed samtygier-stfc closed 1 week ago

samtygier-stfc commented 1 week ago

Issue

Some type checking for #2213

Description

This adds some type annotations to TableModel. This is slightly awkward because the data rows are a heterogenous list, and there is not way to strictly type its elements. We can't switch to a tuple, because they need to be mutable (maybe we can. but it is more code change).

So add ElementType and RowType, which limit the types, but don't understand the positions. and add an overloaded get_element() that fixes the type based on the literal value of the column argument.

Also some changes in the view to access things though get_element() and set_element()

Acceptance Criteria

Existing tests should all still pass Play around with adding, removing and renaming ROIs

Documentation

Not needed

coveralls commented 1 week ago

Coverage Status

coverage: 73.142% (-0.01%) from 73.156% when pulling 1588106d06ce5d3732cb8846fea41ac38ead9510 on 2213-type-checking-2 into d40724317a710baf2d6eaf64da7ae71adc810e14 on main.

coveralls commented 1 week ago

Coverage Status

coverage: 73.137% (-0.02%) from 73.156% when pulling b9cc6932f6384d7fc0f972dbc4abe58d4e0600b1 on 2213-type-checking-2 into 38eeb6111b5bfac794e3530b7451492f791baf70 on main.