Fix previous reviews

This commit is contained in:
Ken Roberts 2014-10-09 13:30:07 -07:00
parent 842898aaf9
commit b8f84f79eb
7 changed files with 36 additions and 31 deletions

View File

@ -217,8 +217,8 @@ def md5_hash(salt, data):
def qmd5_hash(salt, data): def qmd5_hash(salt, data):
""" """
Returns the hashed output of MD%Sum on salt, data Returns the hashed output of MD5Sum on salt, data
using PyQt4.QCryptograhicHash. using PyQt4.QCryptographicHash.
:param salt: Initial salt :param salt: Initial salt
:param data: Data to hash :param data: Data to hash

View File

@ -99,9 +99,9 @@ class UiStrings(object):
self.LiveBGError = translate('OpenLP.Ui', 'Live Background Error') self.LiveBGError = translate('OpenLP.Ui', 'Live Background Error')
self.LiveToolbar = translate('OpenLP.Ui', 'Live Toolbar') self.LiveToolbar = translate('OpenLP.Ui', 'Live Toolbar')
self.Load = translate('OpenLP.Ui', 'Load') self.Load = translate('OpenLP.Ui', 'Load')
self.Manufacturer = translate('OpenLP.Ui', 'Manufacturer', 'Singluar') self.Manufacturer = translate('OpenLP.Ui', 'Manufacturer', 'Singular')
self.Manufacturers = translate('OpenLP.Ui', 'Manufacturers', 'Plural') self.Manufacturers = translate('OpenLP.Ui', 'Manufacturers', 'Plural')
self.Model = translate('OpenLP.Ui', 'Model', 'Singluar') self.Model = translate('OpenLP.Ui', 'Model', 'Singular')
self.Models = translate('OpenLP.Ui', 'Models', 'Plural') self.Models = translate('OpenLP.Ui', 'Models', 'Plural')
self.Minutes = translate('OpenLP.Ui', 'm', 'The abbreviated unit for minutes') self.Minutes = translate('OpenLP.Ui', 'm', 'The abbreviated unit for minutes')
self.Middle = translate('OpenLP.Ui', 'Middle') self.Middle = translate('OpenLP.Ui', 'Middle')
@ -122,7 +122,7 @@ class UiStrings(object):
self.PlaySlidesToEnd = translate('OpenLP.Ui', 'Play Slides to End') self.PlaySlidesToEnd = translate('OpenLP.Ui', 'Play Slides to End')
self.Preview = translate('OpenLP.Ui', 'Preview') self.Preview = translate('OpenLP.Ui', 'Preview')
self.PrintService = translate('OpenLP.Ui', 'Print Service') self.PrintService = translate('OpenLP.Ui', 'Print Service')
self.Projector = translate('OpenLP.Ui', 'Projector', 'Singluar') self.Projector = translate('OpenLP.Ui', 'Projector', 'Singular')
self.Projectors = translate('OpenLP.Ui', 'Projectors', 'Plural') self.Projectors = translate('OpenLP.Ui', 'Projectors', 'Plural')
self.ReplaceBG = translate('OpenLP.Ui', 'Replace Background') self.ReplaceBG = translate('OpenLP.Ui', 'Replace Background')
self.ReplaceLiveBG = translate('OpenLP.Ui', 'Replace live background.') self.ReplaceLiveBG = translate('OpenLP.Ui', 'Replace live background.')

View File

