Re: [gedit-list] Scheduling timers from plugins
- From: Adam Dingle <adam medovina org>
- To: Dustin Oprea <myselfasunder gmail com>
- Cc: gedit-list <gedit-list gnome org>
- Subject: Re: [gedit-list] Scheduling timers from plugins
- Date: Sat, 26 Oct 2013 23:05:00 -0004
Dustin,
first, it's best to cc the entire list when you reply, since others may be able to help too (or at least may be interested in what's discussed).
I'd look at the source to the Snippets plugin which comes with gedit - it's written in Python and includes calls to timeout_add. On a 64-bit Ubuntu system, you could find this at
/usr/lib/x86_64-linux-gnu/gedit/plugins/snippets/
Note that gedit 3.6 (and earlier) uses Python 2.x, but gedit 3.8 (and later) uses Python 3.x. So if you write your plugin using Python 2.x now, you'll have to port to Python 3.x when you upgrade to Ubuntu 13.10, which includes gedit 3.8.3.
Also note that the way to call timeout_add is apparently different in these two versions of Python. Specifically, gedit-3.6.2/plugins/snippets/snippets/document.py has 'GObject.timeout_add(...)' for Python 2.x, but in gedit 3.8.3 this code reads 'GLib.timeout_add(...)' for Python 3.x. I'd also look at the import statements at the top of this file for whichever version of Python you want to use. If all this works in the Snippets plugin, it should work in yours too. :)
adam
On Sat, Oct 26, 2013 at 6:48 PM, Dustin Oprea <myselfasunder gmail com> wrote:
Since everything breaks when I import gobject, I thought that it might belong to a previous GTK/PyGTK version. Since I found some examples using glib.timeout_add() and glib.timeout_add_seconds() (using "glib" rather than "gobject"), I tried doing this as well. I don't get any import related errors (the error in the previous method occurs on import), but I do get another seg-fault. I was guessing that this happens simply because there is some violation in a late-type binding (like those methods can't actually be found on "glib", at the time of invocation).
Python: 2.7.4
Gedit: 3.6.2
Distro: Ubuntu/13.04
Glib package: libglib2.0-0
Dustin Oprea
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]