Пример #1
0
def _test_gtk_availability():
    """Tests availability of pygtk and quits if not found."""
    try:
        import pygtk
        pygtk.require('2.0')
        import gtk
    except ImportError:
        logger.error(_('Please make sure pygtk is installed.'))
        sys.exit(1)
Пример #2
0
def _test_gtk_availability():
    """Tests availability of pygtk and quits if not found."""
    try:
        import pygtk

        pygtk.require("2.0")
        import gtk
    except ImportError:
        logger.error(_("Please make sure pygtk is installed."))
        sys.exit(1)
Пример #3
0
def _get_path(localpath, syspath, filename):
    """Returns the full path to the file with filename. If it exists,
    localpath is used, otherwise the corresponding system directory."""
    basepath = os.path.abspath(sys.path[0])
    localfilepath = os.path.join(basepath, localpath, filename)
    if os.path.exists(localfilepath):
        return localfilepath
    sysfilepath = os.path.join(basepath, syspath, filename)
    if os.path.exists(sysfilepath):
        return sysfilepath
    else:
        logger.error(_('Could not find %s'), sysfilepath)
        sys.exit(1)
Пример #4
0
def _get_path(localpath, syspath, filename):
    """Returns the full path to the file with filename. If it exists,
    localpath is used, otherwise the corresponding system directory."""
    basepath = os.path.abspath(sys.path[0])
    localfilepath = os.path.join(basepath, localpath, filename)
    if os.path.exists(localfilepath):
        return localfilepath
    sysfilepath = os.path.join(basepath, syspath, filename)
    if os.path.exists(sysfilepath):
        return sysfilepath
    else:
        logger.error(_("Could not find %s"), sysfilepath)
        sys.exit(1)