forked from openlp/openlp
Refactor pjlink/remove db id in view projector/add pjlink command to constants
This commit is contained in:
parent
26db1f16ad
commit
72cca86208
@ -61,7 +61,8 @@ LF = chr(0x0A) # \n
|
|||||||
PJLINK_PORT = 4352
|
PJLINK_PORT = 4352
|
||||||
TIMEOUT = 30.0
|
TIMEOUT = 30.0
|
||||||
PJLINK_MAX_PACKET = 136
|
PJLINK_MAX_PACKET = 136
|
||||||
PJLINK_VALID_CMD = {'1': ['POWR', # Power option
|
PJLINK_VALID_CMD = {'1': ['PJLINK', # Initial connection
|
||||||
|
'POWR', # Power option
|
||||||
'INPT', # Video sources option
|
'INPT', # Video sources option
|
||||||
'AVMT', # Shutter option
|
'AVMT', # Shutter option
|
||||||
'ERST', # Error status option
|
'ERST', # Error status option
|
||||||
|
@ -128,17 +128,7 @@ class PJLink1(QTcpSocket):
|
|||||||
self.setReadBufferSize(self.maxSize)
|
self.setReadBufferSize(self.maxSize)
|
||||||
# PJLink projector information
|
# PJLink projector information
|
||||||
self.pjlink_class = '1' # Default class
|
self.pjlink_class = '1' # Default class
|
||||||
self.power = S_OFF
|
self.reset_information()
|
||||||
self.pjlink_name = None
|
|
||||||
self.manufacturer = None
|
|
||||||
self.model = None
|
|
||||||
self.shutter = None
|
|
||||||
self.mute = None
|
|
||||||
self.lamp = None
|
|
||||||
self.fan = None
|
|
||||||
self.source_available = None
|
|
||||||
self.source = None
|
|
||||||
self.projector_errors = None
|
|
||||||
# Set from ProjectorManager.add_projector()
|
# Set from ProjectorManager.add_projector()
|
||||||
self.widget = None # QListBox entry
|
self.widget = None # QListBox entry
|
||||||
self.timer = None # Timer that calls the poll_loop
|
self.timer = None # Timer that calls the poll_loop
|
||||||
@ -156,6 +146,19 @@ class PJLink1(QTcpSocket):
|
|||||||
'POWR': self.process_powr
|
'POWR': self.process_powr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def reset_information(self):
|
||||||
|
self.power = S_OFF
|
||||||
|
self.pjlink_name = None
|
||||||
|
self.manufacturer = None
|
||||||
|
self.model = None
|
||||||
|
self.shutter = None
|
||||||
|
self.mute = None
|
||||||
|
self.lamp = None
|
||||||
|
self.fan = None
|
||||||
|
self.source_available = None
|
||||||
|
self.source = None
|
||||||
|
self.projector_errors = None
|
||||||
|
|
||||||
def thread_started(self):
|
def thread_started(self):
|
||||||
"""
|
"""
|
||||||
Connects signals to methods when thread is started.
|
Connects signals to methods when thread is started.
|
||||||
|
@ -60,7 +60,8 @@ STATUS_ICONS = {S_NOT_CONNECTED: ':/projector/projector_item_disconnect.png',
|
|||||||
E_ERROR: ':/projector/projector_error.png',
|
E_ERROR: ':/projector/projector_error.png',
|
||||||
E_NETWORK: ':/projector/projector_not_connected.png',
|
E_NETWORK: ':/projector/projector_not_connected.png',
|
||||||
E_AUTHENTICATION: ':/projector/projector_not_connected.png',
|
E_AUTHENTICATION: ':/projector/projector_not_connected.png',
|
||||||
E_UNKNOWN_SOCKET_ERROR: ':/icons/openlp-logo-64x64.png'
|
E_UNKNOWN_SOCKET_ERROR: ':/icons/openlp-logo-64x64.png',
|
||||||
|
E_NOT_CONNECTED: ':/projector/projector_not_connected.png'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -730,10 +731,9 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
|||||||
notes = translate('OpenLP.ProjectorManager', 'Notes')
|
notes = translate('OpenLP.ProjectorManager', 'Notes')
|
||||||
QtGui.QMessageBox.information(self, translate('OpenLP.ProjectorManager',
|
QtGui.QMessageBox.information(self, translate('OpenLP.ProjectorManager',
|
||||||
'Projector %s Information' % projector.link.name),
|
'Projector %s Information' % projector.link.name),
|
||||||
'%s: %s<br /><br />%s: %s<br /><br />%s: %s<br /><br />'
|
'<br />%s: %s<br /><br />%s: %s<br /><br />'
|
||||||
'%s: %s<br /><br />%s: %s<br /><br />'
|
'%s: %s<br /><br />%s: %s<br /><br />'
|
||||||
'%s:<br />%s' % (dbid, projector.link.dbid,
|
'%s:<br />%s' % (ip, projector.link.ip,
|
||||||
ip, projector.link.ip,
|
|
||||||
port, projector.link.port,
|
port, projector.link.port,
|
||||||
name, projector.link.name,
|
name, projector.link.name,
|
||||||
location, projector.link.location,
|
location, projector.link.location,
|
||||||
@ -890,7 +890,11 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
|||||||
log.debug('(%s) updateStatus(status=%s) message: "%s"' % (item.link.name, status_code, message))
|
log.debug('(%s) updateStatus(status=%s) message: "%s"' % (item.link.name, status_code, message))
|
||||||
if status in STATUS_ICONS:
|
if status in STATUS_ICONS:
|
||||||
item.icon = QtGui.QIcon(QtGui.QPixmap(STATUS_ICONS[status]))
|
item.icon = QtGui.QIcon(QtGui.QPixmap(STATUS_ICONS[status]))
|
||||||
log.debug('(%s) Updating icon' % item.link.name)
|
if status in ERROR_STRING:
|
||||||
|
status_code = ERROR_STRING[status]
|
||||||
|
elif status in STATUS_STRING:
|
||||||
|
status_code = STATUS_STRING[status]
|
||||||
|
log.debug('(%s) Updating icon with %s' % (item.link.name, status_code))
|
||||||
item.widget.setIcon(item.icon)
|
item.widget.setIcon(item.icon)
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
|
Loading…
Reference in New Issue
Block a user