forked from openlp/openlp
Changed setting version name
This commit is contained in:
parent
f36c8660ab
commit
cbd1b7c223
@ -201,11 +201,11 @@ class OpenLP(OpenLPMixin, QtGui.QApplication):
|
|||||||
|
|
||||||
:param has_run_wizard: OpenLP has been run before
|
:param has_run_wizard: OpenLP has been run before
|
||||||
"""
|
"""
|
||||||
data_version = Settings().value('core/data version')
|
data_version = Settings().value('core/application version')
|
||||||
openlp_version = get_application_version()['version']
|
openlp_version = get_application_version()['version']
|
||||||
# New installation, no need to create backup
|
# New installation, no need to create backup
|
||||||
if not has_run_wizard:
|
if not has_run_wizard:
|
||||||
Settings().setValue('core/data version', openlp_version)
|
Settings().setValue('core/application version', openlp_version)
|
||||||
# If data_version is different from the current version ask if we should backup the data folder
|
# If data_version is different from the current version ask if we should backup the data folder
|
||||||
elif data_version != openlp_version:
|
elif data_version != openlp_version:
|
||||||
if QtGui.QMessageBox.question(None, translate('OpenLP', 'Backup'),
|
if QtGui.QMessageBox.question(None, translate('OpenLP', 'Backup'),
|
||||||
@ -227,7 +227,7 @@ class OpenLP(OpenLPMixin, QtGui.QApplication):
|
|||||||
translate('OpenLP', 'A backup of the data folder has been created at %s')
|
translate('OpenLP', 'A backup of the data folder has been created at %s')
|
||||||
% data_folder_backup_path)
|
% data_folder_backup_path)
|
||||||
# Update the version in the settings
|
# Update the version in the settings
|
||||||
Settings().setValue('core/data version', openlp_version)
|
Settings().setValue('core/application version', openlp_version)
|
||||||
|
|
||||||
def process_events(self):
|
def process_events(self):
|
||||||
"""
|
"""
|
||||||
|
@ -137,7 +137,7 @@ class Settings(QtCore.QSettings):
|
|||||||
# circular dependency.
|
# circular dependency.
|
||||||
'core/display on monitor': True,
|
'core/display on monitor': True,
|
||||||
'core/override position': False,
|
'core/override position': False,
|
||||||
'core/data version': '0.0',
|
'core/application version': '0.0',
|
||||||
'images/background color': '#000000',
|
'images/background color': '#000000',
|
||||||
'media/players': 'webkit',
|
'media/players': 'webkit',
|
||||||
'media/override player': QtCore.Qt.Unchecked,
|
'media/override player': QtCore.Qt.Unchecked,
|
||||||
|
@ -83,7 +83,7 @@ class TestInit(TestCase, TestMixin):
|
|||||||
'version': '2.2.0',
|
'version': '2.2.0',
|
||||||
'build': 'bzr000'
|
'build': 'bzr000'
|
||||||
}
|
}
|
||||||
Settings().setValue('core/data version', '2.2.0')
|
Settings().setValue('core/application version', '2.2.0')
|
||||||
with patch('openlp.core.get_application_version') as mocked_get_application_version,\
|
with patch('openlp.core.get_application_version') as mocked_get_application_version,\
|
||||||
patch('openlp.core.QtGui.QMessageBox.question') as mocked_question:
|
patch('openlp.core.QtGui.QMessageBox.question') as mocked_question:
|
||||||
mocked_get_application_version.return_value = MOCKED_VERSION
|
mocked_get_application_version.return_value = MOCKED_VERSION
|
||||||
@ -93,7 +93,7 @@ class TestInit(TestCase, TestMixin):
|
|||||||
self.openlp.backup_on_upgrade(old_install)
|
self.openlp.backup_on_upgrade(old_install)
|
||||||
|
|
||||||
# THEN: It should not ask if we want to create a backup
|
# THEN: It should not ask if we want to create a backup
|
||||||
self.assertEqual(Settings().value('core/data version'), '2.2.0', 'Version should be the same!')
|
self.assertEqual(Settings().value('core/application version'), '2.2.0', 'Version should be the same!')
|
||||||
self.assertEqual(mocked_question.call_count, 0, 'No question should have been asked!')
|
self.assertEqual(mocked_question.call_count, 0, 'No question should have been asked!')
|
||||||
|
|
||||||
def backup_on_upgrade_test(self):
|
def backup_on_upgrade_test(self):
|
||||||
@ -107,7 +107,7 @@ class TestInit(TestCase, TestMixin):
|
|||||||
'version': '2.2.0',
|
'version': '2.2.0',
|
||||||
'build': 'bzr000'
|
'build': 'bzr000'
|
||||||
}
|
}
|
||||||
Settings().setValue('core/data version', '2.0.5')
|
Settings().setValue('core/application version', '2.0.5')
|
||||||
with patch('openlp.core.get_application_version') as mocked_get_application_version,\
|
with patch('openlp.core.get_application_version') as mocked_get_application_version,\
|
||||||
patch('openlp.core.QtGui.QMessageBox.question') as mocked_question:
|
patch('openlp.core.QtGui.QMessageBox.question') as mocked_question:
|
||||||
mocked_get_application_version.return_value = MOCKED_VERSION
|
mocked_get_application_version.return_value = MOCKED_VERSION
|
||||||
@ -117,5 +117,5 @@ class TestInit(TestCase, TestMixin):
|
|||||||
self.openlp.backup_on_upgrade(old_install)
|
self.openlp.backup_on_upgrade(old_install)
|
||||||
|
|
||||||
# THEN: It should ask if we want to create a backup
|
# THEN: It should ask if we want to create a backup
|
||||||
self.assertEqual(Settings().value('core/data version'), '2.2.0', 'Version should be upgraded!')
|
self.assertEqual(Settings().value('core/application version'), '2.2.0', 'Version should be upgraded!')
|
||||||
self.assertEqual(mocked_question.call_count, 1, 'A question should have been asked!')
|
self.assertEqual(mocked_question.call_count, 1, 'A question should have been asked!')
|
||||||
|
Loading…
Reference in New Issue
Block a user