LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Where under the HOME dir should Nautilus Python-based extensions be stored? (https://www.linuxquestions.org/questions/linux-software-2/where-under-the-home-dir-should-nautilus-python-based-extensions-be-stored-718435/)

bgoodr 04-11-2009 10:37 AM

Where under the HOME dir should Nautilus Python-based extensions be stored?
 
I'm running fully up-to-date Debian Testing using GNOME version 2.22.3 and Nautilus version 2.20.0 installed from packages with no customization (yet, that is what I'm trying to do). I want to customize the available columns to include additional file info versus what is currently provided. I thought I would find an example that works and get that working, so I searched and found an example and some Nautilus Installation info stating:

Quote:

Python extensions go in ~/.nautilus/python-extensions or /usr/lib/nautilus/extensions-2.0/python
The example code I found was the block-size-column.py example. I stored the file and gave it execute permissions at ~/.nautilus/python-extensions/block-size-column.py, restarted Nautilus (note I did not restart the entire GNOME window manager ... is that the issue?), and expected to be able to see the new column under the View Menu/Visible Columns dialog, but that did not occur. The content of the file as it stands now is:

Code:

# I _thought" this should go into ~/.nautilus/python-extensions/block-size-column.py

import os
import urllib

import nautilus

class ColumnExtension(nautilus.ColumnProvider, nautilus.InfoProvider):
    def __init__(self):
        pass

    def get_columns(self):
        return nautilus.Column("NautilusPython::block_size_column",
                              "block_size",
                              "Block size",
                              "Get the block size"),

    def update_file_info(self, file):
        if file.get_uri_scheme() != 'file':
            return

        filename = urllib.unquote(file.get_uri()[7:])

        file.add_string_attribute('block_size', str(os.stat(filename).st_blksize))

The file does have execute permissions:

Code:

-rwxrwxr-x 1 brentg brentg 701 2009-04-11 08:14 /home/brentg/.nautilus/python-extensions/block-size-column.py
Could I be missing some type of "dev" package?

Thanks,
bgoodr

IBall 04-12-2009 07:24 PM

Maybe try restarting the whole Gnome desktop? (ie: Log out and log back in).

In Gnome, Nautilus is responsible for drawing the desktop icons as well and so closing the nautilus windows and reopening is probably not restarting it.

--Ian

bgoodr 04-14-2009 11:29 PM

Quote:

Originally Posted by IBall (Post 3506795)
Maybe try restarting the whole Gnome desktop? (ie: Log out and log back in).

In Gnome, Nautilus is responsible for drawing the desktop icons as well and so closing the nautilus windows and reopening is probably not restarting it.

--Ian

Well, even after a reboot, I don't see a change in the dialogs. Perhaps their documentation is wrong.

bg

bgoodr 04-17-2009 09:12 AM

I'm still after an answer for this, so more searching revealed an Ubuntu reference that states:

Quote:

All of your scripts are stored in the nautilus-scripts folder - so to add a new script, simply place it there. You can find the nautilus-scripts folder here:
~/.gnome2/nautilus-scripts
But that seems to conflict with the Nautilus Installation info I referred to earlier.

I'm wondering if there are two places for scripts: One set that can override things in the View/Visible Columns area of Nautilus (which is what I'm after), and yet another for the context menu on the files (which is not what I'm after, at least, not right now)?

bg

bgoodr 04-17-2009 09:15 AM

More searching found announcement about Nautilus-python back in 2005 that leads me to conclude that the Python extension mechanism is not built into the Nautilus that is installed by default in GNOME on Debian Testing. But I don't know for sure yet.

bgoodr 04-17-2009 09:21 AM

The announcement about Nautilus-python led me to search for a Debian package and I found one that might be what I need at python-nautilus. I will try that first and see if I can get some traction. :)

bgoodr 04-17-2009 09:27 AM

Found the solution
 
The python-nautilus package was the missing piece I needed. Now I see the Block Size entry in the View/Visible Columns dialog box.

bgoodr 04-17-2009 10:54 PM

See also the GNOME Support Forum post.

IBall 04-18-2009 03:33 AM

Well done. Thanks for posting the solution as well :)


All times are GMT -5. The time now is 03:29 AM.