Nautilus Python

Discussion in 'Python' started by Eduardo Ribeiro, Sep 27, 2010.

  1. I'm a python noob and wrote the following code for a nautilus extension:

    #!/usr/local/bin/python
    # -*- coding: utf-8 -*-

    import urllib
    import gtk
    import pygtk
    import nautilus
    import gconf
    import gtk.glade

    class Slide (nautilus.MenuProvider):
    f = None
    def __init__(self):
    self.client = gconf.client_get_default()
    self.f = gtk.glade.XML( "papel.glade" )
    self..window = self.f.get_widget("window1")
    gtk.main()

    def oi (self):
    self.window.show()

    def menu_activate_cb(self, menu, file):
    self.oi()

    def get_file_items(self, window,files):
    if len(files) != 1:
    return
    item =
    nautilus.MenuItem('NautilusPython::slide_file_item','Slide','Slide')
    item.connect('activate', self.menu_activate_cb, files[0])
    return item,

    def get_background_items(self, window, file):
    item = nautilus.MenuItem('NautilusPython::slide_item','Slide','Slide')
    item.connect('activate', self.menu_background_activate_cb, file)
    return item,

    def menu_background_activate_cb(self, menu, file):
    self.oi()

    But it doesn't work. If I comment the lines:

    self.f = gtk.glade.XML( "papel.glade" )
    self.window = self.f.get_widget("window1")
    gtk.main()

    the code works but I can't see any problem in those lines. Any help?
    Eduardo Ribeiro, Sep 27, 2010
    #1
    1. Advertising

  2. On Mon, 27 Sep 2010 15:28:34 -0700, Eduardo Ribeiro wrote:

    > But it doesn't work.


    What do you mean "doesn't work"?

    - It crashes the operating system;
    - You get a core dump;
    - You get an exception;
    - It hangs forever, never doing anything;
    - It does something unexpected;
    - Something else?


    --
    Steven
    Steven D'Aprano, Sep 28, 2010
    #2
    1. Advertising

  3. Eduardo Ribeiro

    Peter Guest

    On Sep 28, 12:31 pm, Steven D'Aprano <steve-REMOVE-
    > wrote:
    > On Mon, 27 Sep 2010 15:28:34 -0700, Eduardo Ribeiro wrote:
    > > But it doesn't work.

    >
    > What do you mean "doesn't work"?
    >
    > - It crashes the operating system;
    > - You get a core dump;
    > - You get an exception;
    > - It hangs forever, never doing anything;
    > - It does something unexpected;
    > - Something else?
    >
    > --
    > Steven


    It seems to be a fairly absolute statement - so I would assume all of
    the above! :)
    Peter, Sep 28, 2010
    #3
  4. In message <>, Eduardo
    Ribeiro wrote:

    > But it doesn't work.


    What messages do you get?
    Lawrence D'Oliveiro, Sep 29, 2010
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    724
  2. manatlan

    gnome/nautilus extensions ?

    manatlan, Dec 12, 2007, in forum: Python
    Replies:
    0
    Views:
    267
    manatlan
    Dec 12, 2007
  3. Diez B. Roggisch

    Re: Python Nautilus script

    Diez B. Roggisch, Sep 15, 2008, in forum: Python
    Replies:
    6
    Views:
    1,933
  4. Nils
    Replies:
    0
    Views:
    279
  5. John Maclean
    Replies:
    0
    Views:
    90
    John Maclean
    Jan 17, 2006
Loading...

Share This Page