Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu #117

Merged
merged 12 commits into from
Jan 1, 2025
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed
- `README.md` modified
- `AUTHORS.md` updated
- Menu updated
- Exit bug fixed
- Program details updated
## [0.8] - 2024-11-04
Expand Down
3 changes: 3 additions & 0 deletions nafas/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ def main():
if silent_flag:
tprint("Silent Mode")
description_print()
_ = input("Press any key to continue.")
clear_screen()
EXIT_FLAG = False
while not EXIT_FLAG:
input_data = get_input_standard()
filtered_data = input_filter(input_data)
program_name, level, program_data = get_program_data(filtered_data)
clear_screen()
program_description_print(program_name, level, program_data)
run(program_data, silent=silent_flag)
INPUTINDEX = str(
Expand Down
5 changes: 3 additions & 2 deletions nafas/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""nafas functions."""

import time
from nafas.params import NAFAS_DESCRIPTION, NAFAS_NOTICE, NAFAS_CAUTIONS, STANDARD_MENU, STANDARD_MENU_ORDER, STEP_MAP
from nafas.params import NAFAS_DESCRIPTION, NAFAS_TIPS, NAFAS_CAUTIONS, STANDARD_MENU, STANDARD_MENU_ORDER, STEP_MAP
from nafas.params import PROGRAMS, PROGRAM_DESCRIPTION, SOUND_MAP, STEP_TEMPLATE, CYCLE_TEMPLATE
from nafas.params import SOUND_WARNING_MESSAGE, EXIT_MESSAGE, BAD_INPUT_MESSAGE, PROGRAM_END_MESSAGE
from nafas.params import MINUTES_TEMPLATE, SECONDS_TEMPLATE, PROGRAM_TIME_TEMPLATE
Expand Down Expand Up @@ -148,7 +148,8 @@ def description_print():
:return: None
"""
print("\n".join(justify(NAFAS_DESCRIPTION.split(), 100)))
print(NAFAS_NOTICE)
print(NAFAS_TIPS)
line()
print(NAFAS_CAUTIONS)


Expand Down
16 changes: 8 additions & 8 deletions nafas/params.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# -*- coding: utf-8 -*-
"""nafas parameters."""

NAFAS_VERSION = "0.8"

NAFAS_DESCRIPTION = """
Breathing gymnastics is a system of breathing exercises that focuses on the treatment of various diseases and general health promotion.
Nafas is a collection of breathing gymnastics designed to reduce the exhaustion of long working hours.
With multiple breathing patterns, Nafas helps you find your way to a detoxified energetic workday and also improves your concentration by increasing the oxygen level.
No need to walk away to take a break, just sit comfortably, run Nafas and let the journey begin.
"""

NAFAS_NOTICE = """
Please consider the following :
NAFAS_TIPS = """
Breathing tips:

1. Inhaling is only done through the nose
2. Exhaling, you can use both nose and mouth
Expand All @@ -24,8 +26,6 @@
3. If you feel dizzy, nauseous, or lightheaded stop practicing and rest
"""

NAFAS_VERSION = "0.8"

SOUND_WARNING_MESSAGE = "Your device is not compatible with our underlying sound-playing library. You can refer to https://github.com/openscilab/nava."

EXIT_MESSAGE = "See you. Bye!"
Expand All @@ -34,7 +34,7 @@

PROGRAM_END_MESSAGE = "Well done!"

PROGRAM_DESCRIPTION = """Program Details :
PROGRAM_DESCRIPTION = """Program details:

Name : {0}

Expand All @@ -55,13 +55,13 @@

PROGRAM_TIME_TEMPLATE = "{0}- {1} (~ {2})"

MENU_TEMPLATE_1 = "- Please choose a {0} : \n"
MENU_TEMPLATE_1 = "- Choose a {0}: \n"

MENU_TEMPLATE_2 = "{0}- {1}"

CYCLE_TEMPLATE = "Cycle : {0} (Remaining : {1})"
CYCLE_TEMPLATE = "Cycle: {0} (Remaining: {1})"

STEP_TEMPLATE = "- {0} for {1} sec"
STEP_TEMPLATE = "- {0} for {1} seconds"

STANDARD_MENU = {
"program": {
Expand Down
45 changes: 23 additions & 22 deletions test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@
oxygen level. No need to walk away to take a break, just sit comfortably, run Nafas and let the
journey begin.
<BLANKLINE>
Please consider the following :
Breathing tips:
<BLANKLINE>
1. Inhaling is only done through the nose
2. Exhaling, you can use both nose and mouth
3. When exhaling through your mouth, it is recommended to fold the lips
<BLANKLINE>
######################################################################
<BLANKLINE>
Cautions:
<BLANKLINE>
Expand Down Expand Up @@ -60,7 +61,7 @@
>>> def test_keyboard_interrupt(i):
... raise KeyboardInterrupt
>>> input_data = get_input_standard(lambda x: "1")
- Please choose a program :
- Choose a program:
<BLANKLINE>
1- Clear Mind (~ 7 minutes)
2- Relax1 (~ 7 minutes)
Expand All @@ -76,7 +77,7 @@
12- Decision-Making (~ 2 minutes)
13- Balancing (~ 2 minutes)
14- Energizing (~ 2 minutes)
- Please choose a level :
- Choose a level:
<BLANKLINE>
1- Beginner
2- Medium
Expand All @@ -96,7 +97,7 @@
True
>>> program_description_print("Clear Mind","Beginner",{"ratio": [1, 0, 3, 0], "unit": 3, "pre": 3, "cycle": 35})
######################################################################
Program Details :
Program details:
<BLANKLINE>
Name : Clear Mind
<BLANKLINE>
Expand All @@ -116,16 +117,16 @@
######################################################################
Start
######################################################################
Cycle : 1 (Remaining : 1)
- Inhale for 1 sec
Cycle: 1 (Remaining: 1)
- Inhale for 1 seconds
.
- Exhale for 3 sec
- Exhale for 3 seconds
. . .
######################################################################
Cycle : 2 (Remaining : 0)
- Inhale for 1 sec
Cycle: 2 (Remaining: 0)
- Inhale for 1 seconds
.
- Exhale for 3 sec
- Exhale for 3 seconds
. . .
######################################################################
Well done!
Expand All @@ -134,16 +135,16 @@
######################################################################
Start
######################################################################
Cycle : 1 (Remaining : 1)
- Inhale for 1 sec
Cycle: 1 (Remaining: 1)
- Inhale for 1 seconds
.
- Exhale for 3 sec
- Exhale for 3 seconds
. . .
######################################################################
Cycle : 2 (Remaining : 0)
- Inhale for 1 sec
Cycle: 2 (Remaining: 0)
- Inhale for 1 seconds
.
- Exhale for 3 sec
- Exhale for 3 seconds
. . .
######################################################################
Well done!
Expand All @@ -152,16 +153,16 @@
######################################################################
Start
######################################################################
Cycle : 1 (Remaining : 1)
- Inhale for 1 sec
Cycle: 1 (Remaining: 1)
- Inhale for 1 seconds
.
- Exhale for 3.3 sec
- Exhale for 3.3 seconds
. . . .
######################################################################
Cycle : 2 (Remaining : 0)
- Inhale for 1 sec
Cycle: 2 (Remaining: 0)
- Inhale for 1 seconds
.
- Exhale for 3.3 sec
- Exhale for 3.3 seconds
. . . .
######################################################################
Well done!
Expand Down