Re: using custom classes

sylvain wrote:
I'm sorry to disturb you again, but in your example, you're adding a menuitem in an existing menu, do you know how to create a new menu in the menubar ?

Thanks a lot :)

I'm replying to the list, so others can google for the info in the future. Hope you don't mind.

The menu definition is GtkUIManager UI definition file, see "";. Scroll down to example 1.

In my plugin, the file is transpose.xml.

And 'Transpose' in these lines in Python:
transpose_ui_actions = {
        'Transpose': f_transpose,

matches     <menuitem action="Transpose"/>
in the UI definition file.

To make a new menu, you simply change

  <menu name="Tools" action="MenuTools">

in the UI definition file to
  <menu> name="Mine" action="AllMine">

(I hope - I didn't test)

the PyGtk documentation is at The Gtk documentation is at The documentation for the Python support in Gnumeric is at


 > Subject: Re: using custom classes
 > From: hellan acm org
 > To: bw_syl hotmail com
 > CC: gnumeric-list gnome org
 > Date: Wed, 6 Dec 2006 21:46:29 +0100
 > On Wed, 2006-12-06 at 20:42 +0100, sylvain wrote:
 > > Hi!!
 > >
 > > I'm trying to write a python plugin for gnumeric, i would like to know
 > > if it is possible to call a class in this type of plugin, for example,
 > > i would like to take information from a database and put it in some
 > > cells.
 > >
 > > And in addition is it possible to add a menu button to call this type
 > > of plugin functions.
 > >
 > > I hope i've been clear enough.
 > >
 > > Thank you.
 > I put up an example with a menu item at
 > It's from 1.4, and I don't know how badly it's bitrotted, but there
 > haven't been big changes in this area since then.
 > As to the first question, yes, your plugin can import other python
 > modules and call them.
 > Jon Kåre

Essayez, votre nouvelle page d'accueil ! Personnalisez-la en quelques clics pour retrouver tout ce qui vous intéresse au même endroit. au même endroit. <>

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