for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
# coding: utf-8
import zope.interface
from schematics.models import Model
from schematics.types import BooleanType
from .interfaces import INISerializable, DefaultProvider
from .helpers import field_from_ini
@zope.interface.implementer(INISerializable)
@zope.interface.implementer(DefaultProvider)
class HUD(Model):
no_mission_info = BooleanType(
default=False,
required=True,
)
no_kill_info = BooleanType(
display_at_bottom = BooleanType(
@classmethod
def from_ini(cls, ini):
return cls({
'no_mission_info': field_from_ini(
cls.no_mission_info, ini,
'game', 'NoMissionInfoHud',
),
'no_kill_info': field_from_ini(
cls.no_kill_info, ini,
'game', 'noKillInfoHud',
'display_at_bottom': field_from_ini(
cls.display_at_bottom, ini,
'game', 'lowInfoHud',
})
def default(cls):
field_name: field.default
for field_name, field in cls.fields.items()