dogtail-devel PROPOSAL: new options in config module for customized environments.



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi all,
I'm proposing two new options in the config module and I have already written
some of the code. Both options will help script development (or dogtail
integration) in customized environments.

1) checkForA11y (boolean), default True. If False don't use GConf to check if
a11y is enabled or not.
2) distroClass (class Distro), default None. If set don't perform the
distribution check and use this class.

+
1) -- get rid of gconf modules and related in customized environment. Such an
environment at present is Anaconda (Fedora installer) which needed ~2MB of GConf
libs only because of that. It also needed a customized XML file with the
necessary settings.

2) Pretty much the same as 1). If you know what you are doing then no need to
automatically detect the system. Further more this detection is based on
/etc/$DISTRO-release which is not very robust will fail anytime this file is not
present.

- -
1) Ugly code. Looks like:

def isA11yEnabled():
    if config.checkForA11y:
        import gconf
        gconfClient = gconf.client_get_default()

        gconfEnabled = gconfClient.get_bool(a11yGConfKey)
        if os.environ.get('GTK_MODULES','').find('gail:atk-bridge') == -1:
            envEnabled = False
        else: envEnabled = True
        return (gconfEnabled or envEnabled)
    else:
        return True

and then pretty much the same for enableA11y()
I can't figure out how to "nicely" import the gconf module if needed.

2) The detection code looks now like that:
if (config.distroClass):
    logger.log(message + config.distroClass.__name__ + " (defined in
configuration)")
    distro = config.distroClass()
elif os.environ.get("CERTIFIED_GNOMIE", "no") == "yes":
    logger.log(message + "JHBuild environment")
    distro = JHBuild()
....
That's in distro.py and gets executed every time this module is imported.
As far as I can see only packageDb is used and it's used only in i18n.py and
examples probably.
Can anyone advise how to change this to something more human friendly ?

Thanks,
Alexander.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Red Hat - http://enigmail.mozdev.org

iD8DBQFHurEghmd3WOiFct4RCgzRAKCEkFnCZZSVyNWTpPiMECzt8huRJwCfSqsx
GIL4ZuxnrhTP2wN6At/1j14=
=TIzn
-----END PGP SIGNATURE-----


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