From 185754f9b5a0f4857f2dcfd84744ce48304938af Mon Sep 17 00:00:00 2001 From: Arjan Schrijver Date: Mon, 18 Mar 2013 14:43:45 +0100 Subject: [PATCH] Add more docstrings --- openlp/plugins/images/forms/addgroupform.py | 17 ++++++++++++++++- openlp/plugins/images/forms/choosegroupform.py | 8 +++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/images/forms/addgroupform.py b/openlp/plugins/images/forms/addgroupform.py index 95eceb678..7f7986499 100644 --- a/openlp/plugins/images/forms/addgroupform.py +++ b/openlp/plugins/images/forms/addgroupform.py @@ -36,7 +36,7 @@ from openlp.plugins.images.forms.addgroupdialog import Ui_AddGroupDialog class AddGroupForm(QtGui.QDialog, Ui_AddGroupDialog): """ - Class documentation goes here. + This class implements the 'Add group' form for the Images plugin. """ def __init__(self, parent=None): """ @@ -46,6 +46,18 @@ class AddGroupForm(QtGui.QDialog, Ui_AddGroupDialog): self.setupUi(self) def exec_(self, clear=True, show_top_level_group=False, selected_group=None): + """ + Show the form + + ``clear`` + Set to False if the text input box should not be cleared when showing the dialog (default: True) + + ``show_top_level_group`` + Set to True when "-- Top level group --" should be showed as first item (default: False) + + ``selected_group`` + The ID of the group that should be selected by default when showing the dialog + """ if clear: self.name_edit.clear() self.name_edit.setFocus() @@ -59,6 +71,9 @@ class AddGroupForm(QtGui.QDialog, Ui_AddGroupDialog): return QtGui.QDialog.exec_(self) def accept(self): + """ + Override the accept() method from QDialog to make sure something is entered in the text input box + """ if not self.name_edit.text(): critical_error_message_box(message=translate('ImagePlugin.AddGroupForm', 'You need to type in a group name.')) diff --git a/openlp/plugins/images/forms/choosegroupform.py b/openlp/plugins/images/forms/choosegroupform.py index 5997d738d..bbb57255c 100644 --- a/openlp/plugins/images/forms/choosegroupform.py +++ b/openlp/plugins/images/forms/choosegroupform.py @@ -34,7 +34,7 @@ from openlp.plugins.images.forms.choosegroupdialog import Ui_ChooseGroupDialog class ChooseGroupForm(QtGui.QDialog, Ui_ChooseGroupDialog): """ - Class documentation goes here. + This class implements the 'Choose group' form for the Images plugin. """ def __init__(self, parent=None): """ @@ -44,6 +44,12 @@ class ChooseGroupForm(QtGui.QDialog, Ui_ChooseGroupDialog): self.setupUi(self) def exec_(self, selected_group=None): + """ + Show the form + + ``selected_group`` + The ID of the group that should be selected by default when showing the dialog + """ if selected_group is not None: for i in range(self.group_combobox.count()): if self.group_combobox.itemData(i) == selected_group: