Fix some slot signatures that were the incorrect type

This commit is contained in:
Raoul Snyman 2016-08-10 11:07:49 +02:00
parent e231398010
commit 51f3a0f406
5 changed files with 269 additions and 223 deletions

View File

@ -1,17 +1,22 @@
[unittest] [unittest]
verbose = True verbose = true
plugins = nose2.plugins.mp
[log-capture] [log-capture]
always-on = True always-on = true
clear-handlers = True clear-handlers = true
filter = -nose filter = -nose
log-level = ERROR log-level = ERROR
[test-result] [test-result]
always-on = True always-on = true
descriptions = True descriptions = true
[coverage] [coverage]
always-on = False always-on = true
coverage = openlp coverage = openlp
coverage-report = html coverage-report = html
[multiprocess]
always-on = false
processes = 4

View File

@ -131,227 +131,243 @@ S_INFO = 310
S_NETWORK_SENDING = 400 S_NETWORK_SENDING = 400
S_NETWORK_RECEIVED = 401 S_NETWORK_RECEIVED = 401
CONNECTION_ERRORS = {E_NOT_CONNECTED, E_NO_AUTHENTICATION, E_AUTHENTICATION, E_CLASS, CONNECTION_ERRORS = {
E_PREFIX, E_CONNECTION_REFUSED, E_REMOTE_HOST_CLOSED_CONNECTION, E_NOT_CONNECTED, E_NO_AUTHENTICATION, E_AUTHENTICATION, E_CLASS,
E_HOST_NOT_FOUND, E_SOCKET_ACCESS, E_SOCKET_RESOURCE, E_SOCKET_TIMEOUT, E_PREFIX, E_CONNECTION_REFUSED, E_REMOTE_HOST_CLOSED_CONNECTION,
E_DATAGRAM_TOO_LARGE, E_NETWORK, E_ADDRESS_IN_USE, E_SOCKET_ADDRESS_NOT_AVAILABLE, E_HOST_NOT_FOUND, E_SOCKET_ACCESS, E_SOCKET_RESOURCE, E_SOCKET_TIMEOUT,
E_UNSUPPORTED_SOCKET_OPERATION, E_PROXY_AUTHENTICATION_REQUIRED, E_DATAGRAM_TOO_LARGE, E_NETWORK, E_ADDRESS_IN_USE, E_SOCKET_ADDRESS_NOT_AVAILABLE,
E_SLS_HANDSHAKE_FAILED, E_UNFINISHED_SOCKET_OPERATION, E_PROXY_CONNECTION_REFUSED, E_UNSUPPORTED_SOCKET_OPERATION, E_PROXY_AUTHENTICATION_REQUIRED,
E_PROXY_CONNECTION_CLOSED, E_PROXY_CONNECTION_TIMEOUT, E_PROXY_NOT_FOUND, E_SLS_HANDSHAKE_FAILED, E_UNFINISHED_SOCKET_OPERATION, E_PROXY_CONNECTION_REFUSED,
E_PROXY_PROTOCOL, E_UNKNOWN_SOCKET_ERROR E_PROXY_CONNECTION_CLOSED, E_PROXY_CONNECTION_TIMEOUT, E_PROXY_NOT_FOUND,
} E_PROXY_PROTOCOL, E_UNKNOWN_SOCKET_ERROR
}
PJLINK_ERRORS = {'ERRA': E_AUTHENTICATION, # Authentication error PJLINK_ERRORS = {
'ERR1': E_UNDEFINED, # Undefined command error 'ERRA': E_AUTHENTICATION, # Authentication error
'ERR2': E_PARAMETER, # Invalid parameter error 'ERR1': E_UNDEFINED, # Undefined command error
'ERR3': E_UNAVAILABLE, # Projector busy 'ERR2': E_PARAMETER, # Invalid parameter error
'ERR4': E_PROJECTOR, # Projector or display failure 'ERR3': E_UNAVAILABLE, # Projector busy
E_AUTHENTICATION: 'ERRA', 'ERR4': E_PROJECTOR, # Projector or display failure
E_UNDEFINED: 'ERR1', E_AUTHENTICATION: 'ERRA',
E_PARAMETER: 'ERR2', E_UNDEFINED: 'ERR1',
E_UNAVAILABLE: 'ERR3', E_PARAMETER: 'ERR2',
E_PROJECTOR: 'ERR4'} E_UNAVAILABLE: 'ERR3',
E_PROJECTOR: 'ERR4'
}
# Map error/status codes to string # Map error/status codes to string
ERROR_STRING = {0: 'S_OK', ERROR_STRING = {
E_GENERAL: 'E_GENERAL', 0: 'S_OK',
E_NOT_CONNECTED: 'E_NOT_CONNECTED', E_GENERAL: 'E_GENERAL',
E_FAN: 'E_FAN', E_NOT_CONNECTED: 'E_NOT_CONNECTED',
E_LAMP: 'E_LAMP', E_FAN: 'E_FAN',
E_TEMP: 'E_TEMP', E_LAMP: 'E_LAMP',
E_COVER: 'E_COVER', E_TEMP: 'E_TEMP',
E_FILTER: 'E_FILTER', E_COVER: 'E_COVER',
E_AUTHENTICATION: 'E_AUTHENTICATION', E_FILTER: 'E_FILTER',
E_NO_AUTHENTICATION: 'E_NO_AUTHENTICATION', E_AUTHENTICATION: 'E_AUTHENTICATION',
E_UNDEFINED: 'E_UNDEFINED', E_NO_AUTHENTICATION: 'E_NO_AUTHENTICATION',
E_PARAMETER: 'E_PARAMETER', E_UNDEFINED: 'E_UNDEFINED',
E_UNAVAILABLE: 'E_UNAVAILABLE', E_PARAMETER: 'E_PARAMETER',
E_PROJECTOR: 'E_PROJECTOR', E_UNAVAILABLE: 'E_UNAVAILABLE',
E_INVALID_DATA: 'E_INVALID_DATA', E_PROJECTOR: 'E_PROJECTOR',
E_WARN: 'E_WARN', E_INVALID_DATA: 'E_INVALID_DATA',
E_ERROR: 'E_ERROR', E_WARN: 'E_WARN',
E_CLASS: 'E_CLASS', E_ERROR: 'E_ERROR',
E_PREFIX: 'E_PREFIX', # Last projector error E_CLASS: 'E_CLASS',
E_CONNECTION_REFUSED: 'E_CONNECTION_REFUSED', # First QtSocket error E_PREFIX: 'E_PREFIX', # Last projector error
E_REMOTE_HOST_CLOSED_CONNECTION: 'E_REMOTE_HOST_CLOSED_CONNECTION', E_CONNECTION_REFUSED: 'E_CONNECTION_REFUSED', # First QtSocket error
E_HOST_NOT_FOUND: 'E_HOST_NOT_FOUND', E_REMOTE_HOST_CLOSED_CONNECTION: 'E_REMOTE_HOST_CLOSED_CONNECTION',
E_SOCKET_ACCESS: 'E_SOCKET_ACCESS', E_HOST_NOT_FOUND: 'E_HOST_NOT_FOUND',
E_SOCKET_RESOURCE: 'E_SOCKET_RESOURCE', E_SOCKET_ACCESS: 'E_SOCKET_ACCESS',
E_SOCKET_TIMEOUT: 'E_SOCKET_TIMEOUT', E_SOCKET_RESOURCE: 'E_SOCKET_RESOURCE',
E_DATAGRAM_TOO_LARGE: 'E_DATAGRAM_TOO_LARGE', E_SOCKET_TIMEOUT: 'E_SOCKET_TIMEOUT',
E_NETWORK: 'E_NETWORK', E_DATAGRAM_TOO_LARGE: 'E_DATAGRAM_TOO_LARGE',
E_ADDRESS_IN_USE: 'E_ADDRESS_IN_USE', E_NETWORK: 'E_NETWORK',
E_SOCKET_ADDRESS_NOT_AVAILABLE: 'E_SOCKET_ADDRESS_NOT_AVAILABLE', E_ADDRESS_IN_USE: 'E_ADDRESS_IN_USE',
E_UNSUPPORTED_SOCKET_OPERATION: 'E_UNSUPPORTED_SOCKET_OPERATION', E_SOCKET_ADDRESS_NOT_AVAILABLE: 'E_SOCKET_ADDRESS_NOT_AVAILABLE',
E_PROXY_AUTHENTICATION_REQUIRED: 'E_PROXY_AUTHENTICATION_REQUIRED', E_UNSUPPORTED_SOCKET_OPERATION: 'E_UNSUPPORTED_SOCKET_OPERATION',
E_SLS_HANDSHAKE_FAILED: 'E_SLS_HANDSHAKE_FAILED', E_PROXY_AUTHENTICATION_REQUIRED: 'E_PROXY_AUTHENTICATION_REQUIRED',
E_UNFINISHED_SOCKET_OPERATION: 'E_UNFINISHED_SOCKET_OPERATION', E_SLS_HANDSHAKE_FAILED: 'E_SLS_HANDSHAKE_FAILED',
E_PROXY_CONNECTION_REFUSED: 'E_PROXY_CONNECTION_REFUSED', E_UNFINISHED_SOCKET_OPERATION: 'E_UNFINISHED_SOCKET_OPERATION',
E_PROXY_CONNECTION_CLOSED: 'E_PROXY_CONNECTION_CLOSED', E_PROXY_CONNECTION_REFUSED: 'E_PROXY_CONNECTION_REFUSED',
E_PROXY_CONNECTION_TIMEOUT: 'E_PROXY_CONNECTION_TIMEOUT', E_PROXY_CONNECTION_CLOSED: 'E_PROXY_CONNECTION_CLOSED',
E_PROXY_NOT_FOUND: 'E_PROXY_NOT_FOUND', E_PROXY_CONNECTION_TIMEOUT: 'E_PROXY_CONNECTION_TIMEOUT',
E_PROXY_PROTOCOL: 'E_PROXY_PROTOCOL', E_PROXY_NOT_FOUND: 'E_PROXY_NOT_FOUND',
E_UNKNOWN_SOCKET_ERROR: 'E_UNKNOWN_SOCKET_ERROR'} E_PROXY_PROTOCOL: 'E_PROXY_PROTOCOL',
E_UNKNOWN_SOCKET_ERROR: 'E_UNKNOWN_SOCKET_ERROR'
}
STATUS_STRING = {S_NOT_CONNECTED: 'S_NOT_CONNECTED', STATUS_STRING = {
S_CONNECTING: 'S_CONNECTING', S_NOT_CONNECTED: 'S_NOT_CONNECTED',
S_CONNECTED: 'S_CONNECTED', S_CONNECTING: 'S_CONNECTING',
S_STATUS: 'S_STATUS', S_CONNECTED: 'S_CONNECTED',
S_OFF: 'S_OFF', S_STATUS: 'S_STATUS',
S_INITIALIZE: 'S_INITIALIZE', S_OFF: 'S_OFF',
S_STANDBY: 'S_STANDBY', S_INITIALIZE: 'S_INITIALIZE',
S_WARMUP: 'S_WARMUP', S_STANDBY: 'S_STANDBY',
S_ON: 'S_ON', S_WARMUP: 'S_WARMUP',
S_COOLDOWN: 'S_COOLDOWN', S_ON: 'S_ON',
S_INFO: 'S_INFO', S_COOLDOWN: 'S_COOLDOWN',
S_NETWORK_SENDING: 'S_NETWORK_SENDING', S_INFO: 'S_INFO',
S_NETWORK_RECEIVED: 'S_NETWORK_RECEIVED'} S_NETWORK_SENDING: 'S_NETWORK_SENDING',
S_NETWORK_RECEIVED: 'S_NETWORK_RECEIVED'
}
# Map error/status codes to message strings # Map error/status codes to message strings
ERROR_MSG = {E_OK: translate('OpenLP.ProjectorConstants', 'OK'), # E_OK | S_OK ERROR_MSG = {
E_GENERAL: translate('OpenLP.ProjectorConstants', 'General projector error'), E_OK: translate('OpenLP.ProjectorConstants', 'OK'), # E_OK | S_OK
E_NOT_CONNECTED: translate('OpenLP.ProjectorConstants', 'Not connected error'), E_GENERAL: translate('OpenLP.ProjectorConstants', 'General projector error'),
E_LAMP: translate('OpenLP.ProjectorConstants', 'Lamp error'), E_NOT_CONNECTED: translate('OpenLP.ProjectorConstants', 'Not connected error'),
E_FAN: translate('OpenLP.ProjectorConstants', 'Fan error'), E_LAMP: translate('OpenLP.ProjectorConstants', 'Lamp error'),
E_TEMP: translate('OpenLP.ProjectorConstants', 'High temperature detected'), E_FAN: translate('OpenLP.ProjectorConstants', 'Fan error'),
E_COVER: translate('OpenLP.ProjectorConstants', 'Cover open detected'), E_TEMP: translate('OpenLP.ProjectorConstants', 'High temperature detected'),
E_FILTER: translate('OpenLP.ProjectorConstants', 'Check filter'), E_COVER: translate('OpenLP.ProjectorConstants', 'Cover open detected'),
E_AUTHENTICATION: translate('OpenLP.ProjectorConstants', 'Authentication Error'), E_FILTER: translate('OpenLP.ProjectorConstants', 'Check filter'),
E_UNDEFINED: translate('OpenLP.ProjectorConstants', 'Undefined Command'), E_AUTHENTICATION: translate('OpenLP.ProjectorConstants', 'Authentication Error'),
E_PARAMETER: translate('OpenLP.ProjectorConstants', 'Invalid Parameter'), E_UNDEFINED: translate('OpenLP.ProjectorConstants', 'Undefined Command'),
E_UNAVAILABLE: translate('OpenLP.ProjectorConstants', 'Projector Busy'), E_PARAMETER: translate('OpenLP.ProjectorConstants', 'Invalid Parameter'),
E_PROJECTOR: translate('OpenLP.ProjectorConstants', 'Projector/Display Error'), E_UNAVAILABLE: translate('OpenLP.ProjectorConstants', 'Projector Busy'),
E_INVALID_DATA: translate('OpenLP.ProjectorConstants', 'Invalid packet received'), E_PROJECTOR: translate('OpenLP.ProjectorConstants', 'Projector/Display Error'),
E_WARN: translate('OpenLP.ProjectorConstants', 'Warning condition detected'), E_INVALID_DATA: translate('OpenLP.ProjectorConstants', 'Invalid packet received'),
E_ERROR: translate('OpenLP.ProjectorConstants', 'Error condition detected'), E_WARN: translate('OpenLP.ProjectorConstants', 'Warning condition detected'),
E_CLASS: translate('OpenLP.ProjectorConstants', 'PJLink class not supported'), E_ERROR: translate('OpenLP.ProjectorConstants', 'Error condition detected'),
E_PREFIX: translate('OpenLP.ProjectorConstants', 'Invalid prefix character'), E_CLASS: translate('OpenLP.ProjectorConstants', 'PJLink class not supported'),
E_CONNECTION_REFUSED: translate('OpenLP.ProjectorConstants', E_PREFIX: translate('OpenLP.ProjectorConstants', 'Invalid prefix character'),
'The connection was refused by the peer (or timed out)'), E_CONNECTION_REFUSED: translate('OpenLP.ProjectorConstants',
E_REMOTE_HOST_CLOSED_CONNECTION: translate('OpenLP.ProjectorConstants', 'The connection was refused by the peer (or timed out)'),
'The remote host closed the connection'), E_REMOTE_HOST_CLOSED_CONNECTION: translate('OpenLP.ProjectorConstants',
E_HOST_NOT_FOUND: translate('OpenLP.ProjectorConstants', 'The host address was not found'), 'The remote host closed the connection'),
E_SOCKET_ACCESS: translate('OpenLP.ProjectorConstants', E_HOST_NOT_FOUND: translate('OpenLP.ProjectorConstants', 'The host address was not found'),
'The socket operation failed because the application ' E_SOCKET_ACCESS: translate('OpenLP.ProjectorConstants',
'lacked the required privileges'), 'The socket operation failed because the application '
E_SOCKET_RESOURCE: translate('OpenLP.ProjectorConstants', 'lacked the required privileges'),
'The local system ran out of resources (e.g., too many sockets)'), E_SOCKET_RESOURCE: translate('OpenLP.ProjectorConstants',
E_SOCKET_TIMEOUT: translate('OpenLP.ProjectorConstants', 'The local system ran out of resources (e.g., too many sockets)'),
'The socket operation timed out'), E_SOCKET_TIMEOUT: translate('OpenLP.ProjectorConstants',
E_DATAGRAM_TOO_LARGE: translate('OpenLP.ProjectorConstants', 'The socket operation timed out'),
'The datagram was larger than the operating system\'s limit'), E_DATAGRAM_TOO_LARGE: translate('OpenLP.ProjectorConstants',
E_NETWORK: translate('OpenLP.ProjectorConstants', 'The datagram was larger than the operating system\'s limit'),
'An error occurred with the network (Possibly someone pulled the plug?)'), E_NETWORK: translate('OpenLP.ProjectorConstants',
E_ADDRESS_IN_USE: translate('OpenLP.ProjectorConstants', 'An error occurred with the network (Possibly someone pulled the plug?)'),
'The address specified with socket.bind() ' E_ADDRESS_IN_USE: translate('OpenLP.ProjectorConstants',
'is already in use and was set to be exclusive'), 'The address specified with socket.bind() '
E_SOCKET_ADDRESS_NOT_AVAILABLE: translate('OpenLP.ProjectorConstants', 'is already in use and was set to be exclusive'),
'The address specified to socket.bind() ' E_SOCKET_ADDRESS_NOT_AVAILABLE: translate('OpenLP.ProjectorConstants',
'does not belong to the host'), 'The address specified to socket.bind() '
E_UNSUPPORTED_SOCKET_OPERATION: translate('OpenLP.ProjectorConstants', 'does not belong to the host'),
'The requested socket operation is not supported by the local ' E_UNSUPPORTED_SOCKET_OPERATION: translate('OpenLP.ProjectorConstants',
'operating system (e.g., lack of IPv6 support)'), 'The requested socket operation is not supported by the local '
E_PROXY_AUTHENTICATION_REQUIRED: translate('OpenLP.ProjectorConstants', 'operating system (e.g., lack of IPv6 support)'),
'The socket is using a proxy, ' E_PROXY_AUTHENTICATION_REQUIRED: translate('OpenLP.ProjectorConstants',
'and the proxy requires authentication'), 'The socket is using a proxy, '
E_SLS_HANDSHAKE_FAILED: translate('OpenLP.ProjectorConstants', 'and the proxy requires authentication'),
'The SSL/TLS handshake failed'), E_SLS_HANDSHAKE_FAILED: translate('OpenLP.ProjectorConstants',
E_UNFINISHED_SOCKET_OPERATION: translate('OpenLP.ProjectorConstants', 'The SSL/TLS handshake failed'),
'The last operation attempted has not finished yet ' E_UNFINISHED_SOCKET_OPERATION: translate('OpenLP.ProjectorConstants',
'(still in progress in the background)'), 'The last operation attempted has not finished yet '
E_PROXY_CONNECTION_REFUSED: translate('OpenLP.ProjectorConstants', '(still in progress in the background)'),
'Could not contact the proxy server because the connection ' E_PROXY_CONNECTION_REFUSED: translate('OpenLP.ProjectorConstants',
'to that server was denied'), 'Could not contact the proxy server because the connection '
E_PROXY_CONNECTION_CLOSED: translate('OpenLP.ProjectorConstants', 'to that server was denied'),
'The connection to the proxy server was closed unexpectedly ' E_PROXY_CONNECTION_CLOSED: translate('OpenLP.ProjectorConstants',
'(before the connection to the final peer was established)'), 'The connection to the proxy server was closed unexpectedly '
E_PROXY_CONNECTION_TIMEOUT: translate('OpenLP.ProjectorConstants', '(before the connection to the final peer was established)'),
'The connection to the proxy server timed out or the proxy ' E_PROXY_CONNECTION_TIMEOUT: translate('OpenLP.ProjectorConstants',
'server stopped responding in the authentication phase.'), 'The connection to the proxy server timed out or the proxy '
E_PROXY_NOT_FOUND: translate('OpenLP.ProjectorConstants', 'server stopped responding in the authentication phase.'),
'The proxy address set with setProxy() was not found'), E_PROXY_NOT_FOUND: translate('OpenLP.ProjectorConstants',
E_PROXY_PROTOCOL: translate('OpenLP.ProjectorConstants', 'The proxy address set with setProxy() was not found'),
'The connection negotiation with the proxy server failed because the ' E_PROXY_PROTOCOL: translate('OpenLP.ProjectorConstants',
'response from the proxy server could not be understood'), 'The connection negotiation with the proxy server failed because the '
E_UNKNOWN_SOCKET_ERROR: translate('OpenLP.ProjectorConstants', 'An unidentified error occurred'), 'response from the proxy server could not be understood'),
S_NOT_CONNECTED: translate('OpenLP.ProjectorConstants', 'Not connected'), E_UNKNOWN_SOCKET_ERROR: translate('OpenLP.ProjectorConstants', 'An unidentified error occurred'),
S_CONNECTING: translate('OpenLP.ProjectorConstants', 'Connecting'), S_NOT_CONNECTED: translate('OpenLP.ProjectorConstants', 'Not connected'),
S_CONNECTED: translate('OpenLP.ProjectorConstants', 'Connected'), S_CONNECTING: translate('OpenLP.ProjectorConstants', 'Connecting'),
S_STATUS: translate('OpenLP.ProjectorConstants', 'Getting status'), S_CONNECTED: translate('OpenLP.ProjectorConstants', 'Connected'),
S_OFF: translate('OpenLP.ProjectorConstants', 'Off'), S_STATUS: translate('OpenLP.ProjectorConstants', 'Getting status'),
S_INITIALIZE: translate('OpenLP.ProjectorConstants', 'Initialize in progress'), S_OFF: translate('OpenLP.ProjectorConstants', 'Off'),
S_STANDBY: translate('OpenLP.ProjectorConstants', 'Power in standby'), S_INITIALIZE: translate('OpenLP.ProjectorConstants', 'Initialize in progress'),
S_WARMUP: translate('OpenLP.ProjectorConstants', 'Warmup in progress'), S_STANDBY: translate('OpenLP.ProjectorConstants', 'Power in standby'),
S_ON: translate('OpenLP.ProjectorConstants', 'Power is on'), S_WARMUP: translate('OpenLP.ProjectorConstants', 'Warmup in progress'),
S_COOLDOWN: translate('OpenLP.ProjectorConstants', 'Cooldown in progress'), S_ON: translate('OpenLP.ProjectorConstants', 'Power is on'),
S_INFO: translate('OpenLP.ProjectorConstants', 'Projector Information available'), S_COOLDOWN: translate('OpenLP.ProjectorConstants', 'Cooldown in progress'),
S_NETWORK_SENDING: translate('OpenLP.ProjectorConstants', 'Sending data'), S_INFO: translate('OpenLP.ProjectorConstants', 'Projector Information available'),
S_NETWORK_RECEIVED: translate('OpenLP.ProjectorConstants', 'Received data')} S_NETWORK_SENDING: translate('OpenLP.ProjectorConstants', 'Sending data'),
S_NETWORK_RECEIVED: translate('OpenLP.ProjectorConstants', 'Received data')
}
# Map for ERST return codes to string # Map for ERST return codes to string
PJLINK_ERST_STATUS = {'0': ERROR_STRING[E_OK], PJLINK_ERST_STATUS = {
'1': ERROR_STRING[E_WARN], '0': ERROR_STRING[E_OK],
'2': ERROR_STRING[E_ERROR]} '1': ERROR_STRING[E_WARN],
'2': ERROR_STRING[E_ERROR]
}
# Map for POWR return codes to status code # Map for POWR return codes to status code
PJLINK_POWR_STATUS = {'0': S_STANDBY, PJLINK_POWR_STATUS = {
'1': S_ON, '0': S_STANDBY,
'2': S_COOLDOWN, '1': S_ON,
'3': S_WARMUP, '2': S_COOLDOWN,
S_STANDBY: '0', '3': S_WARMUP,
S_ON: '1', S_STANDBY: '0',
S_COOLDOWN: '2', S_ON: '1',
S_WARMUP: '3'} S_COOLDOWN: '2',
S_WARMUP: '3'
}
PJLINK_DEFAULT_SOURCES = {'1': translate('OpenLP.DB', 'RGB'), PJLINK_DEFAULT_SOURCES = {
'2': translate('OpenLP.DB', 'Video'), '1': translate('OpenLP.DB', 'RGB'),
'3': translate('OpenLP.DB', 'Digital'), '2': translate('OpenLP.DB', 'Video'),
'4': translate('OpenLP.DB', 'Storage'), '3': translate('OpenLP.DB', 'Digital'),
'5': translate('OpenLP.DB', 'Network')} '4': translate('OpenLP.DB', 'Storage'),
'5': translate('OpenLP.DB', 'Network')
}
PJLINK_DEFAULT_CODES = {'11': translate('OpenLP.DB', 'RGB 1'), PJLINK_DEFAULT_CODES = {
'12': translate('OpenLP.DB', 'RGB 2'), '11': translate('OpenLP.DB', 'RGB 1'),
'13': translate('OpenLP.DB', 'RGB 3'), '12': translate('OpenLP.DB', 'RGB 2'),
'14': translate('OpenLP.DB', 'RGB 4'), '13': translate('OpenLP.DB', 'RGB 3'),
'15': translate('OpenLP.DB', 'RGB 5'), '14': translate('OpenLP.DB', 'RGB 4'),
'16': translate('OpenLP.DB', 'RGB 6'), '15': translate('OpenLP.DB', 'RGB 5'),
'17': translate('OpenLP.DB', 'RGB 7'), '16': translate('OpenLP.DB', 'RGB 6'),
'18': translate('OpenLP.DB', 'RGB 8'), '17': translate('OpenLP.DB', 'RGB 7'),
'19': translate('OpenLP.DB', 'RGB 9'), '18': translate('OpenLP.DB', 'RGB 8'),
'21': translate('OpenLP.DB', 'Video 1'), '19': translate('OpenLP.DB', 'RGB 9'),
'22': translate('OpenLP.DB', 'Video 2'), '21': translate('OpenLP.DB', 'Video 1'),
'23': translate('OpenLP.DB', 'Video 3'), '22': translate('OpenLP.DB', 'Video 2'),
'24': translate('OpenLP.DB', 'Video 4'), '23': translate('OpenLP.DB', 'Video 3'),
'25': translate('OpenLP.DB', 'Video 5'), '24': translate('OpenLP.DB', 'Video 4'),
'26': translate('OpenLP.DB', 'Video 6'), '25': translate('OpenLP.DB', 'Video 5'),
'27': translate('OpenLP.DB', 'Video 7'), '26': translate('OpenLP.DB', 'Video 6'),
'28': translate('OpenLP.DB', 'Video 8'), '27': translate('OpenLP.DB', 'Video 7'),
'29': translate('OpenLP.DB', 'Video 9'), '28': translate('OpenLP.DB', 'Video 8'),
'31': translate('OpenLP.DB', 'Digital 1'), '29': translate('OpenLP.DB', 'Video 9'),
'32': translate('OpenLP.DB', 'Digital 2'), '31': translate('OpenLP.DB', 'Digital 1'),
'33': translate('OpenLP.DB', 'Digital 3'), '32': translate('OpenLP.DB', 'Digital 2'),
'34': translate('OpenLP.DB', 'Digital 4'), '33': translate('OpenLP.DB', 'Digital 3'),
'35': translate('OpenLP.DB', 'Digital 5'), '34': translate('OpenLP.DB', 'Digital 4'),
'36': translate('OpenLP.DB', 'Digital 6'), '35': translate('OpenLP.DB', 'Digital 5'),
'37': translate('OpenLP.DB', 'Digital 7'), '36': translate('OpenLP.DB', 'Digital 6'),
'38': translate('OpenLP.DB', 'Digital 8'), '37': translate('OpenLP.DB', 'Digital 7'),
'39': translate('OpenLP.DB', 'Digital 9'), '38': translate('OpenLP.DB', 'Digital 8'),
'41': translate('OpenLP.DB', 'Storage 1'), '39': translate('OpenLP.DB', 'Digital 9'),
'42': translate('OpenLP.DB', 'Storage 2'), '41': translate('OpenLP.DB', 'Storage 1'),
'43': translate('OpenLP.DB', 'Storage 3'), '42': translate('OpenLP.DB', 'Storage 2'),
'44': translate('OpenLP.DB', 'Storage 4'), '43': translate('OpenLP.DB', 'Storage 3'),
'45': translate('OpenLP.DB', 'Storage 5'), '44': translate('OpenLP.DB', 'Storage 4'),
'46': translate('OpenLP.DB', 'Storage 6'), '45': translate('OpenLP.DB', 'Storage 5'),
'47': translate('OpenLP.DB', 'Storage 7'), '46': translate('OpenLP.DB', 'Storage 6'),
'48': translate('OpenLP.DB', 'Storage 8'), '47': translate('OpenLP.DB', 'Storage 7'),
'49': translate('OpenLP.DB', 'Storage 9'), '48': translate('OpenLP.DB', 'Storage 8'),
'51': translate('OpenLP.DB', 'Network 1'), '49': translate('OpenLP.DB', 'Storage 9'),
'52': translate('OpenLP.DB', 'Network 2'), '51': translate('OpenLP.DB', 'Network 1'),
'53': translate('OpenLP.DB', 'Network 3'), '52': translate('OpenLP.DB', 'Network 2'),
'54': translate('OpenLP.DB', 'Network 4'), '53': translate('OpenLP.DB', 'Network 3'),
'55': translate('OpenLP.DB', 'Network 5'), '54': translate('OpenLP.DB', 'Network 4'),
'56': translate('OpenLP.DB', 'Network 6'), '55': translate('OpenLP.DB', 'Network 5'),
'57': translate('OpenLP.DB', 'Network 7'), '56': translate('OpenLP.DB', 'Network 6'),
'58': translate('OpenLP.DB', 'Network 8'), '57': translate('OpenLP.DB', 'Network 7'),
'59': translate('OpenLP.DB', 'Network 9') '58': translate('OpenLP.DB', 'Network 8'),
} '59': translate('OpenLP.DB', 'Network 9')
}

