<s> from __future__ import unicode_literals , print_function , division <EOL> __author__ = "<STR_LIT>" <EOL> from . compatibility import tostr <EOL> from . xmlns import CN , subelement <EOL> def StringProperty ( name , doc = None ) : <EOL> def getter ( self ) : <EOL> return self . xmlnode . get ( name ) <EOL> def setter ( self , value ) : <EOL> self . xmlnode . set ( name , value ) <EOL> def deleter ( self ) : <EOL> del self . xmlnode . attrib [ name ] <EOL> return property ( getter , setter , deleter , doc ) <EOL> def BooleanProperty ( name , doc = None ) : <EOL> def getter ( self ) : <EOL> return self . xmlnode . get ( name ) == '<STR_LIT:true>' <EOL> def setter ( self , value ) : <EOL> value = '<STR_LIT:true>' if value else '<STR_LIT:false>' <EOL> self . xmlnode . set ( name , value ) <EOL> def deleter ( self ) : <EOL> del self . xmlnode . attrib [ name ] <EOL> return property ( getter , setter , deleter , doc ) <EOL> def FloatProperty ( name , doc = None ) : <EOL> def getter ( self ) : <EOL> value = self . xmlnode . get ( name ) <EOL> if value is None : <EOL> return None <EOL> else : <EOL> return float ( value ) <EOL> def setter ( self , value ) : <EOL> self . xmlnode . set ( name , tostr ( value ) ) <EOL> def deleter ( self ) : <EOL> del self . xmlnode . attrib [ name ] <EOL> return property ( getter , setter , deleter , doc ) <EOL> def IntegerProperty ( name , doc = None ) : <EOL> def getter ( self ) : <EOL> value = self . xmlnode . get ( name ) <EOL> if value is None : <EOL> return None <EOL> else : <EOL> return int ( value ) <EOL> def setter ( self , value ) : <EOL> self . xmlnode . set ( name , tostr ( value ) ) <EOL> def deleter ( self ) : <EOL> del self . xmlnode . attrib [ name ] <EOL> return property ( getter , setter , deleter , doc ) <EOL> def IntegerWithLowerLimitProperty ( name , lower_limit = <NUM_LIT:0> , doc = None ) : <EOL> def getter ( self ) : <EOL> value = self . xmlnode . get ( name ) <EOL> if value is None : <EOL> return lower_limit <EOL> else : <EOL> return max ( lower_limit , int ( value ) ) <EOL> def setter ( self , value ) : <EOL> value = int ( value ) <EOL> self . xmlnode . set ( name , tostr ( max ( lower_limit , value ) ) ) <EOL> def deleter ( self ) : <EOL> del self . xmlnode . attrib [ name ] <EOL> return property ( getter , setter , deleter , doc ) <EOL> class TextNumberingMixin ( object ) : <EOL> @ property <EOL> def start_value ( self ) : <EOL> value = self . get_attr ( CN ( '<STR_LIT>' ) ) <EOL> return int ( value ) if value is not None else None <EOL> @ start_value . setter <EOL> def start_value ( self , value ) : <EOL> value = tostr ( max ( int ( value ) , <NUM_LIT:1> ) ) <EOL> self . set_attr ( CN ( '<STR_LIT>' ) , value ) <EOL> @ property <EOL> def formatted_number ( self ) : <EOL> formatted_number = self . xmlnode . find ( CN ( '<STR_LIT>' ) ) <EOL> return formatted_number . text if formatted_number is not None else None <EOL> @ formatted_number . setter <EOL> def formatted_number ( self , value ) : <EOL> formatted_number = subelement ( self . xmlnode , CN ( '<STR_LIT>' ) ) <EOL> formatted_number . text = tostr ( value ) <EOL> class TableVisibilityMixin ( object ) : <EOL> VALID_VISIBILITY_STATES = frozenset ( ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> @ property <EOL> def visibility ( self ) : <EOL> value = self . get_attr ( CN ( '<STR_LIT>' ) ) <EOL> if value is None : <EOL> value = '<STR_LIT>' <EOL> return value <EOL> @ visibility . setter <EOL> def visibility ( self , value ) : <EOL> if value not in self . VALID_VISIBILITY_STATES : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> self . set_attr ( CN ( '<STR_LIT>' ) , value ) </s>
