Kyle Russell has proposed merging lp:~bkylerussell/openlp/openlp into lp:openlp.
Commit message:
Improve usability of image plugin choosegroupform
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.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~bkylerussell/openlp/openlp/+merge/354137
Simplifies clicks needed to successfully import an image to a new or existing
group with the image plugin
--
Your team OpenLP Core is requested to review the proposed merge of
lp:~bkylerussell/openlp/openlp into lp:openlp.
=== modified file 'openlp/plugins/images/forms/choosegroupdialog.py'
--- openlp/plugins/images/forms/choosegroupdialog.py 2017-12-29 09:15:48 +
+++ openlp/plugins/images/forms/choosegroupdialog.py 2018-08-31 17:40:41 +
@@ -58,6 +58,7 @@
self.choose_group_layout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.existing_radio_button)
self.group_combobox = QtWidgets.QComboBox(choose_group_dialog)
self.group_combobox.setObjectName('group_combobox')
+self.group_combobox.activated.connect(self.on_group_combobox_selected)
self.choose_group_layout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.group_combobox)
self.new_radio_button = QtWidgets.QRadioButton(choose_group_dialog)
self.new_radio_button.setChecked(False)
@@ -65,6 +66,7 @@
self.choose_group_layout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.new_radio_button)
self.new_group_edit = QtWidgets.QLineEdit(choose_group_dialog)
self.new_group_edit.setObjectName('new_group_edit')
+self.new_group_edit.textEdited.connect(self.on_new_group_edit_changed)
self.choose_group_layout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.new_group_edit)
self.group_button_box = create_button_box(choose_group_dialog, 'buttonBox', ['ok'])
self.choose_group_layout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.group_button_box)
@@ -83,3 +85,22 @@
self.nogroup_radio_button.setText(translate('ImagePlugin.ChooseGroupForm', 'No group'))
self.existing_radio_button.setText(translate('ImagePlugin.ChooseGroupForm', 'Existing group'))
self.new_radio_button.setText(translate('ImagePlugin.ChooseGroupForm', 'New group'))
+
+def on_group_combobox_selected(self, index):
+"""
+Handles the activated signal from the existing group combobox when the
+user makes a selection
+
+:param index: position of the selected item in the combobox
+"""
+self.existing_radio_button.setChecked(True)
+self.group_combobox.setFocus()
+
+def on_new_group_edit_changed(self, new_group):
+"""
+Handles the textEdited signal from the new group text input field
+when the user enters a new group name
+
+:param new_group: new text entered by the user
+"""
+self.new_radio_button.setChecked(True)
=== modified file 'openlp/plugins/images/forms/choosegroupform.py'
--- openlp/plugins/images/forms/choosegroupform.py 2017-12-29 09:15:48 +
+++ openlp/plugins/images/forms/choosegroupform.py 2018-08-31 17:40:41 +
@@ -48,4 +48,5 @@
for index in range(self.group_combobox.count()):
if self.group_combobox.itemData(index) == selected_group:
self.group_combobox.setCurrentIndex(index)
+self.existing_radio_button.setChecked(True)
return QtWidgets.QDialog.exec(self)
=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py 2018-08-25 14:08:19 +
+++ openlp/plugins/images/lib/mediaitem.py 2018-08-31 17:40:41 +
@@ -430,16 +430,6 @@
if isinstance(selected_item.data(0, QtCore.Qt.UserRole), ImageGroups):
preselect_group = selected_item.data(0,