Author: jrioux
Date: Thu Jun 16 00:27:44 2011
New Revision: 39078
URL: http://www.lyx.org/trac/changeset/39078
Log:
configure.py : Allow to specify alt_type as a list.
The intend is to specify ['editor', 'viewer'] eventually.
Still no change in the produced output and in lyxrc.defaults
Modified:
lyx-devel/trunk/lib/configure.py
Modified: lyx-devel/trunk/lib/configure.py
==============================================================================
--- lyx-devel/trunk/lib/configure.py Thu Jun 16 00:24:30 2011 (r39077)
+++ lyx-devel/trunk/lib/configure.py Thu Jun 16 00:27:44 2011 (r39078)
@@ -263,30 +263,34 @@
def addAlternatives(rcs, alt_type):
'''
Returns a \\prog_alternatives string to be used as an alternative
- rc entry.
+ rc entry. alt_type can be a string or a list of strings.
'''
r = re.compile(r'\\Format (\S+).*$')
m = None
alt = ''
- alt_token = '\\%s_alternatives ' % alt_type
+ alt_token = '\\%s_alternatives '
+ if isinstance(alt_type, str):
+ alt_tokens = [alt_token % alt_type]
+ else:
+ alt_tokens = map(lambda s: alt_token % s, alt_type)
for idxx in range(len(rcs)):
if len(rcs) == 1:
m = r.match(rcs[0])
if m:
- alt = alt_token + m.group(1) + " %%"
+ alt = '\n'.join([s + m.group(1) + " %%" for s in alt_tokens])
elif len(rcs) > 1:
m = r.match(rcs[idxx])
if m:
if idxx > 0:
alt += '\n'
- alt += alt_token + m.group(1) + " %%"
+ alt += '\n'.join([s + m.group(1) + " %%" for s in alt_tokens])
return alt
def listAlternatives(progs, alt_type, rc_entry = []):
'''
Returns a list of \\prog_alternatives strings to be used as alternative
- rc entries.
+ rc entries. alt_type can be a string or a list of strings.
'''
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.")