comparison 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
comparison
equal deleted inserted replaced
461:4f25aa5039b3 462:07433bd892ee
15 # GNU Affero General Public License for more details. 15 # GNU Affero General Public License for more details.
16 16
17 # You should have received a copy of the GNU Affero General Public License 17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19
20 from libervia.common import constants 20 from libervia.common.constants import Const as C
21 21
22 22
23 class Const(constants.Const): 23 # Auxiliary functions
24 param_to_bool = lambda value: value == 'true'
25
26
27 class Const(C):
24 """Add here the constants that are only used by the browser side.""" 28 """Add here the constants that are only used by the browser side."""
29
30 # Parameters that have an incidence on UI display/refresh:
31 # - they can be any parameter (not necessarily specific to Libervia)
32 # - 'cast_from_str' is a method used to eventually convert to a non string type
33 # - 'initial_value' is used to initialize the display before any profile connection
34 UI_PARAMS = {"unibox": {"name": C.ENABLE_UNIBOX_PARAM,
35 "category": C.COMPOSITION_KEY,
36 "cast_from_str": param_to_bool,
37 "initial_value": False
38 },
39 }