Skip to content

Commit

Permalink
refactor: make local constant private
Browse files Browse the repository at this point in the history
  • Loading branch information
mecaneer23 committed Apr 29, 2024
1 parent cc0a936 commit 2149aa5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/acurses.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def set_blocking(self, block: bool) -> None:
self._block = block


GETCH = _Getch()
_GETCH = _Getch()


class _CursesWindow: # pylint: disable=too-many-instance-attributes
Expand Down Expand Up @@ -144,20 +144,20 @@ def getch(self) -> int:
there is no input, otherwise wait until a key is
pressed.
"""
if not GETCH.is_blocking():
if not _GETCH.is_blocking():
try:
return self._stored_keys.get(block=False)
except queue_empty:
return -1
if not self._stored_keys.empty():
return self._stored_keys.get()
char = GETCH.get()
char = _GETCH.get()
current = [char]
if char == 27:
esc = now()
while now() - esc < _SHORT_TIME_SECONDS:
try:
char = GETCH.get(timeout=_SHORT_TIME_SECONDS)
char = _GETCH.get(timeout=_SHORT_TIME_SECONDS)
except queue_empty:
break
if char not in current:
Expand Down Expand Up @@ -259,7 +259,7 @@ def addch(self, y: int, x: int, char: str, attr: int = 0) -> None:

def nodelay(self, flag: bool = True) -> None:
"""If flag is True, getch() will be non-blocking"""
GETCH.set_blocking(not flag)
_GETCH.set_blocking(not flag)

def box(self) -> None:
"""Draw a border around the current window"""
Expand Down

0 comments on commit 2149aa5

Please sign in to comment.