Generate script docs

This commit is contained in:
Yevgen Muntyan 2010-12-23 16:24:52 -08:00
parent df35c0313c
commit 619597e275
18 changed files with 1545 additions and 42 deletions

View File

@ -17,10 +17,17 @@ genlua_files = \
mpi/module.py \ mpi/module.py \
mpi/luawriter.py mpi/luawriter.py
gendocs_files = \
gendocs.py \
mpi/__init__.py \
mpi/module.py \
mpi/texiwriter.py
EXTRA_DIST = \ EXTRA_DIST = \
$(docparser_files) \ $(docparser_files) \
$(gendefs_files) \ $(gendefs_files) \
$(genlua_files) \ $(genlua_files) \
$(gendocs_files) \
sourcefiles.mak \ sourcefiles.mak \
moo.xml moo.xml

22
api/gendocs.py Normal file
View File

@ -0,0 +1,22 @@
#! /usr/bin/env python
import sys
import optparse
from mpi.module import Module
from mpi.texiwriter import Writer
op = optparse.OptionParser()
op.add_option("--python", action="store_true")
op.add_option("--lua", action="store_true")
(opts, args) = op.parse_args()
assert len(args) == 1
assert bool(opts.python) + bool(opts.lua) == 1
if opts.python:
mode = 'python'
elif opts.lua:
mode = 'lua'
mod = Module.from_xml(args[0])
Writer(mode, sys.stdout).write(mod)

View File

@ -22,6 +22,7 @@ class DoxBlock(object):
self.params = [] self.params = []
self.attributes = [] self.attributes = []
self.docs = [] self.docs = []
self.summary = None
self.__parse(block) self.__parse(block)
@ -62,6 +63,7 @@ class DoxBlock(object):
self.symbol = chunks[0][0] self.symbol = chunks[0][0]
self.annotations = chunks[0][1] self.annotations = chunks[0][1]
self.summary = chunks[0][2]
for chunk in chunks[1:]: for chunk in chunks[1:]:
if chunk[0]: if chunk[0]:
@ -282,6 +284,7 @@ class Parser(object):
raise ParseError('bad function name %s' % (db.symbol,), block) raise ParseError('bad function name %s' % (db.symbol,), block)
func = Function(db.symbol, db.annotations, params, retval, db.docs, block) func = Function(db.symbol, db.annotations, params, retval, db.docs, block)
func.summary = db.summary
if DEBUG: if DEBUG:
print 'func.name:', func.name print 'func.name:', func.name
if func.name in self.__functions_dict: if func.name in self.__functions_dict:
@ -302,6 +305,7 @@ class Parser(object):
raise ParseError('class attributes', block) raise ParseError('class attributes', block)
cls = Class(name, db.annotations, db.docs, block) cls = Class(name, db.annotations, db.docs, block)
cls.summary = db.summary
self.classes.append(cls) self.classes.append(cls)
def __parse_boxed(self, block): def __parse_boxed(self, block):
@ -324,6 +328,7 @@ class Parser(object):
raise ParseError('boxed attributes', block) raise ParseError('boxed attributes', block)
cls = What(name, db.annotations, db.docs, block) cls = What(name, db.annotations, db.docs, block)
cls.summary = db.summary
self.classes.append(cls) self.classes.append(cls)
def __parse_enum(self, block): def __parse_enum(self, block):
@ -339,6 +344,7 @@ class Parser(object):
raise ParseError('enum attributes', block) raise ParseError('enum attributes', block)
enum = Enum(name, db.annotations, db.docs, block) enum = Enum(name, db.annotations, db.docs, block)
enum.summary = db.summary
self.enums.append(enum) self.enums.append(enum)
def __parse_flags(self, block): def __parse_flags(self, block):
@ -354,6 +360,7 @@ class Parser(object):
raise ParseError('flags attributes', block) raise ParseError('flags attributes', block)
flags = Flags(name, db.annotations, db.docs, block) flags = Flags(name, db.annotations, db.docs, block)
flags.summary = db.summary
self.enums.append(flags) self.enums.append(flags)
def __parse_block(self, block): def __parse_block(self, block):

View File

@ -100,6 +100,7 @@ class Symbol(object):
self.name = name self.name = name
self.c_name = c_name self.c_name = c_name
self.docs = docs self.docs = docs
self.summary = None
self.annotations = {} self.annotations = {}
class FunctionBase(Symbol): class FunctionBase(Symbol):
@ -188,6 +189,7 @@ class Module(object):
else: else:
raise RuntimeError("unknown annotation '%s' in class %s" % (a, name)) raise RuntimeError("unknown annotation '%s' in class %s" % (a, name))
cls = Class(name, short_name, parent, gtype_id, docs) cls = Class(name, short_name, parent, gtype_id, docs)
cls.summary = pcls.summary
cls.annotations = annotations cls.annotations = annotations
cls.constructable = constructable cls.constructable = constructable
self.classes.append(cls) self.classes.append(cls)
@ -207,6 +209,7 @@ class Module(object):
else: else:
raise RuntimeError("unknown annotation '%s' in class %s" % (a, name)) raise RuntimeError("unknown annotation '%s' in class %s" % (a, name))
cls = What(name, short_name, gtype_id, docs) cls = What(name, short_name, gtype_id, docs)
cls.summary = pcls.summary
cls.annotations = annotations cls.annotations = annotations
self.boxed.append(cls) self.boxed.append(cls)
self.__class_dict[name] = cls self.__class_dict[name] = cls
@ -236,6 +239,7 @@ class Module(object):
enum = Enum(name, short_name, gtype_id, docs) enum = Enum(name, short_name, gtype_id, docs)
else: else:
enum = Flags(name, short_name, gtype_id, docs) enum = Flags(name, short_name, gtype_id, docs)
enum.summary = ptyp.summary
enum.annotations = annotations enum.annotations = annotations
self.enums.append(enum) self.enums.append(enum)
@ -429,12 +433,14 @@ class Module(object):
if constructor_of: if constructor_of:
func = Function(name, c_name, params, retval, docs) func = Function(name, c_name, params, retval, docs)
func.summary = pfunc.summary
func.annotations = annotations func.annotations = annotations
if constructor_of in self.__constructors: if constructor_of in self.__constructors:
raise RuntimeError('duplicated constructor of class %s' % constructor_of) raise RuntimeError('duplicated constructor of class %s' % constructor_of)
self.__constructors[constructor_of] = func self.__constructors[constructor_of] = func
elif cls: elif cls:
meth = Method(name, c_name, cls, params[1:], retval, docs) meth = Method(name, c_name, cls, params[1:], retval, docs)
meth.summary = pfunc.summary
meth.annotations = annotations meth.annotations = annotations
this_class_methods = self.__methods.get(cls) this_class_methods = self.__methods.get(cls)
if not this_class_methods: if not this_class_methods:
@ -443,6 +449,7 @@ class Module(object):
this_class_methods.append(meth) this_class_methods.append(meth)
else: else:
func = Function(name, c_name, params, retval, docs) func = Function(name, c_name, params, retval, docs)
func.summary = pfunc.summary
func.annotations = annotations func.annotations = annotations
self.functions.append(func) self.functions.append(func)

View File

