forked from openlp/openlp
Head and confilicts
This commit is contained in:
commit
31847abf2a
@ -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):
|
||||
"""
|
||||
|
@ -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)
|
||||
|
6
openlp/core/ui/media/vendor/vlc.py
vendored
6
openlp/core/ui/media/vendor/vlc.py
vendored
@ -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.
|
||||
|
@ -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):
|
||||
"""
|
||||
|
@ -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))
|
||||
|
@ -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
|
||||
|
@ -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):
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
@ -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()
|
||||
|
80
tests/functional/openlp_plugins/remotes/test_server.py
Normal file
80
tests/functional/openlp_plugins/remotes/test_server.py
Normal file
@ -0,0 +1,80 @@
|
||||
"""
|
||||
This module contains tests for the lib submodule of the Remotes plugin.
|
||||
"""
|
||||
import os
|
||||
|
||||
from unittest import TestCase
|
||||
from tempfile import mkstemp
|
||||
from mock import patch, MagicMock
|
||||
import cherrypy
|
||||
|
||||
from openlp.core.lib import Settings
|
||||
from openlp.plugins.remotes.lib.httpserver import HttpConnection
|
||||
from PyQt4 import QtGui
|
||||
|
||||
__default_settings__ = {
|
||||
u'remotes/twelve hour': True,
|
||||
u'remotes/port': 4316,
|
||||
u'remotes/https port': 4317,
|
||||
u'remotes/https enabled': False,
|
||||
u'remotes/user id': u'openlp',
|
||||
u'remotes/password': u'password',
|
||||
u'remotes/authentication enabled': False,
|
||||
u'remotes/ip address': u'0.0.0.0'
|
||||
}
|
||||
|
||||
SESSION_KEY = '_cp_openlp'
|
||||
|
||||
|
||||
class TestAuth(TestCase):
|
||||
"""
|
||||
Test the functions in the :mod:`lib` module.
|
||||
"""
|
||||
def setUp(self):
|
||||
"""
|
||||
Create the UI
|
||||
"""
|
||||
fd, self.ini_file = mkstemp(u'.ini')
|
||||
Settings().set_filename(self.ini_file)
|
||||
self.application = QtGui.QApplication.instance()
|
||||
Settings().extend_default_settings(__default_settings__)
|
||||
self.server = HttpConnection(None)
|
||||
|
||||
def tearDown(self):
|
||||
"""
|
||||
Delete all the C++ objects at the end so that we don't have a segfault
|
||||
"""
|
||||
del self.application
|
||||
os.unlink(self.ini_file)
|
||||
|
||||
def process_http_request_test(self):
|
||||
"""
|
||||
Test the Authentication check routine with credentials.
|
||||
"""
|
||||
# GIVEN: A user and password in settings
|
||||
cherrypy = MagicMock()
|
||||
cherrypy.url.return_value = "nosetest/apl/poll"
|
||||
|
||||
print cherrypy.url()
|
||||
|
||||
with patch(u'url.path') as mocked_url:
|
||||
mocked_url.return_value = "nosetest/apl/poll"
|
||||
self.server._process_http_request(None, None)
|
||||
|
||||
self.assertFalse()
|
||||
|
||||
# WHEN: We run the function with no input
|
||||
#authenticated = check_credentials(u'', u'')
|
||||
|
||||
# THEN: The authentication will fail with an error message
|
||||
#self.assertEqual(authenticated, u'Incorrect username or password.',
|
||||
# u'The return should be a error message string')
|
||||
|
||||
# WHEN: We run the function with the correct input
|
||||
#authenticated = check_credentials(u'twinkle', u'mongoose')
|
||||
|
||||
# THEN: The authentication will pass.
|
||||
#self.assertEqual(authenticated, None, u'The return should be a None string')
|
||||
|
||||
|
||||
|
BIN
tests/interfaces/openlp_plugins/__init__.pyc
Normal file
BIN
tests/interfaces/openlp_plugins/__init__.pyc
Normal file
Binary file not shown.
0
tests/interfaces/openlp_plugins/custom/__init__.py
Normal file
0
tests/interfaces/openlp_plugins/custom/__init__.py
Normal file
@ -0,0 +1,64 @@
|
||||
"""
|
||||
Module to test the custom edit form.
|
||||
"""
|
||||
from unittest import TestCase
|
||||
from mock import MagicMock, patch
|
||||
|
||||
from PyQt4 import QtGui, QtTest, QtCore
|
||||
|
||||
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 load_custom() method.
|
||||
"""
|
||||
# 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')
|
||||
|
||||
|
||||
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 added.'
|
0
tests/interfaces/openlp_plugins/remotes/__init__.py
Normal file
0
tests/interfaces/openlp_plugins/remotes/__init__.py
Normal file
85
tests/interfaces/openlp_plugins/remotes/test_remoteserver.py
Normal file
85
tests/interfaces/openlp_plugins/remotes/test_remoteserver.py
Normal file
@ -0,0 +1,85 @@
|
||||
"""
|
||||
This module contains tests for the lib submodule of the Remotes plugin.
|
||||
"""
|
||||
import os
|
||||
from unittest import TestCase
|
||||
from tempfile import mkstemp
|
||||
from mock import patch, MagicMock
|
||||
|
||||
|
||||
import urllib
|
||||
from BeautifulSoup import BeautifulSoup, NavigableString, Tag
|
||||
|
||||
from openlp.core.lib import Settings
|
||||
from openlp.plugins.remotes.lib import HttpServer
|
||||
from PyQt4 import QtGui
|
||||
|
||||
__default_settings__ = {
|
||||
u'remotes/twelve hour': True,
|
||||
u'remotes/port': 4316,
|
||||
u'remotes/https port': 4317,
|
||||
u'remotes/https enabled': False,
|
||||
u'remotes/user id': u'openlp',
|
||||
u'remotes/password': u'password',
|
||||
u'remotes/authentication enabled': False,
|
||||
u'remotes/ip address': u'0.0.0.0'
|
||||
}
|
||||
|
||||
SESSION_KEY = '_cp_openlp'
|
||||
|
||||
|
||||
class TestRemoteServer(TestCase):
|
||||
"""
|
||||
Test the functions in the :mod:`lib` module.
|
||||
"""
|
||||
def setUp(self):
|
||||
"""
|
||||
Create the UI
|
||||
"""
|
||||
fd, self.ini_file = mkstemp(u'.ini')
|
||||
Settings().set_filename(self.ini_file)
|
||||
self.application = QtGui.QApplication.instance()
|
||||
Settings().extend_default_settings(__default_settings__)
|
||||
self.server = HttpServer(self)
|
||||
|
||||
def tearDown(self):
|
||||
"""
|
||||
Delete all the C++ objects at the end so that we don't have a segfault
|
||||
"""
|
||||
del self.application
|
||||
os.unlink(self.ini_file)
|
||||
os.unlink(Settings().fileName())
|
||||
self.server.close()
|
||||
|
||||
def check_access_test(self):
|
||||
"""
|
||||
Test the Authentication check routine.
|
||||
"""
|
||||
# GIVEN: A user and password in settings
|
||||
Settings().setValue(u'remotes/user id', u'twinkle')
|
||||
Settings().setValue(u'remotes/password', u'mongoose')
|
||||
|
||||
# WHEN: We run the function with no input
|
||||
authenticated = check_credentials(u'', u'')
|
||||
|
||||
# THEN: The authentication will fail with an error message
|
||||
self.assertEqual(authenticated, u'Incorrect username or password.',
|
||||
u'The return should be a error message string')
|
||||
|
||||
# WHEN: We run the function with the correct input
|
||||
authenticated = check_credentials(u'twinkle', u'mongoose')
|
||||
|
||||
# THEN: The authentication will pass.
|
||||
self.assertEqual(authenticated, None, u'The return should be a None string')
|
||||
|
||||
def check_auth_inactive_test(self):
|
||||
"""
|
||||
Test the Authentication check routine.
|
||||
"""
|
||||
# GIVEN: A access which is secure
|
||||
Settings().setValue(u'remotes/authentication enabled', True)
|
||||
|
||||
# WHEN: We run the function with no input
|
||||
f = urllib.urlopen("http://localhost:4316")
|
||||
soup = BeautifulSoup(f.read())
|
||||
print soup.title.string
|
0
tests/interfaces/openlp_plugins/songs/__init__.py
Normal file
0
tests/interfaces/openlp_plugins/songs/__init__.py
Normal file
Loading…
Reference in New Issue
Block a user