Fix settings calls

This commit is contained in:
Ken Roberts 2018-05-18 17:48:33 -07:00
parent 991b2880bf
commit 81ca409e4c
3 changed files with 15 additions and 30 deletions

View File

@ -336,14 +336,10 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM
Retrieve the saved settings Retrieve the saved settings
""" """
log.debug('Updating ProjectorManager settings') log.debug('Updating ProjectorManager settings')
settings = Settings() self.autostart = Settings().value('projector/connect on start')
settings.beginGroup(self.settings_section) self.poll_time = Settings().value('projector/poll time')
self.autostart = settings.value('connect on start') self.socket_timeout = Settings().value('projector/socket timeout')
self.poll_time = settings.value('poll time') self.source_select_dialog_type = Settings().value('projector/source dialog type')
self.socket_timeout = settings.value('socket timeout')
self.source_select_dialog_type = settings.value('source dialog type')
settings.endGroup()
del settings
def context_menu(self, point): def context_menu(self, point):
""" """

View File

@ -516,12 +516,7 @@ class PJLinkCommands(object):
:param data: Data packet from remote :param data: Data packet from remote
""" """
log.debug('({ip}) Processing LKUP command'.format(ip=self.entry.name)) log.debug('({ip}) Processing LKUP command'.format(ip=self.entry.name))
settings = Settings() if Settings().value('projector/connect when LKUP received'):
settings.beginGroup(self.settings_section)
autostart = settings.value('connect when LKUP received')
settings.endGroup()
del settings
if autostart:
self.connect_to_host() self.connect_to_host()
def process_name(self, data): def process_name(self, data):

View File

@ -120,27 +120,21 @@ class ProjectorTab(SettingsTab):
""" """
Load the projector settings on startup Load the projector settings on startup
""" """
settings = Settings() self.connect_on_startup.setChecked(Settings().value('projector/connect on start'))
settings.beginGroup(self.settings_section) self.socket_timeout_spin_box.setValue(Settings().value('projector/socket timeout'))
self.connect_on_startup.setChecked(settings.value('connect on start')) self.socket_poll_spin_box.setValue(Settings().value('projector/poll time'))
self.socket_timeout_spin_box.setValue(settings.value('socket timeout')) self.dialog_type_combo_box.setCurrentIndex(Settings().value('projector/source dialog type'))
self.socket_poll_spin_box.setValue(settings.value('poll time')) self.connect_on_linkup.setChecked(Settings().value('projector/connect when LKUP received'))
self.dialog_type_combo_box.setCurrentIndex(settings.value('source dialog type'))
self.connect_on_linkup.setChecked(settings.value('connect when LKUP received'))
settings.endGroup()
def save(self): def save(self):
""" """
Save the projector settings Save the projector settings
""" """
settings = Settings() Settings().setValue('projector/connect on start', self.connect_on_startup.isChecked())
settings.beginGroup(self.settings_section) Settings().setValue('projector/socket timeout', self.socket_timeout_spin_box.value())
settings.setValue('connect on start', self.connect_on_startup.isChecked()) Settings().setValue('projector/poll time', self.socket_poll_spin_box.value())
settings.setValue('socket timeout', self.socket_timeout_spin_box.value()) Settings().setValue('projector/source dialog type', self.dialog_type_combo_box.currentIndex())
settings.setValue('poll time', self.socket_poll_spin_box.value()) Settings().setValue('projector/connect when LKUP received', self.connect_on_linkup.isChecked())
settings.setValue('source dialog type', self.dialog_type_combo_box.currentIndex())
settings.setValue('connect when LKUP received', self.connect_on_linkup.isChecked())
settings.endGroup()
def on_dialog_type_combo_box_changed(self): def on_dialog_type_combo_box_changed(self):
self.dialog_type = self.dialog_type_combo_box.currentIndex() self.dialog_type = self.dialog_type_combo_box.currentIndex()