forked from openlp/openlp
PJLink2 Update U
This commit is contained in:
parent
07ebc22fa7
commit
cc4b8e4242
@ -417,11 +417,17 @@ class ProjectorDB(Manager):
|
|||||||
value: (str) From ProjectorSource, Sources tables or PJLink default code list
|
value: (str) From ProjectorSource, Sources tables or PJLink default code list
|
||||||
"""
|
"""
|
||||||
source_dict = {}
|
source_dict = {}
|
||||||
|
# Apparently, there was a change to the projector object. Test for which object has db id
|
||||||
|
if hasattr(projector, "id"):
|
||||||
|
chk = projector.id
|
||||||
|
elif hasattr(projector.entry, "id"):
|
||||||
|
chk = projector.entry.id
|
||||||
|
|
||||||
# Get default list first
|
# Get default list first
|
||||||
for key in projector.source_available:
|
for key in projector.source_available:
|
||||||
item = self.get_object_filtered(ProjectorSource,
|
item = self.get_object_filtered(ProjectorSource,
|
||||||
and_(ProjectorSource.code == key,
|
and_(ProjectorSource.code == key,
|
||||||
ProjectorSource.projector_id == projector.id))
|
ProjectorSource.projector_id == chk))
|
||||||
if item is None:
|
if item is None:
|
||||||
source_dict[key] = PJLINK_DEFAULT_CODES[key]
|
source_dict[key] = PJLINK_DEFAULT_CODES[key]
|
||||||
else:
|
else:
|
||||||
|
@ -46,31 +46,10 @@ from openlp.core.projectors.sourceselectform import SourceSelectSingle, SourceSe
|
|||||||
from openlp.core.ui.icons import UiIcons
|
from openlp.core.ui.icons import UiIcons
|
||||||
from openlp.core.widgets.toolbar import OpenLPToolbar
|
from openlp.core.widgets.toolbar import OpenLPToolbar
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
log.debug('projectormanager loaded')
|
log.debug('projectormanager loaded')
|
||||||
|
|
||||||
|
|
||||||
# Dict for matching projector status to display icon
|
|
||||||
STATUS_ICONS = {
|
|
||||||
S_NOT_CONNECTED: ':/projector/projector_item_disconnect.png',
|
|
||||||
S_CONNECTING: ':/projector/projector_item_connect.png',
|
|
||||||
S_CONNECTED: ':/projector/projector_off.png',
|
|
||||||
S_OFF: ':/projector/projector_off.png',
|
|
||||||
S_INITIALIZE: ':/projector/projector_off.png',
|
|
||||||
S_STANDBY: ':/projector/projector_off.png',
|
|
||||||
S_WARMUP: ':/projector/projector_warmup.png',
|
|
||||||
S_ON: ':/projector/projector_on.png',
|
|
||||||
S_COOLDOWN: ':/projector/projector_cooldown.png',
|
|
||||||
E_ERROR: ':/projector/projector_error.png',
|
|
||||||
E_NETWORK: ':/projector/projector_not_connected_error.png',
|
|
||||||
E_SOCKET_TIMEOUT: ':/projector/projector_not_connected_error.png',
|
|
||||||
E_AUTHENTICATION: ':/projector/projector_not_connected_error.png',
|
|
||||||
E_UNKNOWN_SOCKET_ERROR: ':/projector/projector_not_connected_error.png',
|
|
||||||
E_NOT_CONNECTED: ':/projector/projector_not_connected_error.png'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class UiProjectorManager(object):
|
class UiProjectorManager(object):
|
||||||
"""
|
"""
|
||||||
UI part of the Projector Manager
|
UI part of the Projector Manager
|
||||||
@ -122,7 +101,7 @@ class UiProjectorManager(object):
|
|||||||
self.one_toolbar.add_toolbar_action('connect_projector',
|
self.one_toolbar.add_toolbar_action('connect_projector',
|
||||||
text=translate('OpenLP.ProjectorManager',
|
text=translate('OpenLP.ProjectorManager',
|
||||||
'Connect to selected projector.'),
|
'Connect to selected projector.'),
|
||||||
icon=UiIcons().projector_connect,
|
icon=UiIcons().projector_select_connect,
|
||||||
tooltip=translate('OpenLP.ProjectorManager',
|
tooltip=translate('OpenLP.ProjectorManager',
|
||||||
'Connect to selected projector.'),
|
'Connect to selected projector.'),
|
||||||
triggers=self.on_connect_projector)
|
triggers=self.on_connect_projector)
|
||||||
@ -136,7 +115,7 @@ class UiProjectorManager(object):
|
|||||||
self.one_toolbar.add_toolbar_action('disconnect_projector',
|
self.one_toolbar.add_toolbar_action('disconnect_projector',
|
||||||
text=translate('OpenLP.ProjectorManager',
|
text=translate('OpenLP.ProjectorManager',
|
||||||
'Disconnect from selected projectors'),
|
'Disconnect from selected projectors'),
|
||||||
icon=UiIcons().projector_disconnect,
|
icon=UiIcons().projector_select_disconnect,
|
||||||
tooltip=translate('OpenLP.ProjectorManager',
|
tooltip=translate('OpenLP.ProjectorManager',
|
||||||
'Disconnect from selected projector.'),
|
'Disconnect from selected projector.'),
|
||||||
triggers=self.on_disconnect_projector)
|
triggers=self.on_disconnect_projector)
|
||||||
@ -151,7 +130,7 @@ class UiProjectorManager(object):
|
|||||||
self.one_toolbar.add_toolbar_action('poweron_projector',
|
self.one_toolbar.add_toolbar_action('poweron_projector',
|
||||||
text=translate('OpenLP.ProjectorManager',
|
text=translate('OpenLP.ProjectorManager',
|
||||||
'Power on selected projector'),
|
'Power on selected projector'),
|
||||||
icon=UiIcons().projector_on,
|
icon=UiIcons().projector_power_on,
|
||||||
tooltip=translate('OpenLP.ProjectorManager',
|
tooltip=translate('OpenLP.ProjectorManager',
|
||||||
'Power on selected projector.'),
|
'Power on selected projector.'),
|
||||||
triggers=self.on_poweron_projector)
|
triggers=self.on_poweron_projector)
|
||||||
@ -164,7 +143,7 @@ class UiProjectorManager(object):
|
|||||||
triggers=self.on_poweron_projector)
|
triggers=self.on_poweron_projector)
|
||||||
self.one_toolbar.add_toolbar_action('poweroff_projector',
|
self.one_toolbar.add_toolbar_action('poweroff_projector',
|
||||||
text=translate('OpenLP.ProjectorManager', 'Standby selected projector'),
|
text=translate('OpenLP.ProjectorManager', 'Standby selected projector'),
|
||||||
icon=UiIcons().projector_off,
|
icon=UiIcons().projector_power_off,
|
||||||
tooltip=translate('OpenLP.ProjectorManager',
|
tooltip=translate('OpenLP.ProjectorManager',
|
||||||
'Put selected projector in standby.'),
|
'Put selected projector in standby.'),
|
||||||
triggers=self.on_poweroff_projector)
|
triggers=self.on_poweroff_projector)
|
||||||
@ -309,7 +288,7 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM
|
|||||||
S_INITIALIZE: UiIcons().projector_on,
|
S_INITIALIZE: UiIcons().projector_on,
|
||||||
S_STANDBY: UiIcons().projector_off,
|
S_STANDBY: UiIcons().projector_off,
|
||||||
S_WARMUP: UiIcons().projector_warmup,
|
S_WARMUP: UiIcons().projector_warmup,
|
||||||
S_ON: UiIcons().projector_off,
|
S_ON: UiIcons().projector_on,
|
||||||
S_COOLDOWN: UiIcons().projector_cooldown,
|
S_COOLDOWN: UiIcons().projector_cooldown,
|
||||||
E_ERROR: UiIcons().projector_error,
|
E_ERROR: UiIcons().projector_error,
|
||||||
E_NETWORK: UiIcons().error,
|
E_NETWORK: UiIcons().error,
|
||||||
@ -505,7 +484,8 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM
|
|||||||
projector = list_item.data(QtCore.Qt.UserRole)
|
projector = list_item.data(QtCore.Qt.UserRole)
|
||||||
try:
|
try:
|
||||||
projector.link.connect_to_host()
|
projector.link.connect_to_host()
|
||||||
except Exception:
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
def on_delete_projector(self, opt=None):
|
def on_delete_projector(self, opt=None):
|
||||||
@ -880,6 +860,7 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM
|
|||||||
"""
|
"""
|
||||||
Update the icons when the selected projectors change
|
Update the icons when the selected projectors change
|
||||||
"""
|
"""
|
||||||
|
log.debug('update_icons(): Checking for selected projector items in list')
|
||||||
count = len(self.projector_list_widget.selectedItems())
|
count = len(self.projector_list_widget.selectedItems())
|
||||||
projector = None
|
projector = None
|
||||||
if count == 0:
|
if count == 0:
|
||||||
@ -900,6 +881,7 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM
|
|||||||
self.get_toolbar_item('blank_projector_multiple', hidden=True)
|
self.get_toolbar_item('blank_projector_multiple', hidden=True)
|
||||||
self.get_toolbar_item('show_projector_multiple', hidden=True)
|
self.get_toolbar_item('show_projector_multiple', hidden=True)
|
||||||
elif count == 1:
|
elif count == 1:
|
||||||
|
log.debug('update_icons(): Found one item selected')
|
||||||
projector = self.projector_list_widget.selectedItems()[0].data(QtCore.Qt.UserRole)
|
projector = self.projector_list_widget.selectedItems()[0].data(QtCore.Qt.UserRole)
|
||||||
connected = QSOCKET_STATE[projector.link.state()] == S_CONNECTED
|
connected = QSOCKET_STATE[projector.link.state()] == S_CONNECTED
|
||||||
power = projector.link.power == S_ON
|
power = projector.link.power == S_ON
|
||||||
@ -910,12 +892,14 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM
|
|||||||
self.get_toolbar_item('blank_projector_multiple', hidden=True)
|
self.get_toolbar_item('blank_projector_multiple', hidden=True)
|
||||||
self.get_toolbar_item('show_projector_multiple', hidden=True)
|
self.get_toolbar_item('show_projector_multiple', hidden=True)
|
||||||
if connected:
|
if connected:
|
||||||
|
log.debug('update_icons(): Updating icons for connected state')
|
||||||
self.get_toolbar_item('view_projector', enabled=True)
|
self.get_toolbar_item('view_projector', enabled=True)
|
||||||
self.get_toolbar_item('source_view_projector',
|
self.get_toolbar_item('source_view_projector',
|
||||||
enabled=connected and power and projector.link.source_available is not None)
|
enabled=projector.link.source_available is not None and connected and power)
|
||||||
self.get_toolbar_item('edit_projector', hidden=True)
|
self.get_toolbar_item('edit_projector', hidden=True)
|
||||||
self.get_toolbar_item('delete_projector', hidden=True)
|
self.get_toolbar_item('delete_projector', hidden=True)
|
||||||
else:
|
else:
|
||||||
|
log.debug('update_icons(): Updating for not connected state')
|
||||||
self.get_toolbar_item('view_projector', hidden=True)
|
self.get_toolbar_item('view_projector', hidden=True)
|
||||||
self.get_toolbar_item('source_view_projector', hidden=True)
|
self.get_toolbar_item('source_view_projector', hidden=True)
|
||||||
self.get_toolbar_item('edit_projector', enabled=True)
|
self.get_toolbar_item('edit_projector', enabled=True)
|
||||||
@ -931,6 +915,7 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM
|
|||||||
self.get_toolbar_item('blank_projector', enabled=False)
|
self.get_toolbar_item('blank_projector', enabled=False)
|
||||||
self.get_toolbar_item('show_projector', enabled=False)
|
self.get_toolbar_item('show_projector', enabled=False)
|
||||||
else:
|
else:
|
||||||
|
log.debug('update_icons(): Updating for multiple items selected')
|
||||||
self.get_toolbar_item('edit_projector', enabled=False)
|
self.get_toolbar_item('edit_projector', enabled=False)
|
||||||
self.get_toolbar_item('delete_projector', enabled=False)
|
self.get_toolbar_item('delete_projector', enabled=False)
|
||||||
self.get_toolbar_item('view_projector', hidden=True)
|
self.get_toolbar_item('view_projector', hidden=True)
|
||||||
|
@ -528,8 +528,9 @@ class PJLinkCommands(object):
|
|||||||
sources.append(source)
|
sources.append(source)
|
||||||
sources.sort()
|
sources.sort()
|
||||||
self.source_available = sources
|
self.source_available = sources
|
||||||
log.debug('({ip}) Setting projector sources_available to "{data}"'.format(ip=self.entry.name,
|
log.debug('({ip}) Setting projector source_available to "{data}"'.format(ip=self.entry.name,
|
||||||
data=self.source_available))
|
data=self.source_available))
|
||||||
|
self.projectorUpdateIcons.emit()
|
||||||
return
|
return
|
||||||
|
|
||||||
def process_lamp(self, data):
|
def process_lamp(self, data):
|
||||||
@ -886,6 +887,9 @@ class PJLink(QtNetwork.QTcpSocket, PJLinkCommands):
|
|||||||
elif status >= S_NOT_CONNECTED and status in QSOCKET_STATE:
|
elif status >= S_NOT_CONNECTED and status in QSOCKET_STATE:
|
||||||
# Socket connection status update
|
# Socket connection status update
|
||||||
self.status_connect = status
|
self.status_connect = status
|
||||||
|
# Check if we need to update error state as well
|
||||||
|
if self.error_status != S_OK and status != S_NOT_CONNECTED:
|
||||||
|
self.error_status = S_OK
|
||||||
elif status >= S_NOT_CONNECTED and status in PROJECTOR_STATE:
|
elif status >= S_NOT_CONNECTED and status in PROJECTOR_STATE:
|
||||||
# Only affects the projector status
|
# Only affects the projector status
|
||||||
self.projector_status = status
|
self.projector_status = status
|
||||||
@ -905,6 +909,13 @@ class PJLink(QtNetwork.QTcpSocket, PJLinkCommands):
|
|||||||
message=status_message if msg is None else msg))
|
message=status_message if msg is None else msg))
|
||||||
|
|
||||||
# Now that we logged extra information for debugging, broadcast the original change/message
|
# Now that we logged extra information for debugging, broadcast the original change/message
|
||||||
|
# Check for connection errors first
|
||||||
|
if self.error_status != S_OK:
|
||||||
|
log.debug('({ip}) Signalling error code'.format(ip=self.entry.name))
|
||||||
|
(code, message) = self._get_status(self.error_status)
|
||||||
|
status = self.error_status
|
||||||
|
else:
|
||||||
|
log.debug('({ip}) Signalling status code'.format(ip=self.entry.name))
|
||||||
(code, message) = self._get_status(status)
|
(code, message) = self._get_status(status)
|
||||||
if msg is not None:
|
if msg is not None:
|
||||||
message = msg
|
message = msg
|
||||||
@ -953,7 +964,7 @@ class PJLink(QtNetwork.QTcpSocket, PJLinkCommands):
|
|||||||
log.error('({ip}) Invalid initial packet received - closing socket'.format(ip=self.entry.name))
|
log.error('({ip}) Invalid initial packet received - closing socket'.format(ip=self.entry.name))
|
||||||
return self.disconnect_from_host()
|
return self.disconnect_from_host()
|
||||||
# Convert the initial login prompt with the expected PJLink normal command format for processing
|
# Convert the initial login prompt with the expected PJLink normal command format for processing
|
||||||
log.debug('({ip}) check_login(): Formatting initial connection prompt'
|
log.debug('({ip}) check_login(): Formatting initial connection prompt '
|
||||||
'to PJLink packet'.format(ip=self.entry.name))
|
'to PJLink packet'.format(ip=self.entry.name))
|
||||||
return self.get_data('{start}{clss}{data}'.format(start=PJLINK_PREFIX,
|
return self.get_data('{start}{clss}{data}'.format(start=PJLINK_PREFIX,
|
||||||
clss='1',
|
clss='1',
|
||||||
|
@ -117,13 +117,17 @@ class UiIcons(object):
|
|||||||
'presentation': {'icon': 'fa.bar-chart'},
|
'presentation': {'icon': 'fa.bar-chart'},
|
||||||
'preview': {'icon': 'fa.laptop'},
|
'preview': {'icon': 'fa.laptop'},
|
||||||
'projector': {'icon': 'op.video'},
|
'projector': {'icon': 'op.video'},
|
||||||
'projector_connect': {'icon': 'fa.plug'},
|
'projector_connect': {'icon': 'fa.plug'}, # Projector connect
|
||||||
'projector_cooldown': {'icon': 'fa.video-camera', 'attr': 'blue'},
|
'projector_cooldown': {'icon': 'fa.video-camera', 'attr': 'blue'},
|
||||||
'projector_disconnect': {'icon': 'fa.plug', 'attr': 'lightGray'},
|
'projector_disconnect': {'icon': 'fa.plug', 'attr': 'lightGray'}, # Projector disconnect
|
||||||
'projector_error': {'icon': 'fa.video-camera', 'attr': 'red'},
|
'projector_error': {'icon': 'fa.video-camera', 'attr': 'red'},
|
||||||
'projector_hdmi': {'icon': 'op.hdmi'},
|
'projector_hdmi': {'icon': 'op.hdmi'},
|
||||||
'projector_off': {'icon': 'fa.video-camera', 'attr': 'black'},
|
'projector_power_off': {'icon': 'fa.video-camera', 'attr': 'red'}, # Toolbar power off
|
||||||
'projector_on': {'icon': 'fa.video-camera', 'attr': 'green'},
|
'projector_power_on': {'icon': 'fa.video-camera', 'attr': 'green'}, # Toolbar power on
|
||||||
|
'projector_off': {'icon': 'fa.video-camera', 'attr': 'black'}, # Projector off
|
||||||
|
'projector_on': {'icon': 'fa.video-camera', 'attr': 'green'}, # Projector on
|
||||||
|
'projector_select_connect': {'icon': 'fa.plug', 'attr': 'green'}, # Toolbar connect
|
||||||
|
'projector_select_disconnect': {'icon': 'fa.plug', 'attr': 'red'}, # Toolbar disconnect
|
||||||
'projector_warmup': {'icon': 'fa.video-camera', 'attr': 'yellow'},
|
'projector_warmup': {'icon': 'fa.video-camera', 'attr': 'yellow'},
|
||||||
'picture': {'icon': 'fa.picture-o'},
|
'picture': {'icon': 'fa.picture-o'},
|
||||||
'print': {'icon': 'fa.print'},
|
'print': {'icon': 'fa.print'},
|
||||||
|
@ -9,6 +9,7 @@ ignore = E402,E722,W503,W504
|
|||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
exclude=resources.py,vlc.py
|
exclude=resources.py,vlc.py
|
||||||
|
max-line-length = 120
|
||||||
ignore = E402,W503,W504,D
|
ignore = E402,W503,W504,D
|
||||||
|
|
||||||
[pycodestyle]
|
[pycodestyle]
|
||||||
|
@ -178,7 +178,7 @@ class TestImageManager(TestCase, TestMixin):
|
|||||||
# THEN a KeyError is thrown
|
# THEN a KeyError is thrown
|
||||||
with self.assertRaises(KeyError) as context:
|
with self.assertRaises(KeyError) as context:
|
||||||
self.image_manager.get_image(TEST_PATH, 'church1.jpg')
|
self.image_manager.get_image(TEST_PATH, 'church1.jpg')
|
||||||
assert context.exception is not '', 'KeyError exception should have been thrown for missing image'
|
assert context.exception != '', 'KeyError exception should have been thrown for missing image'
|
||||||
|
|
||||||
@patch('openlp.core.lib.imagemanager.run_thread')
|
@patch('openlp.core.lib.imagemanager.run_thread')
|
||||||
def test_different_dimension_image(self, mocked_run_thread):
|
def test_different_dimension_image(self, mocked_run_thread):
|
||||||
@ -211,7 +211,7 @@ class TestImageManager(TestCase, TestMixin):
|
|||||||
# WHEN: calling with correct image, but wrong dimensions
|
# WHEN: calling with correct image, but wrong dimensions
|
||||||
with self.assertRaises(KeyError) as context:
|
with self.assertRaises(KeyError) as context:
|
||||||
self.image_manager.get_image(full_path, 'church.jpg', 120, 120)
|
self.image_manager.get_image(full_path, 'church.jpg', 120, 120)
|
||||||
assert context.exception is not '', 'KeyError exception should have been thrown for missing dimension'
|
assert context.exception != '', 'KeyError exception should have been thrown for missing dimension'
|
||||||
|
|
||||||
@patch('openlp.core.lib.imagemanager.resize_image')
|
@patch('openlp.core.lib.imagemanager.resize_image')
|
||||||
@patch('openlp.core.lib.imagemanager.image_to_byte')
|
@patch('openlp.core.lib.imagemanager.image_to_byte')
|
||||||
|
@ -57,4 +57,4 @@ class MediaPluginTest(TestCase, TestMixin):
|
|||||||
# THEN: about() should return a string object
|
# THEN: about() should return a string object
|
||||||
assert isinstance(MediaPlugin.about(), str)
|
assert isinstance(MediaPlugin.about(), str)
|
||||||
# THEN: about() should return a non-empty string
|
# THEN: about() should return a non-empty string
|
||||||
assert len(MediaPlugin.about()) is not 0
|
assert len(MediaPlugin.about()) != 0
|
||||||
|
@ -199,7 +199,7 @@ class TestLib(TestCase):
|
|||||||
result = _remove_typos(diff)
|
result = _remove_typos(diff)
|
||||||
|
|
||||||
# THEN: There should be no typos in the middle anymore. The remaining equals should have been merged.
|
# THEN: There should be no typos in the middle anymore. The remaining equals should have been merged.
|
||||||
assert len(result) is 1, 'The result should contain only one element.'
|
assert len(result) == 1, 'The result should contain only one element.'
|
||||||
assert result[0][0] == 'equal', 'The result should contain an equal element.'
|
assert result[0][0] == 'equal', 'The result should contain an equal element.'
|
||||||
assert result[0][1] == 0, 'The start indices should be kept.'
|
assert result[0][1] == 0, 'The start indices should be kept.'
|
||||||
assert result[0][2] == 22, 'The stop indices should be kept.'
|
assert result[0][2] == 22, 'The stop indices should be kept.'
|
||||||
|
@ -45,8 +45,8 @@ class TestSongUsage(TestCase):
|
|||||||
# THEN: about() should return a string object
|
# THEN: about() should return a string object
|
||||||
assert isinstance(SongUsagePlugin.about(), str)
|
assert isinstance(SongUsagePlugin.about(), str)
|
||||||
# THEN: about() should return a non-empty string
|
# THEN: about() should return a non-empty string
|
||||||
assert len(SongUsagePlugin.about()) is not 0
|
assert len(SongUsagePlugin.about()) != 0
|
||||||
assert len(SongUsagePlugin.about()) is not 0
|
assert len(SongUsagePlugin.about()) != 0
|
||||||
|
|
||||||
@patch('openlp.plugins.songusage.songusageplugin.Manager')
|
@patch('openlp.plugins.songusage.songusageplugin.Manager')
|
||||||
def test_song_usage_init(self, MockedManager):
|
def test_song_usage_init(self, MockedManager):
|
||||||
|
@ -134,6 +134,7 @@ class TestProjectorDB(TestCase, TestMixin):
|
|||||||
"""
|
"""
|
||||||
Set up anything necessary for all tests
|
Set up anything necessary for all tests
|
||||||
"""
|
"""
|
||||||
|
self.tmp_folder = mkdtemp(prefix='openlp_')
|
||||||
# Create a test app to keep from segfaulting
|
# Create a test app to keep from segfaulting
|
||||||
Registry.create()
|
Registry.create()
|
||||||
self.registry = Registry()
|
self.registry = Registry()
|
||||||
@ -153,11 +154,11 @@ class TestProjectorDB(TestCase, TestMixin):
|
|||||||
patch('openlp.core.ui.mainwindow.ThemeManager'), \
|
patch('openlp.core.ui.mainwindow.ThemeManager'), \
|
||||||
patch('openlp.core.ui.mainwindow.ProjectorManager'), \
|
patch('openlp.core.ui.mainwindow.ProjectorManager'), \
|
||||||
patch('openlp.core.ui.mainwindow.websockets.WebSocketServer'), \
|
patch('openlp.core.ui.mainwindow.websockets.WebSocketServer'), \
|
||||||
patch('openlp.core.ui.mainwindow.server.HttpServer'):
|
patch('openlp.core.ui.mainwindow.server.HttpServer'), \
|
||||||
|
patch('openlp.core.state.State.list_plugins') as mock_plugins:
|
||||||
|
mock_plugins.return_value = []
|
||||||
self.main_window = MainWindow()
|
self.main_window = MainWindow()
|
||||||
|
|
||||||
# Create a temporary database directory and database
|
|
||||||
self.tmp_folder = mkdtemp(prefix='openlp_')
|
|
||||||
tmpdb_url = 'sqlite:///{db}'.format(db=os.path.join(self.tmp_folder, TEST_DB))
|
tmpdb_url = 'sqlite:///{db}'.format(db=os.path.join(self.tmp_folder, TEST_DB))
|
||||||
mocked_init_url.return_value = tmpdb_url
|
mocked_init_url.return_value = tmpdb_url
|
||||||
self.projector = ProjectorDB()
|
self.projector = ProjectorDB()
|
||||||
|
@ -452,12 +452,16 @@ class TestPJLinkCommands(TestCase):
|
|||||||
"""
|
"""
|
||||||
Test saving video source available information
|
Test saving video source available information
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# GIVEN: Test object
|
# GIVEN: Test object
|
||||||
with patch.object(openlp.core.projectors.pjlink, 'log') as mock_log:
|
with patch.object(openlp.core.projectors.pjlink, 'log') as mock_log:
|
||||||
pjlink = PJLink(Projector(**TEST1_DATA), no_poll=True)
|
pjlink = PJLink(Projector(**TEST1_DATA), no_poll=True)
|
||||||
pjlink.source_available = []
|
pjlink.source_available = []
|
||||||
log_debug_calls = [call('({ip}) Setting projector sources_available to '
|
log_debug_calls = [call('({ip}) reset_information() connect status is '
|
||||||
|
'S_NOT_CONNECTED'.format(ip=pjlink.name)),
|
||||||
|
call('({ip}) Setting projector source_available to '
|
||||||
'"[\'11\', \'12\', \'21\', \'22\', \'31\', \'32\']"'.format(ip=pjlink.name))]
|
'"[\'11\', \'12\', \'21\', \'22\', \'31\', \'32\']"'.format(ip=pjlink.name))]
|
||||||
|
|
||||||
chk_data = '21 12 11 22 32 31' # Although they should already be sorted, use unsorted to verify method
|
chk_data = '21 12 11 22 32 31' # Although they should already be sorted, use unsorted to verify method
|
||||||
chk_test = ['11', '12', '21', '22', '31', '32']
|
chk_test = ['11', '12', '21', '22', '31', '32']
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user