In order to add an image to an existing group when no group was preselected,
the user must currently choose the existing group name from the comboxbox
and also select the Existing Group radio button. It should be assumed that
by selecting a group name from the combobox, the user intendeds to add the
image to an existing group, and the accompanying radio button should
automatically be selected. This reduces the number of required clicks, and
the likelihood of not actually adding the image to the correct group.
Likewise, if a user enters text into the New Group field, the dialog
should assume that the user's intent is to create a new group and auto
select the appropriate radio button.
Also removes some choosegroupdialog specific component logic from mediaitem,
since it's now covered by the choosegroupdialog implementation. Better
encapsulation, and improves testability. (Testing that the existing group
radio button was selected when choosedialogform was initialized with a
preselected group requires much more effort when the radio button selection
logic spanned two components.)
Adds simple test cases for the scenarios described above.
The method is allowed to return None, so calling functions should handle that. Raising an error is very rude behavior and the output just said that the input was invalid with no real clue as to what is wrong.
Now None is returned without causing too much hassle, and a proper error is logged mentioning what exactly caused the error.
The test case was updated.
This is sort of related to https://bugs.launchpad.net/openlp/+bug/1786601 in that this would have been nice to actually know what went wrong and failback to None.
bzr-revno: 2829