Gedit Python Plugins

September 9th, 2005

I have been putting together a python plugin system for gedit, so far it seems to work:

Gedit showing the python console

I heavily used the nautilus-python, and epiphany source code to see how this is done, thanks to them !

Notice how the window title has been updated by the command in the console. The clever reader may also recognize the same python console as used in epiphany, simply because i just stole all it’s code, thanks Adam Hooper !

Now for the code, it looks like:

import gedit

# Inheriting from gedit.Plugin is the key here
class MyPlugin(gedit.Plugin):
	def __init__(self):

	def activate(self, window):

	def deactivate(self, window):

	def update_ui(self, window):

The three callbacks are the same used for C plugins, you can do your init/deinit stuff and react to UI changes. The other thing to do is to write a xx.gedit-plugin file to tell gedit that there is a plugin:

[Gedit Plugin]
Name=Python Console
Description=A Python Console inside gedit.
Authors=Raphael Slinckx 
Copyright=Copyright © 2005 Raphael Slinckx

You must specify the langage type, so gedit knows which loader to use, and use Module to give the module name of your plugin, generally the filename without the .py extension, but it can also be a directory containing !

Now, Paolo if you don’t mind, you can come back on IRC 🙂

gShrooms, end of the summer

August 31st, 2005

Some more screenshots:

Rhythmbox source
Colin is streaming music, and jack is his friend.

Jack is receiving the music. The screenshot shows what Jack would see in his own rhythmbox, because he has 4 friends that are currently streaming music, one of them is Colin, he is playing Liquid Scarlet.

Gaim conversation
Here is jack’s conversation window to Colin . Colin has discovered a new album, and tells jack to listen to it, Jack then see the Listen button appearing in the conversation, and also see what colin is playing and is invited to listen to it.

Clicking the button makes rhythmbox play the buddy’s stream automatically (and launches rhythmbox if it wasn’t)

Gaim plugin
Colin has nothing particular to do, he has just to activate the plugin in Gaim, and set the preferences according to his internet connection.

And finally, something i’m proud of, a IRS tax TShirt, that was worth the whole summer:
Me, and the IRS

And a little update for the pastebin script, it now supports http proxies, removes twisted dependency, and allows to select line ranges with the -l x,y switch. Thanks to Gustavo “gjc” 🙂

The wonders of pastebin

August 31st, 2005

These last days, i’ ve been using pastebin intensively, for things like diffs reviews, code snippets to discuss, etc.

And i got sick of the web interface.

So i took a couple of hours to write this nice python script which allows to upload seamlessly any content to, and maybe it will be useful for other people than me, so i publish it here.

Very simple to use here is the usage():

$ pastebin [OPTIONS] [FILE]

Print the URL of the input file

If FILE is omitted content is read from standard input
        -h, --help                      Print this help notice.
        -r, --raw                       Retreive raw text URL (default=off).
        -d, --description       The description of the content (default=empty).
        -m, --message           Same as description
        -n, --name                      Your name (default=your unix username).
        -t, --type                      The type of the content (default="raw")

        Type can be one of:
        raw, asterisk, c, cpp, php, perl, java, vb, csharp,
        ruby, python, pascal, mirc, pli, xml, sql, scheme,
        ascript, ada, apache, nasm, asp, bash, css, delphi, html, js,
        lisp, lua, asm, objc, vbnet

        If type is not specified, an attempt to auto-detect type is made,
        based on file data/extension. Detection is more reliable when giving FILE
        argument than piping directly. This needs modules gnomevfs and gtksourceview

        If you have module gtk, the pastebin url will be placed in your clipboard,
        you can then paste it with ctrl-v as usual.

That means you can cat important-patch.diff|pastebin -m 'look!' then Ctrl-v in xchat or wherever the output URL.

Introducing gShrooms

August 25th, 2005

I have put a page for the Braves who want to try out gShrooms.

You will need a jhbuild environement, rhythmbox and dependencies built, some stuff mentioned in the page, time, and nerves.

I appreciate any report of failure/success on IRC or per mail..

Thos who are wondering about the name think about Shared Music Rooms, then blame Seth 🙂

Summer of Code, the end of the tunnel

August 25th, 2005

We are the 25th of august, the projects are due for the 1st of september, that means i have 6 days left to track down minor issues, and cleanup the thing.

