openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #20408
[Merge] lp:~googol/openlp/bug-1133237 into lp:openlp
Andreas Preikschat has proposed merging lp:~googol/openlp/bug-1133237 into lp:openlp.
Requested reviews:
Raoul Snyman (raoul-snyman)
Tim Bentley (trb143)
Related bugs:
Bug #1133237 in OpenLP: "Our "General" settings section conflicts with Qt"
https://bugs.launchpad.net/openlp/+bug/1133237
For more details, see:
https://code.launchpad.net/~googol/openlp/bug-1133237/+merge/157724
Hello,
- removed "General" section and introduced a "Core" section
- added test
http://ci.openlp.org/view/Specific%20Branch/job/OpenLP-Pull_and_Run_Interface_Tests/19/console
http://ci.openlp.org/view/Specific%20Branch/job/OpenLP-Pull_and_Run_Functional_Tests/73/console
--
https://code.launchpad.net/~googol/openlp/bug-1133237/+merge/157724
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/__init__.py'
--- openlp/core/__init__.py 2013-03-23 07:07:06 +0000
+++ openlp/core/__init__.py 2013-04-08 18:58:23 +0000
@@ -111,10 +111,10 @@
# Decide how many screens we have and their size
screens = ScreenList.create(self.desktop())
# First time checks in settings
- has_run_wizard = Settings().value(u'general/has run wizard')
+ has_run_wizard = Settings().value(u'core/has run wizard')
if not has_run_wizard:
if FirstTimeForm(screens).exec_() == QtGui.QDialog.Accepted:
- Settings().setValue(u'general/has run wizard', True)
+ Settings().setValue(u'core/has run wizard', True)
# Correct stylesheet bugs
application_stylesheet = u''
if not Settings().value(u'advanced/alternate rows'):
@@ -126,7 +126,7 @@
application_stylesheet += NT_REPAIR_STYLESHEET
if application_stylesheet:
self.setStyleSheet(application_stylesheet)
- show_splash = Settings().value(u'general/show splash')
+ show_splash = Settings().value(u'core/show splash')
if show_splash:
self.splash = SplashScreen()
self.splash.show()
@@ -147,7 +147,7 @@
self.processEvents()
if not has_run_wizard:
self.main_window.first_time()
- update_check = Settings().value(u'general/update check')
+ update_check = Settings().value(u'core/update check')
if update_check:
VersionThread(self.main_window).start()
self.main_window.is_display_blank()
@@ -305,8 +305,10 @@
# Instance check
if application.is_already_running():
sys.exit()
+ # Remove/convert obsolete settings.
+ Settings().remove_obsolete_settings()
# First time checks in settings
- if not Settings().value(u'general/has run wizard'):
+ if not Settings().value(u'core/has run wizard'):
if not FirstTimeLanguageForm().exec_():
# if cancel then stop processing
sys.exit()
=== modified file 'openlp/core/lib/screen.py'
--- openlp/core/lib/screen.py 2013-03-08 08:14:39 +0000
+++ openlp/core/lib/screen.py 2013-04-08 18:58:23 +0000
@@ -247,15 +247,15 @@
# Add the screen settings to the settings dict. This has to be done here due to cyclic dependency.
# Do not do this anywhere else.
screen_settings = {
- u'general/x position': self.current[u'size'].x(),
- u'general/y position': self.current[u'size'].y(),
- u'general/monitor': self.display_count - 1,
- u'general/height': self.current[u'size'].height(),
- u'general/width': self.current[u'size'].width()
+ u'core/x position': self.current[u'size'].x(),
+ u'core/y position': self.current[u'size'].y(),
+ u'core/monitor': self.display_count - 1,
+ u'core/height': self.current[u'size'].height(),
+ u'core/width': self.current[u'size'].width()
}
Settings.extend_default_settings(screen_settings)
settings = Settings()
- settings.beginGroup(u'general')
+ settings.beginGroup(u'core')
monitor = settings.value(u'monitor')
self.set_current_display(monitor)
self.display = settings.value(u'display on monitor')
=== modified file 'openlp/core/lib/settings.py'
--- openlp/core/lib/settings.py 2013-03-28 20:15:59 +0000
+++ openlp/core/lib/settings.py 2013-04-08 18:58:23 +0000
@@ -116,30 +116,30 @@
u'advanced/x11 bypass wm': X11_BYPASS_DEFAULT,
u'crashreport/last directory': u'',
u'displayTags/html_tags': u'',
- u'general/audio repeat list': False,
- u'general/auto open': False,
- u'general/auto preview': False,
- u'general/audio start paused': True,
- u'general/auto unblank': False,
- u'general/blank warning': False,
- u'general/ccli number': u'',
- u'general/has run wizard': False,
- u'general/language': u'[en]',
+ u'core/audio repeat list': False,
+ u'core/auto open': False,
+ u'core/auto preview': False,
+ u'core/audio start paused': True,
+ u'core/auto unblank': False,
+ u'core/blank warning': False,
+ u'core/ccli number': u'',
+ u'core/has run wizard': False,
+ u'core/language': u'[en]',
# This defaults to yesterday in order to force the update check to run when you've never run it before.
- u'general/last version test': datetime.datetime.now().date() - datetime.timedelta(days=1),
- u'general/loop delay': 5,
- u'general/recent files': [],
- u'general/save prompt': False,
- u'general/screen blank': False,
- u'general/show splash': True,
- u'general/songselect password': u'',
- u'general/songselect username': u'',
- u'general/update check': True,
- u'general/view mode': u'default',
+ u'core/last version test': datetime.datetime.now().date() - datetime.timedelta(days=1),
+ u'core/loop delay': 5,
+ u'core/recent files': [],
+ u'core/save prompt': False,
+ u'core/screen blank': False,
+ u'core/show splash': True,
+ u'core/songselect password': u'',
+ u'core/songselect username': u'',
+ u'core/update check': True,
+ u'core/view mode': u'default',
# The other display settings (display position and dimensions) are defined in the ScreenList class due to a
# circular dependency.
- u'general/display on monitor': True,
- u'general/override position': False,
+ u'core/display on monitor': True,
+ u'core/override position': False,
u'images/background color': u'#000000',
u'media/players': u'webkit',
u'media/override player': QtCore.Qt.Unchecked,
@@ -304,7 +304,7 @@
# Changed during 1.9.x development.
(u'bibles/bookname language', u'bibles/book name language', []),
(u'general/enable slide loop', u'advanced/slide limits', [(SlideLimits.Wrap, True), (SlideLimits.End, False)]),
- (u'songs/ccli number', u'general/ccli number', []),
+ (u'songs/ccli number', u'core/ccli number', []),
(u'media/use phonon', u'', []),
# Changed during 2.1.x development.
(u'advanced/stylesheet fix', u'', []),
@@ -315,7 +315,34 @@
(u'songs/last directory 1', u'songs/last directory import', []),
(u'songusage/last directory 1', u'songusage/last directory export', []),
(u'user interface/mainwindow splitter geometry', u'user interface/main window splitter geometry', []),
- (u'shortcuts/makeLive', u'shortcuts/make_live', [])
+ (u'shortcuts/makeLive', u'shortcuts/make_live', []),
+ (u'general/audio repeat list', u'core/audio repeat list', []),
+ (u'general/auto open', u'core/auto open', []),
+ (u'general/auto preview', u'core/auto preview', []),
+ (u'general/audio start paused', u'core/audio start paused', []),
+ (u'general/auto unblank', u'core/auto unblank', []),
+ (u'general/blank warning', u'core/blank warning', []),
+ (u'general/ccli number', u'core/ccli number', []),
+ (u'general/has run wizard', u'core/has run wizard', []),
+ (u'general/language', u'core/language', []),
+ (u'general/last version test', u'core/last version test', []),
+ (u'general/loop delay', u'core/loop delay', []),
+ (u'general/recent files', u'core/recent files', []),
+ (u'general/save prompt', u'core/save prompt', []),
+ (u'general/screen blank', u'core/screen blank', []),
+ (u'general/show splash', u'core/show splash', []),
+ (u'general/songselect password', u'core/songselect password', []),
+ (u'general/songselect username', u'core/songselect username', []),
+ (u'general/update check', u'core/update check', []),
+ (u'general/view mode', u'core/view mode', []),
+ (u'general/display on monitor', u'core/display on monitor', []),
+ (u'general/override position', u'core/override position', []),
+ (u'general/x position', u'core/x position', []),
+ (u'general/y position', u'core/y position', []),
+ (u'general/monitor', u'core/monitor', []),
+ (u'general/height', u'core/height', []),
+ (u'general/monitor', u'core/monitor', []),
+ (u'general/width', u'core/width', [])
]
@staticmethod
=== modified file 'openlp/core/ui/firsttimeform.py'
--- openlp/core/ui/firsttimeform.py 2013-03-14 22:22:18 +0000
+++ openlp/core/ui/firsttimeform.py 2013-04-08 18:58:23 +0000
@@ -118,7 +118,7 @@
check_directory_exists(os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp'))
self.noInternetFinishButton.setVisible(False)
# Check if this is a re-run of the wizard.
- self.hasRunWizard = Settings().value(u'general/has run wizard')
+ self.hasRunWizard = Settings().value(u'core/has run wizard')
# Sort out internet access for downloads
if self.web_access:
songs = self.config.get(u'songs', u'languages')
@@ -252,7 +252,7 @@
self.application.set_busy_cursor()
self._performWizard()
self.application.set_normal_cursor()
- Settings().setValue(u'general/has run wizard', True)
+ Settings().setValue(u'core/has run wizard', True)
self.close()
def urlGetFile(self, url, fpath):
@@ -459,7 +459,7 @@
self.urlGetFile(u'%s%s' % (self.web, theme), os.path.join(themes_destination, theme))
# Set Default Display
if self.displayComboBox.currentIndex() != -1:
- Settings().setValue(u'General/monitor', self.displayComboBox.currentIndex())
+ Settings().setValue(u'core/monitor', self.displayComboBox.currentIndex())
self.screens.set_current_display(self.displayComboBox.currentIndex())
# Set Global Theme
if self.themeComboBox.currentIndex() != -1:
=== modified file 'openlp/core/ui/generaltab.py'
--- openlp/core/ui/generaltab.py 2013-03-17 09:21:18 +0000
+++ openlp/core/ui/generaltab.py 2013-04-08 18:58:23 +0000
@@ -49,7 +49,7 @@
self.screens = ScreenList()
self.icon_path = u':/icon/openlp-logo-16x16.png'
general_translated = translate('OpenLP.GeneralTab', 'General')
- SettingsTab.__init__(self, parent, u'General', general_translated)
+ SettingsTab.__init__(self, parent, u'Core', general_translated)
def setupUi(self):
"""
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2013-03-25 07:13:40 +0000
+++ openlp/core/ui/maindisplay.py 2013-04-08 18:58:23 +0000
@@ -357,7 +357,7 @@
# Single screen active
if self.screens.display_count == 1:
# Only make visible if setting enabled.
- if Settings().value(u'general/display on monitor'):
+ if Settings().value(u'core/display on monitor'):
self.setVisible(True)
else:
self.setVisible(True)
@@ -405,7 +405,7 @@
self.footer(service_item.foot_text)
# if was hidden keep it hidden
if self.hide_mode and self.is_live and not service_item.is_media():
- if Settings().value(u'general/auto unblank'):
+ if Settings().value(u'core/auto unblank'):
Registry().execute(u'slidecontroller_live_unblank')
else:
self.hide_display(self.hide_mode)
@@ -427,7 +427,7 @@
log.debug(u'hide_display mode = %d', mode)
if self.screens.display_count == 1:
# Only make visible if setting enabled.
- if not Settings().value(u'general/display on monitor'):
+ if not Settings().value(u'core/display on monitor'):
return
if mode == HideMode.Screen:
self.frame.evaluateJavaScript(u'show_blank("desktop");')
@@ -450,7 +450,7 @@
log.debug(u'show_display')
if self.screens.display_count == 1:
# Only make visible if setting enabled.
- if not Settings().value(u'general/display on monitor'):
+ if not Settings().value(u'core/display on monitor'):
return
self.frame.evaluateJavaScript('show_blank("show");')
if self.isHidden():
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2013-03-28 20:05:46 +0000
+++ openlp/core/ui/mainwindow.py 2013-04-08 18:58:23 +0000
@@ -476,7 +476,7 @@
self.arguments = self.application.args
# Set up settings sections for the main application (not for use by plugins).
self.ui_settings_section = u'user interface'
- self.general_settings_section = u'general'
+ self.general_settings_section = u'core'
self.advanced_settings_section = u'advanced'
self.shortcuts_settings_section = u'shortcuts'
self.service_manager_settings_section = u'servicemanager'
@@ -491,7 +491,6 @@
self.new_data_path = None
self.copy_data = False
Settings().set_up_default_values()
- Settings().remove_obsolete_settings()
self.service_not_saved = False
self.about_form = AboutForm(self)
self.media_controller = MediaController()
=== modified file 'openlp/core/ui/media/mediacontroller.py'
--- openlp/core/ui/media/mediacontroller.py 2013-03-23 07:07:06 +0000
+++ openlp/core/ui/media/mediacontroller.py 2013-04-08 18:58:23 +0000
@@ -415,7 +415,7 @@
elif not hidden or controller.media_info.is_background or service_item.will_auto_start:
autoplay = True
# Unblank on load set
- elif Settings().value(u'general/auto unblank'):
+ elif Settings().value(u'core/auto unblank'):
autoplay = True
if autoplay:
if not self.media_play(controller):
=== modified file 'openlp/core/utils/languagemanager.py'
--- openlp/core/utils/languagemanager.py 2013-02-05 08:05:28 +0000
+++ openlp/core/utils/languagemanager.py 2013-04-08 18:58:23 +0000
@@ -98,7 +98,7 @@
"""
Retrieve a saved language to use from settings
"""
- language = Settings().value(u'general/language')
+ language = Settings().value(u'core/language')
language = str(language)
log.info(u'Language file: \'%s\' Loaded from conf file' % language)
if re.match(r'[[].*[]]', language):
@@ -128,7 +128,7 @@
language = unicode(qm_list[action_name])
if LanguageManager.auto_language:
language = u'[%s]' % language
- Settings().setValue(u'general/language', language)
+ Settings().setValue(u'core/language', language)
log.info(u'Language file: \'%s\' written to conf file' % language)
if message:
QtGui.QMessageBox.information(None,
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2013-03-23 06:46:41 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2013-04-08 18:58:23 +0000
@@ -467,9 +467,9 @@
service_item.raw_footer.append(song.title)
service_item.raw_footer.append(create_separated_list(author_list))
service_item.raw_footer.append(song.copyright)
- if Settings().value(u'general/ccli number'):
+ if Settings().value(u'core/ccli number'):
service_item.raw_footer.append(translate('SongsPlugin.MediaItem', 'CCLI License: ') +
- Settings().value(u'general/ccli number'))
+ Settings().value(u'core/ccli number'))
service_item.audit = [
song.title, author_list, song.copyright, unicode(song.ccli_number)
]
=== modified file 'tests/functional/openlp_core_lib/test_lib.py'
--- tests/functional/openlp_core_lib/test_lib.py 2013-03-06 21:54:13 +0000
+++ tests/functional/openlp_core_lib/test_lib.py 2013-04-08 18:58:23 +0000
@@ -15,7 +15,7 @@
"""
Test the str_to_bool function with boolean input
"""
- #GIVEN: A boolean value set to true
+ # GIVEN: A boolean value set to true
true_boolean = True
# WHEN: We "convert" it to a bool
@@ -25,7 +25,7 @@
assert isinstance(true_result, bool), u'The result should be a boolean'
assert true_result is True, u'The result should be True'
- #GIVEN: A boolean value set to false
+ # GIVEN: A boolean value set to false
false_boolean = False
# WHEN: We "convert" it to a bool
=== modified file 'tests/functional/openlp_core_lib/test_settings.py'
--- tests/functional/openlp_core_lib/test_settings.py 2013-02-21 07:33:21 +0000
+++ tests/functional/openlp_core_lib/test_settings.py 2013-04-08 18:58:23 +0000
@@ -35,16 +35,16 @@
# GIVEN: A new Settings setup
# WHEN reading a setting for the first time
- default_value = Settings().value(u'general/has run wizard')
+ default_value = Settings().value(u'core/has run wizard')
# THEN the default value is returned
assert default_value is False, u'The default value should be False'
# WHEN a new value is saved into config
- Settings().setValue(u'general/has run wizard', True)
+ Settings().setValue(u'core/has run wizard', True)
# THEN the new value is returned when re-read
- assert Settings().value(u'general/has run wizard') is True, u'The saved value should have been returned'
+ assert Settings().value(u'core/has run wizard') is True, u'The saved value should have been returned'
def settings_override_test(self):
"""
=== modified file 'tests/interfaces/openlp_plugins/custom/forms/test_customform.py'
--- tests/interfaces/openlp_plugins/custom/forms/test_customform.py 2013-03-30 09:01:21 +0000
+++ tests/interfaces/openlp_plugins/custom/forms/test_customform.py 2013-04-08 18:58:23 +0000
@@ -36,19 +36,29 @@
del self.main_window
del self.app
+ def load_themes_test(self):
+ """
+ Test the load_themes() method.
+ """
+ # GIVEN: A theme list.
+ theme_list = [u'First Theme', u'Second Theme']
+
+ # WHEN: Show the dialog and add pass a theme list.
+ self.form.load_themes(theme_list)
+
+ # THEN: There should be three items in the combo box.
+ assert self.form.theme_combo_box.count() == 3, u'There should be three items (themes) in the combo box.'
+
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)
+ # WHEN: 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')
+ # 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):
@@ -57,8 +67,8 @@
"""
# 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_()
+ # WHEN: Add a new slide.
QtTest.QTest.mouseClick(self.form.add_button, QtCore.Qt.LeftButton)
- #THEN: One slide should be added.
+
+ # THEN: One slide should be added.
assert self.form.slide_list_view.count() == 1, u'There should be one slide added.'
Follow ups