Install python plugins (they don't work yet)

master
Yevgen Muntyan 2010-12-08 01:36:45 -08:00
parent 70f20bb0da
commit efc260ea16
41 changed files with 2402 additions and 5491 deletions

View File

@ -164,6 +164,9 @@ AC_DEFUN_ONCE([MOO_AC_SET_DIRS],[
AC_DEFINE_UNQUOTED([MOO_PREFS_XML_FILE_NAME], "$MOO_PREFS_XML_FILE_NAME", [prefs.xml])
AC_DEFINE_UNQUOTED([MOO_STATE_XML_FILE_NAME], "$MOO_STATE_XML_FILE_NAME", [state.xml])
AC_DEFINE_UNQUOTED([MOO_SESSION_XML_FILE_NAME], "$MOO_SESSION_XML_FILE_NAME", [session.xml])
AC_SUBST(MOO_PYTHON_PLUGIN_DIR, "${MOO_DATA_DIR}/plugins")
AC_SUBST(MOO_PYTHON_LIB_DIR, "${MOO_DATA_DIR}/python")
])
##############################################################################

View File

@ -2,6 +2,7 @@ moo_python_sources =
built_moo_python_sources =
include moopython/pygtk/Makefile.incl
include moopython/plugins/Makefile.incl
moo_python_sources += \
moopython/moopython-builtin.h \

View File

@ -154,7 +154,7 @@ class Wrapper:
getter_tmpl = (
'static PyObject *\n'
'%(funcname)s(G_GNUC_UNUSED PyObject *self, void *closure)\n'
'%(funcname)s(G_GNUC_UNUSED PyObject *self, G_GNUC_UNUSED void *closure)\n'
'{\n'
'%(varlist)s'
' ret = %(field)s;\n'
@ -716,7 +716,7 @@ class Wrapper:
"Could not write getter for %s.%s: %s\n"
% (self.objinfo.c_name, fname, str(ex)))
if gettername != '0' or settername != '0':
getsets.append(' { "%s", (getter)%s, (setter)%s },\n' %
getsets.append(' { (char*) "%s", (getter)%s, (setter)%s },\n' %
(fixname(fname), gettername, settername))
if not getsets:

View File

@ -24,9 +24,6 @@
#include "moopython/moopython-loader.h"
#include "mooutils/mooutils-misc.h"
#define LIBDIR "lib"
static gboolean
sys_path_add_dir (const char *dir)
{
@ -90,14 +87,10 @@ sys_path_add_plugin_dirs (void)
return;
been_here = TRUE;
dirs = moo_plugin_get_dirs ();
dirs = moo_get_data_and_lib_subdirs ("python");
for (d = dirs; d && *d; ++d)
{
char *libdir = g_build_filename (*d, LIBDIR, NULL);
sys_path_add_dir (libdir);
g_free (libdir);
}
sys_path_add_dir (*d);
g_strfreev (dirs);
}

View File

@ -1,29 +1,48 @@
moopython_pluginsdir = ${MOO_PLUGINS_DIR}
plugins_libdir = ${MOO_PLUGINS_DIR}/lib
moo_python_ini_in_in_files = \
moopython/plugins/terminal.ini.in.in \
moopython/plugins/python.ini.in.in \
moopython/plugins/pycmd.ini.in.in
INI_IN_IN_FILES = \
terminal.ini.in.in \
python.ini.in.in \
pycmd.ini.in.in
moo_python_plugins = \
moopython/plugins/terminal.py \
moopython/plugins/python.py \
moopython/plugins/pycmd.py
plugins = \
terminal.py \
python.py \
pycmd.py
moo_python_lib_files = \
moopython/plugins/lib/pyconsole.py \
moopython/plugins/lib/insert_date_and_time.py
moopython_plugins_DATA = \
$(INI_FILES) \
$(plugins)
moo_python_lib_medit_files = \
moopython/plugins/medit/__init__.py \
moopython/plugins/medit/runpython.py
plugins_lib_DATA = \
lib/pyconsole.py \
lib/insert_date_and_time.py
EXTRA_DIST += \
$(moo_python_ini_in_in_files) \
$(moo_python_plugins) \
$(moo_python_lib_files) \
$(moo_python_lib_medit_files)
nobase_plugins_lib_DATA = \
medit/__init__.py \
medit/runpython.py
if MOO_ENABLE_PYTHON
EXTRA_DIST += \
$(nobase_plugins_lib_DATA) \
$(plugins_lib_DATA) \
$(plugins)
moo_python_ini_in_files = $(moo_python_ini_in_in_files:.ini.in.in=.ini.in)
moo_python_ini_files = $(moo_python_ini_in_files:.ini.in=.ini)
built_plugins_sources += $(moo_python_ini_in_files) $(moo_python_ini_files)
moopython/plugins/%.ini.in: $(srcdir)/moopython/plugins/%.ini.in.in $(top_builddir)/config.status
$(AM_V_at)$(MKDIR_P) moopython/plugins
$(AM_V_GEN)cd $(top_builddir) && ./config.status --silent --file=$(subdir)/$@
moopython/plugins/%.ini: moopython/plugins/%.ini.in @MOO_INTLTOOL_INI_DEPS@
@MOO_INTLTOOL_INI_CMD@
moo_python_plugindir = ${MOO_PYTHON_PLUGIN_DIR}
moo_python_libdir = ${MOO_PYTHON_LIB_DIR}
moo_python_lib_meditdir = ${MOO_PYTHON_LIB_DIR}/medit
moo_python_plugin_DATA = \
$(moo_python_ini_files) \
$(moo_python_plugins)
moo_python_lib_DATA = \
$(moo_python_lib_files)
moo_python_lib_medit_DATA = \
$(moo_python_lib_medit_files)
endif

View File

@ -49,13 +49,13 @@ formats = [
"%d/%m/%y %H:%M:%S",
]
moo.utils.prefs_new_key_string('Tools/InsertDateAndTime', '%c')
moo.prefs_new_key_string('Tools/InsertDateAndTime', '%c')
def populate_tree_view(treeview):
model = gtk.ListStore(str, str)
curtime = time.localtime()
default_iter = None
default_fmt = moo.utils.prefs_get_string('Tools/InsertDateAndTime')
default_fmt = moo.prefs_get_string('Tools/InsertDateAndTime')
for fmt in formats:
iter = model.append([time.strftime(fmt, curtime), fmt])
@ -72,7 +72,7 @@ def populate_tree_view(treeview):
def get_format_from_list(treeview):
model, row = treeview.get_selection().get_selected()
fmt = model[row][1]
moo.utils.prefs_set_string('Tools/InsertDateAndTime', fmt)
moo.prefs_set_string('Tools/InsertDateAndTime', fmt)
return fmt
def get_format(parent=None):

View File

@ -30,7 +30,7 @@
#
# Console may subclass a type other than gtk.TextView, to allow syntax highlighting and stuff,
# e.g.:
# console_type = pyconsole.ConsoleType(moo.edit.TextView)
# console_type = pyconsole.ConsoleType(moo.TextView)
# console = console_type(use_rlcompleter=False, start_script="import moo\nimport gtk\n")
#
# This widget is not a replacement for real terminal with python running
@ -636,12 +636,12 @@ Console = ConsoleType()
def _create_widget(start_script):
try:
import moo
console_type = ConsoleType(moo.edit.TextView)
console_type = ConsoleType(moo.TextView)
console = console_type(banner="Hello there!",
use_rlcompleter=False,
start_script=start_script)
console.set_property("highlight-current-line", False)
editor = moo.edit.create_editor_instance()
editor = moo.create_editor_instance()
console.set_lang_by_id("python-console")
except ImportError:
console = Console(banner="Hello there!",

View File

@ -18,7 +18,7 @@ import os
import re
import gtk
import moo
from moo.utils import _
from moo import _
if os.name == 'nt':
PYTHON_COMMAND = '"' + sys.exec_prefix + '\\pythonw.exe" -u'
@ -39,11 +39,11 @@ class Runner(object):
def __ensure_output(self):
pane = self.__get_output()
if pane is None:
label = self.pane_label or moo.utils.PaneLabel(icon_name=moo.utils.STOCK_EXECUTE,
label_text=_("Python Output"))
output = moo.edit.CmdView()
label = self.pane_label or moo.PaneLabel(icon_name=moo.STOCK_EXECUTE,
label_text=_("Python Output"))
output = moo.CmdView()
output.set_property("highlight-current-line", True)
output.set_filter(moo.edit.command_filter_create("python"))
output.set_filter(moo.command_filter_create("python"))
pane = gtk.ScrolledWindow()
pane.set_shadow_type(gtk.SHADOW_ETCHED_IN)
@ -52,7 +52,7 @@ class Runner(object):
pane.show_all()
pane.output = output
self.window.add_pane(self.pane_id, pane, label, moo.utils.PANE_POS_BOTTOM)
self.window.add_pane(self.pane_id, pane, label, moo.PANE_POS_BOTTOM)
self.window.add_stop_client(output)
return pane
@ -67,7 +67,7 @@ class Runner(object):
if not doc:
return
if not doc.get_filename() or doc.get_status() & moo.edit.EDIT_MODIFIED:
if not doc.get_filename() or doc.get_status() & moo.EDIT_MODIFIED:
if not doc.save():
return

View File

@ -16,11 +16,11 @@
import moo
import gobject
import gtk
from moo.utils import _
from moo import _
class PyCmd(moo.edit.Command):
class PyCmd(moo.Command):
def __init__(self, code, options):
moo.edit.Command.__init__(self)
moo.Command.__init__(self)
if code and code[-1] != '\n' and code[-1] != '\r':
self.code = code + '\n'
else:
@ -35,7 +35,7 @@ class PyCmd(moo.edit.Command):
dic['doc'] = ctx.get_doc()
dic['window'] = ctx.get_window()
dic['buffer'] = ctx.get_doc() and ctx.get_doc().get_buffer()
dic['editor'] = moo.edit.editor_instance()
dic['editor'] = moo.editor_instance()
dic['moo'] = moo
ctx.foreach(self.__set_variable, dic)
@ -58,15 +58,15 @@ class PyCmd(moo.edit.Command):
if exc is not None:
raise exc
class PyCmdFactory(moo.edit.CommandFactory):
class PyCmdFactory(moo.CommandFactory):
def do_create_command(self, data, options):
return PyCmd(data.get_code(), moo.edit.parse_command_options(options))
return PyCmd(data.get_code(), moo.parse_command_options(options))
def do_create_widget(self):
swin = gtk.ScrolledWindow()
swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
swin.set_shadow_type(gtk.SHADOW_ETCHED_IN)
textview = moo.edit.TextView()
textview = moo.TextView()
swin.add(textview)
swin.show_all()
textview.set_font_from_string("Monospace")
@ -93,4 +93,4 @@ class PyCmdFactory(moo.edit.CommandFactory):
gobject.type_register(PyCmd)
gobject.type_register(PyCmdFactory)
moo.edit.command_factory_register("python", _("Python script"), PyCmdFactory(), None, ".py")
moo.command_factory_register("python", _("Python script"), PyCmdFactory(), None, ".py")

View File

@ -15,7 +15,7 @@
__all__ = ['Item']
from moo.utils import _
from moo import _
def create_instance(descr, *args, **kwargs):

View File

@ -25,7 +25,7 @@ import gtk
import gobject
import pango
from moo.utils import _
from moo import _
import mprj.config

View File

@ -17,7 +17,7 @@ import os
import gtk
import gobject
import moo
from moo.utils import _, N_
from moo import _, N_
import mprj.utils
@ -80,11 +80,11 @@ class _Wizard(object):
self.__check_sensitivity()
self.__update_file_label()
def __location_button_clicked(self, *whatever):
path = moo.utils.file_dialogp(self.xml.w_dialog,
moo.utils.FILE_DIALOG_OPEN_DIR,
self.xml.w_location.get_text(),
_("Choose Folder"),
mprj.utils.prefs_key('new_project_dir'))
path = moo.file_dialogp(self.xml.w_dialog,
moo.FILE_DIALOG_OPEN_DIR,
self.xml.w_location.get_text(),
_("Choose Folder"),
mprj.utils.prefs_key('new_project_dir'))
if path:
self.xml.w_location.set_text(path)
@ -100,7 +100,7 @@ class _Wizard(object):
def ask(self, factories, window):
glade_file = os.path.join(os.path.dirname(__file__), "factory.glade")
xml = moo.utils.glade_xml_new_from_file(glade_file, domain=moo.utils.GETTEXT_PACKAGE)
xml = moo.glade_xml_new_from_file(glade_file, domain=moo.GETTEXT_PACKAGE)
self.xml = xml
self.__setup_type_list(factories, xml)
@ -122,21 +122,21 @@ class _Wizard(object):
d, f = self.__get_project_file()
if os.path.lexists(d) and not os.path.isdir(d):
moo.utils.error_dialog(dialog, '%s is not a directory' % (d,))
moo.error_dialog(dialog, '%s is not a directory' % (d,))
continue
if os.path.exists(os.path.join(d, f)):
if not moo.utils.overwrite_file_dialog(dialog, f, d):
if not moo.overwrite_file_dialog(dialog, f, d):
continue
if os.path.exists(d) and not os.access(d, os.W_OK):
moo.utils.error_dialog(dialog, '%s is not writable' % (d,))
moo.error_dialog(dialog, '%s is not writable' % (d,))
continue
if not os.path.exists(d):
try:
os.mkdir(d)
except Exception, e:
moo.utils.error_dialog(dialog, 'Could not create directory %s' % (d,), str(e))
moo.error_dialog(dialog, 'Could not create directory %s' % (d,), str(e))
continue
model, iter = xml.w_type.get_selection().get_selected()
@ -155,7 +155,7 @@ class _Wizard(object):
try:
pi.factory.create(pi)
except Exception, e:
moo.utils.error_dialog(window, 'Could not create project', str(e))
moo.error_dialog(window, 'Could not create project', str(e))
return None
return os.path.join(pi.dir, pi.file)

View File

@ -22,13 +22,13 @@ from mprj.simple import SimpleProject
import mprj.utils
import mprj.factory
from mprj.utils import print_error, format_error
from moo.utils import _, N_
from moo import _, N_
moo.utils.prefs_new_key('Plugins/Project/last', str, None, moo.utils.PREFS_STATE)
moo.utils.prefs_new_key('Plugins/Project/last_dir', str, None, moo.utils.PREFS_STATE)
# moo.utils.prefs_new_key_string('Plugins/Project/last', None)
# moo.utils.prefs_new_key_string('Plugins/Project/last_dir', None)
moo.prefs_new_key('Plugins/Project/last', str, None, moo.PREFS_STATE)
moo.prefs_new_key('Plugins/Project/last_dir', str, None, moo.PREFS_STATE)
# moo.prefs_new_key_string('Plugins/Project/last', None)
# moo.prefs_new_key_string('Plugins/Project/last_dir', None)
class _ProjectStore(object):
@ -55,12 +55,12 @@ class _OpenRecent(object):
self.mgr = mgr
def __call__(self, window):
action = moo.utils.MenuAction("OpenRecentProject", _("Open Recent Project"))
action = moo.MenuAction("OpenRecentProject", _("Open Recent Project"))
action.set_property('display-name', _("Open Recent Project"))
action.set_mgr(self.mgr.recent_list.get_menu_mgr())
moo.utils.bind_bool_property(action, "sensitive",
self.mgr.recent_list, "empty",
True)
moo.bind_bool_property(action, "sensitive",
self.mgr.recent_list, "empty",
True)
return action
@ -70,41 +70,41 @@ class Manager(object):
self.init(project)
def init(self, project):
editor = moo.edit.editor_instance()
editor = moo.editor_instance()
editor.set_property("allow-empty-window", True)
editor.set_property("single-window", True)
moo.utils.window_class_add_action(moo.edit.EditWindow, "NewProject",
display_name=_("New Project"),
label=_("New Project..."),
stock_id=moo.utils.STOCK_NEW_PROJECT,
callback=self.new_project_cb)
moo.utils.window_class_add_action(moo.edit.EditWindow, "OpenProject",
display_name=_("Open Project"),
label=_("Open Project"),
stock_id=moo.utils.STOCK_OPEN_PROJECT,
callback=self.open_project_cb)
moo.utils.window_class_add_action(moo.edit.EditWindow, "ProjectOptions",
display_name=_("Project _Options"),
label=_("Project Options"),
stock_id=moo.utils.STOCK_PROJECT_OPTIONS,
callback=self.project_options_cb)
moo.utils.window_class_add_action(moo.edit.EditWindow, "CloseProject",
display_name=_("Close Project"),
label=_("Close Project"),
stock_id=moo.utils.STOCK_CLOSE_PROJECT,
callback=self.close_project_cb)
moo.window_class_add_action(moo.EditWindow, "NewProject",
display_name=_("New Project"),
label=_("New Project..."),
stock_id=moo.STOCK_NEW_PROJECT,
callback=self.new_project_cb)
moo.window_class_add_action(moo.EditWindow, "OpenProject",
display_name=_("Open Project"),
label=_("Open Project"),
stock_id=moo.STOCK_OPEN_PROJECT,
callback=self.open_project_cb)
moo.window_class_add_action(moo.EditWindow, "ProjectOptions",
display_name=_("Project _Options"),
label=_("Project Options"),
stock_id=moo.STOCK_PROJECT_OPTIONS,
callback=self.project_options_cb)
moo.window_class_add_action(moo.EditWindow, "CloseProject",
display_name=_("Close Project"),
label=_("Close Project"),
stock_id=moo.STOCK_CLOSE_PROJECT,
callback=self.close_project_cb)
self.__init_project_types()
self.project_to_open = project
self.project = None
self.window = None
self.recent_list = moo.utils.HistoryList("ProjectManager")
self.recent_list = moo.HistoryList("ProjectManager")
self.recent_list.connect("activate_item", self.recent_item_activated)
moo.utils.window_class_add_action(moo.edit.EditWindow,
"OpenRecentProject",
factory=_OpenRecent(self))
moo.window_class_add_action(moo.EditWindow,
"OpenRecentProject",
factory=_OpenRecent(self))
xml = editor.get_ui_xml()
self.merge_id = xml.new_merge_id()
@ -127,8 +127,8 @@ class Manager(object):
self.close_project(True)
for a in ["NewProject", "OpenProject", "CloseProject",
"ProjectOptions", "OpenRecentProject"]:
moo.utils.window_class_remove_action(moo.edit.EditWindow, a)
editor = moo.edit.editor_instance()
moo.window_class_remove_action(moo.EditWindow, a)
editor = moo.editor_instance()
editor.get_ui_xml().remove_ui(self.merge_id)
self.merge_id = 0
del self.project_types
@ -158,9 +158,9 @@ class Manager(object):
project = self.project_to_open
self.project_to_open = None
if not project:
project = moo.utils.prefs_get_string("Plugins/Project/last")
project = moo.prefs_get_string("Plugins/Project/last")
if not project:
project = os.path.join(moo.utils.get_user_data_dir(), "default.mprj")
project = os.path.join(moo.get_user_data_dir(), "default.mprj")
if project and os.path.exists(project):
try:
self.open_project(self.window, project)
@ -169,7 +169,7 @@ class Manager(object):
self.recent_list.remove(project)
def __set_title_prefix(self, prefix):
editor = moo.edit.editor_instance()
editor = moo.editor_instance()
editor.set_app_name(prefix or "medit")
def detach_win(self, window):
@ -184,8 +184,8 @@ class Manager(object):
mprj.utils.oops(window, e)
def open_project_cb(self, window):
filename = moo.utils.file_dialogp(parent=window, title=_("Open Project"),
prefs_key="Plugins/Project/last_dir")
filename = moo.file_dialogp(parent=window, title=_("Open Project"),
prefs_key="Plugins/Project/last_dir")
if not filename:
return
@ -195,10 +195,10 @@ class Manager(object):
self.bad_project(window, filename, e)
def bad_project(self, parent, filename, error):
moo.utils.error_dialog(parent, _("Could not open project '%s'") % (filename,), str(error))
moo.error_dialog(parent, _("Could not open project '%s'") % (filename,), str(error))
def fixme(self, parent, msg):
moo.utils.warning_dialog(parent, "FIXME", str(msg))
moo.warning_dialog(parent, "FIXME", str(msg))
def close_window(self, window):
return not self.close_project(False)
@ -212,7 +212,7 @@ class Manager(object):
def close_project_cb(self, window):
if self.project:
if self.close_project(False):
moo.utils.prefs_set_string("Plugins/Project/last", None)
moo.prefs_set_string("Plugins/Project/last", None)
else:
self.fixme(window, "disable Close Project command")
@ -238,8 +238,8 @@ class Manager(object):
f.close()
if file.version != mprj.project_version:
moo.utils.error_dialog(window, _("Could not open project '%s'") % (filename,),
_("Invalid project version %s") % (file.version,))
moo.error_dialog(window, _("Could not open project '%s'") % (filename,),
_("Invalid project version %s") % (file.version,))
return
file.path = filename
@ -251,7 +251,7 @@ class Manager(object):
self.project.load()
self.__set_title_prefix(self.project.name)
self.recent_list.add_filename(filename)
moo.utils.prefs_set_string("Plugins/Project/last", filename)
moo.prefs_set_string("Plugins/Project/last", filename)
close = self.window.get_action("CloseProject")
options = self.window.get_action("ProjectOptions")
@ -313,7 +313,7 @@ class Manager(object):
self.project_types = _ProjectStore()
self.project_types.add("Simple", SimpleProject)
dirs = list(moo.utils.get_data_subdirs("projects", moo.utils.DATA_LIB))
dirs = list(moo.get_data_subdirs("projects", moo.DATA_LIB))
dirs = filter(lambda d: os.path.isdir(d), dirs)
dirs.reverse()

View File

@ -23,14 +23,14 @@ if __name__ == '__main__':
import gobject
import os.path
import moo
from moo.utils import _
from moo import _
dir = os.path.dirname(__file__)
def _init_page(page, page_id, config, glade_file):
cls = page.__class__
xml = moo.utils.GladeXML(moo.utils.GETTEXT_PACKAGE)
xml = moo.GladeXML(moo.GETTEXT_PACKAGE)
xml.map_id(page_id, cls)
types = getattr(cls, '__types__', {})
@ -55,9 +55,9 @@ def _init_page(page, page_id, config, glade_file):
return page
class ConfigPage(moo.utils.PrefsPage):
class ConfigPage(moo.PrefsPage):
def __init__(self, page_id, config, glade_file):
moo.utils.PrefsPage.__init__(self)
moo.PrefsPage.__init__(self)
_init_page(self, page_id, config, glade_file)
def do_init(self):
@ -68,14 +68,14 @@ class ConfigPage(moo.utils.PrefsPage):
widget.apply()
class Dialog(moo.utils.PrefsDialog):
class Dialog(moo.PrefsDialog):
def __init__(self, project, title=_('Project Options')):
moo.utils.PrefsDialog.__init__(self, title)
moo.PrefsDialog.__init__(self, title)
self.project = project
self.config_copy = project.config.copy()
def do_apply(self):
moo.utils.PrefsDialog.do_apply(self)
moo.PrefsDialog.do_apply(self)
self.project.config.copy_from(self.config_copy)
self.project.save_config()
# print '============================='

View File

@ -68,7 +68,7 @@ class Project(object):
self.filename = os.path.abspath(file.path)
self.topdir = os.path.dirname(self.filename)
editor = moo.edit.editor_instance()
editor = moo.editor_instance()
xml = editor.get_ui_xml()
if xml is not None:
self.merge_id = xml.new_merge_id()
@ -76,18 +76,18 @@ class Project(object):
self.panes = []
def add_action(self, id, **kwargs):
moo.utils.window_class_add_action(moo.edit.EditWindow, id, **kwargs)
moo.window_class_add_action(moo.EditWindow, id, **kwargs)
self.actions.append(id)
def init_ui(self):
pass
def deinit_ui(self):
editor = moo.edit.editor_instance()
editor = moo.editor_instance()
xml = editor.get_ui_xml()
xml.remove_ui(self.merge_id)
for a in self.actions:
moo.utils.window_class_remove_action(moo.edit.EditWindow, a)
moo.window_class_remove_action(moo.EditWindow, a)
if self.window:
for p in self.panes:
self.window.remove_pane(p)

View File

@ -27,7 +27,7 @@ class Session(object):
self.__active = None
if data:
if isinstance(data, moo.edit.EditWindow):
if isinstance(data, moo.EditWindow):
self.__load_from_window(data)
else:
file = open(data)
@ -36,7 +36,7 @@ class Session(object):
self.__parse(contents)
def attach(self, window):
editor = moo.edit.editor_instance()
editor = moo.editor_instance()
# saved_silent = editor.get_property("silent")
# editor.set_property("silent", True)
for doc in self.__docs:

View File

@ -25,7 +25,7 @@ import os.path
import tempfile
import moo
from moo.utils import _
from moo import _
from mprj.project import Project
from mprj.config import Config, Dict, Group
@ -68,7 +68,7 @@ class SimpleProject(Project):
self.__filesel_cb_id = None
self.__filesel_destroy_cb_id = None
def __setup_file_selector(self):
plugin = moo.edit.plugin_lookup('FileSelector')
plugin = moo.plugin_lookup('FileSelector')
if plugin:
try:
self.filesel = plugin.call_method('get-widget', self.window)
@ -133,16 +133,16 @@ class SimpleProject(Project):
session.set_file_selector_dir(self.__file_selector_dir)
session.save(file)
except Exception, e:
moo.utils.error_dialog(self.window, 'Could not save session',
'Could not save file %s: %s' % (file, str(e)))
moo.error_dialog(self.window, 'Could not save session',
'Could not save file %s: %s' % (file, str(e)))
def save_config(self):
content = self.config.format()
try:
mprj.utils.save_file(self.filename, content)
except Exception, e:
moo.utils.error_dialog(self.window, 'Could not save project file',
'Could not save file %s: %s' % (self.filename, str(e)))
moo.error_dialog(self.window, 'Could not save project file',
'Could not save file %s: %s' % (self.filename, str(e)))
def options_dialog(self, window):
dialog = self.create_options_dialog()

View File

@ -81,10 +81,10 @@ def get_file_paths(filename, top_srcdir, top_builddir=None):
}
def implement_me(window, what):
moo.utils.warning_dialog(window, "IMPLEMENT ME", str(what))
moo.warning_dialog(window, "IMPLEMENT ME", str(what))
def oops(window, error):
moo.utils.error_dialog(window, "OOPS", format_error(error))
moo.error_dialog(window, "OOPS", format_error(error))
def print_error(error=None):
print >> sys.stderr, format_error(error)
@ -99,8 +99,8 @@ def format_error(error=None):
def entry_dialog(parent=None, label=None, entry_content=None, title=None):
glade_file = os.path.join(os.path.dirname(__file__), "utils.glade")
xml = moo.utils.glade_xml_new_from_file(glade_file, root='entry_dialog',
domain=moo.utils.GETTEXT_PACKAGE)
xml = moo.glade_xml_new_from_file(glade_file, root='entry_dialog',
domain=moo.GETTEXT_PACKAGE)
xml.w_entry_dialog.set_title(title)
if parent:
parent = parent.get_toplevel()
@ -120,7 +120,7 @@ def entry_dialog(parent=None, label=None, entry_content=None, title=None):
return retval
def error_dialog(text, secondary_text=None, parent=None):
moo.utils.error_dialog(parent, text, secondary_text)
moo.error_dialog(parent, text, secondary_text)
def question_dialog(text, secondary_text=None, default_ok=False, parent=None):
if parent:

View File

@ -19,7 +19,7 @@ import traceback
import gobject
from mprj.manager import Manager
class __plugin__(moo.edit.Plugin):
class __plugin__(moo.Plugin):
__gproperties__ = { 'project' : (str, 'project to open', 'project to open', None, gobject.PARAM_READWRITE) }
def do_set_property(self, prop, value):

View File

@ -27,7 +27,7 @@ import gobject
import mprj.utils
from mprj.simple import SimpleProject
from mprj.utils import print_error
from moo.utils import _, N_
from moo import _, N_
import cproj.config
from cproj.config import CConfig
@ -35,10 +35,10 @@ from cproj.parser import parse_make_error
from cproj.optdialog import Dialog as OptionsDialog
_STOCK_BUILD = moo.utils.STOCK_BUILD
_STOCK_COMPILE = moo.utils.STOCK_COMPILE
_STOCK_EXECUTE = moo.utils.STOCK_EXECUTE
_STOCK_PROJECT_OPTIONS = moo.utils.STOCK_PROJECT_OPTIONS
_STOCK_BUILD = moo.STOCK_BUILD
_STOCK_COMPILE = moo.STOCK_COMPILE
_STOCK_EXECUTE = moo.STOCK_EXECUTE
_STOCK_PROJECT_OPTIONS = moo.STOCK_PROJECT_OPTIONS
_BUILD_PANE_ID = "CProjectBuild"
_OUTPUT_PANE_ID = "CProjectOutput"
@ -90,7 +90,7 @@ class CProject(SimpleProject):
self.add_action("CProjectBuildConfiguration",
factory=_BuildConfigurationActionFactory(self))
editor = moo.edit.editor_instance()
editor = moo.editor_instance()
xml = editor.get_ui_xml()
xml.insert_markup_after(self.merge_id, "Editor/Menubar",
"Project", """
@ -124,9 +124,9 @@ class CProject(SimpleProject):
def get_build_pane(self, window):
pane = window.get_pane(_BUILD_PANE_ID)
if not pane:
label = moo.utils.PaneLabel(icon_name=_STOCK_BUILD,
label_text=_("Build Messages"))
output = moo.edit.CmdView()
label = moo.PaneLabel(icon_name=_STOCK_BUILD,
label_text=_("Build Messages"))
output = moo.CmdView()
window.add_stop_client(output)
if 1:
@ -136,7 +136,7 @@ class CProject(SimpleProject):
output.set_property("highlight-current-line", False)
output.set_wrap_mode(gtk.WRAP_CHAR)
output.set_filter(moo.edit.command_filter_create('make'))
output.set_filter(moo.command_filter_create('make'))
pane = gtk.ScrolledWindow()
pane.set_shadow_type(gtk.SHADOW_ETCHED_IN)
@ -145,15 +145,15 @@ class CProject(SimpleProject):
pane.show_all()
pane.output = output
window.add_pane(_BUILD_PANE_ID, pane, label, moo.utils.PANE_POS_BOTTOM)
window.add_pane(_BUILD_PANE_ID, pane, label, moo.PANE_POS_BOTTOM)
return pane
def get_output_pane(self, window):
pane = window.get_pane(_OUTPUT_PANE_ID)
if not pane:
label = moo.utils.PaneLabel(icon_name=_STOCK_EXECUTE,
label_text=_("Output"))
output = moo.edit.CmdView()
label = moo.PaneLabel(icon_name=_STOCK_EXECUTE,
label_text=_("Output"))
output = moo.CmdView()
window.add_stop_client(output)
output.set_property("highlight-current-line", False)
output.set_wrap_mode(gtk.WRAP_CHAR)
@ -165,7 +165,7 @@ class CProject(SimpleProject):
pane.show_all()
pane.output = output
window.add_pane(_OUTPUT_PANE_ID, pane, label, moo.utils.PANE_POS_BOTTOM)
window.add_pane(_OUTPUT_PANE_ID, pane, label, moo.PANE_POS_BOTTOM)
return pane
def get_file_path(self, file):
@ -183,7 +183,7 @@ class CProject(SimpleProject):
def save_all(self, window):
docs = window.list_docs()
for d in docs:
if d.get_filename() and d.get_status() & moo.edit.EDIT_MODIFIED:
if d.get_filename() and d.get_status() & moo.EDIT_MODIFIED:
d.save()
def do_command(self, window, cmd):
@ -276,7 +276,7 @@ class _BuildConfigurationActionFactory(object):
object.__init__(self)
self.project = project
def __call__(self, window):
action = gobject.new(moo.utils.Action,
action = gobject.new(moo.Action,
name="CProjectBuildConfiguration",
label="Build Configuration",
no_accel="True")

View File

@ -22,7 +22,7 @@ if __name__ == '__main__':
import os.path
import moo
from moo.utils import _
from moo import _
from mprj.utils import expand_command
from mprj.settings import *

View File

@ -25,7 +25,7 @@ import gtk
import os.path
import moo
from moo.utils import _
from moo import _
import mprj.optdialog
import mprj.simple
@ -171,8 +171,8 @@ class RunOptionsPage(mprj.optdialog.ConfigPage):
else:
self.xml.w_custom_dir.set_active(True)
self.xml.w_custom_dir_entry.set_text(run_from)
moo.utils.bind_sensitive(self.xml.w_custom_dir,
self.xml.w_custom_dir_entry)
moo.bind_sensitive(self.xml.w_custom_dir,
self.xml.w_custom_dir_entry)
def do_apply(self):
mprj.optdialog.ConfigPage.do_apply(self)
@ -230,7 +230,7 @@ if __name__ == '__main__':
from mprj.config import File
from c import CProject
editor = moo.edit.create_editor_instance()
editor = moo.create_editor_instance()
config_file = File(_sample_file, '/tmp/test-file.mprj')
config = CConfig(config_file)
project = CProject(None, config, config_file)

View File

@ -15,7 +15,7 @@
import os.path
import moo
from moo.utils import _
from moo import _
from mprj.settings import *
from mprj.simple import SimpleConfig

View File

@ -24,7 +24,7 @@ if __name__ == '__main__':
import gobject
import os.path
import moo
from moo.utils import _
from moo import _
import mprj.optdialog
from mprj.config.view import *
@ -41,9 +41,9 @@ class RunOptionsPage(mprj.optdialog.ConfigPage):
self.xml.w_exe.set_setting(self.config.run['exe'])
self.xml.w_args.set_setting(self.config.run['args'])
class Dialog(moo.utils.PrefsDialog):
class Dialog(moo.PrefsDialog):
def __init__(self, project, title=_('Project Options')):
moo.utils.PrefsDialog.__init__(self, title)
moo.PrefsDialog.__init__(self, title)
self.project = project
self.config_copy = project.config.copy()
# self.append_page(mprj.simple.ConfigPage(self.config_copy))
@ -51,7 +51,7 @@ class Dialog(moo.utils.PrefsDialog):
self.append_page(RunOptionsPage('page_run', self.config_copy, glade_file))
def do_apply(self):
moo.utils.PrefsDialog.do_apply(self)
moo.PrefsDialog.do_apply(self)
self.project.config.copy_from(self.config_copy)
self.project.save_config()
# print '============================='
@ -67,7 +67,7 @@ if __name__ == '__main__':
from mprj.config import File
from python import PyProject
editor = moo.edit.create_editor_instance()
editor = moo.create_editor_instance()
file = File(_sample_file, '/tmp/fake/file')
config = PyConfig(file)
project = PyProject(None, config, file)

View File

@ -25,7 +25,7 @@ import os.path
import gobject
import moo
from moo.utils import _, N_
from moo import _, N_
import medit
import mprj.utils
@ -37,8 +37,8 @@ from pyproj.config import PyConfig
from pyproj.optdialog import Dialog as OptionsDialog
_STOCK_EXECUTE = moo.utils.STOCK_EXECUTE
_STOCK_PROJECT_OPTIONS = moo.utils.STOCK_PROJECT_OPTIONS
_STOCK_EXECUTE = moo.STOCK_EXECUTE
_STOCK_PROJECT_OPTIONS = moo.STOCK_PROJECT_OPTIONS
_OUTPUT_PANE_ID = "PythonOutput"
_CMD_EXECUTE = 'execute'
@ -74,7 +74,7 @@ class PyProject(SimpleProject):
stock_id=c[2], default_accel=c[3],
callback=PyProject.DoCmd(self, c[4]))
editor = moo.edit.editor_instance()
editor = moo.editor_instance()
xml = editor.get_ui_xml()
xml.insert_markup_after(self.merge_id, "Editor/Menubar",
"Project", """
@ -104,7 +104,7 @@ class PyProject(SimpleProject):
def save_all(self, window):
docs = window.list_docs()
for d in docs:
if d.get_filename() and d.get_status() & moo.edit.EDIT_MODIFIED:
if d.get_filename() and d.get_status() & moo.EDIT_MODIFIED:
d.save()
def do_command(self, window, cmd):

View File

@ -18,9 +18,9 @@ import gobject
PLUGIN_ID = "TestPythonPlugin"
class Action(moo.edit.Action):
class Action(moo.Action):
def __init__(self):
moo.edit.Action.__init__(self)
moo.Action.__init__(self)
self.set_property("label", "AnAction")
#print "__init__"
@ -33,7 +33,7 @@ class Action(moo.edit.Action):
pass
class Plugin(moo.edit.Plugin):
class Plugin(moo.Plugin):
def do_init(self):
#print "do_init"
@ -57,11 +57,11 @@ class Plugin(moo.edit.Plugin):
pass
if moo.edit.module_check_version(2, 0):
if moo.module_check_version(2, 0):
gobject.type_register(Action)
gobject.type_register(Plugin)
info = moo.edit.PluginInfo("RealPythonPlugin", "Real Python Plugin",
description="Plugin", author="Uknown",
version="3.1415926")
moo.edit.plugin_register(Plugin, info)
info = moo.PluginInfo("RealPythonPlugin", "Real Python Plugin",
description="Plugin", author="Uknown",
version="3.1415926")
moo.plugin_register(Plugin, info)

View File

@ -19,7 +19,7 @@ import pango
import os
import moo
from moo.utils import _
from moo import _
import medit.runpython
MASTER_FILE = 'PYTHON_MASTER_FILE'
@ -32,9 +32,9 @@ except ImportError:
PLUGIN_ID = "Python"
class Plugin(moo.edit.Plugin):
class Plugin(moo.Plugin):
def do_init(self):
editor = moo.edit.editor_instance()
editor = moo.editor_instance()
xml = editor.get_ui_xml()
if xml is None:
@ -44,33 +44,33 @@ class Plugin(moo.edit.Plugin):
self.ui_merge_id = xml.new_merge_id()
if have_pyconsole:
moo.utils.window_class_add_action(moo.edit.EditWindow, "PythonConsole",
display_name=_("Python Console"),
label=_("Python Console"),
callback=self.show_console)
moo.window_class_add_action(moo.EditWindow, "PythonConsole",
display_name=_("Python Console"),
label=_("Python Console"),
callback=self.show_console)
xml.add_item(self.ui_merge_id, "ToolsMenu",
"PythonConsole", "PythonConsole", -1)
""" Run file """
moo.utils.window_class_add_action(moo.edit.EditWindow, "RunFile",
display_name=_("Run File"),
label=_("Run File"),
stock_id=moo.utils.STOCK_EXECUTE,
default_accel="<shift>F9",
callback=self.run_file)
moo.edit.window_set_action_filter("RunFile", moo.edit.ACTION_CHECK_SENSITIVE, "langs:python")
moo.window_class_add_action(moo.EditWindow, "RunFile",
display_name=_("Run File"),
label=_("Run File"),
stock_id=moo.STOCK_EXECUTE,
default_accel="<shift>F9",
callback=self.run_file)
moo.window_set_action_filter("RunFile", moo.ACTION_CHECK_SENSITIVE, "langs:python")
xml.add_item(self.ui_merge_id, "ToolsMenu",
"RunFile", "RunFile", -1)
return True
def do_deinit(self):
editor = moo.edit.editor_instance()
editor = moo.editor_instance()
xml = editor.get_ui_xml()
xml.remove_ui(self.ui_merge_id)
moo.utils.window_class_remove_action(moo.edit.EditWindow, "PythonConsole")
moo.utils.window_class_remove_action(moo.edit.EditWindow, "RunFile")
moo.utils.window_class_remove_action(moo.edit.EditWindow, "ReloadPythonPlugins")
moo.window_class_remove_action(moo.EditWindow, "PythonConsole")
moo.window_class_remove_action(moo.EditWindow, "RunFile")
moo.window_class_remove_action(moo.EditWindow, "ReloadPythonPlugins")
def show_console(self, window):
window = gtk.Window()
@ -79,14 +79,14 @@ class Plugin(moo.edit.Plugin):
window.add(swin)
dic = {}
dic['editor'] = moo.edit.editor_instance()
dic['window'] = moo.edit.editor_instance().get_active_window()
dic['doc'] = moo.edit.editor_instance().get_active_doc()
console_type = pyconsole.ConsoleType(moo.edit.TextView)
dic['editor'] = moo.editor_instance()
dic['window'] = moo.editor_instance().get_active_window()
dic['doc'] = moo.editor_instance().get_active_doc()
console_type = pyconsole.ConsoleType(moo.TextView)
console = console_type(use_rlcompleter=False, start_script=
"import moo\nimport gtk\n", locals=dic)
console.set_property("highlight-current-line", False)
editor = moo.edit.editor_instance()
editor = moo.editor_instance()
console.set_lang_by_id("python-console")
console.modify_font(pango.FontDescription("Monospace"))
@ -103,7 +103,7 @@ class Plugin(moo.edit.Plugin):
if not doc:
return
if not doc.get_filename() or doc.get_status() & moo.edit.EDIT_MODIFIED:
if not doc.get_filename() or doc.get_status() & moo.EDIT_MODIFIED:
if not doc.save():
return

View File

@ -17,21 +17,21 @@ import moo
import gtk
import gobject
class Plugin(moo.edit.Plugin):
class Plugin(moo.Plugin):
# this method is called when plugin is loaded, once per session
# (or after user checks Enabled in Preferences dialog)
def do_init(self):
editor = moo.edit.editor_instance()
editor = moo.editor_instance()
xml = editor.get_ui_xml()
self.ui_merge_id = xml.new_merge_id()
# Create a new action associated with editor windows
moo.utils.window_class_add_action(moo.edit.EditWindow,
"AnAction", # unique action id
display_name="Do Something", # what user sees in Configure Shortcuts dialog
label="Do Something", # menu item label
stock_id=gtk.STOCK_APPLY, # stock icon
callback=self.do_stuff # the action callback
)
moo.window_class_add_action(moo.EditWindow,
"AnAction", # unique action id
display_name="Do Something", # what user sees in Configure Shortcuts dialog
label="Do Something", # menu item label
stock_id=gtk.STOCK_APPLY, # stock icon
callback=self.do_stuff # the action callback
)
# and add it into the xml, so it's actually persent in menu
xml.add_item(self.ui_merge_id, "Editor/Menubar/Tools", action="AnAction")
@ -39,10 +39,10 @@ class Plugin(moo.edit.Plugin):
# this method is called when plugin is unloaded (on program exit or when plugin is disabled)
def do_deinit(self):
editor = moo.edit.editor_instance()
editor = moo.editor_instance()
xml = editor.get_ui_xml()
xml.remove_ui(self.ui_merge_id)
moo.utils.window_class_remove_action(moo.edit.EditWindow, "AnAction")
moo.window_class_remove_action(moo.EditWindow, "AnAction")
def do_stuff(self, window):
doc = window.get_active_doc()

View File

@ -18,32 +18,32 @@ import moo
import gtk
import gobject
import pango
from moo.utils import _
from moo.utils import D_
from moo import _
from moo import D_
try:
import vte
except ImportError:
moo.edit.cancel_plugin_loading()
moo.cancel_plugin_loading()
TERMINAL_PLUGIN_ID = "Terminal"
COLOR_SCHEME_KEY = 'Plugins/Terminal/color_scheme'
SHELL_KEY = 'Plugins/Terminal/shell'
FONT_KEY = 'Plugins/Terminal/font'
moo.utils.prefs_new_key_string(COLOR_SCHEME_KEY, 'Default')
moo.utils.prefs_new_key_string(SHELL_KEY, None)
moo.utils.prefs_new_key_string(FONT_KEY, None)
moo.prefs_new_key_string(COLOR_SCHEME_KEY, 'Default')
moo.prefs_new_key_string(SHELL_KEY, None)
moo.prefs_new_key_string(FONT_KEY, None)
class Terminal(vte.Terminal):
def __init__(self):
vte.Terminal.__init__(self)
cs_name = moo.utils.prefs_get_string(COLOR_SCHEME_KEY)
cs_name = moo.prefs_get_string(COLOR_SCHEME_KEY)
cs = find_color_scheme(cs_name)
self.set_color_scheme(cs)
self.set_allow_bold(False)
font_name = moo.utils.prefs_get_string(FONT_KEY)
font_name = moo.prefs_get_string(FONT_KEY)
if font_name:
self.set_font_from_string(font_name)
@ -55,12 +55,12 @@ class Terminal(vte.Terminal):
def color_scheme_item_activated(self, item, color_scheme):
self.set_color_scheme(color_scheme)
if color_scheme.colors:
moo.utils.prefs_set_string(COLOR_SCHEME_KEY, color_scheme.name)
moo.prefs_set_string(COLOR_SCHEME_KEY, color_scheme.name)
else:
moo.utils.prefs_set_string(COLOR_SCHEME_KEY, None)
moo.prefs_set_string(COLOR_SCHEME_KEY, None)
def font_item_activated(self, *whatever):
dlg = moo.utils.FontSelectionDialog(D_("Pick a Font", "gtk20"))
dlg = moo.FontSelectionDialog(D_("Pick a Font", "gtk20"))
dlg.fontsel.set_property('monospace', True)
old_font = self.get_font()
if old_font:
@ -71,7 +71,7 @@ class Terminal(vte.Terminal):
new_font = pango.FontDescription(font_name)
if old_font != new_font:
self.set_font_from_string(font_name)
moo.utils.prefs_set_string(FONT_KEY, font_name)
moo.prefs_set_string(FONT_KEY, font_name)
dlg.destroy()
def fill_settings_menu(self, menu):
@ -138,9 +138,9 @@ class Terminal(vte.Terminal):
self.popup_menu()
return True
class Plugin(moo.edit.Plugin):
class Plugin(moo.Plugin):
def do_init(self):
editor = moo.edit.editor_instance()
editor = moo.editor_instance()
xml = editor.get_ui_xml()
if xml is None:
@ -157,11 +157,11 @@ class Plugin(moo.edit.Plugin):
window.paned.present_pane(pane)
class WinPlugin(moo.edit.WinPlugin):
class WinPlugin(moo.WinPlugin):
def start(self, *whatever):
self.terminal.reset(True, True)
shell = moo.utils.prefs_get_string(SHELL_KEY)
shell = moo.prefs_get_string(SHELL_KEY)
if not shell:
try:
import os
@ -173,8 +173,8 @@ class WinPlugin(moo.edit.WinPlugin):
self.terminal.fork_command(shell, [shell])
def do_create(self):
label = moo.utils.PaneLabel(icon_name=moo.utils.STOCK_TERMINAL,
label_text=_("Terminal"))
label = moo.PaneLabel(icon_name=moo.STOCK_TERMINAL,
label_text=_("Terminal"))
self.terminal = Terminal()
self.terminal.set_scrollback_lines(1000000)
@ -192,7 +192,7 @@ class WinPlugin(moo.edit.WinPlugin):
self.terminal.set_size(self.terminal.get_column_count(), 10)
self.terminal.set_size_request(10, 10)
self.pane = self.window.add_pane(TERMINAL_PLUGIN_ID, frame, label, moo.utils.PANE_POS_BOTTOM)
self.pane = self.window.add_pane(TERMINAL_PLUGIN_ID, frame, label, moo.PANE_POS_BOTTOM)
self.terminal.connect('icon-title-changed', self.terminal_icon_title_changed)
self.terminal_icon_title_changed()

View File

@ -12,6 +12,9 @@ moo_defs_files = \
moopython/pygtk/moo.defs
moo_override_files = \
moopython/pygtk/mooutils.override \
moopython/pygtk/moopaned.override \
moopython/pygtk/mooedit.override \
moopython/pygtk/moo.override
EXTRA_DIST += \

View File

@ -53,10 +53,13 @@ headers
#include "mooedit/mooeditaction.h"
#include "mooedit/mooeditaction-factory.h"
#include "mooedit/mootextbuffer.h"
#include "mooedit/moolangmgr.h"
#include "plugins/support/moocmdview.h"
#include "plugins/support/mooeditwindowoutput.h"
#include "plugins/usertools/moocommand.h"
#include "mooapp/mooapp.h"
%%
@ -81,13 +84,16 @@ import gtk.FileChooser as PyGtkFileChooser_Type
import gtk.TextTag as PyGtkTextTag_Type
import gtk.TextTagTable as PyGtkTextTagTable_Type
import gtk.gdk.Pixbuf as PyGdkPixbuf_Type
import gtk.Action as PyGtkAction_Type
%%
ignore-glob
*_get_type
%%
// include mooutils.override
// %%
// include mooedit.override
// %%
include mooutils.override
%%
include moopaned.override
%%
include mooedit.override
%%
// include mooapp.override
// %%

View File

@ -19,48 +19,48 @@ import gtk as _gtk
import gobject as _gobject
from _moo import *
# _ = gettext
# D_ = dgettext
#
# def N_(string):
# return string
#
# class ActionFactory(object):
# def __init__(self, action_id, **kwargs):
# object.__init__(self)
# self.id = action_id
#
# self.props = {}
# self.fake_props = {}
#
# for key in kwargs.keys():
# if key in ["callback"]:
# self.fake_props[key] = kwargs[key]
# elif kwargs[key] is not None or key not in ["stock_id"]:
# self.props[key] = kwargs[key]
#
# def __call__(self, window):
# self.window = window
# action = _gobject.new(Action, name=self.id, **self.props)
# self.set_fake_props(action)
# return action
#
# def set_fake_props(self, action):
# def _activate(action, callback, window):
# callback(window)
#
# for key in self.fake_props.keys():
# if key == "callback":
# action.connect("activate", _activate, self.fake_props[key], self.window)
# else:
# raise ValueError("unknown property " + key)
#
# def set_props(self, action):
# for key in self.props.keys():
# action.set_property(key, self.props[key])
#
# def window_class_add_action(klass, action_id, group=None, **kwargs):
# if kwargs.has_key("factory"):
# _utils._window_class_add_action(klass, action_id, group, kwargs["factory"])
# else:
# _utils._window_class_add_action(klass, action_id, group, ActionFactory(action_id, **kwargs))
_ = gettext
D_ = dgettext
def N_(string):
return string
class ActionFactory(object):
def __init__(self, action_id, **kwargs):
object.__init__(self)
self.id = action_id
self.props = {}
self.fake_props = {}
for key in kwargs.keys():
if key in ["callback"]:
self.fake_props[key] = kwargs[key]
elif kwargs[key] is not None or key not in ["stock_id"]:
self.props[key] = kwargs[key]
def __call__(self, window):
self.window = window
action = _gobject.new(Action, name=self.id, **self.props)
self.set_fake_props(action)
return action
def set_fake_props(self, action):
def _activate(action, callback, window):
callback(window)
for key in self.fake_props.keys():
if key == "callback":
action.connect("activate", _activate, self.fake_props[key], self.window)
else:
raise ValueError("unknown property " + key)
def set_props(self, action):
for key in self.props.keys():
action.set_property(key, self.props[key])
def window_class_add_action(klass, action_id, group=None, **kwargs):
if kwargs.has_key("factory"):
_moo._window_class_add_action(klass, action_id, group, kwargs["factory"])
else:
_moo._window_class_add_action(klass, action_id, group, ActionFactory(action_id, **kwargs))

File diff suppressed because it is too large Load Diff

View File

@ -14,43 +14,6 @@
* You should have received a copy of the GNU Lesser General Public
* License along with medit. If not, see <http://www.gnu.org/licenses/>.
*/
%%
headers
#include <Python.h>
#define NO_IMPORT_PYGOBJECT
#define NO_IMPORT_PYGTK
#include <pygobject.h>
#include <pygtk/pygtk.h>
#include "plugins/support/moocmdview.h"
#include "plugins/usertools/moocommand.h"
#include "mooedit/mooedit.h"
#include "mooedit/mooeditbookmark.h"
#include "mooedit/mooedit-enums.h"
#include "mooedit/mooeditaction.h"
#include "mooedit/mooeditaction-factory.h"
#include "mooedit/mooeditconfig.h"
#include "mooedit/mooeditor.h"
#include "mooedit/mooeditprefs.h"
#include "mooedit/mootextsearch.h"
#include "mooedit/mooeditwindow.h"
#include "mooedit/mooindenter.h"
#include "mooedit/moolang.h"
#include "mooedit/moolangmgr.h"
#include "mooedit/moolinemark.h"
#include "plugins/support/moolineview.h"
#include "plugins/support/moooutputfilter.h"
#include "mooedit/mooplugin-macro.h"
#include "mooedit/mooplugin.h"
#include "mooedit/mootextbuffer.h"
#include "mooedit/mootextiter.h"
#include "mooedit/mootextstylescheme.h"
#include "mooedit/mootextview.h"
#include "mooedit/moolinemark.h"
// #include "mooedit/mootextpopup.h"
// #include "mooedit/mootextcompletion.h"
#include "mooedit/mooedit-enums.h"
#include "moopython/moopython-utils.h"
#include "moopython/pygtk/moo-pygtk.h"
%%
override moo_python_plugin_register varargs
@ -137,7 +100,7 @@ override moo_plugin_lookup_method kwargs
static PyObject *
_wrap_moo_plugin_lookup_method (PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "name", NULL };
static char *kwlist[] = { (char*) "name", NULL };
char *name;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:MooPlugin.lookup_method", kwlist, &name))
@ -146,48 +109,48 @@ _wrap_moo_plugin_lookup_method (PyGObject *self, PyObject *args, PyObject *kwarg
return PyBool_FromLong (moo_plugin_lookup_method (MOO_PLUGIN(self->obj), name) != 0);
}
%%
override moo_edit_window_list_docs noargs
static PyObject *
_wrap_moo_edit_window_list_docs (PyObject *self)
{
GSList *list;
PyObject *result;
list = moo_edit_window_list_docs (MOO_EDIT_WINDOW (pygobject_get (self)));
result = _moo_object_slist_to_pyobject (list);
g_slist_free (list);
return result;
}
%%
override moo_editor_list_windows noargs
static PyObject *
_wrap_moo_editor_list_windows (PyObject *self)
{
GSList *list;
PyObject *result;
list = moo_editor_list_windows (MOO_EDITOR (pygobject_get (self)));
result = _moo_object_slist_to_pyobject (list);
g_slist_free (list);
return result;
}
%%
override moo_editor_list_docs noargs
static PyObject *
_wrap_moo_editor_list_docs (PyObject *self)
{
GSList *list;
PyObject *result;
list = moo_editor_list_docs (MOO_EDITOR (pygobject_get (self)));
result = _moo_object_slist_to_pyobject (list);
g_slist_free (list);
return result;
}
// %%
// override moo_edit_window_list_docs noargs
// static PyObject *
// _wrap_moo_edit_window_list_docs (PyObject *self)
// {
// GSList *list;
// PyObject *result;
//
// list = moo_edit_window_list_docs (MOO_EDIT_WINDOW (pygobject_get (self)));
// result = _moo_object_slist_to_pyobject (list);
//
// g_slist_free (list);
// return result;
// }
// %%
// override moo_editor_list_windows noargs
// static PyObject *
// _wrap_moo_editor_list_windows (PyObject *self)
// {
// GSList *list;
// PyObject *result;
//
// list = moo_editor_list_windows (MOO_EDITOR (pygobject_get (self)));
// result = _moo_object_slist_to_pyobject (list);
//
// g_slist_free (list);
// return result;
// }
// %%
// override moo_editor_list_docs noargs
// static PyObject *
// _wrap_moo_editor_list_docs (PyObject *self)
// {
// GSList *list;
// PyObject *result;
//
// list = moo_editor_list_docs (MOO_EDITOR (pygobject_get (self)));
// result = _moo_object_slist_to_pyobject (list);
//
// g_slist_free (list);
// return result;
// }
%%
override-attr MooLang.mime_types
static PyObject *
@ -413,7 +376,7 @@ override moo_edit_class_remove_action kwargs
static PyObject *
_wrap_moo_edit_class_remove_action (G_GNUC_UNUSED PyObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = {"class", "id", NULL};
static char *kwlist[] = { (char*) "class", (char*) "id", NULL };
PyObject *py_type;
GType type;
const char *action_id;
@ -482,7 +445,7 @@ _wrap_moo_plugin_call_method (PyGObject *self, PyObject *args)
{
PyErr_Format (PyExc_TypeError, "in Plugin.call_method: method '%s' takes "
"exactly %d arguments (%d given)", name, meth->n_params,
PyTuple_GET_SIZE (args) - 1);
(int) PyTuple_GET_SIZE (args) - 1);
return NULL;
}
@ -538,7 +501,7 @@ override moo_command_context_set kwargs
static PyObject *
_wrap_moo_command_context_set (PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = {"name", "value", NULL};
static char *kwlist[] = { (char*) "name", (char*) "value", NULL };
char *name;
PyObject *py_value;
GValue value;
@ -563,7 +526,7 @@ override moo_command_context_get kwargs
static PyObject *
_wrap_moo_command_context_get (PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = {"name", NULL};
static char *kwlist[] = { (char*) "name", NULL };
char *name;
PyObject *py_value;
GValue value;

View File

@ -18,7 +18,7 @@ override moo_big_paned_find_pane kwargs
static PyObject *
_wrap_moo_big_paned_find_pane (PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "pane_widget", NULL };
static char *kwlist[] = { (char*) "pane_widget", NULL };
PyGObject *widget;
MooPaned *child;
PyObject *ret;

View File

@ -203,19 +203,19 @@
; (gtype-id "MOO_TYPE_ICON_VIEW")
; )
(define-object LineView
(in-module "Moo")
(parent "MooTextView")
(c-name "MooLineView")
(gtype-id "MOO_TYPE_LINE_VIEW")
)
(define-object CmdView
(in-module "Moo")
(parent "MooLineView")
(c-name "MooCmdView")
(gtype-id "MOO_TYPE_CMD_VIEW")
)
; (define-object LineView
; (in-module "Moo")
; (parent "MooTextView")
; (c-name "MooLineView")
; (gtype-id "MOO_TYPE_LINE_VIEW")
; )
;
; (define-object CmdView
; (in-module "Moo")
; (parent "MooLineView")
; (c-name "MooCmdView")
; (gtype-id "MOO_TYPE_CMD_VIEW")
; )
; (define-object Menu
; (in-module "Moo")
@ -252,13 +252,6 @@
; (gtype-id "MOO_TYPE_NOTEBOOK")
; )
(define-object OutputFilter
(in-module "Moo")
(parent "GObject")
(c-name "MooOutputFilter")
(gtype-id "MOO_TYPE_OUTPUT_FILTER")
)
(define-object Paned
(in-module "Moo")
(parent "GtkBin")
@ -1754,7 +1747,7 @@
(define-method get_uris
(of-object "MooFileDialog")
(c-name "moo_file_dialog_get_uris")
(return-type "char**")
(return-type "strv")
)
(define-method set_current_folder_uri
@ -2929,38 +2922,19 @@
;; From mooi18n.h
(define-function gettext
(c-name "moo_gettext")
(c-name "_")
(return-type "const-char*")
(parameters
'("const-char*" "string")
)
)
(define-function pgettext
(c-name "moo_pgettext")
(return-type "const-char*")
(parameters
'("const-char*" "msgctxtid")
'("gsize" "msgidoffset")
)
)
(define-function pgettext2
(c-name "moo_pgettext2")
(return-type "const-char*")
(parameters
'("const-char*" "context")
'("const-char*" "msgctxtid")
)
)
(define-function dpgettext
(c-name "moo_dpgettext")
(define-function dgettext
(c-name "D_")
(return-type "const-char*")
(parameters
'("const-char*" "string")
'("const-char*" "domain")
'("const-char*" "msgctxtid")
'("gsize" "msgidoffset")
)
)
@ -3466,7 +3440,7 @@
(define-function mime_type_list_parents
(c-name "moo_mime_type_list_parents")
(return-type "const-char**")
(return-type "const-strv")
(parameters
'("const-char*" "mime_type")
)
@ -4107,7 +4081,7 @@
(c-name "moo_prefs_load")
(return-type "gboolean")
(parameters
'("char**" "sys_files")
'("strv" "sys_files")
'("const-char*" "file_rc")
'("const-char*" "file_state")
'("GError**" "error")
@ -4933,17 +4907,17 @@
(define-function get_data_dirs
(c-name "moo_get_data_dirs")
(return-type "char**")
(return-type "strv")
)
(define-function get_lib_dirs
(c-name "moo_get_lib_dirs")
(return-type "char**")
(return-type "strv")
)
(define-function get_data_subdirs
(c-name "moo_get_data_subdirs")
(return-type "char**")
(return-type "strv")
(parameters
'("const-char*" "subdir")
)
@ -4951,7 +4925,7 @@
(define-function get_sys_data_subdirs
(c-name "moo_get_sys_data_subdirs")
(return-type "char**")
(return-type "strv")
(parameters
'("const-char*" "subdir")
)
@ -4959,7 +4933,7 @@
(define-function get_lib_subdirs
(c-name "moo_get_lib_subdirs")
(return-type "char**")
(return-type "strv")
(parameters
'("const-char*" "subdir")
)
@ -4967,7 +4941,7 @@
(define-function get_data_and_lib_subdirs
(c-name "moo_get_data_and_lib_subdirs")
(return-type "char**")
(return-type "strv")
(parameters
'("const-char*" "subdir")
)
@ -5048,7 +5022,7 @@
; (define-function strnsplit_lines
; (c-name "moo_strnsplit_lines")
; (return-type "char**")
; (return-type "strv")
; (parameters
; '("const-char*" "string")
; '("gssize" "len")
@ -5058,7 +5032,7 @@
; (define-function splitlines
; (c-name "moo_splitlines")
; (return-type "char**")
; (return-type "strv")
; (parameters
; '("const-char*" "string")
; )
@ -5208,6 +5182,11 @@
)
)
(define-function _window_class_add_action
(c-name "moo_window_class_add_action")
(return-type "none")
)
(define-method find_action
(of-object "MooWindowClass")
(c-name "moo_window_class_find_action")
@ -5303,359 +5282,242 @@
;; From moocmdview.h
(define-function cmd_view_get_type
(c-name "moo_cmd_view_get_type")
(return-type "GType")
)
(define-function cmd_view_new
(c-name "moo_cmd_view_new")
(is-constructor-of "MooCmdView")
(return-type "GtkWidget*")
)
(define-method set_filter
(of-object "MooCmdView")
(c-name "moo_cmd_view_set_filter")
(return-type "none")
(parameters
'("MooOutputFilter*" "filter")
)
)
(define-method add_filter_dirs
(of-object "MooCmdView")
(c-name "moo_cmd_view_add_filter_dirs")
(return-type "none")
(parameters
'("char**" "dirs")
)
)
(define-method run_command
(of-object "MooCmdView")
(c-name "moo_cmd_view_run_command")
(return-type "gboolean")
(parameters
'("const-char*" "cmd")
'("const-char*" "working_dir")
'("const-char*" "job_name")
)
)
(define-method run_command_full
(of-object "MooCmdView")
(c-name "moo_cmd_view_run_command_full")
(return-type "gboolean")
(parameters
'("const-char*" "cmd")
'("const-char*" "display_cmd")
'("const-char*" "working_dir")
'("char**" "envp")
'("const-char*" "job_name")
)
)
(define-method abort
(of-object "MooCmdView")
(c-name "moo_cmd_view_abort")
(return-type "none")
)
(define-method running
(of-object "MooCmdView")
(c-name "moo_cmd_view_running")
(return-type "gboolean")
)
; ;; From moocmdview.h
;
; (define-function cmd_view_get_type
; (c-name "moo_cmd_view_get_type")
; (return-type "GType")
; )
;
; (define-function cmd_view_new
; (c-name "moo_cmd_view_new")
; (is-constructor-of "MooCmdView")
; (return-type "GtkWidget*")
; )
;
; (define-method set_filter
; (of-object "MooCmdView")
; (c-name "moo_cmd_view_set_filter")
; (return-type "none")
; (parameters
; '("MooOutputFilter*" "filter")
; )
; )
;
; (define-method add_filter_dirs
; (of-object "MooCmdView")
; (c-name "moo_cmd_view_add_filter_dirs")
; (return-type "none")
; (parameters
; '("strv" "dirs")
; )
; )
;
; (define-method run_command
; (of-object "MooCmdView")
; (c-name "moo_cmd_view_run_command")
; (return-type "gboolean")
; (parameters
; '("const-char*" "cmd")
; '("const-char*" "working_dir")
; '("const-char*" "job_name")
; )
; )
;
; (define-method run_command_full
; (of-object "MooCmdView")
; (c-name "moo_cmd_view_run_command_full")
; (return-type "gboolean")
; (parameters
; '("const-char*" "cmd")
; '("const-char*" "display_cmd")
; '("const-char*" "working_dir")
; '("strv" "envp")
; '("const-char*" "job_name")
; )
; )
;
; (define-method abort
; (of-object "MooCmdView")
; (c-name "moo_cmd_view_abort")
; (return-type "none")
; )
;
; (define-method running
; (of-object "MooCmdView")
; (c-name "moo_cmd_view_running")
; (return-type "gboolean")
; )
;; From mooeditwindowoutput.h
(define-method present_output
(of-object "MooEditWindow")
(c-name "moo_edit_window_present_output")
(return-type "none")
)
(define-method get_output
(of-object "MooEditWindow")
(c-name "moo_edit_window_get_output")
(return-type "GtkWidget*")
)
(define-method get_output_pane
(of-object "MooEditWindow")
(c-name "moo_edit_window_get_output_pane")
(return-type "GtkWidget*")
)
; ;; From mooeditwindowoutput.h
;
; (define-method present_output
; (of-object "MooEditWindow")
; (c-name "moo_edit_window_present_output")
; (return-type "none")
; )
;
; (define-method get_output
; (of-object "MooEditWindow")
; (c-name "moo_edit_window_get_output")
; (return-type "GtkWidget*")
; )
;
; (define-method get_output_pane
; (of-object "MooEditWindow")
; (c-name "moo_edit_window_get_output_pane")
; (return-type "GtkWidget*")
; )
;; From moolineview.h
(define-function line_view_get_type
(c-name "moo_line_view_get_type")
(return-type "GType")
)
(define-function line_view_data_get_type
(c-name "moo_line_view_data_get_type")
(return-type "GType")
)
(define-function line_view_new
(c-name "moo_line_view_new")
(is-constructor-of "MooLineView")
(return-type "GtkWidget*")
)
(define-method set_data
(of-object "MooLineView")
(c-name "moo_line_view_set_data")
(return-type "none")
(parameters
'("int" "line")
'("gpointer" "data")
'("GDestroyNotify" "destroy")
)
)
(define-method set_line_data
(of-object "MooLineView")
(c-name "moo_line_view_set_line_data")
(return-type "none")
(parameters
'("int" "line")
'("const-GValue*" "data")
)
)
(define-method set_boxed
(of-object "MooLineView")
(c-name "moo_line_view_set_boxed")
(return-type "none")
(parameters
'("int" "line")
'("GType" "type")
'("gpointer" "data")
)
)
(define-method get_data
(of-object "MooLineView")
(c-name "moo_line_view_get_data")
(return-type "gpointer")
(parameters
'("int" "line")
)
)
(define-method get_line_data
(of-object "MooLineView")
(c-name "moo_line_view_get_line_data")
(return-type "gboolean")
(parameters
'("int" "line")
'("GValue*" "dest")
)
)
(define-method get_boxed
(of-object "MooLineView")
(c-name "moo_line_view_get_boxed")
(return-type "gpointer")
(parameters
'("int" "line")
'("GType" "type")
)
)
(define-method create_tag
(of-object "MooLineView")
(c-name "moo_line_view_create_tag")
(return-type "GtkTextTag*")
(parameters
'("const-char*" "tag_name")
'("const-char*" "first_property_name")
)
(varargs #t)
)
(define-method lookup_tag
(of-object "MooLineView")
(c-name "moo_line_view_lookup_tag")
(return-type "GtkTextTag*")
(parameters
'("const-char*" "tag_name")
)
)
(define-method clear
(of-object "MooLineView")
(c-name "moo_line_view_clear")
(return-type "none")
)
(define-method start_line
(of-object "MooLineView")
(c-name "moo_line_view_start_line")
(return-type "int")
)
(define-method write
(of-object "MooLineView")
(c-name "moo_line_view_write")
(return-type "none")
(parameters
'("const-char*" "text")
'("gssize" "len")
'("GtkTextTag*" "tag")
)
)
(define-method end_line
(of-object "MooLineView")
(c-name "moo_line_view_end_line")
(return-type "none")
)
(define-method write_line
(of-object "MooLineView")
(c-name "moo_line_view_write_line")
(return-type "int")
(parameters
'("const-char*" "text")
'("gssize" "len")
'("GtkTextTag*" "tag")
)
)
(define-method set_cursor
(of-object "MooLineView")
(c-name "moo_line_view_set_cursor")
(return-type "none")
(parameters
'("int" "line")
'("MooTextCursor" "cursor")
)
)
;; From moooutputfilter.h
(define-function output_filter_get_type
(c-name "moo_output_filter_get_type")
(return-type "GType")
)
(define-function file_line_data_get_type
(c-name "moo_file_line_data_get_type")
(return-type "GType")
)
(define-function file_line_data_new
(c-name "moo_file_line_data_new")
(is-constructor-of "MooFileLineData")
(return-type "MooFileLineData*")
(parameters
'("const-char*" "file")
'("int" "line")
'("int" "character")
)
)
(define-method free
(of-object "MooFileLineData")
(c-name "moo_file_line_data_free")
(return-type "none")
)
(define-method set_view
(of-object "MooOutputFilter")
(c-name "moo_output_filter_set_view")
(return-type "none")
(parameters
'("MooLineView*" "view")
)
)
(define-method get_view
(of-object "MooOutputFilter")
(c-name "moo_output_filter_get_view")
(return-type "MooLineView*")
)
(define-method stdout_line
(of-object "MooOutputFilter")
(c-name "moo_output_filter_stdout_line")
(return-type "gboolean")
(parameters
'("const-char*" "line")
)
)
(define-method stderr_line
(of-object "MooOutputFilter")
(c-name "moo_output_filter_stderr_line")
(return-type "gboolean")
(parameters
'("const-char*" "line")
)
)
(define-method cmd_start
(of-object "MooOutputFilter")
(c-name "moo_output_filter_cmd_start")
(return-type "none")
(parameters
'("const-char*" "working_dir")
)
)
(define-method cmd_exit
(of-object "MooOutputFilter")
(c-name "moo_output_filter_cmd_exit")
(return-type "gboolean")
(parameters
'("int" "status")
)
)
(define-method set_active_file
(of-object "MooOutputFilter")
(c-name "moo_output_filter_set_active_file")
(return-type "none")
(parameters
'("const-char*" "path")
)
)
(define-method add_active_dirs
(of-object "MooOutputFilter")
(c-name "moo_output_filter_add_active_dirs")
(return-type "none")
(parameters
'("char**" "dirs")
)
)
(define-method get_active_file
(of-object "MooOutputFilter")
(c-name "moo_output_filter_get_active_file")
(return-type "const-char*")
)
(define-method set_window
(of-object "MooOutputFilter")
(c-name "moo_output_filter_set_window")
(return-type "none")
(parameters
'("gpointer" "window")
)
)
; ;; From moolineview.h
;
; (define-function line_view_get_type
; (c-name "moo_line_view_get_type")
; (return-type "GType")
; )
;
; (define-function line_view_data_get_type
; (c-name "moo_line_view_data_get_type")
; (return-type "GType")
; )
;
; (define-function line_view_new
; (c-name "moo_line_view_new")
; (is-constructor-of "MooLineView")
; (return-type "GtkWidget*")
; )
;
; (define-method set_data
; (of-object "MooLineView")
; (c-name "moo_line_view_set_data")
; (return-type "none")
; (parameters
; '("int" "line")
; '("gpointer" "data")
; '("GDestroyNotify" "destroy")
; )
; )
;
; (define-method set_line_data
; (of-object "MooLineView")
; (c-name "moo_line_view_set_line_data")
; (return-type "none")
; (parameters
; '("int" "line")
; '("const-GValue*" "data")
; )
; )
;
; (define-method set_boxed
; (of-object "MooLineView")
; (c-name "moo_line_view_set_boxed")
; (return-type "none")
; (parameters
; '("int" "line")
; '("GType" "type")
; '("gpointer" "data")
; )
; )
;
; (define-method get_data
; (of-object "MooLineView")
; (c-name "moo_line_view_get_data")
; (return-type "gpointer")
; (parameters
; '("int" "line")
; )
; )
;
; (define-method get_line_data
; (of-object "MooLineView")
; (c-name "moo_line_view_get_line_data")
; (return-type "gboolean")
; (parameters
; '("int" "line")
; '("GValue*" "dest")
; )
; )
;
; (define-method get_boxed
; (of-object "MooLineView")
; (c-name "moo_line_view_get_boxed")
; (return-type "gpointer")
; (parameters
; '("int" "line")
; '("GType" "type")
; )
; )
;
; (define-method create_tag
; (of-object "MooLineView")
; (c-name "moo_line_view_create_tag")
; (return-type "GtkTextTag*")
; (parameters
; '("const-char*" "tag_name")
; '("const-char*" "first_property_name")
; )
; (varargs #t)
; )
;
; (define-method lookup_tag
; (of-object "MooLineView")
; (c-name "moo_line_view_lookup_tag")
; (return-type "GtkTextTag*")
; (parameters
; '("const-char*" "tag_name")
; )
; )
;
; (define-method clear
; (of-object "MooLineView")
; (c-name "moo_line_view_clear")
; (return-type "none")
; )
;
; (define-method start_line
; (of-object "MooLineView")
; (c-name "moo_line_view_start_line")
; (return-type "int")
; )
;
; (define-method write
; (of-object "MooLineView")
; (c-name "moo_line_view_write")
; (return-type "none")
; (parameters
; '("const-char*" "text")
; '("gssize" "len")
; '("GtkTextTag*" "tag")
; )
; )
;
; (define-method end_line
; (of-object "MooLineView")
; (c-name "moo_line_view_end_line")
; (return-type "none")
; )
;
; (define-method write_line
; (of-object "MooLineView")
; (c-name "moo_line_view_write_line")
; (return-type "int")
; (parameters
; '("const-char*" "text")
; '("gssize" "len")
; '("GtkTextTag*" "tag")
; )
; )
;
; (define-method set_cursor
; (of-object "MooLineView")
; (c-name "moo_line_view_set_cursor")
; (return-type "none")
; (parameters
; '("int" "line")
; '("MooTextCursor" "cursor")
; )
; )

View File

@ -13,42 +13,7 @@
* You should have received a copy of the GNU Lesser General Public
* License along with medit. If not, see <http://www.gnu.org/licenses/>.
*/
%%
headers
#include <Python.h>
#define NO_IMPORT_PYGOBJECT
#define NO_IMPORT_PYGTK
#include <pygobject.h>
#include <pygtk/pygtk.h>
#include "mooutils/mooi18n.h"
#include "mooutils/moofilewatch.h"
#include "mooutils/moohistorycombo.h"
#include "mooutils/mooutils-gobject.h"
#include "mooutils/moouixml.h"
#include "mooutils/moowindow.h"
#include "mooutils/mooprefsdialog.h"
#include "mooutils/mooprefs.h"
#include "mooutils/mooglade.h"
#include "mooutils/moobigpaned.h"
#include "mooutils/mooentry.h"
#include "mooutils/moofiltermgr.h"
#include "mooutils/moonotebook.h"
#include "mooutils/mooundo.h"
#include "mooutils/moofiledialog.h"
#include "mooutils/moomenuaction.h"
#include "mooutils/moodialogs.h"
#include "mooutils/mooutils-misc.h"
#include "mooutils/mooaction.h"
#include "mooutils/mooactionbase.h"
#include "mooutils/moofontsel.h"
#include "mooutils/mooutils-enums.h"
#include "mooutils/moostock.h"
#include "moofileview/moofileview.h"
#include "moopython/moopython-utils.h"
#include "moopython/pygtk/moo-pygtk.h"
%%
include moopaned.override
%%
override moo_window_class_add_action varargs
static GtkAction*
@ -514,13 +479,13 @@ _wrap_moo_prefs_new_key (G_GNUC_UNUSED PyObject *self, PyObject *args)
const char *key;
GType type;
GValue default_value;
int prefs_type;
PyObject *py_prefs_type, *py_default, *py_type;
int prefs_kind;
PyObject *py_prefs_kind, *py_default, *py_type;
if (!PyArg_ParseTuple (args, "sOOO:prefs_new_key", &key,
&py_type, &py_default, &py_prefs_type))
&py_type, &py_default, &py_prefs_kind))
return NULL;
if (pyg_enum_get_value (MOO_TYPE_PREFS_TYPE, py_prefs_type, &prefs_type) != 0)
if (pyg_enum_get_value (MOO_TYPE_PREFS_KIND, py_prefs_kind, &prefs_kind) != 0)
return NULL;
if (!(type = pyg_type_from_object (py_type)))
return NULL;
@ -536,81 +501,81 @@ _wrap_moo_prefs_new_key (G_GNUC_UNUSED PyObject *self, PyObject *args)
return_TypeError ("could not convert default value to given type");
}
moo_prefs_new_key (key, type, &default_value, prefs_type);
moo_prefs_new_key (key, type, &default_value, prefs_kind);
g_value_unset (&default_value);
return_None;
}
%%
override moo_get_data_dirs varargs
static PyObject *
_wrap_moo_get_data_dirs (G_GNUC_UNUSED PyObject *self, PyObject *args)
{
int type;
PyObject *py_type = NULL;
PyObject *ret;
char **dirs;
guint n_dirs, i;
if (!PyArg_ParseTuple (args, "O:get_data_dirs", &py_type))
return NULL;
if (pyg_enum_get_value(MOO_TYPE_DATA_DIR_TYPE, py_type, &type))
return NULL;
dirs = moo_get_data_dirs (type, &n_dirs);
if (!dirs)
return_None;
ret = PyTuple_New (n_dirs);
g_return_val_if_fail (ret != NULL, NULL);
for (i = 0; i < n_dirs; ++i)
PyTuple_SET_ITEM (ret, i, PyString_FromString (dirs[i]));
g_strfreev (dirs);
return ret;
}
%%
override moo_get_data_subdirs varargs
static PyObject *
_wrap_moo_get_data_subdirs (G_GNUC_UNUSED PyObject *self, PyObject *args)
{
int type;
PyObject *py_type = NULL;
PyObject *ret;
char **dirs;
guint n_dirs, i;
char *subdir;
if (!PyArg_ParseTuple (args, "sO:get_data_dirs", &subdir, &py_type))
return NULL;
if (pyg_enum_get_value(MOO_TYPE_DATA_DIR_TYPE, py_type, &type))
return NULL;
dirs = moo_get_data_subdirs (subdir, type, &n_dirs);
if (!dirs)
return_None;
ret = PyTuple_New (n_dirs);
g_return_val_if_fail (ret != NULL, NULL);
for (i = 0; i < n_dirs; ++i)
PyTuple_SET_ITEM (ret, i, PyString_FromString (dirs[i]));
g_strfreev (dirs);
return ret;
}
%%
override moo_get_data_files varargs
static PyObject *
_wrap_moo_get_data_subdirs (PyObject *self, PyObject *args);
static PyObject *
_wrap_moo_get_data_files (PyObject *self, PyObject *args)
{
return _wrap_moo_get_data_subdirs (self, args);
}
// %%
// override moo_get_data_dirs varargs
// static PyObject *
// _wrap_moo_get_data_dirs (G_GNUC_UNUSED PyObject *self, PyObject *args)
// {
// int type;
// PyObject *py_type = NULL;
// PyObject *ret;
// char **dirs;
// guint n_dirs, i;
//
// if (!PyArg_ParseTuple (args, "O:get_data_dirs", &py_type))
// return NULL;
// if (pyg_enum_get_value(MOO_TYPE_DATA_DIR_TYPE, py_type, &type))
// return NULL;
//
// dirs = moo_get_data_dirs (type, &n_dirs);
//
// if (!dirs)
// return_None;
//
// ret = PyTuple_New (n_dirs);
// g_return_val_if_fail (ret != NULL, NULL);
//
// for (i = 0; i < n_dirs; ++i)
// PyTuple_SET_ITEM (ret, i, PyString_FromString (dirs[i]));
//
// g_strfreev (dirs);
// return ret;
// }
// %%
// override moo_get_data_subdirs varargs
// static PyObject *
// _wrap_moo_get_data_subdirs (G_GNUC_UNUSED PyObject *self, PyObject *args)
// {
// int type;
// PyObject *py_type = NULL;
// PyObject *ret;
// char **dirs;
// guint n_dirs, i;
// char *subdir;
//
// if (!PyArg_ParseTuple (args, "sO:get_data_dirs", &subdir, &py_type))
// return NULL;
// if (pyg_enum_get_value(MOO_TYPE_DATA_DIR_TYPE, py_type, &type))
// return NULL;
//
// dirs = moo_get_data_subdirs (subdir, type, &n_dirs);
//
// if (!dirs)
// return_None;
//
// ret = PyTuple_New (n_dirs);
// g_return_val_if_fail (ret != NULL, NULL);
//
// for (i = 0; i < n_dirs; ++i)
// PyTuple_SET_ITEM (ret, i, PyString_FromString (dirs[i]));
//
// g_strfreev (dirs);
// return ret;
// }
// %%
// override moo_get_data_files varargs
// static PyObject *
// _wrap_moo_get_data_subdirs (PyObject *self, PyObject *args);
// static PyObject *
// _wrap_moo_get_data_files (PyObject *self, PyObject *args)
// {
// return _wrap_moo_get_data_subdirs (self, args);
// }
%%
override moo_file_watch_monitor_directory kwargs
static PyObject *

View File

@ -1,434 +0,0 @@
;; -*- scheme -*-
(define-object CommandContext
(in-module "Moo")
(parent "GObject")
(c-name "MooCommandContext")
(gtype-id "MOO_TYPE_COMMAND_CONTEXT")
)
(define-object CommandFactory
(in-module "Moo")
(parent "GObject")
(c-name "MooCommandFactory")
(gtype-id "MOO_TYPE_COMMAND_FACTORY")
(fields
'("char*" "name")
'("char*" "display_name")
)
)
(define-object Command
(in-module "Moo")
(parent "GObject")
(c-name "MooCommand")
(gtype-id "MOO_TYPE_COMMAND")
(fields
'("MooCommandOptions" "options")
)
)
(define-boxed CommandData
(in-module "Moo")
(c-name "MooCommandData")
(gtype-id "MOO_TYPE_COMMAND_DATA")
)
(define-flags CommandOptions
(in-module "Moo")
(c-name "MooCommandOptions")
(gtype-id "MOO_TYPE_COMMAND_OPTIONS")
)
(define-function parse_command_options
(c-name "moo_command_options_parse")
(return-type "MooCommandOptions")
(parameters
'("const-char*" "string" (null-ok))
)
)
(define-function command_create
(c-name "moo_command_create")
(return-type "MooCommand*")
(parameters
'("const-char*" "type")
'("const-char*" "options")
'("MooCommandData*" "data")
)
)
(define-function command_factory_register
(c-name "moo_command_factory_register")
(return-type "none")
(parameters
'("const-char*" "name")
'("const-char*" "display_name")
'("MooCommandFactory*" "factory")
'("strv" "data_keys" (null-ok))
'("const-char*" "extension" (null-ok) (default "NULL"))
)
)
(define-function command_factory_lookup
(c-name "moo_command_factory_lookup")
(return-type "MooCommandFactory*")
(parameters
'("const-char*" "name")
)
)
(define-virtual create_command
(of-object "MooCommandFactory")
(return-type "MooCommand*")
(parameters
'("MooCommandData*" "data")
'("const-char*" "options" (null-ok))
)
)
(define-virtual create_widget
(of-object "MooCommandFactory")
(return-type "GtkWidget*")
)
(define-virtual load_data
(of-object "MooCommandFactory")
(return-type "none")
(parameters
'("GtkWidget*" "widget")
'("MooCommandData*" "data")
)
)
(define-virtual save_data
(of-object "MooCommandFactory")
(return-type "gboolean")
(parameters
'("GtkWidget*" "widget")
'("MooCommandData*" "data")
)
)
(define-virtual data_equal
(of-object "MooCommandFactory")
(return-type "gboolean")
(parameters
'("MooCommandData*" "data1")
'("MooCommandData*" "data2")
)
)
(define-method run
(of-object "MooCommand")
(c-name "moo_command_run")
(return-type "none")
(parameters
'("MooCommandContext*" "ctx")
)
)
(define-virtual run
(of-object "MooCommand")
(return-type "none")
(parameters
'("MooCommandContext*" "ctx")
)
)
(define-method set_options
(of-object "MooCommand")
(c-name "moo_command_set_options")
(return-type "none")
(parameters
'("MooCommandOptions" "options")
)
)
(define-method get_options
(of-object "MooCommand")
(c-name "moo_command_get_options")
(return-type "MooCommandOptions")
)
(ifndef pygtk-2.6
(define-function moo_command_context_new
(c-name "moo_command_context_new")
(is-constructor-of "MooCommandContext")
(return-type "MooCommandContext*")
(properties
'("doc" (optional))
'("window" (optional))
)
)
)
(define-method set_doc
(of-object "MooCommandContext")
(c-name "moo_command_context_set_doc")
(return-type "none")
(parameters
'("GtkTextView*" "doc" (null-ok))
)
)
(define-method get_doc
(of-object "MooCommandContext")
(c-name "moo_command_context_get_doc")
(return-type "GtkTextView*")
)
(define-method set_window
(of-object "MooCommandContext")
(c-name "moo_command_context_set_window")
(return-type "none")
(parameters
'("GtkWindow*" "window" (null-ok))
)
)
(define-method get_window
(of-object "MooCommandContext")
(c-name "moo_command_context_get_window")
(return-type "GtkWindow*")
)
(define-method set
(of-object "MooCommandContext")
(c-name "moo_command_context_set")
(return-type "none")
(parameters
'("const-char*" "name")
'("const-GValue*" "value")
)
)
(define-method get
(of-object "MooCommandContext")
(c-name "moo_command_context_get")
(return-type "gboolean")
(parameters
'("const-char*" "name")
'("GValue*" "value")
)
)
(define-method unset
(of-object "MooCommandContext")
(c-name "moo_command_context_unset")
(return-type "none")
(parameters
'("const-char*" "name")
)
)
(define-method foreach
(of-object "MooCommandContext")
(c-name "moo_command_context_foreach")
(return-type "none")
(parameters
'("MooCommandContextForeachFunc" "func")
'("gpointer" "data")
)
)
(define-function moo_command_data_new
(c-name "moo_command_data_new")
(is-constructor-of "MooCommandData")
(return-type "MooCommandData*")
(parameters
'("guint" "len")
)
)
(define-method set
(of-object "MooCommandData")
(c-name "moo_command_data_set")
(return-type "none")
(parameters
'("guint" "key")
'("const-char*" "value" (null-ok))
)
)
(define-method get
(of-object "MooCommandData")
(c-name "moo_command_data_get")
(return-type "const-char*")
(parameters
'("guint" "key")
)
)
(define-method set_code
(of-object "MooCommandData")
(c-name "moo_command_data_set_code")
(return-type "none")
(parameters
'("const-char*" "value" (null-ok))
)
)
(define-method get_code
(of-object "MooCommandData")
(c-name "moo_command_data_get_code")
(return-type "const-char*")
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; MooOutputFilter
;;
(define-object OutputFilter
(in-module "Moo")
(parent "GObject")
(c-name "MooOutputFilter")
(gtype-id "MOO_TYPE_OUTPUT_FILTER")
)
(define-virtual attach
(of-object "MooOutputFilter")
(return-type "none")
)
(define-virtual detach
(of-object "MooOutputFilter")
(return-type "none")
)
(define-virtual stdout_line
(of-object "MooOutputFilter")
(return-type "gboolean")
(parameters
'("const-char*" "line")
)
)
(define-virtual stderr_line
(of-object "MooOutputFilter")
(return-type "gboolean")
(parameters
'("const-char*" "line")
)
)
(define-virtual cmd_start
(of-object "MooOutputFilter")
(return-type "none")
)
(define-virtual cmd_exit
(of-object "MooOutputFilter")
(return-type "gboolean")
(parameters
'("int" "status")
)
)
(define-method set_view
(of-object "MooOutputFilter")
(c-name "moo_output_filter_set_view")
(return-type "none")
(parameters
'("MooLineView*" "view" (null-ok))
)
)
(define-method get_view
(of-object "MooOutputFilter")
(c-name "moo_output_filter_get_view")
(return-type "MooLineView*")
)
(define-method stdout_line
(of-object "MooOutputFilter")
(c-name "moo_output_filter_stdout_line")
(return-type "gboolean")
(parameters
'("const-char*" "line")
)
)
(define-method stderr_line
(of-object "MooOutputFilter")
(c-name "moo_output_filter_stderr_line")
(return-type "gboolean")
(parameters
'("const-char*" "line")
)
)
(define-method cmd_start
(of-object "MooOutputFilter")
(c-name "moo_output_filter_cmd_start")
(return-type "none")
(parameters
'("const-char*" "working_dir")
)
)
(define-method add_active_dirs
(of-object "MooOutputFilter")
(c-name "moo_output_filter_add_active_dirs")
(return-type "none")
(parameters
'("strv" "dirs")
)
)
(define-method cmd_exit
(of-object "MooOutputFilter")
(c-name "moo_output_filter_cmd_exit")
(return-type "gboolean")
(parameters
'("int" "status")
)
)
; (define-function command_filter_register
; (c-name "moo_command_filter_register")
; (return-type "none")
; (parameters
; '("const-char*" "id")
; '("const-char*" "name")
; '("MooCommandFilterFactory" "factory_func")
; '("gpointer" "data")
; '("GDestroyNotify" "data_notify")
; )
; )
(define-function command_filter_unregister
(c-name "moo_command_filter_unregister")
(return-type "none")
(parameters
'("const-char*" "id")
)
)
(define-function command_filter_lookup
(c-name "moo_command_filter_lookup")
(return-type "const-char*")
(parameters
'("const-char*" "id")
)
)
(define-function command_filter_list
(c-name "moo_command_filter_list")
(return-type "string-slist")
(caller-owns-return "t")
)
(define-function command_filter_create
(c-name "moo_command_filter_create")
(return-type "MooOutputFilter*")
(parameters
'("const-char*" "id")
)
)

File diff suppressed because it is too large Load Diff

View File

@ -1,294 +0,0 @@
;; -*- scheme -*-
(define-function editor_instance
(c-name "moo_editor_instance")
(return-type "MooEditor*")
(docstring "editor_instance() -> Editor - returns existing instance of moo.edit.Editor.\n"
"\n"
"It does not create a new instance if it doesn't exist yet. For this see\n"
"create_editor_instance().")
)
(define-function create_editor_instance
(c-name "moo_editor_create")
(return-type "MooEditor*")
(caller-owns-return #t)
(parameters
'("gboolean" "embedded" (default "TRUE"))
)
(docstring "create_editor_instance() -> Editor - returns instance of moo.edit.Editor.\n"
"\n"
"Creates new instance if it doesn't exist yet.")
)
(define-method new_window
(of-object "MooEditor")
(c-name "moo_editor_new_window")
(return-type "MooEditWindow*")
(docstring "new_window() -> EditWindow - creates new editor window.\n")
)
(define-method new_doc
(of-object "MooEditor")
(c-name "moo_editor_new_doc")
(return-type "MooEdit*")
(parameters
'("MooEditWindow*" "window" (null-ok) (default "NULL"))
)
(docstring "new_doc(window=None) -> Edit - creates new document.\n"
"\n"
"Create new document in window. If window is None, \n"
"creates new window.")
)
(define-method create_doc
(of-object "MooEditor")
(c-name "moo_editor_create_doc")
(return-type "MooEdit*")
(parameters
'("const-char*" "filename" (null-ok) (default "NULL"))
'("const-char*" "encoding" (null-ok) (default "NULL"))
'("GError**" "error")
)
(docstring "create_doc([filename, encoding]) -> moo.Edit. \n"
"\n"
"Opens or creates a new document. Raises gobject.GError if open fails.")
)
; (define-method open
; (of-object "MooEditor")
; (c-name "moo_editor_open")
; (return-type "gboolean")
; (parameters
; '("MooEditWindow*" "window" (null-ok) (default "NULL"))
; '("GtkWidget*" "parent" (null-ok) (default "NULL"))
; '("GSList*" "files")
; )
; )
(define-method open_file
(of-object "MooEditor")
(c-name "moo_editor_open_file")
(return-type "MooEdit*")
(parameters
'("MooEditWindow*" "window" (null-ok) (default "NULL"))
'("GtkWidget*" "parent" (null-ok) (default "NULL"))
'("const-char*" "filename" (null-ok) (default "NULL"))
'("const-char*" "encoding" (null-ok) (default "NULL"))
)
(docstring "open_file(window=None, parent=None, filename=None, encoding=None) -> Edit.\n"
"\n"
"Opens a file.\n"
"If filename is None, it asks user for filename first, and returns False if\n"
"user pressed Cancel in the file chooser dialog.")
)
(define-method open_file_line
(of-object "MooEditor")
(c-name "moo_editor_open_file_line")
(return-type "MooEdit*")
(parameters
'("const-char*" "filename")
'("int" "line")
'("MooEditWindow*" "window" (null-ok) (default "NULL"))
)
(docstring "open_file_line(filename, line, window=None) -> Edit.\n"
"\n"
"Opens a file and places cursor on the given line.")
)
(define-method get_doc
(of-object "MooEditor")
(c-name "moo_editor_get_doc")
(return-type "MooEdit*")
(parameters
'("const-char*" "filename")
)
(docstring "get_doc(filename) -> Edit or None.\n"
"\n"
"Finds document instance by filename. Returns None if not found")
)
(define-method get_active_doc
(of-object "MooEditor")
(c-name "moo_editor_get_active_doc")
(return-type "MooEdit*")
(docstring "get_active_doc() -> Edit or None.\n"
"\n"
"Returns active document, i.e. the active document in the top window.")
)
(define-method get_active_window
(of-object "MooEditor")
(c-name "moo_editor_get_active_window")
(return-type "MooEditWindow*")
(docstring "get_active_window() -> EditWindow or None.\n"
"\n"
"Returns active window, i.e. the top one.")
)
(define-method set_active_window
(of-object "MooEditor")
(c-name "moo_editor_set_active_window")
(return-type "none")
(parameters
'("MooEditWindow*" "window")
)
(docstring "set_active_window(window) -> None.\n"
"\n"
"Makes window active, i.e. brings it to front and makes it grab focus.")
)
(define-method set_active_doc
(of-object "MooEditor")
(c-name "moo_editor_set_active_doc")
(return-type "none")
(parameters
'("MooEdit*" "doc")
)
(docstring "set_active_doc(doc) -> None.\n"
"\n"
"Makes the document active, i.e. brings its window to front, and switches\n"
"notebook to its page.")
)
(define-method present
(of-object "MooEditor")
(c-name "moo_editor_present")
(return-type "none")
(parameters
'("guint32" "stamp" (default "0"))
)
(docstring "present() -> None.\n"
"\n"
"Brings top editor window to the front.")
)
(define-method list_windows
(of-object "MooEditor")
(c-name "moo_editor_list_windows")
(return-type "GSList*")
)
(define-method list_docs
(of-object "MooEditor")
(c-name "moo_editor_list_docs")
(return-type "GSList*")
)
(define-method close_window
(of-object "MooEditor")
(c-name "moo_editor_close_window")
(return-type "gboolean")
(parameters
'("MooEditWindow*" "window")
'("gboolean" "ask_confirm")
)
)
(define-method close_doc
(of-object "MooEditor")
(c-name "moo_editor_close_doc")
(return-type "gboolean")
(parameters
'("MooEdit*" "doc")
'("gboolean" "ask_confirm")
)
)
; (define-method close_docs
; (of-object "MooEditor")
; (c-name "moo_editor_close_docs")
; (return-type "gboolean")
; (parameters
; '("GSList*" "list")
; '("gboolean" "ask_confirm")
; )
; )
(define-method close_all
(of-object "MooEditor")
(c-name "moo_editor_close_all")
(return-type "gboolean")
(parameters
'("gboolean" "ask_confirm")
'("gboolean" "leave_one" (default "FALSE"))
)
)
(define-method set_app_name
(of-object "MooEditor")
(c-name "moo_editor_set_app_name")
(return-type "none")
(parameters
'("const-char*" "name" (null-ok))
)
)
(define-method get_ui_xml
(of-object "MooEditor")
(c-name "moo_editor_get_ui_xml")
(return-type "MooUiXml*")
)
(define-method set_ui_xml
(of-object "MooEditor")
(c-name "moo_editor_set_ui_xml")
(return-type "none")
(parameters
'("MooUiXml*" "xml" (null-ok))
)
)
(define-method get_doc_ui_xml
(of-object "MooEditor")
(c-name "moo_editor_get_doc_ui_xml")
(return-type "MooUiXml*")
)
(define-method get_editor
(of-object "MooEditWindow")
(c-name "moo_edit_window_get_editor")
(return-type "MooEditor*")
)
(define-method set_window_type
(of-object "MooEditor")
(c-name "moo_editor_set_window_type")
(return-type "none")
(parameters
'("GType" "type")
)
)
(define-method set_edit_type
(of-object "MooEditor")
(c-name "moo_editor_set_edit_type")
(return-type "none")
(parameters
'("GType" "type")
)
)
(define-method save_copy
(of-object "MooEditor")
(c-name "moo_editor_save_copy")
(return-type "gboolean")
(parameters
'("MooEdit*" "doc")
'("const-char*" "filename")
'("const-char*" "encoding" (null-ok) (default "NULL"))
'("GError**" "error")
)
)
(define-method prefs_page
(of-object "MooEditor")
(c-name "moo_edit_prefs_page_new")
(return-type "GtkWidget*")
)
(define-method apply_prefs
(of-object "MooEditor")
(c-name "moo_editor_apply_prefs")
)

View File

@ -1,373 +0,0 @@
;; -*- scheme -*-
(define-object Plugin
(in-module "Moo")
(parent "GObject")
(c-name "MooPlugin")
(gtype-id "MOO_TYPE_PLUGIN")
(fields
'("gboolean" "initialized")
'("char*" "id")
'("MooPluginInfo*" "info")
'("MooPluginParams*" "params")
; '("GSList*" "docs")
'("GType" "win_plugin_type")
'("GType" "doc_plugin_type")
)
)
(define-object WinPlugin
(in-module "Moo")
(parent "GObject")
(c-name "MooWinPlugin")
(gtype-id "MOO_TYPE_WIN_PLUGIN")
(fields
'("MooEditWindow*" "window")
'("MooPlugin*" "plugin")
)
)
(define-object DocPlugin
(in-module "Moo")
(parent "GObject")
(c-name "MooDocPlugin")
(gtype-id "MOO_TYPE_DOC_PLUGIN")
(fields
'("MooEditWindow*" "window")
'("MooPlugin*" "plugin")
'("MooEdit*" "doc")
)
)
(define-boxed PluginInfo
(in-module "Moo")
(c-name "MooPluginInfo")
(gtype-id "MOO_TYPE_PLUGIN_INFO")
(copy-func "moo_plugin_info_copy")
(release-func "moo_plugin_info_free")
(fields
'("char*" "name")
'("char*" "description")
'("char*" "author")
'("char*" "version")
'("char*" "langs")
)
)
(define-boxed PluginParams
(in-module "Moo")
(c-name "MooPluginParams")
(gtype-id "MOO_TYPE_PLUGIN_PARAMS")
(copy-func "moo_plugin_params_copy")
(release-func "moo_plugin_params_free")
(fields
'("gboolean" "enabled")
'("gboolean" "visible")
)
)
;; MooPlugin
;(define-function moo_plugin_new
; (c-name "moo_plugin_new")
; (is-constructor-of "MooPlugin")
; (return-type "MooPlugin*")
; (properties)
;)
(define-method initialized
(of-object "MooPlugin")
(c-name "moo_plugin_initialized")
(return-type "gboolean")
)
(define-method enabled
(of-object "MooPlugin")
(c-name "moo_plugin_enabled")
(return-type "gboolean")
)
(define-method set_enabled
(of-object "MooPlugin")
(c-name "moo_plugin_set_enabled")
(return-type "gboolean")
(parameters
'("gboolean" "enabled")
)
)
(define-method id
(of-object "MooPlugin")
(c-name "moo_plugin_id")
(return-type "const-char*")
)
(define-method name
(of-object "MooPlugin")
(c-name "moo_plugin_name")
(return-type "const-char*")
)
(define-method description
(of-object "MooPlugin")
(c-name "moo_plugin_description")
(return-type "const-char*")
)
(define-method author
(of-object "MooPlugin")
(c-name "moo_plugin_author")
(return-type "const-char*")
)
(define-method version
(of-object "MooPlugin")
(c-name "moo_plugin_version")
(return-type "const-char*")
)
(define-method lookup_method
(of-object "MooPlugin")
(c-name "moo_plugin_lookup_method")
(return-type "MooPluginMeth*")
(parameters
'("const-char*" "name")
)
)
(define-method list_methods
(of-object "MooPlugin")
(c-name "moo_plugin_list_methods")
(return-type "GSList*")
)
(define-method call_method
(of-object "MooPlugin")
(c-name "moo_plugin_call_method")
(return-type "none")
(parameters
'("const-char*" "name")
)
(varargs #t)
)
(define-virtual init
(of-object "MooPlugin")
(return-type "gboolean")
)
(define-virtual deinit
(of-object "MooPlugin")
(return-type "none")
)
(define-virtual attach_win
(of-object "MooPlugin")
(return-type "none")
(parameters
'("MooEditWindow*" "window")
)
)
(define-virtual detach_win
(of-object "MooPlugin")
(return-type "none")
(parameters
'("MooEditWindow*" "window")
)
)
(define-virtual attach_doc
(of-object "MooPlugin")
(return-type "none")
(parameters
'("MooEdit*" "doc")
'("MooEditWindow*" "window")
)
)
(define-virtual detach_doc
(of-object "MooPlugin")
(return-type "none")
(parameters
'("MooEdit*" "doc")
'("MooEditWindow*" "window")
)
)
(define-virtual create_prefs_page
(of-object "MooPlugin")
(return-type "GtkWidget*")
)
(define-method set_info
(of-object "MooPlugin")
(c-name "moo_plugin_set_info")
(return-type "none")
(parameters
'("MooPluginInfo*" "info")
)
)
(define-method set_win_plugin_type
(of-object "MooPlugin")
(c-name "moo_plugin_set_win_plugin_type")
(return-type "none")
(parameters
'("GType" "type")
)
)
(define-method set_doc_plugin_type
(of-object "MooPlugin")
(c-name "moo_plugin_set_doc_plugin_type")
(return-type "none")
(parameters
'("GType" "type")
)
)
;; MooWinPlugin
(define-virtual create
(of-object "MooWinPlugin")
(return-type "gboolean")
)
(define-virtual destroy
(of-object "MooWinPlugin")
(return-type "none")
)
;; MooDocPlugin
(define-virtual create
(of-object "MooDocPlugin")
(return-type "gboolean")
)
(define-virtual destroy
(of-object "MooDocPlugin")
(return-type "none")
)
;; MooPluginInfo, MooPluginParams
(define-function moo_plugin_info_new
(c-name "moo_plugin_info_new")
(is-constructor-of "MooPluginInfo")
(return-type "MooPluginInfo*")
(parameters
'("const-char*" "name")
'("const-char*" "author" (null-ok) (default "NULL"))
'("const-char*" "description" (null-ok) (default "NULL"))
'("const-char*" "version" (null-ok) (default "NULL"))
'("const-char*" "langs" (null-ok) (default "NULL"))
)
)
(define-function moo_plugin_params_new
(c-name "moo_plugin_params_new")
(is-constructor-of "MooPluginParams")
(return-type "MooPluginParams*")
(parameters
'("gboolean" "enabled" (null-ok) (default "TRUE"))
'("gboolean" "visible" (null-ok) (default "TRUE"))
)
)
(define-function plugin_register
(c-name "moo_plugin_register")
(return-type "gboolean")
(parameters
'("const-char*" "id")
'("GType" "type")
'("MooPluginInfo*" "info")
'("MooPluginParams*" "params" (null-ok) (default "NULL"))
)
)
(define-function plugin_lookup
(c-name "moo_plugin_lookup")
(return-type "MooPlugin*")
(parameters
'("const-char*" "plugin_id")
)
)
(define-function win_plugin_lookup
(c-name "moo_win_plugin_lookup")
(return-type "MooWinPlugin*")
(parameters
'("const-char*" "plugin_id")
'("MooEditWindow*" "window")
)
)
(define-function doc_plugin_lookup
(c-name "moo_doc_plugin_lookup")
(return-type "MooWinPlugin*")
(parameters
'("const-char*" "plugin_id")
'("MooEdit*" "doc")
)
)
(define-function list_plugins
(c-name "moo_list_plugins")
(return-type "GSList*")
)
(define-function plugin_get_dirs
(c-name "moo_plugin_get_dirs")
(return-type "strv")
(caller-owns-return "t")
)
(define-function plugin_read_dirs
(c-name "moo_plugin_read_dirs")
(return-type "none")
)
; (define-function plugin_method_new
; (c-name "moo_plugin_method_new")
; (return-type "none")
; (parameters
; '("const-char*" "name")
; '("GType" "ptype")
; '("GCallback" "method")
; '("GClosureMarshal" "c_marshaller")
; '("GType" "return_type")
; '("guint" "n_params")
; )
; (varargs #t)
; )
; (define-function plugin_method_newv
; (c-name "moo_plugin_method_newv")
; (return-type "none")
; (parameters
; '("const-char*" "name")
; '("GType" "ptype")
; '("GClosure*" "closure")
; '("GClosureMarshal" "c_marshaller")
; '("GType" "return_type")
; '("guint" "n_params")
; '("const-GType*" "param_types")
; )
; )
(define-function module_check_version
(c-name "moo_module_check_version")
(return-type "gboolean")
(parameters
'("guint" "major")
'("guint" "minor")
)
)