From 19db60b609bb0332ef8ea6d479e5f95d0b69bf83 Mon Sep 17 00:00:00 2001 From: Martin Hawlisch Date: Thu, 6 Oct 2005 20:07:25 +0000 Subject: [PATCH] * src/plugins/CmdRef.py: New file. Work in progress. svn: r5282 --- gramps2/ChangeLog | 3 + gramps2/src/plugins/CmdRef.py | 134 ++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 gramps2/src/plugins/CmdRef.py diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 4b10b7e74..b0947de99 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,6 @@ +2005-10-06 Martin Hawlisch + * src/plugins/CmdRef.py: New file. + 2005-10-06 Don Allingham * src/docgen/AbiWord2Doc.py: handle superscript properly * src/ReportUtils.py: remove name generation from list_person_str diff --git a/gramps2/src/plugins/CmdRef.py b/gramps2/src/plugins/CmdRef.py new file mode 100644 index 000000000..69a90bb60 --- /dev/null +++ b/gramps2/src/plugins/CmdRef.py @@ -0,0 +1,134 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2000-2005 Donald N. Allingham +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +# $Id$ + +"Export Report and Tools commandline parameters to DocBook XML" + +import os + +#------------------------------------------------------------------------- +# +# python modules +# +#------------------------------------------------------------------------- +import tempfile +from gettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +import Tool +import Utils +import PluginMgr + +#------------------------------------------------------------------------- +# +# runTool +# +#------------------------------------------------------------------------- +class CmdRef(Tool.Tool): + def __init__(self,db,person,options_class,name,callback=None,parent=None): + Tool.Tool.__init__(self,db,person,options_class,name) + + cli = int(parent == None) + + f = tempfile.NamedTemporaryFile() + fname = f.name + f.write('') + f.write('') + f.write('') + f.write('') + f.write(' Reports and Tools parameter reference') + f.write(' ') + f.write(' Reports') + for item in PluginMgr.cl_list: + pass + #self.write_ref( f, item) + f.write(' ') + f.write(' ') + f.write(' Tools') + for item in PluginMgr.cli_tool_list: + 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): + f.write('') + f.write(' %s' % item[0]) + f.write(' ') + f.write(' Options') + f.write(' ') + oclass = item[3]( item[0]) + print oclass + for arg in oclass.options_help.keys(): + f.write(' ') + f.write(' ') + f.write(' %s: %s' % (arg, oclass.options_help[arg][0])) + f.write(' ') + f.write(' %s' % oclass.options_help[arg][1]) + if type(oclass.options_help[arg][2]) in [list,tuple]: + if oclass.options_help[arg][3]: + f.write(' ') + for val in oclass.options_help[arg][2]: + f.write( " %s" % val) + f.write(' ') + else: + f.write(' ') + for val in oclass.options_help[arg][2]: + f.write( " %s" % val) + f.write(' ') + else: + f.write(' Value: %s' % oclass.options_help[arg][2]) + f.write(' ') + f.write(' ') + f.write(' ') + + f.write(' ') + f.write(' ') + f.write('') + +#------------------------------------------------------------------------ +# +# +# +#------------------------------------------------------------------------ +from PluginMgr import register_tool + +register_tool( + name = 'cmdref', + category = Tool.TOOL_DEBUG, + tool_class = CmdRef, + options_class = Tool.ToolOptions, + modes = Tool.MODE_GUI | Tool.MODE_CLI, + translated_name = _("Generate Commandline Reference for Reports and Tools"), + author_name = "Martin Hawlisch", + author_email = "martin@hawlisch.de", + description=_("Generates a DocBook XML file that contains a parameter reference of Reports and Tools.") + )