From 038cbfa9bbfba10a2e831dc9da887404fc2a9484 Mon Sep 17 00:00:00 2001 From: Martin Hawlisch Date: Thu, 6 Oct 2005 21:45:57 +0000 Subject: [PATCH] Print out Reports as well svn: r5284 --- gramps2/src/plugins/CmdRef.py | 100 +++++++++++++++++++--------------- 1 file changed, 55 insertions(+), 45 deletions(-) diff --git a/gramps2/src/plugins/CmdRef.py b/gramps2/src/plugins/CmdRef.py index 6a85b8def..8f895865e 100644 --- a/gramps2/src/plugins/CmdRef.py +++ b/gramps2/src/plugins/CmdRef.py @@ -57,63 +57,73 @@ class CmdRef(Tool.Tool): f.write('\n') f.write('\n') - f.write('
\n') + f.write('\n') f.write(' Reports and Tools parameter reference\n') f.write(' \n') f.write(' Reports\n') - counter=0 for item in PluginMgr.cl_list: - # self.write_ref( f, item,counter) - # counter = counter + 1 - pass + self.write_ref( f, item) f.write(' \n') - f.write(' \n') + f.write(' \n') f.write(' Tools\n') for item in PluginMgr.cli_tool_list: - self.write_ref( f, item, counter) - counter = counter + 1 - f.write(' \n') - f.write(' \n') - f.write(' \n') - f.write(' \n') - f.write('
\n') + self.write_ref( f, item) + f.write(' ') + f.write(' ') + f.write(' ') + f.write(' ') + f.write('') f.flush() os.spawnlp( os.P_WAIT, "yelp", "yelp", fname) f.close() - def write_ref( self, f, item,counter): - f.write('\n' % counter) - f.write(' %s\n' % item[0]) - f.write(' \n') - f.write(' Options\n') - f.write(' \n') - oclass = item[3]( item[0]) - print oclass - for arg in oclass.options_help.keys(): - f.write(' \n') - f.write(' \n') - f.write(' %s: %s\n' % (arg, oclass.options_help[arg][0])) - f.write(' \n') - f.write(' %s\n' % oclass.options_help[arg][1]) - if type(oclass.options_help[arg][2]) in [list,tuple]: - if oclass.options_help[arg][3]: - f.write(' \n') - for val in oclass.options_help[arg][2]: - f.write( " %s\n" % val) - f.write(' \n') - else: - f.write(' \n') - for val in oclass.options_help[arg][2]: - f.write( " %s\n" % val) - f.write(' \n') - else: - f.write(' Value: %s\n' % oclass.options_help[arg][2]) - f.write(' \n') - f.write(' \n') - f.write(' \n') + def fix(self,line): + l = line.strip() + l = l.replace('&','&') + l = l.replace('>','>') + l = l.replace('<','<') + return l.replace('"','"') - f.write(' \n') - f.write(' \n') + def write_ref( self, f, item): + f.write('\n' % item[0]) + f.write(' %s\n' % self.fix(item[0])) + try: # For Tools + oclass = item[3]( item[0]) + except: # For Reports + oclass = item[3] + try: + ohelp = oclass.options_help + except: + ohelp = None + if ohelp: + f.write(' \n') + f.write(' Options\n') + f.write(' \n') + for arg in ohelp.keys(): + f.write(' \n') + f.write(' \n') + f.write(' %s: %s\n' % (self.fix(arg), self.fix(ohelp[arg][0]))) + f.write(' \n') + f.write(' %s\n' % self.fix(ohelp[arg][1])) + if type(ohelp[arg][2]) in [list,tuple]: + if ohelp[arg][3]: + f.write(' \n') + for val in ohelp[arg][2]: + f.write( " %s\n" % self.fix(val)) + f.write(' \n') + else: + f.write(' \n') + for val in ohelp[arg][2]: + f.write( " %s\n" % self.fix(val)) + f.write(' \n') + else: + f.write(' Value: %s\n' % self.fix(ohelp[arg][2])) + f.write(' \n') + f.write(' \n') + f.write(' \n') + + f.write(' \n') + f.write(' \n') f.write('\n') #------------------------------------------------------------------------