1
|
|
|
# coding: utf-8 |
2
|
|
|
|
3
|
1 |
|
import zope.interface |
4
|
|
|
|
5
|
1 |
|
from schematics.models import Model |
6
|
1 |
|
from schematics.types import BooleanType, IntType |
7
|
|
|
|
8
|
1 |
|
from .interfaces import INISerializable |
9
|
|
|
|
10
|
|
|
|
11
|
1 |
View Code Duplication |
@zope.interface.implementer(INISerializable) |
|
|
|
|
12
|
1 |
|
class Other(Model): |
13
|
1 |
|
difficulty = IntType( |
14
|
|
|
min_value=0, |
15
|
|
|
default=193791, |
16
|
|
|
required=True, |
17
|
|
|
) |
18
|
1 |
|
display_custom_skins = BooleanType( |
19
|
|
|
default=True, |
20
|
|
|
required=True, |
21
|
|
|
) |
22
|
1 |
|
allow_custom_sounds = BooleanType( |
23
|
|
|
default=True, |
24
|
|
|
required=True, |
25
|
|
|
) |
26
|
1 |
|
filter_user_names = BooleanType( |
27
|
|
|
default=False, |
28
|
|
|
required=True, |
29
|
|
|
) |
30
|
1 |
|
small_way_point_labels = BooleanType( |
31
|
|
|
default=True, |
32
|
|
|
required=True, |
33
|
|
|
) |
34
|
1 |
|
skip_paratrooper_views = BooleanType( |
35
|
|
|
default=False, |
36
|
|
|
required=True, |
37
|
|
|
) |
38
|
1 |
|
new_clouds = BooleanType( |
39
|
|
|
default=True, |
40
|
|
|
required=True, |
41
|
|
|
) |
42
|
|
|
|
43
|
1 |
|
@classmethod |
44
|
|
|
def from_ini(cls, ini): |
45
|
|
|
return cls({ |
46
|
|
|
'difficulty': ini.getint( |
47
|
|
|
'NET', 'difficulty', |
48
|
|
|
fallback=cls.difficulty.default, |
49
|
|
|
), |
50
|
|
|
'display_custom_skins': ini.getboolean( |
51
|
|
|
'NET', 'SkinDownload', |
52
|
|
|
fallback=cls.display_custom_skins.default, |
53
|
|
|
), |
54
|
|
|
'allow_custom_sounds': ini.getboolean( |
55
|
|
|
'NET', 'allowCustomSounds', |
56
|
|
|
fallback=cls.allow_custom_sounds.default, |
57
|
|
|
), |
58
|
|
|
'filter_user_names': ini.getboolean( |
59
|
|
|
'NET', 'filterUserNames', |
60
|
|
|
fallback=cls.filter_user_names.default, |
61
|
|
|
), |
62
|
|
|
'small_way_point_labels': ini.getboolean( |
63
|
|
|
'game', 'SmallMapWPLabels', |
64
|
|
|
fallback=cls.small_way_point_labels.default, |
65
|
|
|
), |
66
|
|
|
'skip_paratrooper_views': ini.getboolean( |
67
|
|
|
'game', 'SkipParatrooperViews', |
68
|
|
|
fallback=cls.skip_paratrooper_views.default, |
69
|
|
|
), |
70
|
|
|
'new_clouds': ini.getboolean( |
71
|
|
|
'game', 'TypeClouds', |
72
|
|
|
fallback=cls.new_clouds.default, |
73
|
|
|
), |
74
|
|
|
}) |
75
|
|
|
|