[gen] CSS improvements; bugfix: parsing now works even if encoding is declared at the beginning of the Python file; a default layout for Boolean fields, including a description, is now available in Boolean.dLayouts.

This commit is contained in:
Gaetan Delannay 2012-05-31 17:29:06 +02:00
parent ede29fb6c1
commit e3b7f5364f
3 changed files with 12 additions and 4 deletions

View file

@ -1443,6 +1443,7 @@ class String(Type):
return self.getCaptchaChallenge({})['text']
class Boolean(Type):
def __init__(self, validator=None, multiplicity=(0,1), index=None,
default=None, optional=False, editDefault=False, show=True,
page='main', group=None, layouts = None, move=0, indexed=False,
@ -1458,8 +1459,9 @@ class Boolean(Type):
label)
self.pythonType = bool
dLayouts = {'view': 'lf', 'edit': Table('flrv;=d', width=None)}
def getDefaultLayouts(self):
return {'view': 'l;f!-', 'edit': Table('f;lrv;=', width=None)}
return {'view': 'lf', 'edit': Table('f;lrv;=', width=None)}
def getValue(self, obj):
'''Never returns "None". Returns always "True" or "False", even if

View file

@ -79,10 +79,15 @@ class AstClass:
class Ast:
'''Python AST.'''
classPattern = (symbol.stmt, symbol.compound_stmt, symbol.classdef)
utf8prologue = '# -*- coding: utf-8 -*-'
def __init__(self, pyFile):
f = file(pyFile)
fContent = f.read()
f.close()
# For some unknown reason, when an UTF-8 encoding is declared, parsing
# does not work.
if fContent.startswith(self.utf8prologue):
fContent = fContent[len(self.utf8prologue):]
fContent = fContent.replace('\r', '')
ast = parser.suite(fContent).totuple()
# Get all the classes defined within this module.

View file

@ -59,9 +59,10 @@ img { border: 0; vertical-align: middle}
.buttons { margin-left: 4px;}
.fakeButton { border: 1px solid #D7DEE4; background-color: #fde8e0;
padding: 0px 8px 2px; font: italic 92% Helvetica,Arial,sans-serif}
.message { color: #fd9c03; position: absolute; top: -55px; left: 100px;
width: 700px; border: 1px black dashed; padding: 2px 6px;
background-color: #f4f5f6}
.message { position: absolute; top: -40px; left: 150px; font-size: 90%;
width: 600px; border: 1px #F0C36D solid; padding: 6px 16px;
background-color: #F9EDBE; text-align: center;
border-radius: 2px 2px 2px 2px; box-shadow: 0 2px 4px #A9A9A9;}
.discreet { font-size: 90%; }
.portlet { width: 150px; border-right: 1px solid #5F7983;}
.portletContent { margin: 9px; }