| @@ 12-41 (lines=30) @@ | ||
| 9 | from .interfaces import INISerializable |
|
| 10 | ||
| 11 | ||
| 12 | @zope.interface.implementer(INISerializable) |
|
| 13 | class Logging(Model): |
|
| 14 | file_name = StringType( |
|
| 15 | default="eventlog.lst", |
|
| 16 | min_length=1, |
|
| 17 | required=True, |
|
| 18 | ) |
|
| 19 | keep = BooleanType( |
|
| 20 | default=True, |
|
| 21 | required=True, |
|
| 22 | ) |
|
| 23 | log_buildings = BooleanType( |
|
| 24 | default=False, |
|
| 25 | required=True, |
|
| 26 | ) |
|
| 27 | ||
| 28 | @classmethod |
|
| 29 | def from_ini(cls, ini): |
|
| 30 | return cls({ |
|
| 31 | 'file_name': ini.get( |
|
| 32 | 'game', 'eventlog', |
|
| 33 | fallback=cls.file_name.default, |
|
| 34 | ), |
|
| 35 | 'keep': ini.getboolean( |
|
| 36 | 'game', 'eventlogkeep', |
|
| 37 | fallback=cls.keep.default, |
|
| 38 | ), |
|
| 39 | 'log_buildings': ini.getboolean( |
|
| 40 | 'game', 'eventlogHouse', |
|
| 41 | fallback=cls.log_buildings.default, |
|
| 42 | ), |
|
| 43 | }) |
|
| 44 | ||
| @@ 11-39 (lines=29) @@ | ||
| 8 | from .interfaces import INISerializable |
|
| 9 | ||
| 10 | ||
| 11 | @zope.interface.implementer(INISerializable) |
|
| 12 | class HUD(Model): |
|
| 13 | no_mission_info = BooleanType( |
|
| 14 | default=False, |
|
| 15 | required=True, |
|
| 16 | ) |
|
| 17 | no_kill_info = BooleanType( |
|
| 18 | default=False, |
|
| 19 | required=True, |
|
| 20 | ) |
|
| 21 | display_at_bottom = BooleanType( |
|
| 22 | default=False, |
|
| 23 | required=True, |
|
| 24 | ) |
|
| 25 | ||
| 26 | @classmethod |
|
| 27 | def from_ini(cls, ini): |
|
| 28 | return cls({ |
|
| 29 | 'no_mission_info': ini.getboolean( |
|
| 30 | 'game', 'NoMissionInfoHud', |
|
| 31 | fallback=cls.no_mission_info.default, |
|
| 32 | ), |
|
| 33 | 'no_kill_info': ini.getboolean( |
|
| 34 | 'game', 'noKillInfoHud', |
|
| 35 | fallback=cls.no_kill_info.default, |
|
| 36 | ), |
|
| 37 | 'display_at_bottom': ini.getboolean( |
|
| 38 | 'game', 'lowInfoHud', |
|
| 39 | fallback=cls.display_at_bottom.default, |
|
| 40 | ), |
|
| 41 | }) |
|
| 42 | ||
| @@ 11-39 (lines=29) @@ | ||
| 8 | from .interfaces import INISerializable |
|
| 9 | ||
| 10 | ||
| 11 | @zope.interface.implementer(INISerializable) |
|
| 12 | class Morse(Model): |
|
| 13 | allow_morse_as_text = BooleanType( |
|
| 14 | default=True, |
|
| 15 | required=True, |
|
| 16 | ) |
|
| 17 | show_morse_as_text = BooleanType( |
|
| 18 | default=False, |
|
| 19 | required=True, |
|
| 20 | ) |
|
| 21 | block_morse_chat = BooleanType( |
|
| 22 | default=False, |
|
| 23 | required=True, |
|
| 24 | ) |
|
| 25 | ||
| 26 | @classmethod |
|
| 27 | def from_ini(cls, ini): |
|
| 28 | return cls({ |
|
| 29 | 'allow_morse_as_text': ini.getboolean( |
|
| 30 | 'NET', 'allowMorseAsText', |
|
| 31 | fallback=cls.allow_morse_as_text.default, |
|
| 32 | ), |
|
| 33 | 'show_morse_as_text': ini.getboolean( |
|
| 34 | 'game', 'ShowMorseAsText', |
|
| 35 | fallback=cls.show_morse_as_text.default, |
|
| 36 | ), |
|
| 37 | 'block_morse_chat': ini.getboolean( |
|
| 38 | 'game', 'BlockMorseChat', |
|
| 39 | fallback=cls.block_morse_chat.default, |
|
| 40 | ), |
|
| 41 | }) |
|
| 42 | ||