__init__.py 1.67 KB
Newer Older
1
2
"""
Personal State Script
3
=====================
4
5
6
7
"""
import color
import os
import personal_state
8
import simple_menu
9
10
11
12
13
14
15
16
17
18

states = [
    ("No State", personal_state.NO_STATE),
    ("No Contact", personal_state.NO_CONTACT),
    ("Chaos", personal_state.CHAOS),
    ("Communication", personal_state.COMMUNICATION),
    ("Camp", personal_state.CAMP),
]


19
20
class StateMenu(simple_menu.Menu):
    color_sel = color.WHITE
21

22
23
    def on_scroll(self, item, index):
        personal_state.set(item[1], False)
24

25
26
27
    def on_select(self, item, index):
        personal_state.set(item[1], True)
        os.exit()
28

29
30
31
    def entry2name(self, value):
        return value[0]

32
33
    def draw_entry(self, item, index, offset):
        if item[1] == personal_state.NO_CONTACT:
34
35
36
            self.color_1 = color.RED
            self.color_2 = color.RED
            self.color_text = color.WHITE
37
        elif item[1] == personal_state.CHAOS:
38
39
40
            self.color_1 = color.CHAOSBLUE
            self.color_2 = color.CHAOSBLUE
            self.color_text = color.CHAOSBLUE_DARK
41
        elif item[1] == personal_state.COMMUNICATION:
42
43
44
            self.color_1 = color.COMMYELLOW
            self.color_2 = color.COMMYELLOW
            self.color_text = color.COMMYELLOW_DARK
45
        elif item[1] == personal_state.CAMP:
46
47
48
            self.color_1 = color.CAMPGREEN
            self.color_2 = color.CAMPGREEN
            self.color_text = color.CAMPGREEN_DARK
49
        else:
50
51
52
            self.color_1 = color.Color(100, 100, 100)
            self.color_2 = color.Color(100, 100, 100)
            self.color_text = color.Color(200, 200, 200)
53

54
        super().draw_entry(item, index, offset)
55
56
57


if __name__ == "__main__":
58
    StateMenu(states).run()