eranheres / ultra_type

0 stars 0 forks source link

sweep: in practice view make a white rectangle border around the practice area #47

Open eranheres opened 11 months ago

eranheres commented 11 months ago

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)
sweep-mine[bot] commented 11 months ago

Here's the PR! https://github.com/eranheres/ultra_type/pull/48. See Sweep's process at dashboard.

💎 Sweep Pro: I'm using GPT-4. You have unlimited GPT-4 tickets. (tracking ID: bf8469c3e4)

Actions (click)

Sandbox Execution ✓

Here are the sandbox execution logs prior to making any changes:

Sandbox logs for 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.


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I think are relevant in decreasing order of relevance (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/eranheres/ultra_type/blob/0c252b2da61e6ebedb32286408aaad74077e90d0/ultra_type/view_practice.py#L45-L77 https://github.com/eranheres/ultra_type/blob/0c252b2da61e6ebedb32286408aaad74077e90d0/ultra_type/view_practice.py#L1-L45

Step 2: ⌨️ Coding

--- 
+++ 
@@ -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)

Ran GitHub Actions for c604e0449f4a0ab069bda752e350a6c7263d8c7d:


Step 3: 🔁 Code Review

I have finished reviewing the code for completeness. I did not find errors for sweep/practice-area-border.


🎉 Latest improvements to Sweep:


💡 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