In the meantime, as a teaser, here are two screenshots, i won’t comment them yet, i must sleep ! (click for full size)

Rhythmbox Buddy Source
Rythmbox Buddy Music source

Gaim Plugin
Gaim Plugin in IM windows

DBus tutorial, another one

August 14th, 2005

I finished writing this nice little tutorial about dbus activation, i hope it will be useful at least for some people !

If there are any corrections/infos/additions to make feel free to contact me, also if you want to include it somewhere, feel free, credit is appreciated 🙂

BreakMyGentoo, Nattraverso

August 8th, 2005

BreakMyGentoo is back

You did miss the sleepless nights when you couldn’t do anything else than b0rking your system ? Be happy, is back !

I have become a co-maintainer there, so i will provide some help and ebuilds, starting with the gnome 2.11 beta ebuilds, and some more mono related stuff. The overlay is not quite ready yet, but we are testing each ebuild for dependencies and things like that.


This is the first product for the summer of code, an UPNP-NAT-traversal library, in python. I’m using it in my streamer, and i’m sure it could benefit other gnome applications since twisted has a gtk event loop, beside other type of loops. As i said before i’m not taking full credit for this, i borrowed code from Shtoom, but that’s open-source 🙂

I put up a page on this site, where you can download the package and see examples, there is also a full documentation in the package itself, generated with epydoc, because documenting code is Good.

I need feedback, cause i just tested it with my device, i need to see how much of the code works everywhere, and which parts need to be generalized, cause XML and SOAP sucks. Can you run the examples in the package and send me the debug log, if the thing didn’t work, so i have a trace of the xml exchanges, that would be great !

Beta packages, Summer of code

August 1st, 2005

Gnome beta portage overlay

Today i have been struggling to create all the necessary stuff to make portage install Gnome beta 2.11.90
The result is an overlay which you can download here (the name sucks, i know). If you don’t know what an overlay is, you most probably don’t want to try this thing, else just search the net on how to set this up. There is also a package.unmask file whose content should be added to /etc/portage/package.unmask, and maybe even more, just try..

Be warned that installing these ebuilds will most likely break things, beside the fact that this is a beta release, the ebuilds are mostly copied from existing ones, so they may be doing wrong things, don’t blame me 🙂

Don’t try evolution, evolution-data-server, gtkhtml !

I also included most recent dbus and hal from gentopia overlay, for completeness. If you know any more appropriate place for this, just tell me, or feel free to copy them anywhere you want, i don’t care.

I managed to compile everything here, and am now the proud owner of a beta gnome desktop which, of course, rocks !

Python bindings for libsexy

I made python bindings for libsexy which are documented as much as the original library, not at all ! The standard procedure ./configure; make && make install applies. I submitted the packages to Chris Chipx86 Hammond, so it should soon land in the libsexy SVN repository

Summer of code

I am participating to the google summer of code with gnome as mentoring organisation, Johan “jdahlin” Dahlin is my mentor, and he rocks. The project was the “Shared music spaces” bounty, but the actual end goal isn’t quite defined yet.

For the moment i have:

  • A streaming server, which accept http connections and serve music from a gstreamer pipeline, that’s quite like flumotion, but simpler.
  • A python library that allows to play with upnp devices, get external ip, add port mappings. The code is stolen and adapted from Shtoom, maybe we can turn this in a shared lib, so we don’t maintain two version of the code.
  • A gstreamer element that dump metadata from the stream on dbus, in a hashtable. This can then be retreived for any “Now Playing” needs, as well as an element that would write back tags from dbus to the stream, for example in the stream server.

The initial goal which is mainly achieved was to have a simple streaming server taking as input any sound that comes out the speakers and streaming that with any metadata to people connecting to the server via simple http streaming.

The most obvious problem with this approach is the firewall/NAT issue, while some NATs can be activated through upnp, passing a TCP connection through a firewall is nearly impossible. Maybe there should be a relay server hosted at gnome, but this is quite impossible too due to legal issues, and bandwidth costs. So basically it works if you have direct internet connection with no firewall, indirect connection through an upnp NAT and no firewall (or upnp-esque firewall), and that’s about it, i don’t know how large this part of the gnome users is…