@ -37,6 +37,16 @@ class Writer(object):
self.xml.data(docs) self.xml.data(docs)
self.__end_tag('doc') self.__end_tag('doc')
def __write_summary(self, summary):
if not summary:
return
self.__start_tag('summary')
if isinstance(summary, list):
assert len(summary) == 1
summary = summary[0]
self.xml.data(summary)
self.__end_tag('summary')
def __write_param_or_retval_annotations(self, param, elm): def __write_param_or_retval_annotations(self, param, elm):
for k in param.attributes: for k in param.attributes:
elm.set(k, self.attributes[v]) elm.set(k, self.attributes[v])
@ -96,13 +106,14 @@ class Writer(object):
if cls.constructable: if cls.constructable:
dic['constructable'] = '1' dic['constructable'] = '1'
self.__start_tag('class', dic) self.__start_tag('class', dic)
self.__write_summary(cls.summary)
self.__write_docs(cls.docs)
if cls.constructor is not None: if cls.constructor is not None:
self.__write_function(cls.constructor, 'constructor') self.__write_function(cls.constructor, 'constructor')
for meth in sorted(cls.vmethods, lambda x, y: cmp(x.name, y.name)): for meth in sorted(cls.vmethods, lambda x, y: cmp(x.name, y.name)):
self.__write_function(meth, 'virtual') self.__write_function(meth, 'virtual')
for meth in sorted(cls.methods, lambda x, y: cmp(x.name, y.name)): for meth in sorted(cls.methods, lambda x, y: cmp(x.name, y.name)):
self.__write_function(meth, 'method') self.__write_function(meth, 'method')
self.__write_docs(cls.docs)
self.__end_tag('class') self.__end_tag('class')
def __write_boxed(self, cls): def __write_boxed(self, cls):
@ -111,11 +122,12 @@ class Writer(object):
dic[k] = cls.annotations[k] dic[k] = cls.annotations[k]
tag = 'boxed' if isinstance(cls, module.Boxed) else 'pointer' tag = 'boxed' if isinstance(cls, module.Boxed) else 'pointer'
self.__start_tag(tag, dic) self.__start_tag(tag, dic)
self.__write_summary(cls.summary)
self.__write_docs(cls.docs)
if cls.constructor is not None: if cls.constructor is not None:
self.__write_function(cls.constructor, 'constructor') self.__write_function(cls.constructor, 'constructor')
for meth in cls.methods: for meth in cls.methods:
self.__write_function(meth, 'method') self.__write_function(meth, 'method')
self.__write_docs(cls.docs)
self.__end_tag(tag) self.__end_tag(tag)
def __write_enum(self, enum): def __write_enum(self, enum):
@ -127,6 +139,7 @@ class Writer(object):
for k in enum.annotations: for k in enum.annotations:
dic[k] = enum.annotations[k] dic[k] = enum.annotations[k]
self.__start_tag(tag, dic) self.__start_tag(tag, dic)
self.__write_summary(enum.summary)
self.__write_docs(enum.docs) self.__write_docs(enum.docs)
self.__end_tag(tag) self.__end_tag(tag)
@ -141,6 +154,7 @@ class Writer(object):
self.__write_param(p) self.__write_param(p)
if func.retval: if func.retval:
self.__write_retval(func.retval) self.__write_retval(func.retval)
self.__write_summary(func.summary)
self.__write_docs(func.docs) self.__write_docs(func.docs)
self.__end_tag(tag) self.__end_tag(tag)

View File

@ -171,15 +171,10 @@ class Writer(object):
is_constructor = isinstance(meth, Constructor) is_constructor = isinstance(meth, Constructor)
own_return = is_constructor or (meth.retval and meth.retval.transfer_mode == 'full') own_return = is_constructor or (meth.retval and meth.retval.transfer_mode == 'full')
has_gerror_return = False
params = [] params = []
for i in range(len(meth.params)): for i in range(len(meth.params)):
p = meth.params[i] p = meth.params[i]
# if isinstance(p.type, GErrorReturnType):
# print >> sys.stderr, "Skipping function %s because of 'GError**' parameter" % meth.c_name
# return
if not p.type.name in _arg_helpers and not isinstance(p.type, ArrayType) and \ if not p.type.name in _arg_helpers and not isinstance(p.type, ArrayType) and \
not isinstance(p.type, GTypedType) and not isinstance(p.type, GErrorReturnType): not isinstance(p.type, GTypedType) and not isinstance(p.type, GErrorReturnType):
print >> sys.stderr, "Skipping function %s because of '%s' parameter" % (meth.c_name, p.type.name) print >> sys.stderr, "Skipping function %s because of '%s' parameter" % (meth.c_name, p.type.name)
@ -187,7 +182,7 @@ class Writer(object):
if isinstance(p.type, GErrorReturnType): if isinstance(p.type, GErrorReturnType):
assert i == len(meth.params) - 1 assert i == len(meth.params) - 1
has_gerror_return = True assert meth.has_gerror_return
else: else:
params.append(p) params.append(p)
@ -217,7 +212,7 @@ class Writer(object):
self.__write_function_param(func_body, p, i, meth, None if is_constructor else cls) self.__write_function_param(func_body, p, i, meth, None if is_constructor else cls)
i += 1 i += 1
if has_gerror_return: if meth.has_gerror_return:
func_body.start.append('GError *error = NULL;') func_body.start.append('GError *error = NULL;')
if meth.retval: if meth.retval:
@ -258,7 +253,7 @@ class Writer(object):
else: else:
push_ret = '0;' push_ret = '0;'
if not has_gerror_return: if not meth.has_gerror_return:
func_body.end.append('return %s' % push_ret) func_body.end.append('return %s' % push_ret)
else: else:
func_body.end.append('int ret_lua = %s' % push_ret) func_body.end.append('int ret_lua = %s' % push_ret)
@ -275,7 +270,7 @@ class Writer(object):
func_call += ', ' func_call += ', '
first_arg = False first_arg = False
func_call += 'arg%d' % i func_call += 'arg%d' % i
if has_gerror_return: if meth.has_gerror_return:
func_call += ', &error' func_call += ', &error'
func_call += ');' func_call += ');'

View File

@ -28,6 +28,7 @@ class _XmlObject(object):
def __init__(self): def __init__(self):
object.__init__(self) object.__init__(self)
self.doc = None self.doc = None
self.summary = None
self.annotations = {} self.annotations = {}
@classmethod @classmethod
@ -37,8 +38,8 @@ class _XmlObject(object):
return obj return obj
def _parse_xml_element(self, elm): def _parse_xml_element(self, elm):
if elm.tag == 'doc': if elm.tag in ('doc', 'summary'):
_set_unique_attribute(self, 'doc', Doc.from_xml(elm)) _set_unique_attribute(self, elm.tag, Doc.from_xml(elm))
else: else:
raise RuntimeError('unknown element %s' % (elm.tag,)) raise RuntimeError('unknown element %s' % (elm.tag,))
@ -299,6 +300,10 @@ class Module(object):
if meth.retval: if meth.retval:
meth.retval.type = self.__finish_type(meth.retval.type) meth.retval.type = self.__finish_type(meth.retval.type)
meth.has_gerror_return = False
if meth.params and isinstance(meth.params[-1].type, GErrorReturnType):
meth.has_gerror_return = True
def __finish_parsing_type(self, typ): def __finish_parsing_type(self, typ):
if hasattr(typ, 'constructor') and typ.constructor is not None: if hasattr(typ, 'constructor') and typ.constructor is not None:
self.__finish_parsing_method(typ.constructor, typ) self.__finish_parsing_method(typ.constructor, typ)

