forked from openlp/openlp
Fix decode() string error in about text - fix qt try/except error in projector
This commit is contained in:
parent
cd77486e32
commit
6bca1fc455
@ -513,17 +513,13 @@ class PJLink1(QTcpSocket):
|
|||||||
log.debug('(%s) _send_string(): Sending "%s"' % (self.ip, out.strip()))
|
log.debug('(%s) _send_string(): Sending "%s"' % (self.ip, out.strip()))
|
||||||
log.debug('(%s) _send_string(): Queue = %s' % (self.ip, self.send_queue))
|
log.debug('(%s) _send_string(): Queue = %s' % (self.ip, self.send_queue))
|
||||||
self.socket_timer.start()
|
self.socket_timer.start()
|
||||||
try:
|
self.projectorNetwork.emit(S_NETWORK_SENDING)
|
||||||
self.projectorNetwork.emit(S_NETWORK_SENDING)
|
sent = self.write(out.encode('ascii'))
|
||||||
sent = self.write(out.encode('ascii'))
|
self.waitForBytesWritten(2000) # 2 seconds should be enough
|
||||||
self.waitForBytesWritten(2000) # 2 seconds should be enough
|
if sent == -1:
|
||||||
if sent == -1:
|
# Network error?
|
||||||
# Network error?
|
self.change_status(E_NETWORK,
|
||||||
self.change_status(E_NETWORK,
|
translate('OpenLP.PJLink1', 'Error while sending data to projector'))
|
||||||
translate('OpenLP.PJLink1', 'Error while sending data to projector'))
|
|
||||||
except SocketError as e:
|
|
||||||
self.disconnect_from_host(abort=True)
|
|
||||||
self.changeStatus(E_NETWORK, '%s : %s' % (e.error(), e.errorString()))
|
|
||||||
|
|
||||||
def process_command(self, cmd, data):
|
def process_command(self, cmd, data):
|
||||||
"""
|
"""
|
||||||
|
@ -186,9 +186,9 @@ def get_application_version():
|
|||||||
# If they are equal, then this tree is tarball with the source for the release. We do not want the revision
|
# If they are equal, then this tree is tarball with the source for the release. We do not want the revision
|
||||||
# number in the full version.
|
# number in the full version.
|
||||||
if tree_revision == tag_revision:
|
if tree_revision == tag_revision:
|
||||||
full_version = tag_version.decode('utf-8')
|
full_version = tag_version.strip()
|
||||||
else:
|
else:
|
||||||
full_version = '%s-bzr%s' % (tag_version.decode('utf-8'), tree_revision.decode('utf-8'))
|
full_version = '%s-bzr%s' % (tag_version.strip(), tree_revision.strip())
|
||||||
else:
|
else:
|
||||||
# We're not running the development version, let's use the file.
|
# We're not running the development version, let's use the file.
|
||||||
file_path = AppLocation.get_directory(AppLocation.VersionDir)
|
file_path = AppLocation.get_directory(AppLocation.VersionDir)
|
||||||
|
@ -92,3 +92,18 @@ class TestPJLink(TestCase):
|
|||||||
mock_change_status.called_with(E_PARAMETER,
|
mock_change_status.called_with(E_PARAMETER,
|
||||||
'change_status should have been called with "{}"'.format(
|
'change_status should have been called with "{}"'.format(
|
||||||
ERROR_STRING[E_PARAMETER]))
|
ERROR_STRING[E_PARAMETER]))
|
||||||
|
|
||||||
|
@patch.object(pjlink_test, 'process_inpt')
|
||||||
|
def projector_return_ok_test(self, mock_process_inpt):
|
||||||
|
"""
|
||||||
|
Test projector calls process_inpt command when process_command is called with INPT option
|
||||||
|
"""
|
||||||
|
# GIVEN: Test object
|
||||||
|
pjlink = pjlink_test
|
||||||
|
|
||||||
|
# WHEN: process_command is called with INST command and 31 input:
|
||||||
|
pjlink.process_command('INPT', '31')
|
||||||
|
|
||||||
|
# THEN: process_inpt method should have been called with 31
|
||||||
|
mock_process_inpt.called_with('31',
|
||||||
|
"process_inpt should have been called with 31")
|
||||||
|
Loading…
Reference in New Issue
Block a user