+ ''' The same as checkProgAlternatives, but for viewers '''
+ if len(rc_entry) > 1 and len(rc_entry) != len(progs) + 1:
+ logger.error("rc entry should have one item or item for each prog and not_found.")
+ sys.exit(2)
+ alt_rc_entry = []
+ for idx in range(len(progs)):
+ if len(rc_entry) == 1:
+ rcs = rc_entry[0].split('\n')
+ alt = addViewerAlternatives(rcs)
+ alt_rc_entry.insert(0, alt)
+ elif len(rc_entry) > 1:
+ rcs = rc_entry[idx].split('\n')
+ alt = addViewerAlternatives(rcs)
+ alt_rc_entry.insert(idx, alt)
+ return checkProgAlternatives(description, progs, rc_entry, alt_rc_entry, path, not_found = 'auto')
+
+
+def checkEditor(description, progs, rc_entry = [], path = []):
+ ''' The same as checkProgAlternatives, but for editors '''
+ if len(rc_entry) > 1 and len(rc_entry) != len(progs) + 1:
+ logger.error("rc entry should have one item or item for each prog and not_found.")
+ sys.exit(2)
+ alt_rc_entry = []
+ for idx in range(len(progs)):
+ if len(rc_entry) == 1:
+ rcs = rc_entry[0].split('\n')
+ alt = addEditorAlternatives(rcs)
+ alt_rc_entry.insert(0, alt)
+ elif len(rc_entry) > 1:
+ rcs = rc_entry[idx].split('\n')
+ alt = addEditorAlternatives(rcs)
+ alt_rc_entry.insert(idx, alt)
+ return checkProgAlternatives(description, progs, rc_entry, alt_rc_entry, path, not_found = 'auto')
+
+
+def checkViewerNoRC(description, progs, rc_entry = [], path = []):
+ ''' The same as checkViewer, but do not add rc entry '''
+ if len(rc_entry) > 1 and len(rc_entry) != len(progs) + 1:
+ logger.error("rc entry should have one item or item for each prog and not_found.")
+ sys.exit(2)
+ alt_rc_entry = []
+ for idx in range(len(progs)):
+ if len(rc_entry) == 1:
+ rcs = rc_entry[0].split('\n')
+ alt = addViewerAlternatives(rcs)
+ alt_rc_entry.insert(0, alt)
+ elif len(rc_entry) > 1:
+ rcs = rc_entry[idx].split('\n')
+ alt = addViewerAlternatives(rcs)
+ alt_rc_entry.insert(idx, alt)
+ rc_entry = []
+ return checkProgAlternatives(description, progs, rc_entry, alt_rc_entry, path, not_found = 'auto')
+
+
+def checkEditorNoRC(description, progs, rc_entry = [], path = []):
+ ''' The same as checkViewer, but do not add rc entry '''
+ if len(rc_entry) > 1 and len(rc_entry) != len(progs) + 1:
+ logger.error("rc entry should have one item or item for each prog and not_found.")
+ sys.exit(2)
+ alt_rc_entry = []
+ for idx in range(len(progs)):
+ if len(rc_entry) == 1:
+ rcs = rc_entry[0].split('\n')
+ alt = addEditorAlternatives(rcs)
+ alt_rc_entry.insert(0, alt)
+ elif len(rc_entry) > 1:
+ rcs = rc_entry[idx].split('\n')
+ alt = addEditorAlternatives(rcs)
+ alt_rc_entry.insert(idx, alt)
+ rc_entry = []
+ return checkProgAlternatives(description, progs, rc_entry, alt_rc_entry, path, not_found = 'auto')
+
+
+def checkViewerEditor(description, progs, rc_entry = [], path = []):
+ ''' The same as checkProgAlternatives, but for viewers and editors '''
+ checkEditorNoRC(description, progs, rc_entry, path)
+ return checkViewer(description, progs, rc_entry, path)