205
api/mpi/texiwriter.py Normal file
View File

@ -0,0 +1,205 @@
import StringIO
from mpi.util import *
from mpi.module import *
lua_constants = {
'NULL': 'nil',
'TRUE': 'true',
'FALSE': 'false',
}
python_constants = {
'NULL': 'None',
'TRUE': 'True',
'FALSE': 'False',
}
def split_camel_case_name(name):
comps = []
cur = ''
for c in name:
if c.islower() or not cur:
cur += c
else:
comps.append(cur)
cur = c
if cur:
comps.append(cur)
return comps
def name_all_caps(cls):
return '_'.join([s.upper() for s in split_camel_case_name(cls.name)])
class Writer(object):
def __init__(self, mode, out):
super(Writer, self).__init__()
self.out = out
self.mode = mode
self.part_body = StringIO.StringIO()
self.part_menu = StringIO.StringIO()
if mode == 'python':
self.constants = python_constants
elif mode == 'lua':
self.constants = lua_constants
else:
oops('unknown mode %s' % mode)
self.section_suffix = ' (%s)' % self.mode.capitalize()
def __check_bind_ann(self, obj):
bind = obj.annotations.get('moo.' + self.mode, '1')
if bind == '0':
return False
elif bind == '1':
return True
else:
oops()
def __format_constant(self, value):
if value in self.constants:
return self.constants[value]
try:
i = int(value)
return value
except ValueError:
pass
oops("unknown constant '%s'" % value)
def __format_doc(self, text):
text = re.sub(r'@([\w\d_]+)(?!\{)', r'@param{\1}', text)
text = re.sub(r'%method{', r'@method{', text)
text = re.sub(r'%NULL\b', '@code{%s}' % self.constants['NULL'], text)
text = re.sub(r'%TRUE\b', '@code{%s}' % self.constants['TRUE'], text)
text = re.sub(r'%FALSE\b', '@code{%s}' % self.constants['FALSE'], text)
assert not re.search(r'NULL|TRUE|FALSE', text)
return text
def __make_class_name(self, cls):
if self.mode == 'python':
return 'moo.%s' % cls.short_name
elif self.mode == 'lua':
return 'medit.%s' % cls.short_name
else:
oops()
def __write_function(self, func, cls):
if not self.__check_bind_ann(func):
return
func_params = list(func.params)
if func.has_gerror_return:
func_params = func_params[:-1]
params = []
for p in func_params:
if p.default_value is not None:
params.append('%s=%s' % (p.name, self.__format_constant(p.default_value)))
else:
params.append(p.name)
dic = dict(func=func.name,
params=', '.join(params))
self.part_body.write("""\
@item %(func)s(%(params)s)
""" % dic)
if func.doc:
self.part_body.write(self.__format_doc(func.doc.text))
self.part_body.write('\n')
self.part_body.write('\n')
def __write_class(self, cls):
if not self.__check_bind_ann(cls):
return
do_write = False
if cls.constructor is not None and self.__check_bind_ann(cls.constructor):
do_write = True
else:
for meth in cls.methods:
if self.__check_bind_ann(meth):
do_write = True
break
if not do_write:
return
dic = dict(Class=self.__make_class_name(cls),
HELPSECTION='SCRIPT_%s_%s' % (self.mode.upper(), name_all_caps(cls)),
section_suffix=self.section_suffix,
summary=cls.summary.text + '.' if cls.summary else '',
subsection='class %s' % self.__make_class_name(cls))
self.part_menu.write("""\
* %(Class)s%(section_suffix)s:: %(summary)s
""" % dic)
self.part_body.write("""\
@node %(Class)s%(section_suffix)s
@subsection %(subsection)s
@helpsection{%(HELPSECTION)s}
""" % dic)
if cls.doc:
self.part_body.write(self.__format_doc(cls.doc.text))
self.part_body.write('\n')
self.part_body.write("""\
@table @method
""" % dic)
if cls.constructor is not None:
self.__write_function(cls.constructor, cls)
if hasattr(cls, 'constructable') and cls.constructable:
implement_me('GObject constructor of %s' % cls.name)
if isinstance(cls, Class):
if cls.vmethods:
implement_me('virtual methods of %s' % cls.name)
for meth in cls.methods:
self.__write_function(meth, cls)
self.part_body.write("""\
@end table
""" % dic)
def write(self, module):
self.module = module
self.part_menu.write("""\
@menu
""")
for cls in module.get_classes() + module.get_boxed() + module.get_pointers():
self.__write_class(cls)
dic = dict(HELPSECTION='SCRIPT_%s_FUNCTIONS' % self.mode.upper(),
section_suffix=self.section_suffix)
self.part_menu.write("""\
* Functions%(section_suffix)s:: Functions.
""" % dic)
self.part_body.write("""\
@node Functions%(section_suffix)s
@subsection Functions
@helpsection{%(HELPSECTION)s}
@table @method
""" % dic)
for func in module.get_functions():
self.__write_function(func, None)
self.part_body.write("""\
@end table
""" % dic)
self.part_menu.write("""\
@end menu
""")
self.out.write(self.part_menu.getvalue())
self.out.write(self.part_body.getvalue())
del self.module

9
api/mpi/util.py Normal file
View File

@ -0,0 +1,9 @@
import sys
__all__ = [ 'implement_me', 'oops' ]
def implement_me(what):
print >> sys.stderr, 'implement me: %s' % what
def oops(message=None):
raise RuntimeError(message)

View File

