Results 1 to 3 of 3

Thread: nautilus-python extensions problem.

  1. #1
    Join Date
    Nov 2004
    Location
    Prague, Czech Republic
    Beans
    68

    nautilus-python extensions problem.

    I tryied to write nautilus menu entry extension for opening files as root (as described in one post in howto section). I am newbie in python and progrmming at all and this looks like good first excersie . But i run into problem the extension works OK, when clicked it opens correct file with correct application as root but freezes nautilus for a minute . Here is the code for extension (redone openterminal extension from examples):
    Code:
    import os
    
    import gtk
    import nautilus
    
    class OpenTerminalExtension(nautilus.MenuProvider):
        def __init__(self):
            pass
            
        def _open_terminal(self, file):
            os.system("gksudo 'gnome-open %s'" % file.get_uri())
    	    
            
        def menu_activate_cb(self, menu, file):
            self._open_terminal(file)
            
           
        def get_file_items(self, window, files):
            if len(files) != 1:
                return
            
            file = files[0]
            if file.is_directory() or file.get_uri_scheme() != 'file':
                return
            
            item = nautilus.MenuItem('NautilusPython::openterminal_file_item',
                                     'Open As Root' ,
                                     'Open File %s As Root' % file.get_name())
            item.connect('activate', self.menu_activate_cb, file)
            return item,
    I have no idea where is the problem. Can anyone help me please?

  2. #2
    Join Date
    Aug 2005
    Location
    Boston (British Expat)
    Beans
    474
    Distro
    Ubuntu

    Re: nautilus-python extensions problem.

    Still have problems?
    42 is not an anwser, it's an error code. the universe is saying 'Error 42: meaning to universe not found'
    Programmer, Teacher and Artist

  3. #3
    Join Date
    Jan 2007
    Beans
    19

    Re: nautilus-python extensions problem.

    Try to use

    os.system("gksudo 'gnome-open %s' &" % file.get_uri())

    Greatings

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •