Re: More trouble with Python plugins



Am Dienstag, den 10.06.2008, 10:53 -0700 schrieb Asheesh Laroia:
> There seem be no Python plugins that ship with EOG, nor are Python plugins 
> available in the eog-plugins GNOME svn module.  That's okay.
> 
> It's just that I can't figure out how to make one work.  Some time ago I 
> wrote the example plugin on GNOME Live, but EOG internals have changed 
> and it is out of date.
> 
> I am attaching two files which, when put in ~/.gnome2/eog/plugins/ should 
> (AFAIK) create a valid plugin.  However, instead, I get this lame message:
> 
> (eog:17556): EOG-WARNING **: Cannot load Python plugin 'Hellloooooooooo' 
> since file 'libhello' cannot be read.
> 
> (eog:17556): EOG-WARNING **: Error activating plugin 'Hellloooooooooo'
> 

Hi!

I've been playing a little bit with the Python interface and got the
attached script to work. Basically you need to create a class based on
EOG's base plugin class. You can then add the functions "activate" and
"deactivate" which will be called when the user does the corresponding
action in the preferences dialog (activate is also called when the
plugin is loaded on startup).

Looking at EOG's code it can also call a function named
"create_configure_dialog" which can be used to implement configuration
dialogs (yeah, who would have thought so?) and a function called
"update_ui" what I don't know yet what it is good for.

In Bugzilla is also a pythonconsole plugin [1] which might be useful
during development, but this one can (as other python plugins using the
window pointer) provoke a ref-counting issue[2] that stops EOG from
quitting properly. It also shows how to make plugins spanning over
multiple files.

Well, I guess you already noticed that I'm not really into this
Python-thing, so take this carefully. :-)


Felix

[1]: http://bugzilla.gnome.org/show_bug.cgi?id=462338
[2]: http://bugzilla.gnome.org/show_bug.cgi?id=460781
import eog

class HelloWorldPlugin(eog.Plugin):
	def __init__(self):
		eog.Plugin.__init__(self)

	def activate(self, window):
		print 'The answer landed on my rooftop, whoa'

	def deactivate(self, window):
		print 'The answer fell off my rooftop, woot'



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