View File

@ -49,7 +49,12 @@ from codecs import decode
from PyQt5 import QtCore, QtNetwork from PyQt5 import QtCore, QtNetwork
from openlp.core.common import translate, qmd5_hash from openlp.core.common import translate, qmd5_hash
from openlp.core.lib.projector.constants import * from openlp.core.lib.projector.constants import CONNECTION_ERRORS, CR, ERROR_MSG, ERROR_STRING, \
E_AUTHENTICATION, E_CONNECTION_REFUSED, E_GENERAL, E_INVALID_DATA, E_NETWORK, E_NOT_CONNECTED, \
E_PARAMETER, E_PROJECTOR, E_SOCKET_TIMEOUT, E_UNAVAILABLE, E_UNDEFINED, PJLINK_ERRORS, \
PJLINK_ERST_STATUS, PJLINK_MAX_PACKET, PJLINK_PORT, PJLINK_POWR_STATUS, PJLINK_VALID_CMD, \
STATUS_STRING, S_CONNECTED, S_CONNECTING, S_NETWORK_RECEIVED, S_NETWORK_SENDING, S_NOT_CONNECTED, \
S_OFF, S_OK, S_ON, S_STATUS
# Shortcuts # Shortcuts
SocketError = QtNetwork.QAbstractSocket.SocketError SocketError = QtNetwork.QAbstractSocket.SocketError

