openlp/openlp/core/api/poll.py

52 lines
2.6 KiB
Python
Raw Normal View History

2016-06-04 10:50:43 +00:00
# -*- coding: utf-8 -*-
2019-04-13 13:00:22 +00:00
##########################################################################
# OpenLP - Open Source Lyrics Projection #
# ---------------------------------------------------------------------- #
2022-02-01 10:10:57 +00:00
# Copyright (c) 2008-2022 OpenLP Developers #
2019-04-13 13:00:22 +00:00
# ---------------------------------------------------------------------- #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
##########################################################################
2017-10-23 22:09:57 +00:00
from openlp.core.common.mixins import RegistryProperties
2016-06-04 10:50:43 +00:00
2017-03-05 16:55:58 +00:00
2016-06-16 20:50:01 +00:00
class Poller(RegistryProperties):
2016-06-05 14:56:01 +00:00
"""
2016-07-23 04:48:36 +00:00
Accessed by the web layer to get status type information from the application
2021-01-08 15:01:53 +00:00
WARNING:
This class is DEPRECATED, if you need the state of the program, use the registry to access variables.
Used only for the deprecated V1 HTTP API.
2016-06-05 14:56:01 +00:00
"""
2016-06-04 10:50:43 +00:00
def __init__(self):
"""
Constructor for the poll builder class.
"""
2016-06-16 20:50:01 +00:00
super(Poller, self).__init__()
2016-06-04 10:50:43 +00:00
2021-01-08 15:01:53 +00:00
def poll(self):
return {'results': {
2020-10-04 19:20:10 +00:00
'counter': self.live_controller.slide_count if self.live_controller.slide_count else 0,
2016-06-04 10:50:43 +00:00
'service': self.service_manager.service_id,
'slide': self.live_controller.selected_row or 0,
'item': self.live_controller.service_item.unique_identifier if self.live_controller.service_item else '',
'twelve': self.settings.value('api/twelve hour'),
2016-06-04 10:50:43 +00:00
'blank': self.live_controller.blank_screen.isChecked(),
'theme': self.live_controller.theme_screen.isChecked(),
'display': self.live_controller.desktop_screen.isChecked(),
2016-06-19 17:39:48 +00:00
'version': 3,
'isSecure': self.settings.value('api/authentication enabled'),
2020-06-17 13:49:31 +00:00
'chordNotation': self.settings.value('songs/chord notation')
2021-01-08 15:01:53 +00:00
}}