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.
Files changed (105) hide show
  1. {tko-2.2.3/src/tko.egg-info → tko-2.3.1}/PKG-INFO +1 -1
  2. {tko-2.2.3 → tko-2.3.1}/changelog.md +4 -0
  3. tko-2.3.1/src/tko/__init__.py +1 -0
  4. {tko-2.2.3 → tko-2.3.1}/src/tko/cmds/cmd_play.py +2 -2
  5. {tko-2.2.3 → tko-2.3.1}/src/tko/game/game.py +4 -4
  6. {tko-2.2.3 → tko-2.3.1}/src/tko/game/quest.py +8 -8
  7. {tko-2.2.3 → tko-2.3.1}/src/tko/game/task.py +48 -34
  8. {tko-2.2.3 → tko-2.3.1}/src/tko/play/floating.py +107 -1
  9. {tko-2.2.3 → tko-2.3.1}/src/tko/play/grade_message.py +39 -21
  10. {tko-2.2.3 → tko-2.3.1}/src/tko/play/gui.py +27 -18
  11. {tko-2.2.3 → tko-2.3.1}/src/tko/play/images.py +9 -10
  12. {tko-2.2.3 → tko-2.3.1}/src/tko/play/keys.py +4 -13
  13. {tko-2.2.3 → tko-2.3.1}/src/tko/play/play.py +3 -11
  14. {tko-2.2.3 → tko-2.3.1}/src/tko/play/play_actions.py +21 -7
  15. {tko-2.2.3 → tko-2.3.1}/src/tko/play/tasktree.py +21 -64
  16. {tko-2.2.3 → tko-2.3.1}/src/tko/play/tester.py +9 -8
  17. {tko-2.2.3 → tko-2.3.1}/src/tko/settings/app_settings.py +1 -1
  18. {tko-2.2.3 → tko-2.3.1}/src/tko/util/daily.py +16 -17
  19. {tko-2.2.3 → tko-2.3.1}/src/tko/util/logger.py +23 -35
  20. {tko-2.2.3 → tko-2.3.1}/src/tko/util/symbols.py +13 -11
  21. {tko-2.2.3 → tko-2.3.1/src/tko.egg-info}/PKG-INFO +1 -1
  22. tko-2.2.3/src/tko/__init__.py +0 -1
  23. {tko-2.2.3 → tko-2.3.1}/LICENSE +0 -0
  24. {tko-2.2.3 → tko-2.3.1}/MANIFEST.in +0 -0
  25. {tko-2.2.3 → tko-2.3.1}/Readme.md +0 -0
  26. {tko-2.2.3 → tko-2.3.1}/config.md +0 -0
  27. {tko-2.2.3 → tko-2.3.1}/requirements.txt +0 -0
  28. {tko-2.2.3 → tko-2.3.1}/setup.cfg +0 -0
  29. {tko-2.2.3 → tko-2.3.1}/setup.py +0 -0
  30. {tko-2.2.3 → tko-2.3.1}/src/tko/__main__.py +0 -0
  31. {tko-2.2.3 → tko-2.3.1}/src/tko/cmds/__init__.py +0 -0
  32. {tko-2.2.3 → tko-2.3.1}/src/tko/cmds/cmd_build.py +0 -0
  33. {tko-2.2.3 → tko-2.3.1}/src/tko/cmds/cmd_config.py +0 -0
  34. {tko-2.2.3 → tko-2.3.1}/src/tko/cmds/cmd_down.py +0 -0
  35. {tko-2.2.3 → tko-2.3.1}/src/tko/cmds/cmd_rep.py +0 -0
  36. {tko-2.2.3 → tko-2.3.1}/src/tko/cmds/cmd_run.py +0 -0
  37. {tko-2.2.3 → tko-2.3.1}/src/tko/down/__init__.py +0 -0
  38. {tko-2.2.3 → tko-2.3.1}/src/tko/down/down.py +0 -0
  39. {tko-2.2.3 → tko-2.3.1}/src/tko/down/drafts.py +0 -0
  40. {tko-2.2.3 → tko-2.3.1}/src/tko/game/__init__.py +0 -0
  41. {tko-2.2.3 → tko-2.3.1}/src/tko/game/cluster.py +0 -0
  42. {tko-2.2.3 → tko-2.3.1}/src/tko/game/game_builder.py +0 -0
  43. {tko-2.2.3 → tko-2.3.1}/src/tko/game/game_validator.py +0 -0
  44. {tko-2.2.3 → tko-2.3.1}/src/tko/game/graph.py +0 -0
  45. {tko-2.2.3 → tko-2.3.1}/src/tko/game/tree_item.py +0 -0
  46. {tko-2.2.3 → tko-2.3.1}/src/tko/game/xp.py +0 -0
  47. {tko-2.2.3 → tko-2.3.1}/src/tko/play/__init__.py +0 -0
  48. {tko-2.2.3 → tko-2.3.1}/src/tko/play/border.py +0 -0
  49. {tko-2.2.3 → tko-2.3.1}/src/tko/play/colors.py +0 -0
  50. {tko-2.2.3 → tko-2.3.1}/src/tko/play/flags.py +0 -0
  51. {tko-2.2.3 → tko-2.3.1}/src/tko/play/floating_manager.py +0 -0
  52. {tko-2.2.3 → tko-2.3.1}/src/tko/play/fmt.py +0 -0
  53. {tko-2.2.3 → tko-2.3.1}/src/tko/play/frame.py +0 -0
  54. {tko-2.2.3 → tko-2.3.1}/src/tko/play/functors.py +0 -0
  55. {tko-2.2.3 → tko-2.3.1}/src/tko/play/input_manager.py +0 -0
  56. {tko-2.2.3 → tko-2.3.1}/src/tko/play/language_setter.py +0 -0
  57. {tko-2.2.3 → tko-2.3.1}/src/tko/play/opener.py +0 -0
  58. {tko-2.2.3 → tko-2.3.1}/src/tko/play/patch_history.py +0 -0
  59. {tko-2.2.3 → tko-2.3.1}/src/tko/play/play_palette.py +0 -0
  60. {tko-2.2.3 → tko-2.3.1}/src/tko/play/search.py +0 -0
  61. {tko-2.2.3 → tko-2.3.1}/src/tko/play/tracker.py +0 -0
  62. {tko-2.2.3 → tko-2.3.1}/src/tko/run/__init__.py +0 -0
  63. {tko-2.2.3 → tko-2.3.1}/src/tko/run/diff_builder.py +0 -0
  64. {tko-2.2.3 → tko-2.3.1}/src/tko/run/diff_builder_down.py +0 -0
  65. {tko-2.2.3 → tko-2.3.1}/src/tko/run/diff_builder_side.py +0 -0
  66. {tko-2.2.3 → tko-2.3.1}/src/tko/run/loader.py +0 -0
  67. {tko-2.2.3 → tko-2.3.1}/src/tko/run/solver_builder.py +0 -0
  68. {tko-2.2.3 → tko-2.3.1}/src/tko/run/unit.py +0 -0
  69. {tko-2.2.3 → tko-2.3.1}/src/tko/run/unit_runner.py +0 -0
  70. {tko-2.2.3 → tko-2.3.1}/src/tko/run/wdir.py +0 -0
  71. {tko-2.2.3 → tko-2.3.1}/src/tko/run/writer.py +0 -0
  72. {tko-2.2.3 → tko-2.3.1}/src/tko/settings/__init__.py +0 -0
  73. {tko-2.2.3 → tko-2.3.1}/src/tko/settings/check_version.py +0 -0
  74. {tko-2.2.3 → tko-2.3.1}/src/tko/settings/repository.py +0 -0
  75. {tko-2.2.3 → tko-2.3.1}/src/tko/settings/repository_starter.py +0 -0
  76. {tko-2.2.3 → tko-2.3.1}/src/tko/settings/settings.py +0 -0
  77. {tko-2.2.3 → tko-2.3.1}/src/tko/util/__init__.py +0 -0
  78. {tko-2.2.3 → tko-2.3.1}/src/tko/util/code_filter.py +0 -0
  79. {tko-2.2.3 → tko-2.3.1}/src/tko/util/compare.py +0 -0
  80. {tko-2.2.3 → tko-2.3.1}/src/tko/util/consts.py +0 -0
  81. {tko-2.2.3 → tko-2.3.1}/src/tko/util/decoder.py +0 -0
  82. {tko-2.2.3 → tko-2.3.1}/src/tko/util/freerun.py +0 -0
  83. {tko-2.2.3 → tko-2.3.1}/src/tko/util/get_md_link.py +0 -0
  84. {tko-2.2.3 → tko-2.3.1}/src/tko/util/guide.py +0 -0
  85. {tko-2.2.3 → tko-2.3.1}/src/tko/util/identifier.py +0 -0
  86. {tko-2.2.3 → tko-2.3.1}/src/tko/util/label_factory.py +0 -0
  87. {tko-2.2.3 → tko-2.3.1}/src/tko/util/param.py +0 -0
  88. {tko-2.2.3 → tko-2.3.1}/src/tko/util/pattern.py +0 -0
  89. {tko-2.2.3 → tko-2.3.1}/src/tko/util/raw_terminal.py +0 -0
  90. {tko-2.2.3 → tko-2.3.1}/src/tko/util/remote_md.py +0 -0
  91. {tko-2.2.3 → tko-2.3.1}/src/tko/util/remote_url.py +0 -0
  92. {tko-2.2.3 → tko-2.3.1}/src/tko/util/runner.py +0 -0
  93. {tko-2.2.3 → tko-2.3.1}/src/tko/util/task_md_title.py +0 -0
  94. {tko-2.2.3 → tko-2.3.1}/src/tko/util/text.py +0 -0
  95. {tko-2.2.3 → tko-2.3.1}/src/tko/util/to_asc.py +0 -0
  96. {tko-2.2.3 → tko-2.3.1}/src/tko.egg-info/SOURCES.txt +0 -0
  97. {tko-2.2.3 → tko-2.3.1}/src/tko.egg-info/dependency_links.txt +0 -0
  98. {tko-2.2.3 → tko-2.3.1}/src/tko.egg-info/entry_points.txt +0 -0
  99. {tko-2.2.3 → tko-2.3.1}/src/tko.egg-info/requires.txt +0 -0
  100. {tko-2.2.3 → tko-2.3.1}/src/tko.egg-info/top_level.txt +0 -0
  101. {tko-2.2.3 → tko-2.3.1}/tests/test_fmt.py +0 -0
  102. {tko-2.2.3 → tko-2.3.1}/tests/test_logger.py +0 -0
  103. {tko-2.2.3 → tko-2.3.1}/tests/test_one.py +0 -0
  104. {tko-2.2.3 → tko-2.3.1}/tests/test_text.py +0 -0
  105. {tko-2.2.3 → tko-2.3.1}/todo.md +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tko
