~alisonken1/openlp/pjlink2-f

« back to all changes in this revision

Viewing changes to openlp/core/lib/projector/constants.py

  • Committer: Tim Bentley
  • Author(s): Ken Roberts
  • Date: 2017-05-17 20:34:14 UTC
  • mfrom: (2733.1.2 pjlink2-a)
  • Revision ID: tim.bentley@gmail.com-20170517203414-ao8bliafoaa8cs43
Initial PJLink class 2 updates

- Converted PJLINK_DEFAULT_CODES from a static dictionary to dynamically-built dictionary
- Added _not_implemented method to be able to list future methods while updating
- Added class list to hold future method functionality
- Added class list for UDP commands
- Added test for building PJLINK_DEFAULT_CODES dictionary
- Added test for _not_implemented method
- Removed extraneous TODO

--------------------------------
lp:~alisonken1/openlp/pjlink2-a (revision 27...

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
           'S_INFO', 'S_NETWORK_SENDING', 'S_NETWORK_RECEIVED',
49
49
           'ERROR_STRING', 'CR', 'LF', 'PJLINK_ERST_STATUS', 'PJLINK_POWR_STATUS',
50
50
           'PJLINK_PORT', 'PJLINK_MAX_PACKET', 'TIMEOUT', 'ERROR_MSG', 'PJLINK_ERRORS',
51
 
           'STATUS_STRING', 'PJLINK_VALID_CMD', 'CONNECTION_ERRORS']
 
51
           'STATUS_STRING', 'PJLINK_VALID_CMD', 'CONNECTION_ERRORS',
 
52
           'PJLINK_DEFAULT_SOURCES', 'PJLINK_DEFAULT_CODES', 'PJLINK_DEFAULT_ITEMS']
52
53
 
53
54
# Set common constants.
54
55
CR = chr(0x0D)  # \r
321
322
    '2': translate('OpenLP.DB', 'Video'),
322
323
    '3': translate('OpenLP.DB', 'Digital'),
323
324
    '4': translate('OpenLP.DB', 'Storage'),
324
 
    '5': translate('OpenLP.DB', 'Network')
325
 
}
326
 
 
327
 
PJLINK_DEFAULT_CODES = {
328
 
    '11': translate('OpenLP.DB', 'RGB 1'),
329
 
    '12': translate('OpenLP.DB', 'RGB 2'),
330
 
    '13': translate('OpenLP.DB', 'RGB 3'),
331
 
    '14': translate('OpenLP.DB', 'RGB 4'),
332
 
    '15': translate('OpenLP.DB', 'RGB 5'),
333
 
    '16': translate('OpenLP.DB', 'RGB 6'),
334
 
    '17': translate('OpenLP.DB', 'RGB 7'),
335
 
    '18': translate('OpenLP.DB', 'RGB 8'),
336
 
    '19': translate('OpenLP.DB', 'RGB 9'),
337
 
    '21': translate('OpenLP.DB', 'Video 1'),
338
 
    '22': translate('OpenLP.DB', 'Video 2'),
339
 
    '23': translate('OpenLP.DB', 'Video 3'),
340
 
    '24': translate('OpenLP.DB', 'Video 4'),
341
 
    '25': translate('OpenLP.DB', 'Video 5'),
342
 
    '26': translate('OpenLP.DB', 'Video 6'),
343
 
    '27': translate('OpenLP.DB', 'Video 7'),
344
 
    '28': translate('OpenLP.DB', 'Video 8'),
345
 
    '29': translate('OpenLP.DB', 'Video 9'),
346
 
    '31': translate('OpenLP.DB', 'Digital 1'),
347
 
    '32': translate('OpenLP.DB', 'Digital 2'),
348
 
    '33': translate('OpenLP.DB', 'Digital 3'),
349
 
    '34': translate('OpenLP.DB', 'Digital 4'),
350
 
    '35': translate('OpenLP.DB', 'Digital 5'),
351
 
    '36': translate('OpenLP.DB', 'Digital 6'),
352
 
    '37': translate('OpenLP.DB', 'Digital 7'),
353
 
    '38': translate('OpenLP.DB', 'Digital 8'),
354
 
    '39': translate('OpenLP.DB', 'Digital 9'),
355
 
    '41': translate('OpenLP.DB', 'Storage 1'),
356
 
    '42': translate('OpenLP.DB', 'Storage 2'),
357
 
    '43': translate('OpenLP.DB', 'Storage 3'),
358
 
    '44': translate('OpenLP.DB', 'Storage 4'),
359
 
    '45': translate('OpenLP.DB', 'Storage 5'),
360
 
    '46': translate('OpenLP.DB', 'Storage 6'),
361
 
    '47': translate('OpenLP.DB', 'Storage 7'),
362
 
    '48': translate('OpenLP.DB', 'Storage 8'),
363
 
    '49': translate('OpenLP.DB', 'Storage 9'),
364
 
    '51': translate('OpenLP.DB', 'Network 1'),
365
 
    '52': translate('OpenLP.DB', 'Network 2'),
366
 
    '53': translate('OpenLP.DB', 'Network 3'),
367
 
    '54': translate('OpenLP.DB', 'Network 4'),
368
 
    '55': translate('OpenLP.DB', 'Network 5'),
369
 
    '56': translate('OpenLP.DB', 'Network 6'),
370
 
    '57': translate('OpenLP.DB', 'Network 7'),
371
 
    '58': translate('OpenLP.DB', 'Network 8'),
372
 
    '59': translate('OpenLP.DB', 'Network 9')
373
 
}
 
