From 81ca409e4c7a463656eef71e21fddd8be6a079bd Mon Sep 17 00:00:00 2001 From: Ken Roberts Date: Fri, 18 May 2018 17:48:33 -0700 Subject: [PATCH] Fix settings calls --- openlp/core/projectors/manager.py | 12 ++++-------- openlp/core/projectors/pjlink.py | 7 +------ openlp/core/projectors/tab.py | 26 ++++++++++---------------- 3 files changed, 15 insertions(+), 30 deletions(-) diff --git a/openlp/core/projectors/manager.py b/openlp/core/projectors/manager.py index a0bfc19d7..044b2faf8 100644 --- a/openlp/core/projectors/manager.py +++ b/openlp/core/projectors/manager.py @@ -336,14 +336,10 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM Retrieve the saved settings """ log.debug('Updating ProjectorManager settings') - settings = Settings() - settings.beginGroup(self.settings_section) - self.autostart = settings.value('connect on start') - self.poll_time = settings.value('poll time') - self.socket_timeout = settings.value('socket timeout') - self.source_select_dialog_type = settings.value('source dialog type') - settings.endGroup() - del settings + self.autostart = Settings().value('projector/connect on start') + self.poll_time = Settings().value('projector/poll time') + self.socket_timeout = Settings().value('projector/socket timeout') + self.source_select_dialog_type = Settings().value('projector/source dialog type') def context_menu(self, point): """ diff --git a/openlp/core/projectors/pjlink.py b/openlp/core/projectors/pjlink.py index 3c5833066..beeaabe1d 100644 --- a/openlp/core/projectors/pjlink.py +++ b/openlp/core/projectors/pjlink.py @@ -516,12 +516,7 @@ class PJLinkCommands(object): :param data: Data packet from remote """ log.debug('({ip}) Processing LKUP command'.format(ip=self.entry.name)) - settings = Settings() - settings.beginGroup(self.settings_section) - autostart = settings.value('connect when LKUP received') - settings.endGroup() - del settings - if autostart: + if Settings().value('projector/connect when LKUP received'): self.connect_to_host() def process_name(self, data): diff --git a/openlp/core/projectors/tab.py b/openlp/core/projectors/tab.py index 04c0823d7..a7aba4602 100644 --- a/openlp/core/projectors/tab.py +++ b/openlp/core/projectors/tab.py @@ -120,27 +120,21 @@ class ProjectorTab(SettingsTab): """ Load the projector settings on startup """ - settings = Settings() - settings.beginGroup(self.settings_section) - self.connect_on_startup.setChecked(settings.value('connect on start')) - self.socket_timeout_spin_box.setValue(settings.value('socket timeout')) - self.socket_poll_spin_box.setValue(settings.value('poll time')) - self.dialog_type_combo_box.setCurrentIndex(settings.value('source dialog type')) - self.connect_on_linkup.setChecked(settings.value('connect when LKUP received')) - settings.endGroup() + self.connect_on_startup.setChecked(Settings().value('projector/connect on start')) + self.socket_timeout_spin_box.setValue(Settings().value('projector/socket timeout')) + self.socket_poll_spin_box.setValue(Settings().value('projector/poll time')) + self.dialog_type_combo_box.setCurrentIndex(Settings().value('projector/source dialog type')) + self.connect_on_linkup.setChecked(Settings().value('projector/connect when LKUP received')) def save(self): """ Save the projector settings """ - settings = Settings() - settings.beginGroup(self.settings_section) - settings.setValue('connect on start', self.connect_on_startup.isChecked()) - settings.setValue('socket timeout', self.socket_timeout_spin_box.value()) - settings.setValue('poll time', self.socket_poll_spin_box.value()) - settings.setValue('source dialog type', self.dialog_type_combo_box.currentIndex()) - settings.setValue('connect when LKUP received', self.connect_on_linkup.isChecked()) - settings.endGroup() + Settings().setValue('projector/connect on start', self.connect_on_startup.isChecked()) + Settings().setValue('projector/socket timeout', self.socket_timeout_spin_box.value()) + Settings().setValue('projector/poll time', self.socket_poll_spin_box.value()) + Settings().setValue('projector/source dialog type', self.dialog_type_combo_box.currentIndex()) + Settings().setValue('projector/connect when LKUP received', self.connect_on_linkup.isChecked()) def on_dialog_type_combo_box_changed(self): self.dialog_type = self.dialog_type_combo_box.currentIndex()