- fixed regression in bible manager

- fixed wrong Registry usage
- fixed method/argument renames
- fixed custom regression + added test for it
- fixed FTW regression
- fixed more regression bugs

bzr-revno: 2220
This commit is contained in:
Andreas Preikschat 2013-03-28 22:44:46 +01:00
commit d9a27ed2d1
13 changed files with 74 additions and 25 deletions

View File

@ -175,7 +175,7 @@ class MainDisplay(Display):
We need to rebuild the CSS on the live display. We need to rebuild the CSS on the live display.
""" """
for plugin in self.plugin_manager.plugins: for plugin in self.plugin_manager.plugins:
plugin.refreshCss(self.frame) plugin.refresh_css(self.frame)
def retranslateUi(self): def retranslateUi(self):
""" """

View File

@ -651,7 +651,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
for plugin in self.plugin_manager.plugins: for plugin in self.plugin_manager.plugins:
self.activePlugin = plugin self.activePlugin = plugin
oldStatus = self.activePlugin.status oldStatus = self.activePlugin.status
self.activePlugin.setStatus() self.activePlugin.set_status()
if oldStatus != self.activePlugin.status: if oldStatus != self.activePlugin.status:
if self.activePlugin.status == PluginStatus.Active: if self.activePlugin.status == PluginStatus.Active:
self.activePlugin.toggle_status(PluginStatus.Active) self.activePlugin.toggle_status(PluginStatus.Active)

View File

@ -184,7 +184,7 @@ class ThemesTab(SettingsTab):
""" """
self.global_theme = self.default_combo_box.currentText() self.global_theme = self.default_combo_box.currentText()
self.renderer.set_global_theme() self.renderer.set_global_theme()
self._previewGlobalTheme() self._preview_global_theme()
def update_theme_list(self, theme_list): def update_theme_list(self, theme_list):
""" """

View File

@ -225,7 +225,7 @@ class AlertsPlugin(Plugin):
``frame`` ``frame``
The Web frame holding the page. 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")' % frame.evaluateJavaScript(u'update_css("%s", "%s", "%s", "%s", "%s")' %
(align, self.settingsTab.font_face, self.settingsTab.font_size, (align, self.settings_tab.font_face, self.settings_tab.font_size,
self.settingsTab.font_color, self.settingsTab.background_color)) self.settings_tab.font_color, self.settings_tab.background_color))

View File

@ -206,7 +206,7 @@ class BiblesTab(SettingsTab):
self.layout_style = self.layout_style_combo_box.currentIndex() self.layout_style = self.layout_style_combo_box.currentIndex()
def on_language_selection_combo_box_changed(self): 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): def on_new_chapters_check_box_changed(self, check_state):
self.show_new_chapters = False self.show_new_chapters = False

View File

@ -516,13 +516,13 @@ class BibleMediaItem(MediaManagerItem):
def onQuickStyleComboBoxChanged(self): def onQuickStyleComboBoxChanged(self):
self.settings.layout_style = self.quickStyleComboBox.currentIndex() self.settings.layout_style = self.quickStyleComboBox.currentIndex()
self.advancedStyleComboBox.setCurrentIndex(self.settings.layout_style) 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) Settings().setValue(self.settings_section + u'/verse layout style', self.settings.layout_style)
def onAdvancedStyleComboBoxChanged(self): def onAdvancedStyleComboBoxChanged(self):
self.settings.layout_style = self.advancedStyleComboBox.currentIndex() self.settings.layout_style = self.advancedStyleComboBox.currentIndex()
self.quickStyleComboBox.setCurrentIndex(self.settings.layout_style) 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) Settings().setValue(self.settings_section + u'/verse layout style', self.settings.layout_style)
def onAdvancedVersionComboBox(self): def onAdvancedVersionComboBox(self):

View File

@ -26,6 +26,3 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
from editcustomform import EditCustomForm
from editcustomslideform import EditCustomSlideForm

View File

@ -91,8 +91,8 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
self.slide_list_view.clear() self.slide_list_view.clear()
if id == 0: if id == 0:
self.custom_slide = CustomSlide() self.custom_slide = CustomSlide()
self.title_edit.set_text(u'') self.title_edit.setText(u'')
self.credit_edit.set_text(u'') self.credit_edit.setText(u'')
self.theme_combo_box.setCurrentIndex(0) self.theme_combo_box.setCurrentIndex(0)
else: else:
self.custom_slide = self.manager.get_object(CustomSlide, id) self.custom_slide = self.manager.get_object(CustomSlide, id)
@ -158,7 +158,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
""" """
Add a new blank slide. Add a new blank slide.
""" """
self.edit_slide_form.set_text(u'') self.edit_slide_form.setText(u'')
if self.edit_slide_form.exec_(): if self.edit_slide_form.exec_():
self.slide_list_view.addItems(self.edit_slide_form.get_text()) 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. 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_(): if self.edit_slide_form.exec_():
self.update_slide_list(self.edit_slide_form.get_text()) self.update_slide_list(self.edit_slide_form.get_text())
@ -180,7 +180,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
slide_text += item.text() slide_text += item.text()
if row != self.slide_list_view.count() - 1: if row != self.slide_list_view.count() - 1:
slide_text += u'\n[===]\n' 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_(): if self.edit_slide_form.exec_():
self.update_slide_list(self.edit_slide_form.get_text(), True) self.update_slide_list(self.edit_slide_form.get_text(), True)

View File

@ -34,7 +34,7 @@ from sqlalchemy.sql import or_, func, and_
from openlp.core.lib import Registry, MediaManagerItem, ItemCapabilities, ServiceItemContext, Settings, PluginStatus,\ from openlp.core.lib import Registry, MediaManagerItem, ItemCapabilities, ServiceItemContext, Settings, PluginStatus,\
UiStrings, check_item_selected, translate 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 import CustomXMLParser, CustomXMLBuilder
from openlp.plugins.custom.lib.db import CustomSlide from openlp.plugins.custom.lib.db import CustomSlide

View File

@ -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'/ip address', self.address_edit.text())
Settings().setValue(self.settings_section + u'/twelve hour', self.twelve_hour) Settings().setValue(self.settings_section + u'/twelve hour', self.twelve_hour)
if changed: if changed:
Registry().register_function(u'remotes_config_updated') Registry().execute(u'remotes_config_updated')
def onTwelveHourCheckBoxChanged(self, check_state): def onTwelveHourCheckBoxChanged(self, check_state):
self.twelve_hour = False self.twelve_hour = False

View File

@ -256,8 +256,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
A QtGui.QKeyEvent event. A QtGui.QKeyEvent event.
""" """
if event.key() in (QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return): if event.key() in (QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return):
if self.authorsComboBox.hasFocus() and self.authorsComboBox.currentText(): if self.authors_combo_box.hasFocus() and self.authors_combo_box.currentText():
self.onAuthorAddButtonClicked() self.on_author_add_button_clicked()
return return
if self.topicsComboBox.hasFocus() and self.topicsComboBox.currentText(): if self.topicsComboBox.hasFocus() and self.topicsComboBox.currentText():
self.on_topic_add_button_clicked() self.on_topic_add_button_clicked()

View File

@ -0,0 +1,52 @@
"""
Module to test 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 and create a new custom item.
self.form.exec_()
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')