annotate src/browser/constants.py @ 462:07433bd892ee

server and browser sides: fixes UI parameters initialisation with user values + small refactoring
author souliane <souliane@mailoo.org>
date Wed, 04 Jun 2014 00:23:14 +0200
parents 981ed669d3b3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
1 #!/usr/bin/python
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
3
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
4 # Libervia: a SAT frontend
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
5 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Jérôme Poisson (goffi@goffi.org)
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
6
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
7 # This program is free software: you can redistribute it and/or modify
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
8 # it under the terms of the GNU Affero General Public License as published by
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
10 # (at your option) any later version.
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
11
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
12 # This program is distributed in the hope that it will be useful,
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
15 # GNU Affero General Public License for more details.
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
16
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
19
462
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
20 from libervia.common.constants import Const as C
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
21
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
22
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
23 # Auxiliary functions
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
24 param_to_bool = lambda value: value == 'true'
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
25
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
26
462
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
27 class Const(C):
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
diff changeset
28 """Add here the constants that are only used by the browser side."""
462
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
29
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
30 # Parameters that have an incidence on UI display/refresh:
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
31 # - they can be any parameter (not necessarily specific to Libervia)
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
32 # - 'cast_from_str' is a method used to eventually convert to a non string type
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
33 # - 'initial_value' is used to initialize the display before any profile connection
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
34 UI_PARAMS = {"unibox": {"name": C.ENABLE_UNIBOX_PARAM,
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
35 "category": C.COMPOSITION_KEY,
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
36 "cast_from_str": param_to_bool,
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
37 "initial_value": False
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
38 },
07433bd892ee server and browser sides: fixes UI parameters initialisation with user values + small refactoring
souliane <souliane@mailoo.org>
parents: 449
diff changeset
39 }