Open eranheres opened 11 months ago
bf8469c3e4
)Here are the sandbox execution logs prior to making any changes:
0c252b2
Checking ultra_type/view_practice.py for syntax errors... ✅ ultra_type/view_practice.py has no syntax errors!
1/1 ✓Checking ultra_type/view_practice.py for syntax errors... ✅ ultra_type/view_practice.py has no syntax errors!
Sandbox passed on the latest main
, so sandbox checks will be enabled for this issue.
I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.
ultra_type/view_practice.py
✓ https://github.com/eranheres/ultra_type/commit/c604e0449f4a0ab069bda752e350a6c7263d8c7d Edit
Modify ultra_type/view_practice.py with contents:
• In the `__init__` method of the `ViewPractice` class, initialize a color pair for white using the `curses.init_pair()` function. The first argument should be a unique number, and the second and third arguments should both be `curses.COLOR_WHITE`. This will create a color pair that can be used to set the color of the border to white.
• Still in the `__init__` method, create a new window for the practice area using the `curses.newwin()` function. The height and width should be `_max_height` and `_max_width`, and the start y and x coordinates should be 0. Store this window in a new attribute `_practice_win`.
• Still in the `__init__` method, draw a border around the `_practice_win` window using the `box()` method. Set the color of the border to white using the `curses.color_pair()` function with the number of the white color pair.
• In the `set_practice_text` method, redraw the border around the `_practice_win` window after the practice text has been paginated. This ensures that the border is always visible, even when the practice text changes.
--- +++ @@ -4,12 +4,17 @@ class ViewPractice: def __init__(self, stdscr, win_width: int, win_height: int, is_ltr: bool, sound_enabled: bool): - self._max_width = win_width - self._max_height = win_height - self._stdscr = stdscr - self._is_ltr = is_ltr - self._current_page = -1 - self.clicker = Clicker(sound_enabled) + self._max_width = win_width + self._max_height = win_height + self._stdscr = stdscr + self._is_ltr = is_ltr + self._current_page = -1 + self.clicker = Clicker(sound_enabled) + curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_WHITE) + self._practice_win = curses.newwin(self._max_height, self._max_width, 0, 0) + self._practice_win.box(0, 0) + self._practice_win.bkgd(' ', curses.color_pair(1)) + self._practice_win.refresh() def set_practice_text(self, practice_text: str): self._practice_text = practice_text @@ -35,7 +40,7 @@ else: x = col return x, y - + return x, y def display_typed_char(self, char: str, pos: int): x, y = self._get_x_y_of_practice(pos) self._stdscr.move(y, x)
ultra_type/view_practice.py
✓ Edit
Check ultra_type/view_practice.py with contents:
Ran GitHub Actions for c604e0449f4a0ab069bda752e350a6c7263d8c7d:
I have finished reviewing the code for completeness. I did not find errors for sweep/practice-area-border
.
💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request. Join Our Discord
make a border around the practice area. don't include the statistics view inside this area. files to check view_practice.py
Checklist
- [X] Modify `ultra_type/view_practice.py` ✓ https://github.com/eranheres/ultra_type/commit/c604e0449f4a0ab069bda752e350a6c7263d8c7d [Edit](https://github.com/eranheres/ultra_type/edit/sweep/practice-area-border/ultra_type/view_practice.py) - [X] Running GitHub Actions for `ultra_type/view_practice.py` ✓ [Edit](https://github.com/eranheres/ultra_type/edit/sweep/practice-area-border/ultra_type/view_practice.py) ![Flowchart](https://raw.githubusercontent.com/eranheres/ultra_type/sweep/assets/a39b53cf52e1278ba52518f90cd687410eef5aa1d2f6c49b30999aaefd8ddd41_47_flowchart.svg)