82 We want to add point annotation as an option when the user creates an annotation template. By doing so, the default field is hidden. After the template is created, the 'Select' button is disabled before the annotation starts. This PR also makes sure that the user can save and load a template containing point annotations in the json format.
Changes
annotation_item.py
__init__():
Added point as an option in self.type_selection_combo to allow the user to select when they create a template.
Replaced default_label with self.default_label as I need to explicitly call .show() and .hide() in order to hide it for point annotation items.
fill_vals_point(): for existing point annotations, set the option to "point" and fill in the annotation name
type_changed():
It checks if default_widget exists before removing it. We need to do this as point annotations do not have default widgets to avoid errors.
I added an if statement that hides default_label, default_options, and default_options_label when point annotation is selected.
get_data(): Added an if statement to set type and default for point annotation.
annotation_widget.py
add_existing_item(): Added an if statement to fill in values for existing point annotations.
template_item.py
ItemType: Added "point" as POINT.
__init__(): If it's a point annotation item, center and disable the button. Otherwise, add the name and the widget to the layout as usual and enable the widget.
template_item.py
add_item(): added an if statement for point annotation which sets annot_type and creates a QPushButton widget.
Write tests for new and modified functions in annotation_item_test.py, annotation_widget_test.py, template_list_test.py
Context
82 We want to add point annotation as an option when the user creates an annotation template. By doing so, the default field is hidden. After the template is created, the 'Select' button is disabled before the annotation starts. This PR also makes sure that the user can save and load a template containing point annotations in the json format.
Changes
annotation_item.py
__init__()
:self.type_selection_combo
to allow the user to select when they create a template.default_label
withself.default_label
as I need to explicitly call.show()
and.hide()
in order to hide it for point annotation items.fill_vals_point()
: for existing point annotations, set the option to "point" and fill in the annotation nametype_changed()
:default_widget
exists before removing it. We need to do this as point annotations do not have default widgets to avoid errors.default_label
,default_options
, anddefault_options_label
when point annotation is selected.get_data()
: Added an if statement to settype
anddefault
for point annotation.annotation_widget.py
add_existing_item()
: Added an if statement to fill in values for existing point annotations.template_item.py
ItemType
: Added"point"
asPOINT
.__init__()
: If it's a point annotation item, center and disable the button. Otherwise, add the name and the widget to the layout as usual and enable the widget.template_item.py
add_item()
: added an if statement for point annotation which setsannot_type
and creates a QPushButton widget.annotation_item_test.py
,annotation_widget_test.py
,template_list_test.py