I’m waiting for more instructions/discussions (*hint*) to continue this thing, in the meantime i fix bugs and polish the code.

I didn’t hear anything from the other gnome SoC’ers, maybe you should do some status report too, would be great 🙂

Gedit follow-up

June 16th, 2005

This post will answer the questions generated by the previous one (or at least try to).

One of the main concern is “Why use yet another search UI ?”, evince/firefox/epiphany use more or less the same approach, a bottom bar that pops-in causing no reflow of text. Gedit uses a sidebar that cause text to be “pushed” to the right, maybe causing reflow is auto-wrap is activated and the window too small

Here is what Paolo “pbor” Borelli has to say about that:

Did gedit look at the mozilla/evince/epiphany style search popup at all?
Yes, we discussed it a lot, we also discussed it at guadec, and we also tried implementing a search bar before implementing the sidebar, the reasons why a search bar doesn’t work very well for us are:

  • Fitting replace in the bar doesn’t work well
  • Ditto for the varions search options (match case, etc)
  • The search bar at the bottom doesn’t work well with the output window (bottom pane) open
  • And at the top it doesn’t work well with tabs, which I think is the reason why firefox has it at the bottom. In general I’m not very fond of search bars at the bottom… is the last place where my eyes goes
  • The last reason (even if not very important) is that for text,I value vertical space more than horizontal

However we are aware of some of the drawbacks of a side pane search, the most important being that the text is “shifted” to the right, so we decided to stop speculating and try this UI and stick with it until we get enough feedback (note that now search does also find-as-you-type), after having tried it for a while, it’s not that bad. The problem of reflow would also be fixed by having the pane on the right, but we felt that a sidepane on the right is weird.

Now some other points taken from the same IRC discussion:

“new_mdi” [the CVS branch] is almost a rewrite (apart from search, it gets rid of bonobo, has completely async file loading/saving with complete vfs support, new plugin system,etc), but we do not have enough time/manpower, so we are taking our time [This is frightening, quick they need developers, developers, developers !]

I think that our loading/saving code in new_mdi is shaping up really good, we are using xfer too for remote saving, the problem is that we also have to deal with backups which makes things really hard, especially when you have to deal with permissions and symlinks…

We also put special care in avoiding races (like testing perms before writing, which is inherently racy), local files are special cased and the saving algorithm is inspired by vim, also for loading we special cased local files and used mmap which is blazingly fast 🙂

And finally we got rid of the dialogs, dialogs suck in gedit because they block all the tabs… now you can start a slow operation in a tab and do stuff in another one:

Gedit opening a remote file

Concerning other questions:

  • What are the tabs at the bottom of the sidebar?
    It has three tabs, the first one presents a list of opened documents, the second, the search UI.
    The third is in fact added by a plugin, which can now add their tab to the sidebar, here it is the TagList plugin’s list (a list of xhtml tags for examples)
  • Is there a FileBrowser Plugin for gedit, or Project Manager ?
    Yes there will be one, but the plugin interface has been completely rewritten, so it’s not usable yet.
  • Is it possible to reorder tabs manually now? (with drag-and-drop)
    Yes !
  • I don’t see this in CVS yet, or am I missing something ?
    to see this new gedit, you have to specify the “new_mdi” CVS branch, be warned, it is experimental !
    cvs -d co -r new_mdi gedit

Gedit development

June 15th, 2005

Gedit is the gnome text editor, you all know that, i thought i might post some screenies of the latest interface improvements (i just make PR for them, i didn’t really work on it)

Find interface

Here you have on the left, the new find/replace sidebar, allowing a far better search experience than the crappy over-the-top dialog. You can also see the context menu with interesting undo/redo labels, see next screenshot.

Edit menu, undo/redo improvements

Again, the edit menu, showing the undo/redo items, like gnumeric and i suppose other applications, it shows a more comprehensible label than just “Undo” or “Redo”, that’s what i’m working on for the moment, you can follow it in this bugzilla bug, it is implemented in gtksourceview, so anyone using it should be able to have such menu items in his own app.

Unreadable file error

Finally, they are struggling to get rid of all annoying popup messages, this is what happens when an unreadable file is opened. The print preview will also show up in the same tab as the text it previews, much more clear, unfortunatley it appears to be broken right now…