|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2002 - 2022 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module containing the default configuration of the eric installation. |
|
8 """ |
|
9 |
|
10 import os |
|
11 import contextlib |
|
12 |
|
13 __ericDir = os.path.dirname(__file__) |
|
14 |
|
15 _pkg_config = { |
|
16 'ericDir': __ericDir, |
|
17 'ericPixDir': os.path.join(__ericDir, 'pixmaps'), |
|
18 'ericIconDir': os.path.join(__ericDir, 'icons'), |
|
19 'ericDTDDir': os.path.join(__ericDir, 'DTDs'), |
|
20 'ericCSSDir': os.path.join(__ericDir, 'CSSs'), |
|
21 'ericStylesDir': os.path.join(__ericDir, "Styles"), |
|
22 'ericThemesDir': os.path.join(__ericDir, "Themes"), |
|
23 'ericDocDir': os.path.join(__ericDir, 'Documentation'), |
|
24 'ericExamplesDir': os.path.join(__ericDir, 'Examples'), |
|
25 'ericTranslationsDir': os.path.join(__ericDir, 'i18n'), |
|
26 'ericTemplatesDir': os.path.join(__ericDir, 'DesignerTemplates'), |
|
27 'ericCodeTemplatesDir': os.path.join(__ericDir, 'CodeTemplates'), |
|
28 'ericOthersDir': __ericDir, |
|
29 'bindir': __ericDir, |
|
30 'mdir': __ericDir, |
|
31 } |
|
32 |
|
33 |
|
34 def getConfig(name): |
|
35 """ |
|
36 Module function to get a configuration value. |
|
37 |
|
38 @param name name of the configuration value |
|
39 @type str |
|
40 @return requested config value |
|
41 @exception AttributeError raised to indicate an invalid config entry |
|
42 """ |
|
43 with contextlib.suppress(KeyError): |
|
44 return _pkg_config[name] |
|
45 |
|
46 raise AttributeError( |
|
47 '"{0}" is not a valid configuration value'.format(name)) |