core, frontends (constants): frontends Const inheritates from core Const

This commit is contained in:
souliane 2014-04-01 16:27:59 +02:00
commit 8fa0b7b8c2
2 changed files with 30 additions and 27 deletions

View file

@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from sat.core import constants
from sat.core.i18n import _, D_ from sat.core.i18n import _, D_
try: try:
@ -50,7 +51,8 @@ def getPresence():
return presence return presence
class Const(object): class Const(constants.Const):
PRESENCE = getPresence() PRESENCE = getPresence()
MENU_NORMAL = "NORMAL" MENU_NORMAL = "NORMAL"
@ -60,8 +62,6 @@ class Const(object):
SYNTAX_CURRENT = "@CURRENT@" SYNTAX_CURRENT = "@CURRENT@"
SYNTAX_TEXT = "text" SYNTAX_TEXT = "text"
NO_SECURITY_LIMIT = -1
# XMLUI # XMLUI
SAT_FORM_PREFIX = "SAT_FORM_" SAT_FORM_PREFIX = "SAT_FORM_"
SAT_PARAM_SEPARATOR = "_XMLUI_PARAM_" # used to have unique elements names SAT_PARAM_SEPARATOR = "_XMLUI_PARAM_" # used to have unique elements names

View file

@ -18,7 +18,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import os.path import os.path
from xdg import BaseDirectory try:
from xdg import BaseDirectory
except ImportError:
# Catch JS runtime error while using Libervia
BaseDirectory = None
class Const(object): class Const(object):
@ -27,9 +31,8 @@ class Const(object):
APP_NAME = u'Salut à Toi' APP_NAME = u'Salut à Toi'
APP_NAME_SHORT = u'SàT' APP_NAME_SHORT = u'SàT'
APP_NAME_FULL = u'%s (%s)' % (APP_NAME_SHORT, APP_NAME) APP_NAME_FULL = u'%s (%s)' % (APP_NAME_SHORT, APP_NAME)
APP_VERSION = u'0.4.1D' # Please add 'D' at the end for dev versions APP_VERSION = u'0.4.1D' # Please add 'D' at the end for dev versions
APP_URL = 'http://www.salut-a-toi.org' APP_URL = 'http://salut-a-toi.org'
## Parameters ## ## Parameters ##
NO_SECURITY_LIMIT = -1 NO_SECURITY_LIMIT = -1
@ -44,26 +47,26 @@ class Const(object):
ENTITY_LAST_RESOURCE = 'LAST_RESOURCE' ENTITY_LAST_RESOURCE = 'LAST_RESOURCE'
ENTITY_CAP_HASH = 'CAP_HASH' ENTITY_CAP_HASH = 'CAP_HASH'
if BaseDirectory: # skipped when imported from Libervia browser_side
## Configuration ## ## Configuration ##
DEFAULT_CONFIG = { DEFAULT_CONFIG = {
'media_dir': '/usr/share/sat/media', 'media_dir': '/usr/share/sat/media',
'pid_dir': '/tmp', 'pid_dir': '/tmp',
'log_dir': BaseDirectory.save_data_path('sat'), 'log_dir': BaseDirectory.save_data_path('sat'),
} }
# XXX: tmp update code, will be removed in the future # XXX: tmp update code, will be removed in the future
# When you remove this, please add that in DEFAULT_CONFIG: # When you remove this, please add that in DEFAULT_CONFIG:
# 'local_dir': BaseDirectory.save_data_path('sat'), # 'local_dir': BaseDirectory.save_data_path('sat'),
# and also remove sat.memory.memory.Memory.__fixLocalDir # and also remove sat.memory.memory.Memory.__fixLocalDir
DEFAULT_LOCAL_DIR = BaseDirectory.save_data_path('sat') DEFAULT_LOCAL_DIR = BaseDirectory.save_data_path('sat')
# List of the configuration filenames sorted by ascending priority
CONFIG_FILES = [(os.path.expanduser(path) + 'sat.conf') for path in \
['/etc/', '~/', '~/.', '', '.'] + \
['%s/' % path for path in list(BaseDirectory.load_config_paths('sat'))]
]
# List of the configuration filenames sorted by ascending priority
CONFIG_FILES = [(os.path.expanduser(path) + 'sat.conf') for path in \
['/etc/', '~/', '~/.', '', '.'] + \
['%s/' % path for path in list(BaseDirectory.load_config_paths('sat'))]
]
## Plugins ## ## Plugins ##
# names of widely used plugins # names of widely used plugins