@ -7,21 +7,37 @@ src_texinfo_files = \
user-tools.texi \ user-tools.texi \
regex.texi \ regex.texi \
license.texi \ license.texi \
script.texi script.texi \
script-python.texi \
script-lua.texi
medit.texi: medit.texi.in $(top_builddir)/config.status medit.texi: medit.texi.in $(top_builddir)/config.status
$(AM_V_GEN)cd $(top_builddir) && ./config.status --silent --file=doc/medit.texi $(AM_V_GEN)cd $(top_builddir) && ./config.status --silent --file=doc/medit.texi
$(AM_V_at)mv medit.texi $(srcdir)/medit.texi $(AM_V_at)mv medit.texi $(srcdir)/medit.texi
# mooscript.texi: $(top_srcdir)/moo/mooscript/mooscript-classes-impl.cpp $(top_srcdir)/moo/mooscript/gendoc.py gendocs_files = \
# $(AM_V_GEN)$(PYTHON) $(top_srcdir)/moo/mooscript/gendoc.py $(top_srcdir)/moo/mooscript/mooscript-classes-impl.cpp \ $(top_srcdir)/api/gendocs.py \
# > mooscript.texi.tmp && mv mooscript.texi.tmp $(srcdir)/mooscript.texi $(top_srcdir)/api/mpi/__init__.py \
$(top_srcdir)/api/mpi/module.py \
$(top_srcdir)/api/mpi/texiwriter.py
script-python.texi: $(gendocs_files) $(top_srcdir)/api/moo.xml
$(AM_V_GEN)$(PYTHON) $(top_srcdir)/api/gendocs.py --python $(top_srcdir)/api/moo.xml \
> script-python.texi.tmp && mv script-python.texi.tmp $(srcdir)/script-python.texi
script-lua.texi: $(gendocs_files) $(top_srcdir)/api/moo.xml
$(AM_V_GEN)$(PYTHON) $(top_srcdir)/api/gendocs.py --lua $(top_srcdir)/api/moo.xml \
> script-lua.texi.tmp && mv script-lua.texi.tmp $(srcdir)/script-lua.texi
help/index.html: $(src_texinfo_files) help/index.html: $(src_texinfo_files)
$(AM_V_at)rm -f $(srcdir)/help/*.html $(AM_V_at)rm -f $(srcdir)/help/*.html
$(AM_V_at)$(MKDIR_P) $(srcdir)/help $(AM_V_at)$(MKDIR_P) $(srcdir)/help
$(AM_V_GEN)cd $(srcdir) && makeinfo --html medit.texi $(AM_V_GEN)cd $(srcdir) && makeinfo --html medit.texi
help/help.html: help/index.html
$(AM_V_at)rm -f $(srcdir)/help/help.html
$(AM_V_GEN)cd $(srcdir) && makeinfo --html --no-split medit.texi && mv help.html help/
help-sections.h.stamp: help/index.html $(srcdir)/gensections.py help-sections.h.stamp: help/index.html $(srcdir)/gensections.py
$(AM_V_GEN)$(PYTHON) $(srcdir)/gensections.py $(srcdir)/help/*.html > help-sections.h.tmp && \ $(AM_V_GEN)$(PYTHON) $(srcdir)/gensections.py $(srcdir)/help/*.html > help-sections.h.tmp && \
(cmp -s help-sections.h.tmp $(srcdir)/help-sections.h || mv help-sections.h.tmp $(srcdir)/help-sections.h) (cmp -s help-sections.h.tmp $(srcdir)/help-sections.h || mv help-sections.h.tmp $(srcdir)/help-sections.h)
@ -29,7 +45,7 @@ help-sections.h.stamp: help/index.html $(srcdir)/gensections.py
$(AM_V_at)echo stamp > help-sections.h.stamp $(AM_V_at)echo stamp > help-sections.h.stamp
all-am: doc all-am: doc
doc: help/index.html help-sections.h.stamp medit.1 doc: help/index.html help/help.html help-sections.h.stamp medit.1
man-medit.t2t: man-medit.t2t.in $(top_builddir)/config.status man-medit.t2t: man-medit.t2t.in $(top_builddir)/config.status
$(AM_V_GEN)cd $(top_builddir) && ./config.status --silent --file=doc/man-medit.t2t $(AM_V_GEN)cd $(top_builddir) && ./config.status --silent --file=doc/man-medit.t2t
@ -41,7 +57,7 @@ medit.1: man-medit.t2t
endif endif
EXTRA_DIST = help help-sections.h medit.1 EXTRA_DIST = help help.html help-sections.h medit.1
install-data-local: install-data-local:
$(MKDIR_P) $(DESTDIR)$(MOO_HELP_DIR) $(MKDIR_P) $(DESTDIR)$(MOO_HELP_DIR)

View File

@ -15,7 +15,7 @@
#define HELP_SECTION_LICENSE_XDG_UTILS "xdg_002dutils-License.html" #define HELP_SECTION_LICENSE_XDG_UTILS "xdg_002dutils-License.html"
#define HELP_SECTION_PREFS_ACCELS "index.html" #define HELP_SECTION_PREFS_ACCELS "index.html"
#define HELP_SECTION_PREFS_DIALOG "index.html" #define HELP_SECTION_PREFS_DIALOG "index.html"
#define HELP_SECTION_PREFS_FILE "meditrc.html" #define HELP_SECTION_PREFS_FILE "prefs_002exml.html"
#define HELP_SECTION_PREFS_FILE_FILTERS "File-filters-tab.html" #define HELP_SECTION_PREFS_FILE_FILTERS "File-filters-tab.html"
#define HELP_SECTION_PREFS_FILE_SELECTOR "index.html" #define HELP_SECTION_PREFS_FILE_SELECTOR "index.html"
#define HELP_SECTION_PREFS_LANGS_AND_FILTERS "Preferences.html" #define HELP_SECTION_PREFS_LANGS_AND_FILTERS "Preferences.html"
@ -23,6 +23,45 @@
#define HELP_SECTION_PREFS_PLUGINS "index.html" #define HELP_SECTION_PREFS_PLUGINS "index.html"
#define HELP_SECTION_REGEX "Regular-expressions.html" #define HELP_SECTION_REGEX "Regular-expressions.html"
#define HELP_SECTION_SCRIPT "Scripting.html" #define HELP_SECTION_SCRIPT "Scripting.html"
#define HELP_SECTION_SCRIPT_LUA_FUNCTIONS "Functions-_0028Lua_0029.html"
#define HELP_SECTION_SCRIPT_LUA_MOO_APP "medit_002eApp-_0028Lua_0029.html"
#define HELP_SECTION_SCRIPT_LUA_MOO_COMMAND "medit_002eCommand-_0028Lua_0029.html"
#define HELP_SECTION_SCRIPT_LUA_MOO_COMMAND_CONTEXT "medit_002eCommandContext-_0028Lua_0029.html"
#define HELP_SECTION_SCRIPT_LUA_MOO_COMMAND_DATA "medit_002eCommandData-_0028Lua_0029.html"
#define HELP_SECTION_SCRIPT_LUA_MOO_EDIT "medit_002eEdit-_0028Lua_0029.html"
#define HELP_SECTION_SCRIPT_LUA_MOO_EDITOR "medit_002eEditor-_0028Lua_0029.html"
#define HELP_SECTION_SCRIPT_LUA_MOO_EDIT_OPEN_INFO "medit_002eEditOpenInfo-_0028Lua_0029.html"
#define HELP_SECTION_SCRIPT_LUA_MOO_EDIT_RELOAD_INFO "medit_002eEditReloadInfo-_0028Lua_0029.html"
#define HELP_SECTION_SCRIPT_LUA_MOO_EDIT_SAVE_INFO "medit_002eEditSaveInfo-_0028Lua_0029.html"
#define HELP_SECTION_SCRIPT_LUA_MOO_EDIT_WINDOW "medit_002eEditWindow-_0028Lua_0029.html"
#define HELP_SECTION_SCRIPT_LUA_MOO_PANE "medit_002ePane-_0028Lua_0029.html"
#define HELP_SECTION_SCRIPT_LUA_MOO_PANE_LABEL "medit_002ePaneLabel-_0028Lua_0029.html"
#define HELP_SECTION_SCRIPT_LUA_MOO_PANE_PARAMS "medit_002ePaneParams-_0028Lua_0029.html"
#define HELP_SECTION_SCRIPT_LUA_MOO_TEXT_VIEW "medit_002eTextView-_0028Lua_0029.html"
#define HELP_SECTION_SCRIPT_LUA_MOO_UI_NODE "medit_002eUiNode-_0028Lua_0029.html"
#define HELP_SECTION_SCRIPT_LUA_MOO_UI_XML "medit_002eUiXml-_0028Lua_0029.html"
#define HELP_SECTION_SCRIPT_PYTHON_FUNCTIONS "Functions-_0028Python_0029.html"
#define HELP_SECTION_SCRIPT_PYTHON_MOO_APP "moo_002eApp-_0028Python_0029.html"
#define HELP_SECTION_SCRIPT_PYTHON_MOO_COMMAND "moo_002eCommand-_0028Python_0029.html"
#define HELP_SECTION_SCRIPT_PYTHON_MOO_COMMAND_CONTEXT "moo_002eCommandContext-_0028Python_0029.html"
#define HELP_SECTION_SCRIPT_PYTHON_MOO_COMMAND_DATA "moo_002eCommandData-_0028Python_0029.html"
#define HELP_SECTION_SCRIPT_PYTHON_MOO_DOC_PLUGIN "moo_002eDocPlugin-_0028Python_0029.html"
#define HELP_SECTION_SCRIPT_PYTHON_MOO_EDIT "moo_002eEdit-_0028Python_0029.html"
#define HELP_SECTION_SCRIPT_PYTHON_MOO_EDITOR "moo_002eEditor-_0028Python_0029.html"
#define HELP_SECTION_SCRIPT_PYTHON_MOO_EDIT_OPEN_INFO "moo_002eEditOpenInfo-_0028Python_0029.html"
#define HELP_SECTION_SCRIPT_PYTHON_MOO_EDIT_RELOAD_INFO "moo_002eEditReloadInfo-_0028Python_0029.html"
#define HELP_SECTION_SCRIPT_PYTHON_MOO_EDIT_SAVE_INFO "moo_002eEditSaveInfo-_0028Python_0029.html"
#define HELP_SECTION_SCRIPT_PYTHON_MOO_EDIT_WINDOW "moo_002eEditWindow-_0028Python_0029.html"
#define HELP_SECTION_SCRIPT_PYTHON_MOO_PANE "moo_002ePane-_0028Python_0029.html"
#define HELP_SECTION_SCRIPT_PYTHON_MOO_PANE_LABEL "moo_002ePaneLabel-_0028Python_0029.html"
#define HELP_SECTION_SCRIPT_PYTHON_MOO_PANE_PARAMS "moo_002ePaneParams-_0028Python_0029.html"
#define HELP_SECTION_SCRIPT_PYTHON_MOO_PLUGIN "moo_002ePlugin-_0028Python_0029.html"
#define HELP_SECTION_SCRIPT_PYTHON_MOO_PLUGIN_INFO "moo_002ePluginInfo-_0028Python_0029.html"
#define HELP_SECTION_SCRIPT_PYTHON_MOO_PLUGIN_PARAMS "moo_002ePluginParams-_0028Python_0029.html"
#define HELP_SECTION_SCRIPT_PYTHON_MOO_TEXT_VIEW "moo_002eTextView-_0028Python_0029.html"
#define HELP_SECTION_SCRIPT_PYTHON_MOO_UI_NODE "moo_002eUiNode-_0028Python_0029.html"
#define HELP_SECTION_SCRIPT_PYTHON_MOO_UI_XML "moo_002eUiXml-_0028Python_0029.html"
#define HELP_SECTION_SCRIPT_PYTHON_MOO_WIN_PLUGIN "moo_002eWinPlugin-_0028Python_0029.html"
#define HELP_SECTION_USER_TOOLS "User_002ddefined-tools.html" #define HELP_SECTION_USER_TOOLS "User_002ddefined-tools.html"
#define HELP_SECTION_USER_TOOLS_FILES "Storing-tools-in-files.html" #define HELP_SECTION_USER_TOOLS_FILES "Storing-tools-in-files.html"
#define HELP_SECTION_USER_TOOLS_MANAGING "Managing-tools.html" #define HELP_SECTION_USER_TOOLS_MANAGING "Managing-tools.html"

View File

@ -1,8 +1,8 @@
@node meditrc @node prefs.xml
@chapter Preferences files @chapter Preferences files
@helpsection{PREFS_FILE} @helpsection{PREFS_FILE}
@medit{} preferences are stored in @file{$HOME/.config/@medit{}rc} file. @medit{} preferences are stored in @file{$HOME/.local/share/medit-1/prefs.xml} file.
It is an XML file which may be edited to set preferences which have not found It is an XML file which may be edited to set preferences which have not found
their place in the @uilabel{Preferences} dialog. their place in the @uilabel{Preferences} dialog.

544
doc/script-lua.texi Normal file
View File

@ -0,0 +1,544 @@
@menu
* medit.App (Lua)::
* medit.Command (Lua)::
* medit.CommandContext (Lua)::
* medit.Edit (Lua):: Document object.
* medit.EditOpenInfo (Lua)::
* medit.EditReloadInfo (Lua)::
* medit.EditSaveInfo (Lua)::
* medit.EditWindow (Lua)::
* medit.Editor (Lua)::
* medit.Pane (Lua)::
* medit.TextView (Lua)::
* medit.UiXml (Lua)::
* medit.CommandData (Lua)::
* medit.PaneLabel (Lua)::
* medit.PaneParams (Lua)::
* medit.UiNode (Lua)::
* Functions (Lua):: Functions.
@end menu
@node medit.App (Lua)
@subsection class medit.App
@helpsection{SCRIPT_LUA_MOO_APP}
@table @method
@item get_editor()
@end table
@node medit.Command (Lua)
@subsection class medit.Command
@helpsection{SCRIPT_LUA_MOO_COMMAND}
@table @method
@item get_options()
@item set_options(options)
@end table
@node medit.CommandContext (Lua)
@subsection class medit.CommandContext
@helpsection{SCRIPT_LUA_MOO_COMMAND_CONTEXT}
@table @method
@item get_doc()
@item get_window()
@end table
@node medit.Edit (Lua)
@subsection class medit.Edit
@helpsection{SCRIPT_LUA_MOO_EDIT}
Object which represents a document. It has methods for file operations and manipulating document text.
@table @method
@item append_text(text)
@item begin_non_undoable_action()
@item can_redo()
@item can_undo()
@item clear()
@item close(ask_confirm=true)
@item copy()
@item cut()
@item delete_selected_lines()
@item delete_selected_text()
@item delete_text(start, end)
@item end_non_undoable_action()
@item get_buffer()
@item get_char_at_pos(pos)
@item get_char_count()
@item get_clean()
@item get_cursor_pos()
@item get_display_basename()
@item get_display_name()
@item get_editor()
@item get_encoding()
@item get_end_pos()
@item get_file()
@item get_filename()
@item get_lang_id()
@item get_line_at_pos(pos)
@item get_line_count()
@item get_line_end_type()
@item get_pos_at_line(line)
@item get_pos_at_line_end(line)
@item get_selected_lines()
Returns selected lines as a list of strings, one string for each line, line terminator characters not included. If nothing is selected, then line at cursor is returned.
@item get_selected_text()
returns selected text.
@item get_selection_end_pos()
@item get_selection_start_pos()
@item get_start_pos()
@item get_status()
@item get_text(start=nil, end=nil)
@item get_uri()
@item get_view()
@item get_window()
@item has_selection()
@item insert_text(text, where=nil)
Insert text at position @param{where} or at cursor position if @param{where} is @code{nil}.
@item is_empty()
This function returns whether the document is "empty", i.e. is not modified, is untitled, and contains no text.
@item is_modified()
@item is_untitled()
@item paste()
@item redo()
@item reload(info=nil)
Reload document from disk
@item replace_selected_lines(replacement)
replace selected lines with @param{replacement}. Similar to @method{replace_selected_text()}, but selection is extended to include whole lines. If nothing is selected, then line at cursor is replaced.
@item replace_selected_text(replacement)
replace selected text with @param{replacement}. If nothing is selected, then @param{replacement} is inserted at cursor.
@item replace_text(start, end, text)
@item save()
@item save_as(info)
@item save_copy(info)
@item select_all()
@item select_lines(start, end=-1)
@item select_lines_at_pos(start, end=nil)
Select lines which span the range from @param{start} to @param{end} (including @param{end} position). If @param{end} is @code{nil}, then it selects single line which contains position @param{start}.
@item select_text(start, end)
@item set_clean(clean)
@item set_cursor_pos(pos)
@item set_encoding(encoding)
@item set_line_end_type(le)
@item set_modified(modified)
@item set_selection(start, end)
@item undo()
@end table
@node medit.EditOpenInfo (Lua)
@subsection class medit.EditOpenInfo
@helpsection{SCRIPT_LUA_MOO_EDIT_OPEN_INFO}
@table @method
@item edit_open_info_new(file, encoding=nil)
@item dup()
@end table
@node medit.EditReloadInfo (Lua)
@subsection class medit.EditReloadInfo
@helpsection{SCRIPT_LUA_MOO_EDIT_RELOAD_INFO}
@table @method
@item edit_reload_info_new(encoding=nil)
@item dup()
@end table
@node medit.EditSaveInfo (Lua)
@subsection class medit.EditSaveInfo
@helpsection{SCRIPT_LUA_MOO_EDIT_SAVE_INFO}
@table @method
@item edit_save_info_new(file, encoding=nil)
@item dup()
@end table
@node medit.EditWindow (Lua)
@subsection class medit.EditWindow
@helpsection{SCRIPT_LUA_MOO_EDIT_WINDOW}
@table @method
@item abort_jobs()
@item add_pane(user_id, widget, label, position)
@item add_stop_client(client)
@item close_all()
@item get_active_doc()
@item get_active_view()
@item get_docs()
@item get_editor()
@item get_nth_doc(n)
@item get_nth_view(n)
@item get_pane(user_id)
@item get_views()
@item num_docs()
@item remove_pane(user_id)
@item remove_stop_client(client)
@item set_active_doc(edit)
@item set_active_view(view)
@end table
@node medit.Editor (Lua)
@subsection class medit.Editor
@helpsection{SCRIPT_LUA_MOO_EDITOR}
@table @method
@item close_doc(doc, ask_confirm=true)
@item close_docs(docs, ask_confirm=true)
@item close_window(window, ask_confirm=true)
@item get_active_doc()
@item get_active_view()
@item get_active_window()
@item get_doc(file)
@item get_doc_for_path(path)
@item get_doc_for_uri(uri)
@item get_doc_ui_xml()
@item get_docs()
@item get_ui_xml()
@item get_windows()
@item new_doc(window=nil)
@item new_file(info, parent=nil)
@item new_window()
@item open_file(info, parent=nil)
@item open_files(files, parent=nil)
@item open_path(path, encoding=nil, line=-1, window=nil)
@item open_uri(uri, encoding=nil, line=-1, window=nil)
@item reload(doc, info)
@item save(doc)
@item save_as(doc, info)
@item save_copy(doc, info)
@item set_active_doc(doc)
@item set_active_view(view)
@item set_active_window(window)
@item set_ui_xml(xml)
@end table
@node medit.Pane (Lua)
@subsection class medit.Pane
@helpsection{SCRIPT_LUA_MOO_PANE}
@table @method
@item attach()
@item detach()
@item get_child()
@item get_detachable()
@item get_id()
@item get_index()
@item get_label()
@item get_params()
@item get_removable()
@item open()
@item present()
@item set_detachable(detachable)
@item set_drag_dest()
@item set_frame_markup(markup)
@item set_frame_text(text)
@item set_label(label)
@item set_params(params)
@item set_removable(removable)
@item unset_drag_dest()
@end table
@node medit.TextView (Lua)
@subsection class medit.TextView
@helpsection{SCRIPT_LUA_MOO_TEXT_VIEW}
@table @method
@item set_font_from_string(font)
@item set_lang_by_id(id)
@end table
@node medit.UiXml (Lua)
@subsection class medit.UiXml
@helpsection{SCRIPT_LUA_MOO_UI_XML}
@table @method
@item add_item(merge_id, parent_path, name, action, position)
@item add_ui_from_string(buffer, length=-1)
@item create_widget(type, path, actions, accel_group)
@item find_placeholder(name)
@item get_node(path)
@item get_widget(toplevel, path)
@item insert(merge_id, parent, position, markup)
@item insert_after(merge_id, parent, after, markup)
@item insert_before(merge_id, parent, before, markup)
@item insert_markup(merge_id, parent_path, position, markup)
@item insert_markup_after(merge_id, parent_path, after, markup)
@item insert_markup_before(merge_id, parent_path, before, markup)
@item new_merge_id()
@item remove_node(node)
@item remove_ui(merge_id)
@end table
@node medit.CommandData (Lua)
@subsection class medit.CommandData
@helpsection{SCRIPT_LUA_MOO_COMMAND_DATA}
@table @method
@item set(index_, value)
@item get(index_)
@item set_code(code)
@item get_code()
@end table
@node medit.PaneLabel (Lua)
@subsection class medit.PaneLabel
@helpsection{SCRIPT_LUA_MOO_PANE_LABEL}
@table @method
@item pane_label_new(icon_name=nil, icon_pixbuf=nil, label_text=nil, window_title=nil)
@end table
@node medit.PaneParams (Lua)
@subsection class medit.PaneParams
@helpsection{SCRIPT_LUA_MOO_PANE_PARAMS}
@table @method
@item pane_params_new(window_position, detached, maximized, keep_on_top)
@end table
@node medit.UiNode (Lua)
@subsection class medit.UiNode
@helpsection{SCRIPT_LUA_MOO_UI_NODE}
@table @method
@item get_path()
@item get_child(path)
@end table
@node Functions (Lua)
@subsection Functions
@helpsection{SCRIPT_LUA_FUNCTIONS}
@table @method
@item app_instance()
@item command_factory_register(name, display_name, factory, keys=nil, extension=nil)
@item dgettext(domain, string)
@item edit_open_info_new_path(path, encoding=nil)
@item edit_open_info_new_uri(uri, encoding=nil)
@item edit_save_info_new_path(path, encoding=nil)
@item edit_save_info_new_uri(uri, encoding=nil)
@item edit_window_set_action_filter(action_id, type, filter)
@item editor_instance()
@item gettext(string)
@item parse_command_options(string)
@item prefs_get_bool(key)
@item prefs_get_file(key)
@item prefs_get_filename(key)
@item prefs_get_int(key)
@item prefs_get_string(key)
@item prefs_new_key_bool(key, default_val=false)
@item prefs_new_key_int(key, default_val=0)
@item prefs_new_key_string(key, default_val=nil)
@item prefs_set_bool(key, val)
@item prefs_set_file(key, val)
@item prefs_set_filename(key, val)
@item prefs_set_int(key, val)
@item prefs_set_string(key, val)
@item spin_main_loop(sec)
@end table

617
doc/script-python.texi Normal file
View File

@ -0,0 +1,617 @@
@menu
* moo.App (Python)::
* moo.Command (Python)::
* moo.CommandContext (Python)::
* moo.DocPlugin (Python)::
* moo.Edit (Python):: Document object.
* moo.EditOpenInfo (Python)::
* moo.EditReloadInfo (Python)::
* moo.EditSaveInfo (Python)::
* moo.EditWindow (Python)::
* moo.Editor (Python)::
* moo.Pane (Python)::
* moo.Plugin (Python)::
* moo.TextView (Python)::
* moo.UiXml (Python)::
* moo.WinPlugin (Python)::
* moo.CommandData (Python)::
* moo.PaneLabel (Python)::
* moo.PaneParams (Python)::
* moo.PluginInfo (Python)::
* moo.PluginParams (Python)::
* moo.UiNode (Python)::
* Functions (Python):: Functions.
@end menu
@node moo.App (Python)
@subsection class moo.App
@helpsection{SCRIPT_PYTHON_MOO_APP}
@table @method
@item get_editor()
@end table
@node moo.Command (Python)
@subsection class moo.Command
@helpsection{SCRIPT_PYTHON_MOO_COMMAND}
@table @method
@item get_options()
@item set_options(options)
@end table
@node moo.CommandContext (Python)
@subsection class moo.CommandContext
@helpsection{SCRIPT_PYTHON_MOO_COMMAND_CONTEXT}
@table @method
@item get_doc()
@item get_window()
@end table
@node moo.DocPlugin (Python)
@subsection class moo.DocPlugin
@helpsection{SCRIPT_PYTHON_MOO_DOC_PLUGIN}
@table @method
@item get_doc()
@item get_plugin()
@item get_window()
@end table
@node moo.Edit (Python)
@subsection class moo.Edit
@helpsection{SCRIPT_PYTHON_MOO_EDIT}
Object which represents a document. It has methods for file operations and manipulating document text.
@table @method
@item append_text(text)
@item begin_non_undoable_action()
@item can_redo()
@item can_undo()
@item clear()
@item close(ask_confirm=True)
@item copy()
@item cut()
@item delete_selected_lines()
@item delete_selected_text()
@item delete_text(start, end)
@item end_non_undoable_action()
@item get_buffer()
@item get_char_at_pos(pos)
@item get_char_count()
@item get_clean()
@item get_cursor_pos()
@item get_display_basename()
@item get_display_name()
@item get_editor()
@item get_encoding()
@item get_end_pos()
@item get_file()
@item get_filename()
@item get_lang_id()
@item get_line_at_pos(pos)
@item get_line_count()
@item get_line_end_type()
@item get_pos_at_line(line)
@item get_pos_at_line_end(line)
@item get_selected_lines()
Returns selected lines as a list of strings, one string for each line, line terminator characters not included. If nothing is selected, then line at cursor is returned.
@item get_selected_text()
returns selected text.
@item get_selection_end_pos()
@item get_selection_start_pos()
@item get_start_pos()
@item get_status()
@item get_text(start=None, end=None)
@item get_uri()
@item get_view()
@item get_window()
@item has_selection()
@item insert_text(text, where=None)
Insert text at position @param{where} or at cursor position if @param{where} is @code{None}.
@item is_empty()
This function returns whether the document is "empty", i.e. is not modified, is untitled, and contains no text.
@item is_modified()
@item is_untitled()
@item paste()
@item redo()
@item reload(info=None)
Reload document from disk
@item replace_selected_lines(replacement)
replace selected lines with @param{replacement}. Similar to @method{replace_selected_text()}, but selection is extended to include whole lines. If nothing is selected, then line at cursor is replaced.
@item replace_selected_text(replacement)
replace selected text with @param{replacement}. If nothing is selected, then @param{replacement} is inserted at cursor.
@item replace_text(start, end, text)
@item save()
@item save_as(info)
@item save_copy(info)
@item select_all()
@item select_lines(start, end=-1)
@item select_lines_at_pos(start, end=None)
Select lines which span the range from @param{start} to @param{end} (including @param{end} position). If @param{end} is @code{None}, then it selects single line which contains position @param{start}.
@item select_text(start, end)
@item set_clean(clean)
@item set_cursor_pos(pos)
@item set_encoding(encoding)
@item set_line_end_type(le)
@item set_modified(modified)
@item set_selection(start, end)
@item undo()
@end table
@node moo.EditOpenInfo (Python)
@subsection class moo.EditOpenInfo
@helpsection{SCRIPT_PYTHON_MOO_EDIT_OPEN_INFO}
@table @method
@item edit_open_info_new(file, encoding=None)
@item dup()
@end table
@node moo.EditReloadInfo (Python)
@subsection class moo.EditReloadInfo
@helpsection{SCRIPT_PYTHON_MOO_EDIT_RELOAD_INFO}
@table @method
@item edit_reload_info_new(encoding=None)
@item dup()
@end table
@node moo.EditSaveInfo (Python)
@subsection class moo.EditSaveInfo
@helpsection{SCRIPT_PYTHON_MOO_EDIT_SAVE_INFO}
@table @method
@item edit_save_info_new(file, encoding=None)
@item dup()
@end table
@node moo.EditWindow (Python)
@subsection class moo.EditWindow
@helpsection{SCRIPT_PYTHON_MOO_EDIT_WINDOW}
@table @method
@item abort_jobs()
@item add_pane(user_id, widget, label, position)
@item add_stop_client(client)
@item close_all()
@item get_active_doc()
@item get_active_view()
@item get_docs()
@item get_editor()
@item get_nth_doc(n)
@item get_nth_view(n)
@item get_pane(user_id)
@item get_views()
@item num_docs()
@item remove_pane(user_id)
@item remove_stop_client(client)
@item set_active_doc(edit)
@item set_active_view(view)
@end table
@node moo.Editor (Python)
@subsection class moo.Editor
@helpsection{SCRIPT_PYTHON_MOO_EDITOR}
@table @method
@item close_doc(doc, ask_confirm=True)
@item close_docs(docs, ask_confirm=True)
@item close_window(window, ask_confirm=True)
@item get_active_doc()
@item get_active_view()
@item get_active_window()
@item get_doc(file)
@item get_doc_for_path(path)
@item get_doc_for_uri(uri)
@item get_doc_ui_xml()
@item get_docs()
@item get_ui_xml()
@item get_windows()
@item new_doc(window=None)
@item new_file(info, parent=None)
@item new_window()
@item open_file(info, parent=None)
@item open_files(files, parent=None)
@item open_path(path, encoding=None, line=-1, window=None)
@item open_uri(uri, encoding=None, line=-1, window=None)
@item reload(doc, info)
@item save(doc)
@item save_as(doc, info)
@item save_copy(doc, info)
@item set_active_doc(doc)
@item set_active_view(view)
@item set_active_window(window)
@item set_doc_type(type)
@item set_ui_xml(xml)
@item set_window_type(type)
@end table
@node moo.Pane (Python)
@subsection class moo.Pane
@helpsection{SCRIPT_PYTHON_MOO_PANE}
@table @method
@item attach()
@item detach()
@item get_child()
@item get_detachable()
@item get_id()
@item get_index()
@item get_label()
@item get_params()
@item get_removable()
@item open()
@item present()
@item set_detachable(detachable)
@item set_drag_dest()
@item set_frame_markup(markup)
@item set_frame_text(text)
@item set_label(label)
@item set_params(params)
@item set_removable(removable)
@item unset_drag_dest()
@end table
@node moo.Plugin (Python)
@subsection class moo.Plugin
@helpsection{SCRIPT_PYTHON_MOO_PLUGIN}
@table @method
@item set_doc_plugin_type(type)
@item set_info(info)
@item set_win_plugin_type(type)
@end table
@node moo.TextView (Python)
@subsection class moo.TextView
@helpsection{SCRIPT_PYTHON_MOO_TEXT_VIEW}
@table @method
@item set_font_from_string(font)
@item set_lang_by_id(id)
@end table
@node moo.UiXml (Python)
@subsection class moo.UiXml
@helpsection{SCRIPT_PYTHON_MOO_UI_XML}
@table @method
@item add_item(merge_id, parent_path, name, action, position)
@item add_ui_from_string(buffer, length=-1)
@item create_widget(type, path, actions, accel_group)
@item find_placeholder(name)
@item get_node(path)
@item get_widget(toplevel, path)
@item insert(merge_id, parent, position, markup)
@item insert_after(merge_id, parent, after, markup)
@item insert_before(merge_id, parent, before, markup)
@item insert_markup(merge_id, parent_path, position, markup)
@item insert_markup_after(merge_id, parent_path, after, markup)
@item insert_markup_before(merge_id, parent_path, before, markup)
@item new_merge_id()
@item remove_node(node)
@item remove_ui(merge_id)
@end table
@node moo.WinPlugin (Python)
@subsection class moo.WinPlugin
@helpsection{SCRIPT_PYTHON_MOO_WIN_PLUGIN}
@table @method
@item get_plugin()
@item get_window()
@end table
@node moo.CommandData (Python)
@subsection class moo.CommandData
@helpsection{SCRIPT_PYTHON_MOO_COMMAND_DATA}
@table @method
@item set(index_, value)
@item get(index_)
@item set_code(code)
@item get_code()
@end table
@node moo.PaneLabel (Python)
@subsection class moo.PaneLabel
@helpsection{SCRIPT_PYTHON_MOO_PANE_LABEL}
@table @method
@item pane_label_new(icon_name=None, icon_pixbuf=None, label_text=None, window_title=None)
@end table
@node moo.PaneParams (Python)
@subsection class moo.PaneParams
@helpsection{SCRIPT_PYTHON_MOO_PANE_PARAMS}
@table @method
@item pane_params_new(window_position, detached, maximized, keep_on_top)
@end table
@node moo.PluginInfo (Python)
@subsection class moo.PluginInfo
@helpsection{SCRIPT_PYTHON_MOO_PLUGIN_INFO}
@table @method
@item plugin_info_new(name, description=None, author=None, version=None)
@end table
@node moo.PluginParams (Python)
@subsection class moo.PluginParams
@helpsection{SCRIPT_PYTHON_MOO_PLUGIN_PARAMS}
@table @method
@item plugin_params_new(enabled=True, visible=True)
@end table
@node moo.UiNode (Python)
@subsection class moo.UiNode
@helpsection{SCRIPT_PYTHON_MOO_UI_NODE}
@table @method
@item get_path()
@item get_child(path)
@end table
@node Functions (Python)
@subsection Functions
@helpsection{SCRIPT_PYTHON_FUNCTIONS}
@table @method
@item app_instance()
@item command_factory_register(name, display_name, factory, keys=None, extension=None)
@item dgettext(domain, string)
@item edit_open_info_new_path(path, encoding=None)
@item edit_open_info_new_uri(uri, encoding=None)
@item edit_save_info_new_path(path, encoding=None)
@item edit_save_info_new_uri(uri, encoding=None)
@item edit_window_set_action_filter(action_id, type, filter)
@item editor_create(embedded)
@item editor_instance()
@item gettext(string)
@item parse_command_options(string)
@item plugin_register(id, type, info, params=None)
@item prefs_get_bool(key)
@item prefs_get_file(key)
@item prefs_get_filename(key)
@item prefs_get_int(key)
@item prefs_get_string(key)
@item prefs_new_key_bool(key, default_val=False)
@item prefs_new_key_int(key, default_val=0)
@item prefs_new_key_string(key, default_val=None)
@item prefs_set_bool(key, val)
@item prefs_set_file(key, val)
@item prefs_set_filename(key, val)
@item prefs_set_int(key, val)
@item prefs_set_string(key, val)
@item spin_main_loop(sec)
@end table

View File

@ -10,6 +10,15 @@
@var{\text\} @var{\text\}
@end macro @end macro
@macro null{} @menu
@code{null} * Lua:: Lua
@end macro * Python:: Python
@end menu
@node Lua
@section Lua
@include script-lua.texi
@node Python
@section Python
@include script-python.texi

View File

@ -296,7 +296,7 @@ moo_edit_get_text (MooEdit *doc,
* @text: * @text:
* @where: (allow-none) (default NULL) * @where: (allow-none) (default NULL)
* *
* Insert text at position @where or at cursor position if @where is NULL. * Insert text at position @where or at cursor position if @where is %NULL.
**/ **/
void void
moo_edit_insert_text (MooEdit *doc, moo_edit_insert_text (MooEdit *doc,
@ -484,6 +484,9 @@ moo_edit_select_lines (MooEdit *doc,
* @doc: * @doc:
* @start: * @start:
* @end: (allow-none) (default NULL) * @end: (allow-none) (default NULL)
*
* Select lines which span the range from @start to @end (including @end position).
* If @end is %NULL, then it selects single line which contains position @start.
**/ **/
void void
moo_edit_select_lines_at_pos (MooEdit *doc, moo_edit_select_lines_at_pos (MooEdit *doc,
@ -592,7 +595,7 @@ join_lines (char **strv)
* @doc: * @doc:
* @replacement: (type strv) (allow-none) * @replacement: (type strv) (allow-none)
* *
* replace selected lines with %param{replacement}. Similar to * replace selected lines with @replacement. Similar to
* %method{replace_selected_text()}, but selection is extended to include * %method{replace_selected_text()}, but selection is extended to include
* whole lines. If nothing is selected, then line at cursor is replaced. * whole lines. If nothing is selected, then line at cursor is replaced.
**/ **/
@ -663,8 +666,8 @@ moo_edit_delete_selected_lines (MooEdit *doc)
/** /**
* moo_edit_replace_selected_text: * moo_edit_replace_selected_text:
* *
* replace selected text with %param{replacement}. If nothing is selected, * replace selected text with @replacement. If nothing is selected,
* then %param{replacement} is inserted at cursor. * then @replacement is inserted at cursor.
**/ **/
void void
moo_edit_replace_selected_text (MooEdit *doc, moo_edit_replace_selected_text (MooEdit *doc,

View File

@ -14,7 +14,10 @@
*/ */
/** /**
* class:MooEdit: (parent GObject) * class:MooEdit: (parent GObject): Document object
*
* Object which represents a document. It has methods for file operations
* and manipulating document text.
**/ **/
#define MOOEDIT_COMPILATION #define MOOEDIT_COMPILATION

View File

@ -21,11 +21,12 @@ print >> outfile, ';'
outfile.close() outfile.close()
docopy = False # docopy = False
try: # try:
docopy = not filecmp.cmp(tmp_output, output) # docopy = not filecmp.cmp(tmp_output, output)
except: # except:
docopy = True # docopy = True
docopy = True
if docopy: if docopy:
shutil.copyfile(tmp_output, output) shutil.copyfile(tmp_output, output)