@ -69,7 +69,7 @@ PJLINK_VALID_CMD = {'1': ['POWR', # Power option
'INST', # Input sources available query 'INST', # Input sources available query
'NAME', # Projector name query 'NAME', # Projector name query
'INF1', # Manufacturer name query 'INF1', # Manufacturer name query
'INF2', # Projuct name query 'INF2', # Product name query
'INFO', # Other information query 'INFO', # Other information query
'CLSS' # PJLink class support query 'CLSS' # PJLink class support query
]} ]}
@ -221,7 +221,6 @@ STATUS_STRING = {S_NOT_CONNECTED: translate('OpenLP.ProjectorConstants', 'S_NOT_
ERROR_MSG = {E_OK: translate('OpenLP.ProjectorConstants', 'OK'), # E_OK | S_OK ERROR_MSG = {E_OK: translate('OpenLP.ProjectorConstants', 'OK'), # E_OK | S_OK
E_GENERAL: translate('OpenLP.ProjectorConstants', 'General projector error'), E_GENERAL: translate('OpenLP.ProjectorConstants', 'General projector error'),
E_NOT_CONNECTED: translate('OpenLP.ProjectorConstants', 'Not connected error'), E_NOT_CONNECTED: translate('OpenLP.ProjectorConstants', 'Not connected error'),
E_NETWORK: translate('OpenLP.ProjectorConstants', 'Network error'),
E_LAMP: translate('OpenLP.ProjectorConstants', 'Lamp error'), E_LAMP: translate('OpenLP.ProjectorConstants', 'Lamp error'),
E_FAN: translate('OpenLP.ProjectorConstants', 'Fan error'), E_FAN: translate('OpenLP.ProjectorConstants', 'Fan error'),
E_TEMP: translate('OpenLP.ProjectorConstants', 'High temperature detected'), E_TEMP: translate('OpenLP.ProjectorConstants', 'High temperature detected'),
@ -232,7 +231,7 @@ ERROR_MSG = {E_OK: translate('OpenLP.ProjectorConstants', 'OK'), # E_OK | S_OK
E_PARAMETER: translate('OpenLP.ProjectorConstants', 'Invalid Parameter'), E_PARAMETER: translate('OpenLP.ProjectorConstants', 'Invalid Parameter'),
E_UNAVAILABLE: translate('OpenLP.ProjectorConstants', 'Projector Busy'), E_UNAVAILABLE: translate('OpenLP.ProjectorConstants', 'Projector Busy'),
E_PROJECTOR: translate('OpenLP.ProjectorConstants', 'Projector/Display Error'), E_PROJECTOR: translate('OpenLP.ProjectorConstants', 'Projector/Display Error'),
E_INVALID_DATA: translate('OpenLP.ProjectorConstants', 'Invald packet received'), E_INVALID_DATA: translate('OpenLP.ProjectorConstants', 'Invalid packet received'),
E_WARN: translate('OpenLP.ProjectorConstants', 'Warning condition detected'), E_WARN: translate('OpenLP.ProjectorConstants', 'Warning condition detected'),
E_ERROR: translate('OpenLP.ProjectorConstants', 'Error condition detected'), E_ERROR: translate('OpenLP.ProjectorConstants', 'Error condition detected'),
E_CLASS: translate('OpenLP.ProjectorConstants', 'PJLink class not supported'), E_CLASS: translate('OpenLP.ProjectorConstants', 'PJLink class not supported'),
@ -295,7 +294,7 @@ ERROR_MSG = {E_OK: translate('OpenLP.ProjectorConstants', 'OK'), # E_OK | S_OK
S_WARMUP: translate('OpenLP.ProjectorConstants', 'Warmup in progress'), S_WARMUP: translate('OpenLP.ProjectorConstants', 'Warmup in progress'),
S_ON: translate('OpenLP.ProjectorConstants', 'Power is on'), S_ON: translate('OpenLP.ProjectorConstants', 'Power is on'),
S_COOLDOWN: translate('OpenLP.ProjectorConstants', 'Cooldown in progress'), S_COOLDOWN: translate('OpenLP.ProjectorConstants', 'Cooldown in progress'),
S_INFO: translate('OpenLP.ProjectorConstants', 'Projector Information availble'), S_INFO: translate('OpenLP.ProjectorConstants', 'Projector Information available'),
S_NETWORK_SENDING: translate('OpenLP.ProjectorConstants', 'Sending data'), S_NETWORK_SENDING: translate('OpenLP.ProjectorConstants', 'Sending data'),
S_NETWORK_RECEIVED: translate('OpenLP.ProjectorConstants', 'Received data')} S_NETWORK_RECEIVED: translate('OpenLP.ProjectorConstants', 'Received data')}

View File

@ -96,7 +96,7 @@ class Model(CommonBase, Base):
class Source(CommonBase, Base): class Source(CommonBase, Base):
""" """
Input ource table. Input source table.
Model table links here. Model table links here.
These entries map PJLink source codes to text strings. These entries map PJLink source codes to text strings.
@ -170,7 +170,7 @@ class ProjectorDB(Manager):
Locate a projector by host IP/Name. Locate a projector by host IP/Name.
:param ip: Host IP/Name :param ip: Host IP/Name
:returns: Projetor() instance :returns: Projector() instance
""" """
log.debug('get_projector_by_ip(ip="%s")' % ip) log.debug('get_projector_by_ip(ip="%s")' % ip)
projector = self.get_object_filtered(Projector, Projector.ip == ip) projector = self.get_object_filtered(Projector, Projector.ip == ip)
@ -186,7 +186,7 @@ class ProjectorDB(Manager):
Locate a projector by name field Locate a projector by name field
:param name: Name of projector :param name: Name of projector
:returns: Projetor() instance :returns: Projector() instance
""" """
log.debug('get_projector_by_name(name="%s")' % name) log.debug('get_projector_by_name(name="%s")' % name)
projector = self.get_object_filtered(Projector, Projector.name == name) projector = self.get_object_filtered(Projector, Projector.name == name)
@ -203,7 +203,7 @@ class ProjectorDB(Manager):
NOTE: Will not add new entry if IP is the same as already in the table. NOTE: Will not add new entry if IP is the same as already in the table.
:param projector: Projetor() instance to add :param projector: Projector() instance to add
:returns: bool :returns: bool
""" """
old_projector = self.get_object_filtered(Projector, Projector.ip == projector.ip) old_projector = self.get_object_filtered(Projector, Projector.ip == projector.ip)

View File

@ -123,7 +123,7 @@ class PJLink1(QTcpSocket):
self.projector_status = S_NOT_CONNECTED self.projector_status = S_NOT_CONNECTED
self.error_status = S_OK self.error_status = S_OK
# Socket information # Socket information
# Account for self.readLine appending \0 and/or exraneous \r # Account for self.readLine appending \0 and/or extraneous \r
self.maxSize = PJLINK_MAX_PACKET + 2 self.maxSize = PJLINK_MAX_PACKET + 2
self.setReadBufferSize(self.maxSize) self.setReadBufferSize(self.maxSize)
# PJLink projector information # PJLink projector information
@ -239,21 +239,24 @@ class PJLink1(QTcpSocket):
return self.pjlink_class in PJLINK_VALID_CMD and \ return self.pjlink_class in PJLINK_VALID_CMD and \
cmd in PJLINK_VALID_CMD[self.pjlink_class] cmd in PJLINK_VALID_CMD[self.pjlink_class]
def check_login(self): @pyqtSlot()
def check_login(self, data=None):
""" """
Processes the initial connection and authentication (if needed). Processes the initial connection and authentication (if needed).
""" """
self.waitForReadyRead(5000) # 5 seconds should be more than enough if data is None:
read = self.readLine(self.maxSize) # Reconnected setup?
dontcare = self.readLine(self.maxSize) # Clean out the trailing \r\n self.waitForReadyRead(5000) # 5 seconds should be more than enough
if len(read) < 8: read = self.readLine(self.maxSize)
log.warn('(%s) Not enough data read)' % self.ip) dontcare = self.readLine(self.maxSize) # Clean out the trailing \r\n
return if len(read) < 8:
data = decode(read, 'ascii') log.warn('(%s) Not enough data read)' % self.ip)
# Possibility of extraneous data on input when reading. return
# Clean out extraneous characters in buffer. data = decode(read, 'ascii')
dontcare = self.readLine(self.maxSize) # Possibility of extraneous data on input when reading.
log.debug('(%s) check_login() read "%s"' % (self.ip, data)) # Clean out extraneous characters in buffer.
dontcare = self.readLine(self.maxSize)
log.debug('(%s) check_login() read "%s"' % (self.ip, data))
# At this point, we should only have the initial login prompt with # At this point, we should only have the initial login prompt with
# possible authentication # possible authentication
if not data.upper().startswith('PJLINK'): if not data.upper().startswith('PJLINK'):
@ -304,10 +307,13 @@ class PJLink1(QTcpSocket):
log.debug('(%s) get_data(): Packet length < 8: "%s"' % (self.ip, data)) log.debug('(%s) get_data(): Packet length < 8: "%s"' % (self.ip, data))
return return
log.debug('(%s) Checking new data "%s"' % (self.ip, data)) log.debug('(%s) Checking new data "%s"' % (self.ip, data))
if data.upper().startswith('PJLINK'):
# Reconnected from remote host disconnect ?
return self.check_login(data)
if '=' in data: if '=' in data:
pass pass
else: else:
log.warn('(%s) Invalid packet received') log.warn('(%s) Invalid packet received' % self.ip)
return return
data_split = data.split('=') data_split = data.split('=')
try: try:
@ -622,7 +628,7 @@ class PJLink1(QTcpSocket):
def get_shutter_status(self): def get_shutter_status(self):
""" """
Send command to retrive shutter status. Send command to retrieve shutter status.
""" """
return self.send_command(cmd='AVMT') return self.send_command(cmd='AVMT')

View File

@ -432,9 +432,9 @@ class Ui_MainWindow(object):
'exported on this or another machine')) 'exported on this or another machine'))
self.settings_import_item.setText(translate('OpenLP.MainWindow', 'Settings')) self.settings_import_item.setText(translate('OpenLP.MainWindow', 'Settings'))
self.view_projector_manager_item.setText(translate('OPenLP.MainWindow', '&ProjectorManager')) self.view_projector_manager_item.setText(translate('OPenLP.MainWindow', '&ProjectorManager'))
self.view_projector_manager_item.setToolTip(translate('OpenLP.MainWindow', 'Toogle Projector Manager')) self.view_projector_manager_item.setToolTip(translate('OpenLP.MainWindow', 'Toggle Projector Manager'))
self.view_projector_manager_item.setStatusTip(translate('OpenLP.MainWindow', self.view_projector_manager_item.setStatusTip(translate('OpenLP.MainWindow',
'Toggle the visibiilty of the Projector Manager')) 'Toggle the visibility of the Projector Manager'))
self.view_media_manager_item.setText(translate('OpenLP.MainWindow', '&Media Manager')) self.view_media_manager_item.setText(translate('OpenLP.MainWindow', '&Media Manager'))
self.view_media_manager_item.setToolTip(translate('OpenLP.MainWindow', 'Toggle Media Manager')) self.view_media_manager_item.setToolTip(translate('OpenLP.MainWindow', 'Toggle Media Manager'))
self.view_media_manager_item.setStatusTip(translate('OpenLP.MainWindow', self.view_media_manager_item.setStatusTip(translate('OpenLP.MainWindow',

View File

@ -786,7 +786,7 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
if ip == list_item.link.ip: if ip == list_item.link.ip:
item = list_item item = list_item
break break
message = 'No message' if msg is None else msg message = translate('OpenLP.ProjectorManager', 'No message') if msg is None else msg
if status in STATUS_STRING: if status in STATUS_STRING:
status_code = STATUS_STRING[status] status_code = STATUS_STRING[status]
message = ERROR_MSG[status] if msg is None else msg message = ERROR_MSG[status] if msg is None else msg