forked from openlp/openlp
Translations and more minor cleanups
This commit is contained in:
parent
80369c8b0b
commit
0fc49e3df1
@ -57,61 +57,113 @@ LF = chr(0x0A) # \n
|
|||||||
PJLINK_PORT = 4352
|
PJLINK_PORT = 4352
|
||||||
TIMEOUT = 30.0
|
TIMEOUT = 30.0
|
||||||
PJLINK_MAX_PACKET = 136
|
PJLINK_MAX_PACKET = 136
|
||||||
# NOTE: Change format to account for some commands are both class 1 and 2
|
# NOTE: Changed format to account for some commands are both class 1 and 2
|
||||||
PJLINK_VALID_CMD = {
|
PJLINK_VALID_CMD = {
|
||||||
'ACKN': {'version': ['2', ], # UDP Reply to 'SRCH'
|
'ACKN': {'version': ['2', ],
|
||||||
'description': 'Acknowledge a PJLink SRCH command - returns MAC address.'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Acknowledge a PJLink SRCH command - returns MAC address.')
|
||||||
|
},
|
||||||
'AVMT': {'version': ['1', ],
|
'AVMT': {'version': ['1', ],
|
||||||
'description': 'Blank/unblank video and/or mute audio.'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Blank/unblank video and/or mute audio.')
|
||||||
|
},
|
||||||
'CLSS': {'version': ['1', ],
|
'CLSS': {'version': ['1', ],
|
||||||
'description': 'Query projector PJLink class support.'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Query projector PJLink class support.')
|
||||||
|
},
|
||||||
'ERST': {'version': ['1', '2'],
|
'ERST': {'version': ['1', '2'],
|
||||||
'description': 'Query error status from projector. '
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
'Returns fan/lamp/temp/cover/filter/other error status.'},
|
'Query error status from projector. '
|
||||||
'FILT': {'version': ['2', ], # Assume (!) time in hours
|
'Returns fan/lamp/temp/cover/filter/other error status.')
|
||||||
'description': 'Query number of hours on filter.'},
|
},
|
||||||
|
'FILT': {'version': ['2', ],
|
||||||
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Query number of hours on filter.')
|
||||||
|
},
|
||||||
'FREZ': {'version': ['2', ],
|
'FREZ': {'version': ['2', ],
|
||||||
'description': 'Freeze or unfreeze current image being projected.'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Freeze or unfreeze current image being projected.')
|
||||||
|
},
|
||||||
'INF1': {'version': ['1', ],
|
'INF1': {'version': ['1', ],
|
||||||
'description': 'Query projector manufacturer name.'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Query projector manufacturer name.')
|
||||||
|
},
|
||||||
'INF2': {'version': ['1', ],
|
'INF2': {'version': ['1', ],
|
||||||
'description': 'Query projector product name.'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Query projector product name.')
|
||||||
|
},
|
||||||
'INFO': {'version': ['1', ],
|
'INFO': {'version': ['1', ],
|
||||||
'description': 'Query projector for other information set by manufacturer.'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Query projector for other information set by manufacturer.')
|
||||||
|
},
|
||||||
'INNM': {'version': ['2', ],
|
'INNM': {'version': ['2', ],
|
||||||
'description': 'Query specified input source name'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Query specified input source name')
|
||||||
|
},
|
||||||
'INPT': {'version': ['1', ],
|
'INPT': {'version': ['1', ],
|
||||||
'description': 'Switch to specified video source.'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Switch to specified video source.')
|
||||||
|
},
|
||||||
'INST': {'version': ['1', ],
|
'INST': {'version': ['1', ],
|
||||||
'description': 'Query available input sources.'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Query available input sources.')
|
||||||
|
},
|
||||||
'IRES': {'version:': ['2', ],
|
'IRES': {'version:': ['2', ],
|
||||||
'description': 'Query current input resolution.'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Query current input resolution.')
|
||||||
|
},
|
||||||
'LAMP': {'version': ['1', ],
|
'LAMP': {'version': ['1', ],
|
||||||
'description': 'Query lamp time and on/off status. Multiple lamps supported.'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Query lamp time and on/off status. Multiple lamps supported.')
|
||||||
|
},
|
||||||
'LKUP': {'version': ['2', ],
|
'LKUP': {'version': ['2', ],
|
||||||
'description': 'UDP Status notify. Returns MAC address.'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'UDP Status notify. Includes MAC address.')
|
||||||
|
},
|
||||||
'MVOL': {'version': ['2', ],
|
'MVOL': {'version': ['2', ],
|
||||||
'description': 'Adjust microphone volume by 1 step.'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Adjust microphone volume by 1 step.')
|
||||||
|
},
|
||||||
'NAME': {'version': ['1', ],
|
'NAME': {'version': ['1', ],
|
||||||
'description': 'Query customer-set projector name.'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Query customer-set projector name.')
|
||||||
|
},
|
||||||
'PJLINK': {'version': ['1', ],
|
'PJLINK': {'version': ['1', ],
|
||||||
'description': 'Initial connection with authentication/no authentication request.'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Initial connection with authentication/no authentication request.')
|
||||||
|
},
|
||||||
'POWR': {'version': ['1', ],
|
'POWR': {'version': ['1', ],
|
||||||
'description': 'Turn lamp on or off/standby.'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Turn lamp on or off/standby.')
|
||||||
|
},
|
||||||
'RFIL': {'version': ['2', ],
|
'RFIL': {'version': ['2', ],
|
||||||
'description': 'Query replacement air filter model number.'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Query replacement air filter model number.')
|
||||||
|
},
|
||||||
'RLMP': {'version': ['2', ],
|
'RLMP': {'version': ['2', ],
|
||||||
'description': 'Query replacement lamp model number.'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Query replacement lamp model number.')
|
||||||
|
},
|
||||||
'RRES': {'version': ['2', ],
|
'RRES': {'version': ['2', ],
|
||||||
'description': 'Query recommended resolution.'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Query recommended resolution.')
|
||||||
|
},
|
||||||
'SNUM': {'version': ['2', ],
|
'SNUM': {'version': ['2', ],
|
||||||
'description': 'Query projector serial number.'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Query projector serial number.')
|
||||||
|
},
|
||||||
'SRCH': {'version': ['2', ],
|
'SRCH': {'version': ['2', ],
|
||||||
'description': 'UDP broadcast search request for available projectors.'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'UDP broadcast search request for available projectors.')
|
||||||
|
},
|
||||||
'SVER': {'version': ['2', ],
|
'SVER': {'version': ['2', ],
|
||||||
'description': 'Query projector software version number.'},
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Query projector software version number.')
|
||||||
|
},
|
||||||
'SVOL': {'version': ['2', ],
|
'SVOL': {'version': ['2', ],
|
||||||
'description': 'Adjust speaker volume by 1 step.'}
|
'description': translate('OpenLP.PJLinkConstants',
|
||||||
|
'Adjust speaker volume by 1 step.')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Error and status codes
|
# Error and status codes
|
||||||
|
@ -167,13 +167,14 @@ class Projector(CommonBase, Base):
|
|||||||
"""
|
"""
|
||||||
Return basic representation of Source table entry.
|
Return basic representation of Source table entry.
|
||||||
"""
|
"""
|
||||||
return '< Projector(id="{data}", ip="{ip}", port="{port}", pin="{pin}", name="{name}", ' \
|
return '< Projector(id="{data}", ip="{ip}", port="{port}", mac_adx="{mac}", pin="{pin}", name="{name}", ' \
|
||||||
'location="{location}", notes="{notes}", pjlink_name="{pjlink_name}", ' \
|
'location="{location}", notes="{notes}", pjlink_name="{pjlink_name}", ' \
|
||||||
'manufacturer="{manufacturer}", model="{model}", serial_no="{serial}", other="{other}", ' \
|
'manufacturer="{manufacturer}", model="{model}", serial_no="{serial}", other="{other}", ' \
|
||||||
'sources="{sources}", source_list="{source_list}", model_filter="{mfilter}", ' \
|
'sources="{sources}", source_list="{source_list}", model_filter="{mfilter}", ' \
|
||||||
'model_lamp="{mlamp}", sw_version="{sw_ver}") >'.format(data=self.id,
|
'model_lamp="{mlamp}", sw_version="{sw_ver}") >'.format(data=self.id,
|
||||||
ip=self.ip,
|
ip=self.ip,
|
||||||
port=self.port,
|
port=self.port,
|
||||||
|
mac=self.mac_adx,
|
||||||
pin=self.pin,
|
pin=self.pin,
|
||||||
name=self.name,
|
name=self.name,
|
||||||
location=self.location,
|
location=self.location,
|
||||||
@ -190,6 +191,7 @@ class Projector(CommonBase, Base):
|
|||||||
sw_ver=self.sw_version)
|
sw_ver=self.sw_version)
|
||||||
ip = Column(String(100))
|
ip = Column(String(100))
|
||||||
port = Column(String(8))
|
port = Column(String(8))
|
||||||
|
mac_adx = Column(String(18))
|
||||||
pin = Column(String(20))
|
pin = Column(String(20))
|
||||||
name = Column(String(20))
|
name = Column(String(20))
|
||||||
location = Column(String(30))
|
location = Column(String(30))
|
||||||
@ -244,7 +246,7 @@ class ProjectorDB(Manager):
|
|||||||
"""
|
"""
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
log.debug('ProjectorDB().__init__(args="{arg}", kwargs="{kwarg}")'.format(arg=args, kwarg=kwargs))
|
log.debug('ProjectorDB().__init__(args="{arg}", kwargs="{kwarg}")'.format(arg=args, kwarg=kwargs))
|
||||||
super(ProjectorDB, self).__init__(plugin_name='projector',
|
super().__init__(plugin_name='projector',
|
||||||
init_schema=self.init_schema,
|
init_schema=self.init_schema,
|
||||||
upgrade_mod=upgrade)
|
upgrade_mod=upgrade)
|
||||||
log.debug('ProjectorDB() Initialized using db url {db}'.format(db=self.db_url))
|
log.debug('ProjectorDB() Initialized using db url {db}'.format(db=self.db_url))
|
||||||
|
@ -65,6 +65,7 @@ def upgrade_2(session, metadata):
|
|||||||
new_op = get_upgrade_op(session)
|
new_op = get_upgrade_op(session)
|
||||||
if 'serial_no' not in [t.name for t in metadata.tables.values()]:
|
if 'serial_no' not in [t.name for t in metadata.tables.values()]:
|
||||||
log.debug("Upgrading projector DB to version '2'")
|
log.debug("Upgrading projector DB to version '2'")
|
||||||
|
new_op.add_column('projector', Column('mac_adx', types.String(18), server_default=null()))
|
||||||
new_op.add_column('projector', Column('serial_no', types.String(30), server_default=null()))
|
new_op.add_column('projector', Column('serial_no', types.String(30), server_default=null()))
|
||||||
new_op.add_column('projector', Column('sw_version', types.String(30), server_default=null()))
|
new_op.add_column('projector', Column('sw_version', types.String(30), server_default=null()))
|
||||||
new_op.add_column('projector', Column('model_filter', types.String(30), server_default=null()))
|
new_op.add_column('projector', Column('model_filter', types.String(30), server_default=null()))
|
||||||
|
@ -29,7 +29,7 @@ class TestProjectorConstants(TestCase):
|
|||||||
"""
|
"""
|
||||||
Test specific functions in the projector constants module.
|
Test specific functions in the projector constants module.
|
||||||
"""
|
"""
|
||||||
def build_pjlink_video_label_test(self):
|
def test_build_pjlink_video_label(self):
|
||||||
"""
|
"""
|
||||||
Test building PJLINK_DEFAULT_CODES dictionary
|
Test building PJLINK_DEFAULT_CODES dictionary
|
||||||
"""
|
"""
|
||||||
|
@ -306,10 +306,10 @@ class TestProjectorDB(TestCase):
|
|||||||
|
|
||||||
# THEN: __repr__ should return a proper string
|
# THEN: __repr__ should return a proper string
|
||||||
self.assertEqual(str(projector),
|
self.assertEqual(str(projector),
|
||||||
'< Projector(id="0", ip="127.0.0.1", port="4352", pin="None", name="Test One", '
|
'< Projector(id="0", ip="127.0.0.1", port="4352", mac_adx="None", pin="None", '
|
||||||
'location="Somewhere over the rainbow", notes="Not again", pjlink_name="TEST", '
|
'name="Test One", location="Somewhere over the rainbow", notes="Not again", '
|
||||||
'manufacturer="IN YOUR DREAMS", model="OpenLP", serial_no="None", other="None", '
|
'pjlink_name="TEST", manufacturer="IN YOUR DREAMS", model="OpenLP", serial_no="None", '
|
||||||
'sources="None", source_list="[]", model_filter="None", model_lamp="None", '
|
'other="None", sources="None", source_list="[]", model_filter="None", model_lamp="None", '
|
||||||
'sw_version="None") >',
|
'sw_version="None") >',
|
||||||
'Projector.__repr__() should have returned a proper representation string')
|
'Projector.__repr__() should have returned a proper representation string')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user