3
- Version: 2.2.3
3
+ Version: 2.3.1
4
4
  Summary: tko: Test Kit Operations
5
5
  Home-page: https://github.com/senapk/tko
6
6
  Author: David Sena Oliveira
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ - 2.3.1
4
+ - fix: error in search
5
+ - 2.3.0
6
+ - add: new evaluate menu
3
7
  - 2.2.3
4
8
  - fix: change diff mode
5
9
  - 2.2.2
@@ -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.record_other_event(LogAction.OPEN)
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.record_other_event(LogAction.QUIT)
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.self_grade/10)
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.self_grade/10)
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.self_grade/10)
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.self_grade/10)
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].get_total_percent() < 50:
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 7
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.self_grade >= tmin])
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.self_grade < self.tmin:
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.self_grade > 0:
122
- obtained += t.xp * t.self_grade // 10
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 * 100 // total
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.self_grade != 0:
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.self_grade: int = 0 #valor de 0 a 9
24
- self.progress: int = 0 #valor de 0 a 100
25
- self.main_index: int = 0
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.self_grade = int(value)
76
+ self.set_autonomy_ability(int(value))
70
77
  else:
71
78
  v = value.split(":")
72
79
  if len(v) == 3:
73
- self.self_grade = int(v[0])
74
- self.main_index = int(v[1])
75
- self.progress = int(v[2])
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.self_grade}:{self.main_index}:{self.progress}"
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.self_grade == 0 and self.main_index == 0 and self.progress == 0
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.progress // 10
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.progress // 10
114
+ prog = self.coverage // 10
103
115
  if prog == 0:
