From 76a58001b7d058f92359dd59337b73c2ace01c29 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 25 Mar 2013 07:22:11 +0100 Subject: [PATCH 01/17] fixed bible manager regression --- openlp/plugins/bibles/lib/mediaitem.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 2bb3fb383..bb3bd01cb 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -516,13 +516,13 @@ class BibleMediaItem(MediaManagerItem): def onQuickStyleComboBoxChanged(self): self.settings.layout_style = self.quickStyleComboBox.currentIndex() self.advancedStyleComboBox.setCurrentIndex(self.settings.layout_style) - self.settings.layoutStyleComboBox.setCurrentIndex(self.settings.layout_style) + self.settings.layout_style_combo_box.setCurrentIndex(self.settings.layout_style) Settings().setValue(self.settings_section + u'/verse layout style', self.settings.layout_style) def onAdvancedStyleComboBoxChanged(self): self.settings.layout_style = self.advancedStyleComboBox.currentIndex() self.quickStyleComboBox.setCurrentIndex(self.settings.layout_style) - self.settings.layoutStyleComboBox.setCurrentIndex(self.settings.layout_style) + self.settings.layout_style_combo_box.setCurrentIndex(self.settings.layout_style) Settings().setValue(self.settings_section + u'/verse layout style', self.settings.layout_style) def onAdvancedVersionComboBox(self): From 52cecd44a2fea40066f78ca685521751a124c0ec Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 25 Mar 2013 07:40:47 +0100 Subject: [PATCH 02/17] fixed remotetab regression --- openlp/plugins/remotes/lib/remotetab.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/remotes/lib/remotetab.py b/openlp/plugins/remotes/lib/remotetab.py index 55c8f9bb0..483b3461b 100644 --- a/openlp/plugins/remotes/lib/remotetab.py +++ b/openlp/plugins/remotes/lib/remotetab.py @@ -150,7 +150,7 @@ class RemoteTab(SettingsTab): Settings().setValue(self.settings_section + u'/ip address', self.address_edit.text()) Settings().setValue(self.settings_section + u'/twelve hour', self.twelve_hour) if changed: - Registry().register_function(u'remotes_config_updated') + Registry().execute(u'remotes_config_updated') def onTwelveHourCheckBoxChanged(self, check_state): self.twelve_hour = False From 4283742081eba5078815197f131aa1ac39662369 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 25 Mar 2013 08:13:40 +0100 Subject: [PATCH 03/17] fixed settingsTab rename --- openlp/core/ui/maindisplay.py | 2 +- openlp/plugins/alerts/alertsplugin.py | 6 +++--- openlp/plugins/alerts/lib/alertsmanager.py | 4 ++-- openlp/plugins/media/mediaplugin.py | 3 ++- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 15a915da5..9b4037875 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -175,7 +175,7 @@ class MainDisplay(Display): We need to rebuild the CSS on the live display. """ for plugin in self.plugin_manager.plugins: - plugin.refreshCss(self.frame) + plugin.refresh_css(self.frame) def retranslateUi(self): """ diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index 452b45713..8d8530918 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -225,7 +225,7 @@ class AlertsPlugin(Plugin): ``frame`` The Web frame holding the page. """ - align = VerticalType.Names[self.settingsTab.location] + align = VerticalType.Names[self.settings_tab.location] frame.evaluateJavaScript(u'update_css("%s", "%s", "%s", "%s", "%s")' % - (align, self.settingsTab.font_face, self.settingsTab.font_size, - self.settingsTab.font_color, self.settingsTab.background_color)) + (align, self.settings_tab.font_face, self.settings_tab.font_size, + self.settings_tab.font_color, self.settings_tab.background_color)) diff --git a/openlp/plugins/alerts/lib/alertsmanager.py b/openlp/plugins/alerts/lib/alertsmanager.py index f760288f1..1e88c0916 100644 --- a/openlp/plugins/alerts/lib/alertsmanager.py +++ b/openlp/plugins/alerts/lib/alertsmanager.py @@ -87,7 +87,7 @@ class AlertsManager(QtCore.QObject): if not self.alert_list: return text = self.alert_list.pop(0) - alertTab = self.parent().settingsTab + alertTab = self.parent().settings_tab self.live_controller.display.alert(text, alertTab.location) # Check to see if we have a timer running. if self.timer_id == 0: @@ -103,7 +103,7 @@ class AlertsManager(QtCore.QObject): """ log.debug(u'timer event') if event.timerId() == self.timer_id: - alertTab = self.parent().settingsTab + alertTab = self.parent().settings_tab self.live_controller.display.alert(u'', alertTab.location) self.killTimer(self.timer_id) self.timer_id = 0 diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index 3e685f4c6..8bfc2b52f 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -127,6 +127,7 @@ class MediaPlugin(Plugin): Plugin.app_startup(self) settings = Settings() settings.beginGroup(self.settings_section) + # FIXME: Probably broken due to Settings rewrite. if settings.contains(u'use phonon'): log.info(u'Found old Phonon setting') players = self.media_controller.mediaPlayers.keys() @@ -139,7 +140,7 @@ class MediaPlugin(Plugin): new_players.insert(0, u'phonon') self.media_controller.mediaPlayers[u'phonon'].is_active = True settings.setValue(u'players', u','.join(new_players)) - self.settingsTab.load() + self.settings_tab.load() settings.remove(u'use phonon') settings.endGroup() From fa43759d8d39a5e484cdd48654c80429cdbf9712 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 25 Mar 2013 08:27:54 +0100 Subject: [PATCH 04/17] more regression fixes --- openlp/core/ui/themestab.py | 2 +- openlp/plugins/bibles/lib/biblestab.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index 2dc7ad7b6..f0f821494 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -184,7 +184,7 @@ class ThemesTab(SettingsTab): """ self.global_theme = self.default_combo_box.currentText() self.renderer.set_global_theme() - self._previewGlobalTheme() + self._preview_global_theme() def update_theme_list(self, theme_list): """ diff --git a/openlp/plugins/bibles/lib/biblestab.py b/openlp/plugins/bibles/lib/biblestab.py index ab6796f94..17182d7e2 100644 --- a/openlp/plugins/bibles/lib/biblestab.py +++ b/openlp/plugins/bibles/lib/biblestab.py @@ -206,7 +206,7 @@ class BiblesTab(SettingsTab): self.layout_style = self.layout_style_combo_box.currentIndex() def on_language_selection_combo_box_changed(self): - self.language_selection = self.language_selectioncombo_box.currentIndex() + self.language_selection = self.language_selection_combo_box.currentIndex() def on_new_chapters_check_box_changed(self, check_state): self.show_new_chapters = False From e6e9dec39660b53744776d40cd9f2ebe939ddbe3 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 26 Mar 2013 12:15:31 +0100 Subject: [PATCH 05/17] updated vlc.py --- openlp/core/ui/media/vendor/vlc.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/media/vendor/vlc.py b/openlp/core/ui/media/vendor/vlc.py index e7138b50a..dbb2971f7 100644 --- a/openlp/core/ui/media/vendor/vlc.py +++ b/openlp/core/ui/media/vendor/vlc.py @@ -48,7 +48,7 @@ import sys from inspect import getargspec __version__ = "N/A" -build_date = "Wed Feb 13 18:40:24 2013" +build_date = "Thu Mar 21 22:33:03 2013" if sys.version_info[0] > 2: str = str @@ -70,7 +70,7 @@ if sys.version_info[0] > 2: if isinstance(b, bytes): return b.decode(sys.getfilesystemencoding()) else: - return b + return str(b) else: str = str unicode = unicode @@ -90,6 +90,8 @@ else: """ if isinstance(b, str): return unicode(b, sys.getfilesystemencoding()) + else: + return b # Internal guard to prevent internal classes to be directly # instanciated. From 30a7034ac9648b28ebae124d9c9fe96cc8e4eff4 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 28 Mar 2013 21:03:58 +0100 Subject: [PATCH 06/17] fixed regression + added test for it --- openlp/plugins/custom/forms/__init__.py | 3 -- openlp/plugins/custom/forms/editcustomform.py | 12 ++--- openlp/plugins/custom/lib/mediaitem.py | 2 +- .../openlp_plugins_custom_forms/__init__.py | 0 .../test_customform.py | 53 +++++++++++++++++++ 5 files changed, 60 insertions(+), 10 deletions(-) create mode 100644 tests/interfaces/openlp_plugins_custom_forms/__init__.py create mode 100644 tests/interfaces/openlp_plugins_custom_forms/test_customform.py diff --git a/openlp/plugins/custom/forms/__init__.py b/openlp/plugins/custom/forms/__init__.py index aa0d21fd1..64d028205 100644 --- a/openlp/plugins/custom/forms/__init__.py +++ b/openlp/plugins/custom/forms/__init__.py @@ -26,6 +26,3 @@ # with this program; if not, write to the Free Software Foundation, Inc., 59 # # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### - -from editcustomform import EditCustomForm -from editcustomslideform import EditCustomSlideForm diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index 5146a0e05..85a536ba5 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -35,8 +35,8 @@ from openlp.core.lib import Registry, translate from openlp.core.lib.ui import critical_error_message_box, find_and_set_in_combo_box from openlp.plugins.custom.lib import CustomXMLBuilder, CustomXMLParser from openlp.plugins.custom.lib.db import CustomSlide -from editcustomdialog import Ui_CustomEditDialog from editcustomslideform import EditCustomSlideForm +from editcustomdialog import Ui_CustomEditDialog log = logging.getLogger(__name__) @@ -91,8 +91,8 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.slide_list_view.clear() if id == 0: self.custom_slide = CustomSlide() - self.title_edit.set_text(u'') - self.credit_edit.set_text(u'') + self.title_edit.setText(u'') + self.credit_edit.setText(u'') self.theme_combo_box.setCurrentIndex(0) else: self.custom_slide = self.manager.get_object(CustomSlide, id) @@ -158,7 +158,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): """ Add a new blank slide. """ - self.edit_slide_form.set_text(u'') + self.edit_slide_form.setText(u'') if self.edit_slide_form.exec_(): self.slide_list_view.addItems(self.edit_slide_form.get_text()) @@ -166,7 +166,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): """ Edit the currently selected slide. """ - self.edit_slide_form.set_text(self.slide_list_view.currentItem().text()) + self.edit_slide_form.setText(self.slide_list_view.currentItem().text()) if self.edit_slide_form.exec_(): self.update_slide_list(self.edit_slide_form.get_text()) @@ -180,7 +180,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): slide_text += item.text() if row != self.slide_list_view.count() - 1: slide_text += u'\n[===]\n' - self.edit_slide_form.set_text(slide_text) + self.edit_slide_form.setText(slide_text) if self.edit_slide_form.exec_(): self.update_slide_list(self.edit_slide_form.get_text(), True) diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 8e95b038b..46e4291cd 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -34,7 +34,7 @@ from sqlalchemy.sql import or_, func, and_ from openlp.core.lib import Registry, MediaManagerItem, ItemCapabilities, ServiceItemContext, Settings, PluginStatus,\ UiStrings, check_item_selected, translate -from openlp.plugins.custom.forms import EditCustomForm +from openlp.plugins.custom.forms.editcustomform import EditCustomForm from openlp.plugins.custom.lib import CustomXMLParser, CustomXMLBuilder from openlp.plugins.custom.lib.db import CustomSlide diff --git a/tests/interfaces/openlp_plugins_custom_forms/__init__.py b/tests/interfaces/openlp_plugins_custom_forms/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/interfaces/openlp_plugins_custom_forms/test_customform.py b/tests/interfaces/openlp_plugins_custom_forms/test_customform.py new file mode 100644 index 000000000..2ad97da14 --- /dev/null +++ b/tests/interfaces/openlp_plugins_custom_forms/test_customform.py @@ -0,0 +1,53 @@ +""" +Module to the custom edit form. +""" +from unittest import TestCase +from mock import MagicMock, patch + +from PyQt4 import QtGui + +from openlp.core.lib import Registry +# Import needed due to import problems. +from openlp.plugins.custom.lib.mediaitem import CustomMediaItem +from openlp.plugins.custom.forms.editcustomform import EditCustomForm + + +class TestCustomFrom(TestCase): + """ + Test the EditCustomForm. + """ + def setUp(self): + """ + Create the UI + """ + Registry.create() + self.app = QtGui.QApplication([]) + self.main_window = QtGui.QMainWindow() + Registry().register(u'main_window', self.main_window) + media_item = MagicMock() + manager = MagicMock() + self.form = EditCustomForm(media_item, self.main_window, manager) + + def tearDown(self): + """ + Delete all the C++ objects at the end so that we don't have a segfault + """ + del self.form + del self.main_window + del self.app + + def load_custom_test(self): + """ + Test the EditCustomForm defaults are correct + """ + # GIVEN: A mocked QDialog.exec_() method + with patch(u'PyQt4.QtGui.QDialog.exec_') as mocked_exec: + # WHEN: Show the dialog. + self.form.exec_() + # Create a new custom item. + self.form.load_custom(0) + + #THEN: The line edits should not contain any text. + self.assertEqual(self.form.title_edit.text(), u'', u'The title edit should be empty') + self.assertEqual(self.form.credit_edit.text(), u'', u'The credit edit should be empty') + From 6c7d608fbb8ae95d4301e8c86c4fcba5a7b45fce Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 28 Mar 2013 21:05:46 +0100 Subject: [PATCH 07/17] fixed FTW regression --- openlp/core/ui/mainwindow.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 6567ae9ba..69439c1b1 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -328,7 +328,7 @@ class Ui_MainWindow(object): # Order things differently in OS X so that Preferences menu item in the # app menu is correct (this gets picked up automatically by Qt). if sys.platform == u'darwin': - add_actions(self.settings_menu, (self.settingsPluginListItem, self.settings_language_menu.menuAction(), + add_actions(self.settings_menu, (self.settingsPluginListItem, self.settings_language_menu.menuAction(), None, self.settings_configure_item, self.settings_shortcuts_item, self.formatting_tag_item)) else: add_actions(self.settings_menu, (self.settingsPluginListItem, self.settings_language_menu.menuAction(), @@ -342,7 +342,7 @@ class Ui_MainWindow(object): self.about_item)) else: add_actions(self.help_menu, (self.on_line_help_item, None, self.web_site_item, self.about_item)) - add_actions(self.menuBar, (self.file_menu.menuAction(), self.view_menu.menuAction(), + add_actions(self.menuBar, (self.file_menu.menuAction(), self.view_menu.menuAction(), self.tools_menu.menuAction(), self.settings_menu.menuAction(), self.help_menu.menuAction())) # Initialise the translation self.retranslateUi(main_window) @@ -386,7 +386,7 @@ class Ui_MainWindow(object): self.file_save_item.setStatusTip(translate('OpenLP.MainWindow', 'Save the current service to disk.')) self.file_save_as_item.setText(translate('OpenLP.MainWindow', 'Save &As...')) self.file_save_as_item.setToolTip(translate('OpenLP.MainWindow', 'Save Service As')) - self.file_save_as_item.setStatusTip(translate('OpenLP.MainWindow', + self.file_save_as_item.setStatusTip(translate('OpenLP.MainWindow', 'Save the current service under a new name.')) self.print_service_order_item.setText(UiStrings().PrintService) self.print_service_order_item.setStatusTip(translate('OpenLP.MainWindow', 'Print the current service.')) @@ -449,7 +449,7 @@ class Ui_MainWindow(object): self.tools_first_time_wizard.setStatusTip(translate('OpenLP.MainWindow', 'Re-run the First Time Wizard, importing songs, Bibles and themes.')) self.update_theme_images.setText(translate('OpenLP.MainWindow', 'Update Theme Images')) - self.update_theme_images.setStatusTip(translate('OpenLP.MainWindow', + self.update_theme_images.setStatusTip(translate('OpenLP.MainWindow', 'Update the preview images for all themes.')) self.mode_default_Item.setText(translate('OpenLP.MainWindow', '&Default')) self.mode_default_Item.setStatusTip(translate('OpenLP.MainWindow', 'Set the view mode back to the default.')) @@ -651,7 +651,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): for plugin in self.plugin_manager.plugins: self.activePlugin = plugin oldStatus = self.activePlugin.status - self.activePlugin.setStatus() + self.activePlugin.set_status() if oldStatus != self.activePlugin.status: if self.activePlugin.status == PluginStatus.Active: self.activePlugin.toggle_status(PluginStatus.Active) From 06cf4e1cd6dc2ad7a43fa70786aca414afc55a22 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 28 Mar 2013 21:23:53 +0100 Subject: [PATCH 08/17] fixed spelling --- tests/interfaces/openlp_plugins_custom_forms/test_customform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/interfaces/openlp_plugins_custom_forms/test_customform.py b/tests/interfaces/openlp_plugins_custom_forms/test_customform.py index 2ad97da14..24fefeafb 100644 --- a/tests/interfaces/openlp_plugins_custom_forms/test_customform.py +++ b/tests/interfaces/openlp_plugins_custom_forms/test_customform.py @@ -1,5 +1,5 @@ """ -Module to the custom edit form. +Module to test the custom edit form. """ from unittest import TestCase from mock import MagicMock, patch From 77bd7325a6015bf55155b0e22b805be775a24297 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 28 Mar 2013 21:24:38 +0100 Subject: [PATCH 09/17] reverted code --- openlp/plugins/media/mediaplugin.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index 8bfc2b52f..3e685f4c6 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -127,7 +127,6 @@ class MediaPlugin(Plugin): Plugin.app_startup(self) settings = Settings() settings.beginGroup(self.settings_section) - # FIXME: Probably broken due to Settings rewrite. if settings.contains(u'use phonon'): log.info(u'Found old Phonon setting') players = self.media_controller.mediaPlayers.keys() @@ -140,7 +139,7 @@ class MediaPlugin(Plugin): new_players.insert(0, u'phonon') self.media_controller.mediaPlayers[u'phonon'].is_active = True settings.setValue(u'players', u','.join(new_players)) - self.settings_tab.load() + self.settingsTab.load() settings.remove(u'use phonon') settings.endGroup() From 696f359cb0e4e8bc22b917b5f2946d3b4994964d Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 28 Mar 2013 21:25:35 +0100 Subject: [PATCH 10/17] changed order back --- openlp/plugins/custom/forms/editcustomform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index 85a536ba5..3c2b06f86 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -35,8 +35,8 @@ from openlp.core.lib import Registry, translate from openlp.core.lib.ui import critical_error_message_box, find_and_set_in_combo_box from openlp.plugins.custom.lib import CustomXMLBuilder, CustomXMLParser from openlp.plugins.custom.lib.db import CustomSlide -from editcustomslideform import EditCustomSlideForm from editcustomdialog import Ui_CustomEditDialog +from editcustomslideform import EditCustomSlideForm log = logging.getLogger(__name__) From 818fa367346b9e9bd4c9ab2440c4e3a6d5c1aae3 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 28 Mar 2013 22:24:19 +0100 Subject: [PATCH 11/17] fixed comment --- .../interfaces/openlp_plugins_custom_forms/test_customform.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/interfaces/openlp_plugins_custom_forms/test_customform.py b/tests/interfaces/openlp_plugins_custom_forms/test_customform.py index 24fefeafb..029244220 100644 --- a/tests/interfaces/openlp_plugins_custom_forms/test_customform.py +++ b/tests/interfaces/openlp_plugins_custom_forms/test_customform.py @@ -42,9 +42,8 @@ class TestCustomFrom(TestCase): """ # GIVEN: A mocked QDialog.exec_() method with patch(u'PyQt4.QtGui.QDialog.exec_') as mocked_exec: - # WHEN: Show the dialog. + # WHEN: Show the dialog and create a new custom item. self.form.exec_() - # Create a new custom item. self.form.load_custom(0) #THEN: The line edits should not contain any text. From 643fa9436c1fe6174c52d9c52fa53c2f00fadf14 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 28 Mar 2013 22:36:18 +0100 Subject: [PATCH 12/17] fixed song editor regression --- openlp/plugins/songs/forms/editsongform.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index f5a0f0cac..49a20762a 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -256,8 +256,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): A QtGui.QKeyEvent event. """ if event.key() in (QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return): - if self.authorsComboBox.hasFocus() and self.authorsComboBox.currentText(): - self.onAuthorAddButtonClicked() + if self.authors_combo_box.hasFocus() and self.authors_combo_box.currentText(): + self.on_author_add_button_clicked() return if self.topicsComboBox.hasFocus() and self.topicsComboBox.currentText(): self.on_topic_add_button_clicked() From b139b6a4ebc77a8665f969a5566ce7133710b58a Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 28 Mar 2013 22:49:11 +0100 Subject: [PATCH 13/17] fixed regression :/ --- openlp/plugins/custom/forms/editcustomform.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index 3c2b06f86..c78baa974 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -158,7 +158,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): """ Add a new blank slide. """ - self.edit_slide_form.setText(u'') + self.edit_slide_form.set_text(u'') if self.edit_slide_form.exec_(): self.slide_list_view.addItems(self.edit_slide_form.get_text()) @@ -166,7 +166,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): """ Edit the currently selected slide. """ - self.edit_slide_form.setText(self.slide_list_view.currentItem().text()) + self.edit_slide_form.set_text(self.slide_list_view.currentItem().text()) if self.edit_slide_form.exec_(): self.update_slide_list(self.edit_slide_form.get_text()) @@ -180,7 +180,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): slide_text += item.text() if row != self.slide_list_view.count() - 1: slide_text += u'\n[===]\n' - self.edit_slide_form.setText(slide_text) + self.edit_slide_form.set_text(slide_text) if self.edit_slide_form.exec_(): self.update_slide_list(self.edit_slide_form.get_text(), True) From 94b926d273849faa7fbde46f15039fc3a69a9816 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 28 Mar 2013 23:08:14 +0100 Subject: [PATCH 14/17] added test --- .../test_customform.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/interfaces/openlp_plugins_custom_forms/test_customform.py b/tests/interfaces/openlp_plugins_custom_forms/test_customform.py index 029244220..166ccd672 100644 --- a/tests/interfaces/openlp_plugins_custom_forms/test_customform.py +++ b/tests/interfaces/openlp_plugins_custom_forms/test_customform.py @@ -4,7 +4,7 @@ Module to test the custom edit form. from unittest import TestCase from mock import MagicMock, patch -from PyQt4 import QtGui +from PyQt4 import QtGui, QtTest, QtCore from openlp.core.lib import Registry # Import needed due to import problems. @@ -36,9 +36,9 @@ class TestCustomFrom(TestCase): del self.main_window del self.app - def load_custom_test(self): + def load_custom(self): """ - Test the EditCustomForm defaults are correct + Test the load_custom() method. """ # GIVEN: A mocked QDialog.exec_() method with patch(u'PyQt4.QtGui.QDialog.exec_') as mocked_exec: @@ -50,3 +50,15 @@ class TestCustomFrom(TestCase): self.assertEqual(self.form.title_edit.text(), u'', u'The title edit should be empty') self.assertEqual(self.form.credit_edit.text(), u'', u'The credit edit should be empty') + + def on_add_button_clicked_test(self): + """ + Test the on_add_button_clicked_test method / add_button button. + """ + # GIVEN: A mocked QDialog.exec_() method + with patch(u'PyQt4.QtGui.QDialog.exec_') as mocked_exec: + # WHEN: Show the dialog and add a new slide. + self.form.exec_() + QtTest.QTest.mouseClick(self.form.add_button, QtCore.Qt.LeftButton) + #THEN: One slide should be added. + assert self.form.slide_list_view.count() == 1, u'There should be one slide be added.' From 219ab48277594bf1aaa7cca33a832ac5aafbccfe Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 28 Mar 2013 23:10:24 +0100 Subject: [PATCH 15/17] enabled test again --- tests/interfaces/openlp_plugins_custom_forms/test_customform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/interfaces/openlp_plugins_custom_forms/test_customform.py b/tests/interfaces/openlp_plugins_custom_forms/test_customform.py index 166ccd672..ee0eb4137 100644 --- a/tests/interfaces/openlp_plugins_custom_forms/test_customform.py +++ b/tests/interfaces/openlp_plugins_custom_forms/test_customform.py @@ -36,7 +36,7 @@ class TestCustomFrom(TestCase): del self.main_window del self.app - def load_custom(self): + def load_custom_test(self): """ Test the load_custom() method. """ From ffd409d24ea55f2b7a0cfecce0a84e67d0140a75 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 28 Mar 2013 23:12:09 +0100 Subject: [PATCH 16/17] wording --- tests/interfaces/openlp_plugins_custom_forms/test_customform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/interfaces/openlp_plugins_custom_forms/test_customform.py b/tests/interfaces/openlp_plugins_custom_forms/test_customform.py index ee0eb4137..ebd12f49d 100644 --- a/tests/interfaces/openlp_plugins_custom_forms/test_customform.py +++ b/tests/interfaces/openlp_plugins_custom_forms/test_customform.py @@ -61,4 +61,4 @@ class TestCustomFrom(TestCase): self.form.exec_() QtTest.QTest.mouseClick(self.form.add_button, QtCore.Qt.LeftButton) #THEN: One slide should be added. - assert self.form.slide_list_view.count() == 1, u'There should be one slide be added.' + assert self.form.slide_list_view.count() == 1, u'There should be one slide added.' From 48ffb04f5d1fede7cc64d5d2c7bd1612196c055e Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 29 Mar 2013 07:25:01 +0100 Subject: [PATCH 17/17] moved tests --- .../__init__.py | 0 tests/interfaces/openlp_plugins/__init__.pyc | Bin 0 -> 184 bytes .../custom}/__init__.py | 0 .../openlp_plugins/custom/forms/__init__.py | 0 .../custom/forms}/test_customform.py | 0 tests/interfaces/openlp_plugins/songs/__init__.py | 0 .../openlp_plugins/songs/forms/__init__.py | 0 .../songs/forms}/test_authorsform.py | 0 .../songs/forms}/test_editsongform.py | 0 .../songs/forms}/test_editverseform.py | 0 .../songs/forms}/test_topicsform.py | 0 11 files changed, 0 insertions(+), 0 deletions(-) rename tests/interfaces/{openlp_plugins_custom_forms => openlp_plugins}/__init__.py (100%) create mode 100644 tests/interfaces/openlp_plugins/__init__.pyc rename tests/interfaces/{openlp_plugins_songs_forms => openlp_plugins/custom}/__init__.py (100%) create mode 100644 tests/interfaces/openlp_plugins/custom/forms/__init__.py rename tests/interfaces/{openlp_plugins_custom_forms => openlp_plugins/custom/forms}/test_customform.py (100%) create mode 100644 tests/interfaces/openlp_plugins/songs/__init__.py create mode 100644 tests/interfaces/openlp_plugins/songs/forms/__init__.py rename tests/interfaces/{openlp_plugins_songs_forms => openlp_plugins/songs/forms}/test_authorsform.py (100%) rename tests/interfaces/{openlp_plugins_songs_forms => openlp_plugins/songs/forms}/test_editsongform.py (100%) rename tests/interfaces/{openlp_plugins_songs_forms => openlp_plugins/songs/forms}/test_editverseform.py (100%) rename tests/interfaces/{openlp_plugins_songs_forms => openlp_plugins/songs/forms}/test_topicsform.py (100%) diff --git a/tests/interfaces/openlp_plugins_custom_forms/__init__.py b/tests/interfaces/openlp_plugins/__init__.py similarity index 100% rename from tests/interfaces/openlp_plugins_custom_forms/__init__.py rename to tests/interfaces/openlp_plugins/__init__.py diff --git a/tests/interfaces/openlp_plugins/__init__.pyc b/tests/interfaces/openlp_plugins/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0d24c9eff54ac7d86f14523ef46194c4bbc24cad GIT binary patch literal 184 zcmZ9GO$q`r423JY5W#!QX3Pa-@BpGC9-x#qGe-JH(*ZrLhY(zw0apgz3w(L-vV3nh zpI3LW>NgA72NAEtoKn|jCZ|SB{TUl!a7zKfL|4!-^d;TVR)%xNc