Re: Meld 1.1.4: Question regarding paths.py



Hi Andreas, it's probably clearer if you get the meld source tarball.
The way I've done it, you can run directly from untarred source
without having to install.

Your modifications would mean that if there was a version already
installed on your system, then you could not download and check out
the latest version without clobbering the installed version.

I often wish all python packages had this facility when I'm deciding
whether it's worthwhile to install them or not.

Stephen.

On 9/18/06, Andreas Imhof <andreas imhof metamedia ch> wrote:
Dear Stephen

Being a very happy user of Meld since long ago and the lack of useful
tutorials for PyGtk and Glade lead me to have a look at your code in
order to teach myself GUI programming with Python.

I just had a look at some of your code written for Meld 1.1.4, and I
already have a few questions regarding paths.py.

First of all, I wonder why you have the application name hardcoded in
both _help_dir and _share_dir? Is there a specific reason to do so?

And then I was not sure what "if not _locale_dir:" and the other two are
doing, since this always returns true? Did I misunderstand some basics
about Python?

Below I copied the code after my modifications. Please have a look at it
and let me know if my modifications make any sense at all.

Thank you in advance for your help.

Kind regards
Andreas



paths.py

<snip>

# Determine application name

appdir = os.path.dirname(__file__)
appname = os.path.split(appdir)[1]

# Find typical shared folders as default locations

_locale_dir = ("/usr/share/locale")
_help_dir = os.path.join("/usr/share/gnome/help/", appname)
_share_dir = os.path.join("/usr/lib/", appname)

# Fallback

if not os.path.isdir(_locale_dir):
    _locale_dir = os.path.join(appdir, "po")
if not os.path.isdir(_help_dir):
    _help_dir  = os.path.join(appdir, "help")
if not os.path.isdir(_share_dir):
    _share_dir  = appdir

</snip>






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