104
- return Text().addf(color, "0")
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
- if self.self_grade == 0:
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 get_total_percent(self):
121
- # return (self.self_grade * 10 + self.progress) // 2
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.self_grade == 10
132
+ return self.get_percent() == 100
126
133
 
127
134
  def not_started(self):
128
- return self.self_grade == 0
135
+ return self.get_percent() == 0
129
136
 
130
137
  def in_progress(self):
131
- return self.self_grade > 0 and self.self_grade < 10
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 set_progress(self, progress: int):
134
- progress = int(progress)
135
- if progress >= 0 and progress <= 100:
136
- self.progress = progress
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"Progresso inválido: {progress}")
152
+ print(f"Autonomia inválida: {value}")
139
153
 
140
- def set_grade(self, grade: int):
141
- grade = int(grade)
142
- if grade >= 0 and grade <= 10:
143
- self.self_grade = grade
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"Grade inválida: {grade}")
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.self_grade} key:{key} title:{self.title} skills:{self.skills} down:{self.download_link} vis:{self.visitable_url}"
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 set_header_sentence(self, sentence: Text):
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.compreensao_d,
20
- "$2": symbols.compreensao_c,
21
- "$3": symbols.compreensao_b,
22
- "$4": symbols.compreensao_a,
23
- "$5": symbols.suporte_a,
24
- "$6": symbols.suporte_b,
25
- "$7": symbols.suporte_c,
26
- "$8": symbols.suporte_d
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.suporte_e, symbols.compreensao_e),
36
- 1: (symbols.suporte_d, symbols.compreensao_d),
37
- 2: (symbols.suporte_d, symbols.compreensao_c),
38
- 3: (symbols.suporte_c, symbols.compreensao_c),
39
- 4: (symbols.suporte_b, symbols.compreensao_c),
40
- 5: (symbols.suporte_d, symbols.compreensao_b),
41
- 6: (symbols.suporte_c, symbols.compreensao_b),
42
- 7: (symbols.suporte_b, symbols.compreensao_b),
43
- 8: (symbols.suporte_a, symbols.compreensao_b),
44
- 9: (symbols.suporte_b, symbols.compreensao_a),
45
- 10: (symbols.suporte_a, symbols.compreensao_a)
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.suporte_e
111
- value.data[pos - 2] = symbols.compreensao_e
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" {GuiActions.leave} [{GuiKeys.key_quit}]"),
47
- Text() + RToken("Y", f"{GuiActions.palette} [{GuiKeys.palette}]"),
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("Y", f"{GuiActions.edit} [{GuiKeys.edit}]"),
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.get_selected()
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"{GuiActions.self_grade} {GuiKeys.dec_self1}{GuiKeys.inc_self1}"),
202
- Text() + RToken("Y", f"{GuiActions.progress} {GuiKeys.dec_prog1}{GuiKeys.inc_prog1}"),
209
+ Text() + RToken("Y", f"Sair [q]"),
210
+ Text() + RToken("Y", f"Ajuda [?]"),
203
211
  ]
204
212
  help = self.build_list_sentence(lista)
205
- self_grade = help[0]
206
- progress = help[1]
207
- # pesquisar = help[2]
213
+ search = help[0]
214
+ evaluate = help[1]
208
215
 
209
216
  pre: List[Text] = []
210
- pre.append(progress)
217
+ pre.append(search)
211
218
 
212
219
  pos: List[Text] = []
213
- pos.append(self_grade)
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.set_header_sentence(Text().add(" Ajuda "))
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() + f" {GuiActions.self_grade}" + RToken("r", f"{GuiKeys.dec_self1}") + RToken("r", f"{GuiKeys.inc_self1}") + " Muda a autoavaliação")
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
- # if Fmt.get_size()[1] < 100:
267
- # return
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
- Progresso, Autonomia e Compreensão
37
- Progresso é o QUANTO você fez.
38
- Ele é gerado automaticamente pelos
39
- testes ou manualmente usando +-.
40
- Autonomia e Compreensão são COMO.
41
- Use <> para marcar COMO você fez.
42
- Progressao : ✓ 9.... 0
43
- Compreensão: A B C D E
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
- inc_prog1 = "+"
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"