tko 2.2.3__tar.gz → 2.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tko-2.2.3/src/tko.egg-info → tko-2.3.1}/PKG-INFO +1 -1
- {tko-2.2.3 → tko-2.3.1}/changelog.md +4 -0
- tko-2.3.1/src/tko/__init__.py +1 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/cmds/cmd_play.py +2 -2
- {tko-2.2.3 → tko-2.3.1}/src/tko/game/game.py +4 -4
- {tko-2.2.3 → tko-2.3.1}/src/tko/game/quest.py +8 -8
- {tko-2.2.3 → tko-2.3.1}/src/tko/game/task.py +48 -34
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/floating.py +107 -1
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/grade_message.py +39 -21
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/gui.py +27 -18
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/images.py +9 -10
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/keys.py +4 -13
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/play.py +3 -11
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/play_actions.py +21 -7
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/tasktree.py +21 -64
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/tester.py +9 -8
- {tko-2.2.3 → tko-2.3.1}/src/tko/settings/app_settings.py +1 -1
- {tko-2.2.3 → tko-2.3.1}/src/tko/util/daily.py +16 -17
- {tko-2.2.3 → tko-2.3.1}/src/tko/util/logger.py +23 -35
- {tko-2.2.3 → tko-2.3.1}/src/tko/util/symbols.py +13 -11
- {tko-2.2.3 → tko-2.3.1/src/tko.egg-info}/PKG-INFO +1 -1
- tko-2.2.3/src/tko/__init__.py +0 -1
- {tko-2.2.3 → tko-2.3.1}/LICENSE +0 -0
- {tko-2.2.3 → tko-2.3.1}/MANIFEST.in +0 -0
- {tko-2.2.3 → tko-2.3.1}/Readme.md +0 -0
- {tko-2.2.3 → tko-2.3.1}/config.md +0 -0
- {tko-2.2.3 → tko-2.3.1}/requirements.txt +0 -0
- {tko-2.2.3 → tko-2.3.1}/setup.cfg +0 -0
- {tko-2.2.3 → tko-2.3.1}/setup.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/__main__.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/cmds/__init__.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/cmds/cmd_build.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/cmds/cmd_config.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/cmds/cmd_down.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/cmds/cmd_rep.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/cmds/cmd_run.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/down/__init__.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/down/down.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/down/drafts.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/game/__init__.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/game/cluster.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/game/game_builder.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/game/game_validator.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/game/graph.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/game/tree_item.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/game/xp.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/__init__.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/border.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/colors.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/flags.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/floating_manager.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/fmt.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/frame.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/functors.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/input_manager.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/language_setter.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/opener.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/patch_history.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/play_palette.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/search.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/play/tracker.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/run/__init__.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/run/diff_builder.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/run/diff_builder_down.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/run/diff_builder_side.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/run/loader.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/run/solver_builder.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/run/unit.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/run/unit_runner.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/run/wdir.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/run/writer.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/settings/__init__.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/settings/check_version.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/settings/repository.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/settings/repository_starter.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/settings/settings.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/util/__init__.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/util/code_filter.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/util/compare.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/util/consts.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/util/decoder.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/util/freerun.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/util/get_md_link.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/util/guide.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/util/identifier.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/util/label_factory.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/util/param.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/util/pattern.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/util/raw_terminal.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/util/remote_md.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/util/remote_url.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/util/runner.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/util/task_md_title.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/util/text.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko/util/to_asc.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko.egg-info/SOURCES.txt +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko.egg-info/dependency_links.txt +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko.egg-info/entry_points.txt +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko.egg-info/requires.txt +0 -0
- {tko-2.2.3 → tko-2.3.1}/src/tko.egg-info/top_level.txt +0 -0
- {tko-2.2.3 → tko-2.3.1}/tests/test_fmt.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/tests/test_logger.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/tests/test_one.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/tests/test_text.py +0 -0
- {tko-2.2.3 → tko-2.3.1}/todo.md +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.3.1"
|
|
@@ -31,11 +31,11 @@ class CmdPlay:
|
|
|
31
31
|
|
|
32
32
|
logger: Logger = Logger.get_instance()
|
|
33
33
|
logger.set_history_file(self.rep.get_history_file())
|
|
34
|
-
logger.
|
|
34
|
+
logger.record_open()
|
|
35
35
|
play = Play(self.settings, self.rep)
|
|
36
36
|
logger.set_daily(self.rep.get_daily_file(), play.game.tasks)
|
|
37
37
|
play.play()
|
|
38
|
-
logger.
|
|
38
|
+
logger.record_quit()
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
# @staticmethod
|
|
@@ -68,26 +68,26 @@ class Game:
|
|
|
68
68
|
if s in total:
|
|
69
69
|
total[s] += t.skills[s]
|
|
70
70
|
if reachable:
|
|
71
|
-
obtained[s] += int(t.skills[s] * t.
|
|
71
|
+
obtained[s] += int(t.skills[s] * t.get_ratio())
|
|
72
72
|
else:
|
|
73
73
|
obtained[s] += 0
|
|
74
74
|
else:
|
|
75
75
|
total[s] = t.skills[s]
|
|
76
76
|
if reachable:
|
|
77
|
-
obtained[s] = int(t.skills[s] * t.
|
|
77
|
+
obtained[s] = int(t.skills[s] * t.get_ratio())
|
|
78
78
|
else:
|
|
79
79
|
obtained[s] = 0
|
|
80
80
|
for s in t.qskills:
|
|
81
81
|
if s in total:
|
|
82
82
|
total[s] += t.qskills[s]
|
|
83
83
|
if reachable:
|
|
84
|
-
obtained[s] += int(t.qskills[s] * t.
|
|
84
|
+
obtained[s] += int(t.qskills[s] * t.get_ratio())
|
|
85
85
|
else:
|
|
86
86
|
obtained[s] += 0
|
|
87
87
|
else:
|
|
88
88
|
total[s] = t.qskills[s]
|
|
89
89
|
if reachable:
|
|
90
|
-
obtained[s] = int(t.qskills[s] * t.
|
|
90
|
+
obtained[s] = int(t.qskills[s] * t.get_ratio())
|
|
91
91
|
else:
|
|
92
92
|
obtained[s] = 0
|
|
93
93
|
return total, obtained
|
|
@@ -42,7 +42,7 @@ class Quest(TreeItem):
|
|
|
42
42
|
if i == 0:
|
|
43
43
|
self.__tasks[i].set_reachable(True)
|
|
44
44
|
else:
|
|
45
|
-
if self.__tasks[i-1].
|
|
45
|
+
if self.__tasks[i-1].get_percent() < 50:
|
|
46
46
|
reach = False
|
|
47
47
|
self.__tasks[i].set_reachable(reach)
|
|
48
48
|
|
|
@@ -65,10 +65,10 @@ class Quest(TreeItem):
|
|
|
65
65
|
return Text()
|
|
66
66
|
|
|
67
67
|
def get_resume_by_tasks(self) -> Text:
|
|
68
|
-
tmin = self.tmin if self.tmin is not None else
|
|
68
|
+
tmin = self.tmin if self.tmin is not None else 70
|
|
69
69
|
total = len([t for t in self.__tasks if not t.opt])
|
|
70
70
|
plus = len([t for t in self.__tasks if t.opt])
|
|
71
|
-
count = len([t for t in self.__tasks if t.
|
|
71
|
+
count = len([t for t in self.__tasks if t.get_percent() >= tmin])
|
|
72
72
|
output = f"{count}/{total}"
|
|
73
73
|
if plus > 0:
|
|
74
74
|
output += f"+{plus}"
|
|
@@ -89,7 +89,7 @@ class Quest(TreeItem):
|
|
|
89
89
|
# task complete mode
|
|
90
90
|
if self.tmin is not None:
|
|
91
91
|
for t in self.__tasks:
|
|
92
|
-
if not t.opt and t.
|
|
92
|
+
if not t.opt and t.get_percent() < self.tmin:
|
|
93
93
|
return False
|
|
94
94
|
return True
|
|
95
95
|
|
|
@@ -118,8 +118,8 @@ class Quest(TreeItem):
|
|
|
118
118
|
obtained = 0
|
|
119
119
|
for t in self.__tasks:
|
|
120
120
|
total += t.xp
|
|
121
|
-
if t.
|
|
122
|
-
obtained += t.xp * t.
|
|
121
|
+
if t.get_percent() > 0:
|
|
122
|
+
obtained += int(t.xp * t.get_ratio())
|
|
123
123
|
|
|
124
124
|
return obtained, total
|
|
125
125
|
|
|
@@ -127,13 +127,13 @@ class Quest(TreeItem):
|
|
|
127
127
|
obtained, total = self.get_xp()
|
|
128
128
|
if total == 0:
|
|
129
129
|
return 0
|
|
130
|
-
return obtained *
|
|
130
|
+
return obtained * 10 // total
|
|
131
131
|
|
|
132
132
|
def in_progress(self):
|
|
133
133
|
if self.is_complete():
|
|
134
134
|
return False
|
|
135
135
|
for t in self.__tasks:
|
|
136
|
-
if t.
|
|
136
|
+
if t.get_percent() != 0:
|
|
137
137
|
return True
|
|
138
138
|
return False
|
|
139
139
|
|
|
@@ -20,9 +20,10 @@ class Task(TreeItem):
|
|
|
20
20
|
self.line_number = 0
|
|
21
21
|
self.line = ""
|
|
22
22
|
|
|
23
|
-
self.
|
|
24
|
-
self.
|
|
25
|
-
self.
|
|
23
|
+
self.coverage: int = 0 # valor de 0 a 100
|
|
24
|
+
self.autonomy: int = 0 # valor de 0 a 5
|
|
25
|
+
self.ability: int = 0 # valor de 0 a 5
|
|
26
|
+
self.main_idx: int = 0
|
|
26
27
|
|
|
27
28
|
self.qskills: Dict[str, int] = {} # default quest skills
|
|
28
29
|
self.skills: Dict[str, int] = {} # local skills
|
|
@@ -64,26 +65,37 @@ class Task(TreeItem):
|
|
|
64
65
|
def get_track_folder(self) -> str | None:
|
|
65
66
|
return self.track_folder
|
|
66
67
|
|
|
68
|
+
def set_autonomy_ability(self, value: int):
|
|
69
|
+
opts = [(0, 0), (1, 1), (1, 2), (2, 2), (3, 2), (1, 3), (2, 3), (3, 3), (4, 3), (3, 4), (4, 4)]
|
|
70
|
+
self.autonomy = opts[value][0]
|
|
71
|
+
self.ability = opts[value][1]
|
|
72
|
+
|
|
73
|
+
|
|
67
74
|
def load_from_db(self, value: str):
|
|
68
75
|
if ":" not in value:
|
|
69
|
-
self.
|
|
76
|
+
self.set_autonomy_ability(int(value))
|
|
70
77
|
else:
|
|
71
78
|
v = value.split(":")
|
|
72
79
|
if len(v) == 3:
|
|
73
|
-
self.
|
|
74
|
-
self.
|
|
75
|
-
self.
|
|
80
|
+
self.set_autonomy_ability(int(v[0]))
|
|
81
|
+
self.main_idx = int(v[1])
|
|
82
|
+
self.coverage = int(v[2])
|
|
83
|
+
elif len(v) == 4:
|
|
84
|
+
self.coverage = (int(v[0]))
|
|
85
|
+
self.autonomy = (int(v[1]))
|
|
86
|
+
self.ability = (int(v[2]))
|
|
87
|
+
self.main_idx = (int(v[3]))
|
|
76
88
|
|
|
77
89
|
def save_to_db(self) -> str:
|
|
78
|
-
return f"{self.
|
|
90
|
+
return f"{self.coverage}:{self.autonomy}:{self.ability}:{self.main_idx}"
|
|
79
91
|
|
|
80
92
|
def is_db_empty(self) -> bool:
|
|
81
|
-
return self.
|
|
93
|
+
return self.autonomy == 0 and self.ability == 0 and self.main_idx == 0 and self.coverage == 0
|
|
82
94
|
|
|
83
95
|
def get_prog_color(self, min_value: Optional[int] = None) -> str:
|
|
84
96
|
if min_value is None:
|
|
85
97
|
min_value = self.default_min_value
|
|
86
|
-
prog = self.
|
|
98
|
+
prog = self.coverage // 10
|
|
87
99
|
if prog == 0:
|
|
88
100
|
return "c"
|
|
89
101
|
if prog < min_value:
|
|
@@ -99,9 +111,9 @@ class Task(TreeItem):
|
|
|
99
111
|
if min_value is None:
|
|
100
112
|
min_value = self.default_min_value
|
|
101
113
|
color = self.get_prog_color(min_value)
|
|
102
|
-
prog = self.
|
|
114
|
+
prog = self.coverage // 10
|
|
103
115
|
if prog == 0:
|
|
104
|
-
return Text().
|
|
116
|
+
return Text().add("x")
|
|
105
117
|
if prog < min_value:
|
|
106
118
|
return Text().addf(color, str(prog))
|
|
107
119
|
if prog < 10:
|
|
@@ -111,38 +123,40 @@ class Task(TreeItem):
|
|
|
111
123
|
return Text().add("0")
|
|
112
124
|
|
|
113
125
|
def get_percent(self):
|
|
114
|
-
|
|
115
|
-
return 0
|
|
116
|
-
if self.self_grade == 10:
|
|
117
|
-
return 100
|
|
118
|
-
return self.self_grade * 10
|
|
126
|
+
return (self.autonomy / 5) * (self.ability / 5) * self.coverage
|
|
119
127
|
|
|
120
|
-
def
|
|
121
|
-
|
|
122
|
-
return self.self_grade * self.progress // 10
|
|
128
|
+
def get_ratio(self) -> float:
|
|
129
|
+
return self.get_percent() / 10.0
|
|
123
130
|
|
|
124
131
|
def is_complete(self):
|
|
125
|
-
return self.
|
|
132
|
+
return self.get_percent() == 100
|
|
126
133
|
|
|
127
134
|
def not_started(self):
|
|
128
|
-
return self.
|
|
135
|
+
return self.get_percent() == 0
|
|
129
136
|
|
|
130
137
|
def in_progress(self):
|
|
131
|
-
return self.
|
|
138
|
+
return self.get_percent() > 0 and self.get_percent() < 100
|
|
139
|
+
|
|
140
|
+
def set_coverage(self, coverage: int):
|
|
141
|
+
coverage = int(coverage)
|
|
142
|
+
if coverage >= 0 and coverage <= 100:
|
|
143
|
+
self.coverage = coverage
|
|
144
|
+
else:
|
|
145
|
+
print(f"Progresso inválido: {coverage}")
|
|
132
146
|
|
|
133
|
-
def
|
|
134
|
-
|
|
135
|
-
if
|
|
136
|
-
self.
|
|
147
|
+
def set_autonomy(self, value: int):
|
|
148
|
+
value = int(value)
|
|
149
|
+
if value >= 0 and value <= 5:
|
|
150
|
+
self.autonomy = value
|
|
137
151
|
else:
|
|
138
|
-
print(f"
|
|
152
|
+
print(f"Autonomia inválida: {value}")
|
|
139
153
|
|
|
140
|
-
def
|
|
141
|
-
|
|
142
|
-
if
|
|
143
|
-
self.
|
|
154
|
+
def set_hability(self, value: int):
|
|
155
|
+
value = int(value)
|
|
156
|
+
if value >= 0 and value <= 5:
|
|
157
|
+
self.ability = value
|
|
144
158
|
else:
|
|
145
|
-
print(f"
|
|
159
|
+
print(f"Compreensão inválida: {value}")
|
|
146
160
|
|
|
147
161
|
def get_download_link(self) -> str:
|
|
148
162
|
return self.download_link
|
|
@@ -153,7 +167,7 @@ class Task(TreeItem):
|
|
|
153
167
|
def __str__(self):
|
|
154
168
|
lnum = str(self.line_number).rjust(3)
|
|
155
169
|
key = "" if self.key == self.title else self.key + " "
|
|
156
|
-
return f"{lnum} grade:{self.
|
|
170
|
+
return f"{lnum} grade:{self.autonomy}:{self.ability} key:{key} title:{self.title} skills:{self.skills} down:{self.download_link} vis:{self.visitable_url}"
|
|
157
171
|
|
|
158
172
|
def has_at_symbol(self):
|
|
159
173
|
return any([s.startswith("@") for s in self.title.split(" ")])
|
|
@@ -6,6 +6,7 @@ import curses
|
|
|
6
6
|
from typing import Callable
|
|
7
7
|
from tko.play.input_manager import InputManager
|
|
8
8
|
from tko.util.symbols import symbols
|
|
9
|
+
from tko.game.task import Task
|
|
9
10
|
|
|
10
11
|
class Floating:
|
|
11
12
|
def __init__(self, _align=""):
|
|
@@ -38,7 +39,7 @@ class Floating:
|
|
|
38
39
|
self._frame.set_header(Text().addf("/", text), "")
|
|
39
40
|
return self
|
|
40
41
|
|
|
41
|
-
def
|
|
42
|
+
def set_header_text(self, sentence: Text):
|
|
42
43
|
self._frame.set_header(sentence, "")
|
|
43
44
|
return self
|
|
44
45
|
|
|
@@ -46,6 +47,10 @@ class Floating:
|
|
|
46
47
|
self._frame.set_footer(Text().addf("/", text), "")
|
|
47
48
|
return self
|
|
48
49
|
|
|
50
|
+
def set_footer_text(self, sentence: Text):
|
|
51
|
+
self._frame.set_footer(sentence, "")
|
|
52
|
+
return self
|
|
53
|
+
|
|
49
54
|
def set_exit_key(self, key: str):
|
|
50
55
|
self._exit_key = ord(key)
|
|
51
56
|
return self
|
|
@@ -167,6 +172,107 @@ class Floating:
|
|
|
167
172
|
|
|
168
173
|
return -1
|
|
169
174
|
|
|
175
|
+
class FloatingGrade(Floating):
|
|
176
|
+
def __init__(self, task: Task, _align=""):
|
|
177
|
+
super().__init__(_align)
|
|
178
|
+
self._task = task
|
|
179
|
+
self._line = 0
|
|
180
|
+
self.set_text_ljust()
|
|
181
|
+
self._frame.set_border_color("g")
|
|
182
|
+
self.set_header_text(Text.format("{y/}", " Utilize os direcionais para marcar "))
|
|
183
|
+
self.set_footer_text(Text.format("{y/}", " Pressione Enter para confirmar "))
|
|
184
|
+
|
|
185
|
+
self.grades_index = [task.coverage // 10, task.autonomy, task.ability]
|
|
186
|
+
self.coverage = ["x", "1", "2", "3", "4", "5", "6", "7", "8", "9", "✓"]
|
|
187
|
+
self.coverage_msg = [
|
|
188
|
+
"Não fiz",
|
|
189
|
+
"Fiz 10%",
|
|
190
|
+
"Fiz 20%",
|
|
191
|
+
"Fiz 30%",
|
|
192
|
+
"Fiz 40%",
|
|
193
|
+
"Fiz 50%",
|
|
194
|
+
"Fiz 60%",
|
|
195
|
+
"Fiz 70%",
|
|
196
|
+
"Fiz 80%",
|
|
197
|
+
"Fiz 90%",
|
|
198
|
+
"Fiz 100%"]
|
|
199
|
+
self.autonomy = [x.text for x in [symbols.autonomy_x, symbols.autonomy_e, symbols.autonomy_d, symbols.autonomy_c, symbols.autonomy_b, symbols.autonomy_a]]
|
|
200
|
+
self.autonomy_msg = [
|
|
201
|
+
"Não fiz ",
|
|
202
|
+
"Copiei ",
|
|
203
|
+
"Fiz guiado ",
|
|
204
|
+
"Fiz com muita ajuda ",
|
|
205
|
+
"Fiz com ajuda ",
|
|
206
|
+
"Fiz sem ajuda "
|
|
207
|
+
]
|
|
208
|
+
self.hability = [x.text for x in [symbols.hability_x, symbols.hability_e, symbols.hability_d, symbols.hability_c, symbols.hability_b, symbols.hability_a]]
|
|
209
|
+
self.hability_msg = [
|
|
210
|
+
"Não fiz ",
|
|
211
|
+
"Não entendi ",
|
|
212
|
+
"Entendi uma parte ",
|
|
213
|
+
"Entendi boa parte ",
|
|
214
|
+
"Entendi quase tudo ",
|
|
215
|
+
"Entendi tudo "
|
|
216
|
+
]
|
|
217
|
+
self.grades_value = [self.coverage, self.autonomy, self.hability]
|
|
218
|
+
self.grades_msg = [self.coverage_msg, self.autonomy_msg, self.hability_msg]
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
def update_content(self):
|
|
222
|
+
self._content = []
|
|
223
|
+
self._content.append(Text())
|
|
224
|
+
coverage_text = Text().add(" ").addf("Y" if self._line == 0 else "", "Cobertura").add(" ")
|
|
225
|
+
for i, c in enumerate(self.coverage):
|
|
226
|
+
coverage_text.addf("C" if i == self.grades_index[0] else "", c)
|
|
227
|
+
coverage_text.add(" ").addf("m", self.coverage_msg[self.grades_index[0]])
|
|
228
|
+
self._content.append(coverage_text)
|
|
229
|
+
# self._content.append(Text())
|
|
230
|
+
hability_text = Text().add(" ").addf("Y" if self._line == 1 else "", "Autonomia").add(" ")
|
|
231
|
+
for i, c in enumerate(self.autonomy):
|
|
232
|
+
hability_text.addf("G" if i == self.grades_index[1] else "", c).add(" ")
|
|
233
|
+
hability_text.add(" ").addf("m", self.autonomy_msg[self.grades_index[1]])
|
|
234
|
+
self._content.append(hability_text)
|
|
235
|
+
# self._content.append(Text())
|
|
236
|
+
autonomy_text = Text().add(" ").addf("Y" if self._line == 2 else "", "Compreensão").add(" ")
|
|
237
|
+
for i, c in enumerate(self.hability):
|
|
238
|
+
autonomy_text.addf("yW" if i == self.grades_index[2] else "", c).add(" ")
|
|
239
|
+
autonomy_text.add(" ").addf("m", self.hability_msg[self.grades_index[2]])
|
|
240
|
+
self._content.append(autonomy_text)
|
|
241
|
+
self._content.append(Text())
|
|
242
|
+
|
|
243
|
+
def draw(self):
|
|
244
|
+
self._set_default_header()
|
|
245
|
+
self._set_default_footer()
|
|
246
|
+
self.setup_frame()
|
|
247
|
+
self._frame.draw()
|
|
248
|
+
self.update_content()
|
|
249
|
+
self.write_content()
|
|
250
|
+
|
|
251
|
+
def change_task(self):
|
|
252
|
+
self._task.set_coverage(self.grades_index[0] * 10)
|
|
253
|
+
self._task.set_autonomy(self.grades_index[1])
|
|
254
|
+
self._task.set_hability(self.grades_index[2])
|
|
255
|
+
|
|
256
|
+
def get_input(self) -> int:
|
|
257
|
+
self.draw()
|
|
258
|
+
key: int = Fmt.getch()
|
|
259
|
+
key = InputManager.fix_cedilha(Fmt.get_screen(), key)
|
|
260
|
+
if key == curses.KEY_UP or key == ord('w'):
|
|
261
|
+
self._line = max(self._line - 1, 0)
|
|
262
|
+
elif key == curses.KEY_DOWN or key == ord('s'):
|
|
263
|
+
self._line = min(self._line + 1, 2)
|
|
264
|
+
elif key == curses.KEY_LEFT or key == ord('a'):
|
|
265
|
+
self.grades_index[self._line] = max(self.grades_index[self._line] - 1, 0)
|
|
266
|
+
self.change_task()
|
|
267
|
+
elif key == curses.KEY_RIGHT or key == ord('d'):
|
|
268
|
+
self.grades_index[self._line] = min(self.grades_index[self._line] + 1, len(self.grades_value[self._line]) - 1)
|
|
269
|
+
self.change_task()
|
|
270
|
+
elif key == ord('\n') or key == curses.KEY_BACKSPACE or key == InputManager.esc:
|
|
271
|
+
self._enable = False
|
|
272
|
+
if self._exit_fn is not None:
|
|
273
|
+
self._exit_fn()
|
|
274
|
+
return -1
|
|
275
|
+
|
|
170
276
|
class FloatingInputData:
|
|
171
277
|
def __init__(self, label: Callable[[], Text], action: Callable[[], None], shortcut: str = ""):
|
|
172
278
|
self.label = label
|
|
@@ -16,33 +16,51 @@ Sem Ajuda│$5 Sozinho │ │ │ [8] │ [10]
|
|
|
16
16
|
"""[1:-1]
|
|
17
17
|
|
|
18
18
|
self.emoji: Dict[str, Token] = {
|
|
19
|
-
"$1": symbols.
|
|
20
|
-
"$2": symbols.
|
|
21
|
-
"$3": symbols.
|
|
22
|
-
"$4": symbols.
|
|
23
|
-
"$5": symbols.
|
|
24
|
-
"$6": symbols.
|
|
25
|
-
"$7": symbols.
|
|
26
|
-
"$8": symbols.
|
|
19
|
+
"$1": symbols.hability_d,
|
|
20
|
+
"$2": symbols.hability_c,
|
|
21
|
+
"$3": symbols.hability_b,
|
|
22
|
+
"$4": symbols.hability_a,
|
|
23
|
+
"$5": symbols.autonomy_a,
|
|
24
|
+
"$6": symbols.autonomy_b,
|
|
25
|
+
"$7": symbols.autonomy_c,
|
|
26
|
+
"$8": symbols.autonomy_d
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
self.axes: Dict[int, list[str]] = {}
|
|
30
30
|
self.load_axes()
|
|
31
31
|
|
|
32
|
+
@staticmethod
|
|
33
|
+
def autonomy_emoji(value):
|
|
34
|
+
return [symbols.autonomy_x,
|
|
35
|
+
symbols.autonomy_e,
|
|
36
|
+
symbols.autonomy_d,
|
|
37
|
+
symbols.autonomy_c,
|
|
38
|
+
symbols.autonomy_b,
|
|
39
|
+
symbols.autonomy_a][value]
|
|
40
|
+
|
|
41
|
+
@staticmethod
|
|
42
|
+
def hability_emoji(value):
|
|
43
|
+
return [symbols.hability_x,
|
|
44
|
+
symbols.hability_e,
|
|
45
|
+
symbols.hability_d,
|
|
46
|
+
symbols.hability_c,
|
|
47
|
+
symbols.hability_b,
|
|
48
|
+
symbols.hability_a][value]
|
|
49
|
+
|
|
32
50
|
@staticmethod
|
|
33
51
|
def grade_to_emojis(grade: int) -> Text:
|
|
34
52
|
decode_dict = {
|
|
35
|
-
0: (symbols.
|
|
36
|
-
1: (symbols.
|
|
37
|
-
2: (symbols.
|
|
38
|
-
3: (symbols.
|
|
39
|
-
4: (symbols.
|
|
40
|
-
5: (symbols.
|
|
41
|
-
6: (symbols.
|
|
42
|
-
7: (symbols.
|
|
43
|
-
8: (symbols.
|
|
44
|
-
9: (symbols.
|
|
45
|
-
10: (symbols.
|
|
53
|
+
0: (symbols.autonomy_e, symbols.hability_e),
|
|
54
|
+
1: (symbols.autonomy_d, symbols.hability_d),
|
|
55
|
+
2: (symbols.autonomy_d, symbols.hability_c),
|
|
56
|
+
3: (symbols.autonomy_c, symbols.hability_c),
|
|
57
|
+
4: (symbols.autonomy_b, symbols.hability_c),
|
|
58
|
+
5: (symbols.autonomy_d, symbols.hability_b),
|
|
59
|
+
6: (symbols.autonomy_c, symbols.hability_b),
|
|
60
|
+
7: (symbols.autonomy_b, symbols.hability_b),
|
|
61
|
+
8: (symbols.autonomy_a, symbols.hability_b),
|
|
62
|
+
9: (symbols.autonomy_b, symbols.hability_a),
|
|
63
|
+
10: (symbols.autonomy_a, symbols.hability_a)
|
|
46
64
|
}
|
|
47
65
|
a = decode_dict[grade][0]
|
|
48
66
|
b = decode_dict[grade][1]
|
|
@@ -107,8 +125,8 @@ Sem Ajuda│$5 Sozinho │ │ │ [8] │ [10]
|
|
|
107
125
|
# pos += 1
|
|
108
126
|
|
|
109
127
|
pos = value.get_text().find("Não Fiz")
|
|
110
|
-
value.data[pos - 3] = symbols.
|
|
111
|
-
value.data[pos - 2] = symbols.
|
|
128
|
+
value.data[pos - 3] = symbols.autonomy_e
|
|
129
|
+
value.data[pos - 2] = symbols.hability_e
|
|
112
130
|
# marcando axes com a cor correspondente
|
|
113
131
|
if grade > 0 and grade <= 10:
|
|
114
132
|
value = value.replace(self.axes[grade][0], Token(self.axes[grade][0], "M"))
|
|
@@ -42,11 +42,19 @@ class Gui:
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
def get_help_fixed(self):
|
|
45
|
+
color = "W"
|
|
46
|
+
try:
|
|
47
|
+
selected = self.tree.get_selected_throw()
|
|
48
|
+
if isinstance(selected, Task):
|
|
49
|
+
color = "Y"
|
|
50
|
+
except IndexError:
|
|
51
|
+
pass
|
|
52
|
+
|
|
45
53
|
help_fixed: List[Text] = [
|
|
46
|
-
Text() + RToken("C", f"
|
|
47
|
-
Text() + RToken(
|
|
54
|
+
Text() + RToken("C", f"{GuiActions.palette} [{GuiKeys.palette}]"),
|
|
55
|
+
Text() + RToken(color, f"{GuiActions.evaluate}[.]"),
|
|
48
56
|
Text() + RToken("G", f"{self.get_activate_label()} [↲]"),
|
|
49
|
-
Text() + RToken(
|
|
57
|
+
Text() + RToken(color, f"{GuiActions.edit} [{GuiKeys.edit}]"),
|
|
50
58
|
# Text() + RToken("C", f"{GuiActions.navegar} [wasd]")
|
|
51
59
|
Text() + RToken("C", f"{GuiActions.search} [{GuiKeys.search}]")
|
|
52
60
|
]
|
|
@@ -55,7 +63,7 @@ class Gui:
|
|
|
55
63
|
def get_activate_label(self) -> str:
|
|
56
64
|
output: str = GuiActions.activate
|
|
57
65
|
try:
|
|
58
|
-
obj = self.tree.
|
|
66
|
+
obj = self.tree.get_selected_throw()
|
|
59
67
|
except IndexError:
|
|
60
68
|
return " Retornar"
|
|
61
69
|
if isinstance(obj, Quest):
|
|
@@ -198,19 +206,18 @@ class Gui:
|
|
|
198
206
|
|
|
199
207
|
def show_top_bar(self, frame: Frame):
|
|
200
208
|
lista = [
|
|
201
|
-
Text() + RToken("Y", f"
|
|
202
|
-
Text() + RToken("Y", f"
|
|
209
|
+
Text() + RToken("Y", f"Sair [q]"),
|
|
210
|
+
Text() + RToken("Y", f"Ajuda [?]"),
|
|
203
211
|
]
|
|
204
212
|
help = self.build_list_sentence(lista)
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
# pesquisar = help[2]
|
|
213
|
+
search = help[0]
|
|
214
|
+
evaluate = help[1]
|
|
208
215
|
|
|
209
216
|
pre: List[Text] = []
|
|
210
|
-
pre.append(
|
|
217
|
+
pre.append(search)
|
|
211
218
|
|
|
212
219
|
pos: List[Text] = []
|
|
213
|
-
pos.append(
|
|
220
|
+
pos.append(evaluate)
|
|
214
221
|
|
|
215
222
|
limit = frame.get_dx()
|
|
216
223
|
size = limit - Text().add(" ").join(pre + pos).len() - 2
|
|
@@ -224,7 +231,7 @@ class Gui:
|
|
|
224
231
|
_help: Floating = Floating("v>").set_text_ljust()
|
|
225
232
|
self.fman.add_input(_help)
|
|
226
233
|
|
|
227
|
-
_help.
|
|
234
|
+
_help.set_header_text(Text().add(" Ajuda "))
|
|
228
235
|
# _help.put_text(" Movimentação ".center(dx, symbols.hbar.text))
|
|
229
236
|
_help.put_sentence(Text.format(" Ajuda ").addf("r", GuiKeys.key_help).add(" Abre essa tela de ajuda")
|
|
230
237
|
)
|
|
@@ -232,11 +239,15 @@ class Gui:
|
|
|
232
239
|
_help.put_sentence(Text.format(" ").addf("r", "Shift + B")
|
|
233
240
|
.add(" Habilita ").addf("r", "").addf("R", "ícones").addf("r", "").add(" se seu ambiente suportar"))
|
|
234
241
|
_help.put_sentence(Text() + "" + RToken("g", "setas") + ", " + RToken("g", "wasd") + " Para navegar entre os elementos")
|
|
242
|
+
_help.put_sentence(Text() + f" {GuiActions.palette} " + RToken("r", f"{GuiKeys.palette}") + " Abre o menu de ações e configurações")
|
|
235
243
|
_help.put_sentence(Text() + f" {GuiActions.github} " + RToken("r", f"{GuiKeys.github_open}") + " Abre tarefa em uma aba do browser")
|
|
236
244
|
_help.put_sentence(Text() + f" {GuiActions.download} " + RToken("r", f"{GuiKeys.down_task}") + " Baixa tarefa de código para seu dispositivo")
|
|
237
245
|
_help.put_sentence(Text() + f" {GuiActions.edit} " + RToken("r", f"{GuiKeys.edit}") + " Abre os arquivos no editor de código")
|
|
238
|
-
_help.put_sentence(Text() + f" {GuiActions.activate} " + RToken("r", "↲") + " Interage com o elemento")
|
|
239
|
-
_help.put_sentence(Text() +
|
|
246
|
+
_help.put_sentence(Text() + f" {GuiActions.activate} " + RToken("r", "↲") + " Interage com o elemento de acordo com o contexto")
|
|
247
|
+
_help.put_sentence(Text() + " (baixar, visitar, escolher, compactar, expandir)")
|
|
248
|
+
_help.put_sentence(Text() + f" {GuiActions.evaluate} " + RToken("r", ".") + " Abre tela para auto avaliação")
|
|
249
|
+
_help.put_sentence(Text() + f"{GuiActions.search} " + RToken("r", f"{GuiKeys.search}") + " Abre a barra de pesquisa")
|
|
250
|
+
|
|
240
251
|
_help.put_sentence(Text())
|
|
241
252
|
_help.put_sentence(Text() + "Você pode mudar o editor padrão com o comando")
|
|
242
253
|
_help.put_sentence(Text() + RToken("g", " tko config --editor <comando>"))
|
|
@@ -263,10 +274,8 @@ class Gui:
|
|
|
263
274
|
return text, percent
|
|
264
275
|
|
|
265
276
|
def show_opening(self, frame: Frame):
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
# if not self.app.has_images():
|
|
269
|
-
# return
|
|
277
|
+
if not self.app.has_images():
|
|
278
|
+
return
|
|
270
279
|
_, cols = Fmt.get_size()
|
|
271
280
|
|
|
272
281
|
now = datetime.datetime.now()
|
|
@@ -32,16 +32,15 @@ opening: Dict[str, str] = {}
|
|
|
32
32
|
# """
|
|
33
33
|
|
|
34
34
|
opening["estuda"] = r"""
|
|
35
|
-
O modelo de avaliação usa 3 notas
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
Compreensão:
|
|
44
|
-
Autonomia : █ ▅ ▃ ▂ ▁
|
|
35
|
+
O modelo de avaliação usa 3 notas
|
|
36
|
+
Cobertura: quanto da atividade você fez
|
|
37
|
+
Autonomia: quanta ajuda você precisou
|
|
38
|
+
(ChatGpt, Copilot, Monitoria)
|
|
39
|
+
Compreensão: quanto você entendeu do que fez
|
|
40
|
+
|
|
41
|
+
Cobertura : 0 1 ... 9 ✓
|
|
42
|
+
Autonomia : x E D C B A
|
|
43
|
+
Compreensão : x ▁ ▂ ▃ ▅ █
|
|
45
44
|
|
|
46
45
|
,`````. __||||___
|
|
47
46
|
' Estuda`, /_ ___ \
|
|
@@ -10,11 +10,10 @@ class GuiActions:
|
|
|
10
10
|
download = "Baixar"
|
|
11
11
|
activate = "Ativar"
|
|
12
12
|
navigate = "←↓→"
|
|
13
|
-
progress = "Quanto"
|
|
14
13
|
uncheck = "Desmarcar"
|
|
15
14
|
search = "Pesquisar"
|
|
16
|
-
self_grade = " Como "
|
|
17
15
|
palette = "Paleta"
|
|
16
|
+
evaluate = "Avaliar"
|
|
18
17
|
all = "Todos"
|
|
19
18
|
|
|
20
19
|
class GuiKeys:
|
|
@@ -28,17 +27,8 @@ class GuiKeys:
|
|
|
28
27
|
down_task = "b"
|
|
29
28
|
activate = "\n"
|
|
30
29
|
key_help = "?"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
inc_prog2 = "="
|
|
34
|
-
dec_prog1 = "-"
|
|
35
|
-
dec_prog2 = "_"
|
|
36
|
-
|
|
37
|
-
inc_self1 = ">"
|
|
38
|
-
inc_self2 = "."
|
|
39
|
-
dec_self1 = "<"
|
|
40
|
-
dec_self2 = ","
|
|
41
|
-
|
|
30
|
+
|
|
31
|
+
evaluate = "j"
|
|
42
32
|
set_root_dir = "D"
|
|
43
33
|
set_lang = "L"
|
|
44
34
|
github_open = "g"
|
|
@@ -48,6 +38,7 @@ class GuiKeys:
|
|
|
48
38
|
borders = "B"
|
|
49
39
|
search = "/"
|
|
50
40
|
graph = "G"
|
|
41
|
+
evaluate = "."
|
|
51
42
|
diff = "m"
|
|
52
43
|
interact = "i"
|
|
53
44
|
test = "\n"
|