Sunday, January 16, 2011

pyGtkPlot: yet another graphical front-end for gnuplot

The main window of pyGtkPlot.
As the title of this post suggests, I'm going to introduce to you a new graphical interface for gnuplot. The name of the project, pyGtkPlot, surely synthesizes the programming language employed and the target window manager: python and gnome/gtk+ respectively. This project has a (not so) old C ancestor, the gtkplot project at sourceforge.net (a C++ translation was on its way, but was never released to the public, and probably it'll never be). Since the development of the C and C++ version was becoming very slow due to the fact that the team of developers was composed of only one member (:P), that very same one member decided to turn his head towards python. This important decision took some time to become reality, because basically that implied the choice between performances and development speed, but now the pyGtkPlot has officially came to life, and it is hosted at Launchpad.net. There are no stable releases at the moment, but you may consider each new revision as a release candidate. This is because pyGtkPlot embeds the gnuplot x11 terminal inside its graphical interface (for this to work you must have the latest version of gnuplot installed on your linux machine), still retaining all the original interactiveness of gnuplot. Moreover you have the opportunity of sending commands to gnuplot directly, as though you were running it from a console. The only difference is that you have some additional aids at your disposal coming from the surrounding gtk+ widgets of the interface, which will increase in number at each new code revision pushed on Launchpad.

Basically, you start with a new gnuplot session with default settings and add new plots by configuring the panel at the left and then clicking o the + (Add) button in the toolbar, or the Edit -> Add menu entry (keyb. shortcut: Alt + a). You can save the current session for later uses or load a previously saved session in order to modify it or export the plots in different formats, actually in all the terminal supported by your installation of gnuplot (of course you may not want to choose a terminal that does not write to a file, like wxt or x11 :P). You can embed mathatematical formulae too using LaTeX syntax and export in png format directly (check the menu File for this). But, as ever, the best way to learn how to use pyGtkPlot is by playing around with its commands.

Monday, January 3, 2011

How to implement a non-blocking two-way pipe in Python

I was surprised by the lack of a way to read from a stream without blocking in Python, and this is the main reason why I'm writing this post. Some years ago I had the urge to open a two-way channel of communication between the program I was writing and an external command-line program (actually a GUI). I had solved this problem in mainly two different ways in C and C++ on Unix, by using pseudo-terminals in one case, and duplicated file descriptors in the other. Here we are going to create an object which inherits from a preexisting class which is provided by one of the modules for Python.

Monday, December 27, 2010

sopcast-player: a graphical frontend for sopcast

SopCast is P2P way of broadcasting video and audio contents over the internet. The main line of development revolves around the Windows platform, but there is a unix command-line alternative. Jason Scheunemann has developed a graphical frontend for Gnome known as sopcast-player, today at version 0.4.1. I wanted to add some useful features to this great application, so I started editing the version 0.3.3. The result has been released as a branch of the main program at launchpad, where you can find more details about the differences and the source as well.

Saturday, December 25, 2010

emeseLaTeX: LaTeX plugin for emesene

I'm a Linux Ubuntu user and I've been using amsn for years because of the TeXIM plugin that enable to send formulae to other contacts which are rendered with LaTeX. The latest version of amsn (0.98.4) still relies on tcl/tk for its interface, and amsn 2, which promises to integrate natively on the most popular window managers, is still a "work in progress" project at the moment. Nevertheless an very appreciable alternative exists: emesene. It integrates wonderfully in Gnome, and a v2 is underway as well. Looking for something similar to TeXIM for emesene, one day i discovered the emeseLaTeX plugin, developed by the author of the Dainaccio blog, and the latest version i think is that of the 28th of July, 2008. While using emeseLaTeX i become aware of some bugs and limitations and therefore I started to work on it in order to improve it. I managed to fix the "integer only" zoom scale factor bug in the settings window, and I've also added the possibility of choosing a custom preamble file. Moreover, longer and more complex LaTeX commands can be enclosed in the XML-ish <tex>...</tex> tags, in addition to the standard in-line math environment $...$ (replaced internally with $$...$$) which was already present in the original edition of the plugin.


The new configuration window.
I've decided to retain the original name for the plugin, i.e. emeseLaTeX. Here the credits follow:

The original idea was from the author of the Dainaccio blog. As you can read from the original source code file, it
# Uses a Dainaccio's modified version of
# latexmath2png.py, created by Kamil Kisie
# (that you can find at the end of this file)

Have fun with LaTeX in your conversations!