Re: [gedit-list] latex editing with gedit



Il giorno ven, 30/09/2005 alle 09.42 -0400, Jeff Ward ha scritto:
> On Fri, 2005-09-30 at 14:33 +0200, Paolo Borelli wrote:
> > Hello G�, I am glad that you like gedit.
> > This kind of functionality has indeed been requested more than once and
> > some people expressed interest in writing a plugin, but unfortunately I
> > haven't seen any.
> > 
> > In the upcoming versions of gedit writing plugins is way easier, just a
> > few lines of python, and I really hope to see this and many other
> > plugins get done.
> > At the moment there is the shell command plugin, but I know it is way
> > subotimal for this task.
> > 
> > 
> > ciao
> > 	Paolo
> 
> Paolo, I was originally interested in working on one of the GnomeLove
> tasks for gedit (as I am a new programmer in the open source community).
> This can be found at http://live.gnome.org/Gedit but this task is way
> more appealing to me as I am also a Mathematics major.  I was looking
> for a project this year and think this would be a great idea.  Do you
> have any input or suggestions to that could help me get started?
> Thanks!
> 

Wonderful!

I take that you read http://live.gnome.org/Gedit/NewMdi, so what I
describe below requires to get the new_mdi branch from cvs.

If you follow my suggestion of doing this in python, getting started is
really easy, you just need to write two files:
your_plugin_name.gedit-plugin and a your_plugin.py. The first is a
simple ini-like file which describes the plugin (author, name, etc, see
the pythonconsole plugin in cvs for an example), the second is the real
plugin and it is a python class that inherits from GeditPlugin.
Just drop these two files in ~/.gnome2/gedit/plugins and they should
show up in the list of available plugins.

Doing it in C is not much harder (same concept) but it's more boring
because you have to recompile the plugin each time. However if you are
more comfortable with C feel free to chose what you prefer.

The scheleton for a plugin is something like the following (in python,
but apart the syntax, in C it is the same).


class YourPlugin(gedit.Plugin):
	def __init__(self):
		gedit.Plugin.__init__(self)
		... (do init stuff)

	def activate(self, window):
		... (do stuff needed when the plugin is activated)

	def deactivate(self, window):
		... (do stuff needed when the plugin is deactivated)

	def update_ui(self, window):
		... (updated the ui, for instance if you added a menu item and you want to set is sensitivity)


among other things, two functions are particurlarly important:
window.get_active_view and window.get_active_document allow you to
access the current text view and the current text buffer respectively


With regard to the latex plugin in question, I have no particular ideas
or opinion, you are free to implement it as you prefer :)

Feel free to ask any question either here or by dropping on #gedit on
irc.gnome.org


ciao
	Paolo




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]