View File

@ -34,9 +34,9 @@ from openlp.core.common import RegistryProperties, Settings, OpenLPMixin, \
from openlp.core.ui.lib import OpenLPToolbar from openlp.core.ui.lib import OpenLPToolbar
from openlp.core.lib.ui import create_widget_action from openlp.core.lib.ui import create_widget_action
from openlp.core.lib.projector import DialogSourceStyle from openlp.core.lib.projector import DialogSourceStyle
from openlp.core.lib.projector.constants import S_NOT_CONNECTED, S_CONNECTING, S_CONNECTED, S_OFF, S_INITIALIZE, \ from openlp.core.lib.projector.constants import ERROR_MSG, ERROR_STRING, E_AUTHENTICATION, E_ERROR, \
S_STANDBY, S_WARMUP, S_ON, S_COOLDOWN, E_ERROR, E_NETWORK, E_AUTHENTICATION, E_UNKNOWN_SOCKET_ERROR, \ E_NETWORK, E_NOT_CONNECTED, E_UNKNOWN_SOCKET_ERROR, STATUS_STRING, S_CONNECTED, S_CONNECTING, S_COOLDOWN, \
E_NOT_CONNECTED S_INITIALIZE, S_NOT_CONNECTED, S_OFF, S_ON, S_STANDBY, S_WARMUP
from openlp.core.lib.projector.db import ProjectorDB from openlp.core.lib.projector.db import ProjectorDB
from openlp.core.lib.projector.pjlink1 import PJLink1 from openlp.core.lib.projector.pjlink1 import PJLink1
from openlp.core.ui.projector.editform import ProjectorEditForm from openlp.core.ui.projector.editform import ProjectorEditForm

View File

@ -37,7 +37,7 @@ class TestRegistryProperties(TestCase, RegistryProperties):
""" """
Create the Register Create the Register
""" """
Registry.create() self.registry = Registry.create()
def test_no_application(self): def test_no_application(self):
""" """
@ -75,3 +75,23 @@ class TestRegistryProperties(TestCase, RegistryProperties):
# THEN the application should be none # THEN the application should be none
self.assertEqual(self.application, application, 'The application value should match') self.assertEqual(self.application, application, 'The application value should match')
@patch('openlp.core.common.registryproperties.is_win')
def test_get_application_on_windows(self, mocked_is_win):
"""
Set that getting the application object on Windows happens dynamically
"""
# GIVEN an Empty Registry and we're on Windows
mocked_is_win.return_value = True
mock_application = MagicMock()
reg_props = RegistryProperties()
# WHEN the application is accessed
with patch.object(self.registry, 'get') as mocked_get:
mocked_get.return_value = mock_application
actual_application = reg_props.application
# THEN the application should be the mock object, and the correct function should have been called
self.assertEqual(mock_application, actual_application, 'The application value should match')
mocked_is_win.assert_called_with()
mocked_get.assert_called_with('application')