325
    '5': translate('OpenLP.DB', 'Network'),
 
326
    '6': translate('OpenLP.DB', 'Internal')
 
327
}
 
328
 
 
329
PJLINK_DEFAULT_ITEMS = {
 
330
    '1': translate('OpenLP.DB', '1'),
 
331
    '2': translate('OpenLP.DB', '2'),
 
332
    '3': translate('OpenLP.DB', '3'),
 
333
    '4': translate('OpenLP.DB', '4'),
 
334
    '5': translate('OpenLP.DB', '5'),
 
335
    '6': translate('OpenLP.DB', '6'),
 
336
    '7': translate('OpenLP.DB', '7'),
 
337
    '8': translate('OpenLP.DB', '8'),
 
338
    '9': translate('OpenLP.DB', '9'),
 
339
    'A': translate('OpenLP.DB', 'A'),
 
340
    'B': translate('OpenLP.DB', 'B'),
 
341
    'C': translate('OpenLP.DB', 'C'),
 
342
    'D': translate('OpenLP.DB', 'D'),
 
343
    'E': translate('OpenLP.DB', 'E'),
 
344
    'F': translate('OpenLP.DB', 'F'),
 
345
    'G': translate('OpenLP.DB', 'G'),
 
346
    'H': translate('OpenLP.DB', 'H'),
 
347
    'I': translate('OpenLP.DB', 'I'),
 
348
    'J': translate('OpenLP.DB', 'J'),
 
349
    'K': translate('OpenLP.DB', 'K'),
 
350
    'L': translate('OpenLP.DB', 'L'),
 
351
    'M': translate('OpenLP.DB', 'M'),
 
352
    'N': translate('OpenLP.DB', 'N'),
 
353
    'O': translate('OpenLP.DB', 'O'),
 
354
    'P': translate('OpenLP.DB', 'P'),
 
355
    'Q': translate('OpenLP.DB', 'Q'),
 
356
    'R': translate('OpenLP.DB', 'R'),
 
357
    'S': translate('OpenLP.DB', 'S'),
 
358
    'T': translate('OpenLP.DB', 'T'),
 
359
    'U': translate('OpenLP.DB', 'U'),
 
360
    'V': translate('OpenLP.DB', 'V'),
 
361
    'W': translate('OpenLP.DB', 'W'),
 
362
    'X': translate('OpenLP.DB', 'X'),
 
363
    'Y': translate('OpenLP.DB', 'Y'),
 
364
    'Z': translate('OpenLP.DB', 'Z')
 
365
}
 
366
 
 
367
# Due to the expanded nature of PJLink class 2 video sources,
 
368
# translate the individual types then build the video source
 
369
# dictionary from the translations.
 
370
PJLINK_DEFAULT_CODES = dict()
 
371
for source in PJLINK_DEFAULT_SOURCES:
 
372
    for item in PJLINK_DEFAULT_ITEMS:
 
373
        label = "{source}{item}".format(source=source, item=item)
 
374
        PJLINK_DEFAULT_CODES[label] = "{source} {item}".format(source=PJLINK_DEFAULT_SOURCES[source],
 
375
                                                               item=PJLINK_DEFAULT_ITEMS[item])