allcalc 4.1.0__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.
- allcalc-4.1.0/PKG-INFO +48 -0
- allcalc-4.1.0/README.md +38 -0
- allcalc-4.1.0/allcalc.egg-info/PKG-INFO +48 -0
- allcalc-4.1.0/allcalc.egg-info/SOURCES.txt +24 -0
- allcalc-4.1.0/allcalc.egg-info/dependency_links.txt +1 -0
- allcalc-4.1.0/allcalc.egg-info/entry_points.txt +2 -0
- allcalc-4.1.0/allcalc.egg-info/requires.txt +2 -0
- allcalc-4.1.0/allcalc.egg-info/top_level.txt +2 -0
- allcalc-4.1.0/app.py +126 -0
- allcalc-4.1.0/modules/__init__.py +0 -0
- allcalc-4.1.0/modules/basic.py +9 -0
- allcalc-4.1.0/modules/basiccalc.py +53 -0
- allcalc-4.1.0/modules/config.py +98 -0
- allcalc-4.1.0/modules/evenodd.py +16 -0
- allcalc-4.1.0/modules/grade.py +15 -0
- allcalc-4.1.0/modules/i18n.py +28 -0
- allcalc-4.1.0/modules/language/de.json +78 -0
- allcalc-4.1.0/modules/language/en.json +78 -0
- allcalc-4.1.0/modules/language/sk.json +78 -0
- allcalc-4.1.0/modules/negativecheck.py +13 -0
- allcalc-4.1.0/modules/newusr.py +42 -0
- allcalc-4.1.0/modules/printmenu.py +46 -0
- allcalc-4.1.0/modules/settings.py +26 -0
- allcalc-4.1.0/modules/surface.py +59 -0
- allcalc-4.1.0/pyproject.toml +35 -0
- allcalc-4.1.0/setup.cfg +4 -0
allcalc-4.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: allcalc
|
|
3
|
+
Version: 4.1.0
|
|
4
|
+
Summary: A simple CLI calculator with multiple math tools
|
|
5
|
+
Author-email: Denis Varga <mail@denisvarga.eu>
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: rich
|
|
9
|
+
Requires-Dist: simpleeval
|
|
10
|
+
|
|
11
|
+
# ALLCALC
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
░███ ░██ ░██ ░██████ ░███ ░██ ░██████
|
|
15
|
+
░██░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██
|
|
16
|
+
░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██
|
|
17
|
+
░█████████ ░██ ░██ ░██ ░█████████ ░██ ░██
|
|
18
|
+
░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██
|
|
19
|
+
░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██
|
|
20
|
+
░██ ░██ ░██████████ ░██████████ ░██████ ░██ ░██ ░██████████ ░██████
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Version 4.1.0**
|
|
24
|
+
|
|
25
|
+
### Modular Python calculator, fully CLI, lightweight, and fast.
|
|
26
|
+
|
|
27
|
+
## Modules
|
|
28
|
+
|
|
29
|
+
* Basic Calculator Shell | /modules/basiccalc.py
|
|
30
|
+
* Even or odd number chceker | /modules/evenodd.py
|
|
31
|
+
* Grade chcker | /modules/grade.py
|
|
32
|
+
* Negative number checker | /modules/negativecheck.py
|
|
33
|
+
* Surface calculator| /modules/surface.py
|
|
34
|
+
|
|
35
|
+
## Features
|
|
36
|
+
|
|
37
|
+
* I18n localiztion
|
|
38
|
+
* modular system
|
|
39
|
+
* easy to read code
|
|
40
|
+
* setting to edit language and more features coming soon
|
|
41
|
+
* config file to store config for now jut language
|
|
42
|
+
|
|
43
|
+
## Languages
|
|
44
|
+
* sk - slovak
|
|
45
|
+
* en - English
|
|
46
|
+
* de - Deutch
|
|
47
|
+
##### Feel free to contribute
|
|
48
|
+
### made with code and <3 by Denis Varga
|
allcalc-4.1.0/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# ALLCALC
|
|
2
|
+
|
|
3
|
+
```text
|
|
4
|
+
░███ ░██ ░██ ░██████ ░███ ░██ ░██████
|
|
5
|
+
░██░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██
|
|
6
|
+
░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██
|
|
7
|
+
░█████████ ░██ ░██ ░██ ░█████████ ░██ ░██
|
|
8
|
+
░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██
|
|
9
|
+
░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██
|
|
10
|
+
░██ ░██ ░██████████ ░██████████ ░██████ ░██ ░██ ░██████████ ░██████
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Version 4.1.0**
|
|
14
|
+
|
|
15
|
+
### Modular Python calculator, fully CLI, lightweight, and fast.
|
|
16
|
+
|
|
17
|
+
## Modules
|
|
18
|
+
|
|
19
|
+
* Basic Calculator Shell | /modules/basiccalc.py
|
|
20
|
+
* Even or odd number chceker | /modules/evenodd.py
|
|
21
|
+
* Grade chcker | /modules/grade.py
|
|
22
|
+
* Negative number checker | /modules/negativecheck.py
|
|
23
|
+
* Surface calculator| /modules/surface.py
|
|
24
|
+
|
|
25
|
+
## Features
|
|
26
|
+
|
|
27
|
+
* I18n localiztion
|
|
28
|
+
* modular system
|
|
29
|
+
* easy to read code
|
|
30
|
+
* setting to edit language and more features coming soon
|
|
31
|
+
* config file to store config for now jut language
|
|
32
|
+
|
|
33
|
+
## Languages
|
|
34
|
+
* sk - slovak
|
|
35
|
+
* en - English
|
|
36
|
+
* de - Deutch
|
|
37
|
+
##### Feel free to contribute
|
|
38
|
+
### made with code and <3 by Denis Varga
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: allcalc
|
|
3
|
+
Version: 4.1.0
|
|
4
|
+
Summary: A simple CLI calculator with multiple math tools
|
|
5
|
+
Author-email: Denis Varga <mail@denisvarga.eu>
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: rich
|
|
9
|
+
Requires-Dist: simpleeval
|
|
10
|
+
|
|
11
|
+
# ALLCALC
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
░███ ░██ ░██ ░██████ ░███ ░██ ░██████
|
|
15
|
+
░██░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██
|
|
16
|
+
░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██
|
|
17
|
+
░█████████ ░██ ░██ ░██ ░█████████ ░██ ░██
|
|
18
|
+
░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██
|
|
19
|
+
░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██
|
|
20
|
+
░██ ░██ ░██████████ ░██████████ ░██████ ░██ ░██ ░██████████ ░██████
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Version 4.1.0**
|
|
24
|
+
|
|
25
|
+
### Modular Python calculator, fully CLI, lightweight, and fast.
|
|
26
|
+
|
|
27
|
+
## Modules
|
|
28
|
+
|
|
29
|
+
* Basic Calculator Shell | /modules/basiccalc.py
|
|
30
|
+
* Even or odd number chceker | /modules/evenodd.py
|
|
31
|
+
* Grade chcker | /modules/grade.py
|
|
32
|
+
* Negative number checker | /modules/negativecheck.py
|
|
33
|
+
* Surface calculator| /modules/surface.py
|
|
34
|
+
|
|
35
|
+
## Features
|
|
36
|
+
|
|
37
|
+
* I18n localiztion
|
|
38
|
+
* modular system
|
|
39
|
+
* easy to read code
|
|
40
|
+
* setting to edit language and more features coming soon
|
|
41
|
+
* config file to store config for now jut language
|
|
42
|
+
|
|
43
|
+
## Languages
|
|
44
|
+
* sk - slovak
|
|
45
|
+
* en - English
|
|
46
|
+
* de - Deutch
|
|
47
|
+
##### Feel free to contribute
|
|
48
|
+
### made with code and <3 by Denis Varga
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
app.py
|
|
3
|
+
pyproject.toml
|
|
4
|
+
allcalc.egg-info/PKG-INFO
|
|
5
|
+
allcalc.egg-info/SOURCES.txt
|
|
6
|
+
allcalc.egg-info/dependency_links.txt
|
|
7
|
+
allcalc.egg-info/entry_points.txt
|
|
8
|
+
allcalc.egg-info/requires.txt
|
|
9
|
+
allcalc.egg-info/top_level.txt
|
|
10
|
+
modules/__init__.py
|
|
11
|
+
modules/basic.py
|
|
12
|
+
modules/basiccalc.py
|
|
13
|
+
modules/config.py
|
|
14
|
+
modules/evenodd.py
|
|
15
|
+
modules/grade.py
|
|
16
|
+
modules/i18n.py
|
|
17
|
+
modules/negativecheck.py
|
|
18
|
+
modules/newusr.py
|
|
19
|
+
modules/printmenu.py
|
|
20
|
+
modules/settings.py
|
|
21
|
+
modules/surface.py
|
|
22
|
+
modules/language/de.json
|
|
23
|
+
modules/language/en.json
|
|
24
|
+
modules/language/sk.json
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
allcalc-4.1.0/app.py
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# math modules
|
|
2
|
+
from modules import negativecheck as ng
|
|
3
|
+
from modules import evenodd as eo
|
|
4
|
+
from modules import grade as gr
|
|
5
|
+
from modules import basiccalc as basic
|
|
6
|
+
from modules import surface as su
|
|
7
|
+
from modules import settings as st
|
|
8
|
+
from modules import basic as bs
|
|
9
|
+
# config
|
|
10
|
+
from modules.i18n import I18n
|
|
11
|
+
from modules import config as cfg
|
|
12
|
+
from modules import printmenu as pm
|
|
13
|
+
from modules import newusr as nw
|
|
14
|
+
# misc
|
|
15
|
+
from rich.prompt import Prompt
|
|
16
|
+
from rich.console import Console
|
|
17
|
+
import time
|
|
18
|
+
|
|
19
|
+
version = "4.1.0"
|
|
20
|
+
lang = cfg.load_language()
|
|
21
|
+
i18n = I18n(lang)
|
|
22
|
+
console = Console(style="yellow")
|
|
23
|
+
|
|
24
|
+
if cfg.new_user_check() == "1":
|
|
25
|
+
nw.nw(lang, version)
|
|
26
|
+
else:
|
|
27
|
+
print("67")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
pm.printmenu(lang, version)
|
|
31
|
+
|
|
32
|
+
def pick(choice, sk):
|
|
33
|
+
global lang
|
|
34
|
+
|
|
35
|
+
if choice == "1":
|
|
36
|
+
print(i18n.get("pls.provide.pos.neg.main"))
|
|
37
|
+
|
|
38
|
+
if sk == 1:
|
|
39
|
+
number = float(input(i18n.get("pls.num.inp.main")))
|
|
40
|
+
cfg.save_acive_option("0")
|
|
41
|
+
ng.check(number, lang)
|
|
42
|
+
else:
|
|
43
|
+
cfg.save_acive_option("1")
|
|
44
|
+
bs.clear_screen()
|
|
45
|
+
pm.printmenu(lang, version)
|
|
46
|
+
|
|
47
|
+
elif choice == "2":
|
|
48
|
+
print(i18n.get("pls.provide.even.odd.main"))
|
|
49
|
+
|
|
50
|
+
if sk == 1:
|
|
51
|
+
number = float(input(i18n.get("pls.num.inp.main")))
|
|
52
|
+
cfg.save_acive_option("0")
|
|
53
|
+
eo.check(number, lang)
|
|
54
|
+
else:
|
|
55
|
+
cfg.save_acive_option("2")
|
|
56
|
+
bs.clear_screen()
|
|
57
|
+
pm.printmenu(lang, version)
|
|
58
|
+
|
|
59
|
+
elif choice == "3":
|
|
60
|
+
print(i18n.get("pls.provide.grade.main"))
|
|
61
|
+
|
|
62
|
+
if sk == 1:
|
|
63
|
+
score = float(input(i18n.get("pls.score.inp.main")))
|
|
64
|
+
cfg.save_acive_option("0")
|
|
65
|
+
gr.check(score, lang)
|
|
66
|
+
else:
|
|
67
|
+
cfg.save_acive_option("3")
|
|
68
|
+
bs.clear_screen()
|
|
69
|
+
pm.printmenu(lang, version)
|
|
70
|
+
|
|
71
|
+
elif choice == "4":
|
|
72
|
+
print(i18n.get("choose.basic.calc.main"))
|
|
73
|
+
|
|
74
|
+
if sk == 1:
|
|
75
|
+
cfg.save_acive_option("0")
|
|
76
|
+
basic.calc(lang)
|
|
77
|
+
else:
|
|
78
|
+
cfg.save_acive_option("4")
|
|
79
|
+
bs.clear_screen()
|
|
80
|
+
pm.printmenu(lang, version)
|
|
81
|
+
|
|
82
|
+
elif choice == "5":
|
|
83
|
+
print(i18n.get("choose.surface.calc.main"))
|
|
84
|
+
|
|
85
|
+
if sk == 1:
|
|
86
|
+
cfg.save_acive_option("0")
|
|
87
|
+
su.run(lang)
|
|
88
|
+
else:
|
|
89
|
+
cfg.save_acive_option("5")
|
|
90
|
+
bs.clear_screen()
|
|
91
|
+
pm.printmenu(lang, version)
|
|
92
|
+
|
|
93
|
+
elif choice == "Q" or choice == "q":
|
|
94
|
+
print(i18n.get("exit.msg"))
|
|
95
|
+
time.sleep(2)
|
|
96
|
+
basic.clear_screen()
|
|
97
|
+
exit()
|
|
98
|
+
|
|
99
|
+
elif choice == "DEBUG" or choice == "debug":
|
|
100
|
+
print(i18n.get("debug.msg"))
|
|
101
|
+
su.run()
|
|
102
|
+
|
|
103
|
+
elif choice == "SET" or choice == "set":
|
|
104
|
+
st.run(lang)
|
|
105
|
+
|
|
106
|
+
elif choice == "RES" or choice == "res":
|
|
107
|
+
st.restart_app()
|
|
108
|
+
|
|
109
|
+
else:
|
|
110
|
+
print("")
|
|
111
|
+
while True:
|
|
112
|
+
if cfg.load_active_option() == "0":
|
|
113
|
+
bs.clear_screen()
|
|
114
|
+
pm.printmenu(lang, version)
|
|
115
|
+
choice = Prompt.ask(f"[#1E3A8A]{i18n.get('input.choice.msg')}[/#1E3A8A]")
|
|
116
|
+
pick(choice, 0)
|
|
117
|
+
elif cfg.load_active_option() == "1":
|
|
118
|
+
pick("1", 1)
|
|
119
|
+
elif cfg.load_active_option() == "2":
|
|
120
|
+
pick("2", 1)
|
|
121
|
+
elif cfg.load_active_option() == "3":
|
|
122
|
+
pick("3", 1)
|
|
123
|
+
elif cfg.load_active_option() == "4":
|
|
124
|
+
pick("4", 1)
|
|
125
|
+
elif cfg.load_active_option() == "5":
|
|
126
|
+
pick("5", 1)
|
|
File without changes
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import time
|
|
3
|
+
from simpleeval import simple_eval
|
|
4
|
+
from rich.console import Console
|
|
5
|
+
from . import basic as bs
|
|
6
|
+
from .i18n import I18n
|
|
7
|
+
|
|
8
|
+
console = Console()
|
|
9
|
+
|
|
10
|
+
def clear_screen():
|
|
11
|
+
os.system('cls' if os.name == 'nt' else 'clear')
|
|
12
|
+
|
|
13
|
+
clear_screen()
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def shell(language):
|
|
17
|
+
i18n = I18n(language)
|
|
18
|
+
while True:
|
|
19
|
+
expresion = console.input(f"[bold #2563EB]BasicCalc> [/bold #2563EB]")# prompt.shell
|
|
20
|
+
if expresion.lower() == 'exit':
|
|
21
|
+
print(i18n.get('exit.msg.shell'))#exit.msg.shell
|
|
22
|
+
print(i18n.get('exit.msg'))#exit.msg
|
|
23
|
+
exit()
|
|
24
|
+
elif expresion.lower() == "help":
|
|
25
|
+
print(i18n.get("help.msg.calc"))#help.msg.calc
|
|
26
|
+
console.print(f"[bold #1E3A8A]{i18n.get('exit')}[/bold #1E3A8A] {i18n.get('help.msg.exit')}")
|
|
27
|
+
console.print(f"[bold #1E3A8A]{i18n.get('clear')}[/bold #1E3A8A] {i18n.get('help.msg.clear')}")
|
|
28
|
+
console.print(f"[bold #1E3A8A]{i18n.get('back')}[/bold #1E3A8A] {i18n.get('help.msg.back')}")
|
|
29
|
+
console.print(f"[bold #1E3A8A]{i18n.get('help')}[/bold #1E3A8A] {i18n.get('help.msg.help')}")
|
|
30
|
+
|
|
31
|
+
elif expresion.strip() == "":
|
|
32
|
+
continue # Ignore empty input
|
|
33
|
+
elif expresion.lower() == "clear":
|
|
34
|
+
clear_screen()
|
|
35
|
+
elif expresion.lower() == "back":
|
|
36
|
+
print(i18n.get("back.msg.shell"))#back.msg.shell
|
|
37
|
+
bs.restart_app()
|
|
38
|
+
elif expresion.lower() == "ai":
|
|
39
|
+
print(i18n.get("ai.msg.shell"))#ai.msg.shell
|
|
40
|
+
|
|
41
|
+
else:
|
|
42
|
+
try:
|
|
43
|
+
result = simple_eval(expresion)
|
|
44
|
+
print(f"Result: {result}")
|
|
45
|
+
except Exception as e:
|
|
46
|
+
print(f"{i18n.get('error')} {e}. {i18n.get('error.msg.shell')}.")#error, #error.msg.shell
|
|
47
|
+
|
|
48
|
+
def calc(language):
|
|
49
|
+
i18n = I18n(language)
|
|
50
|
+
clear_screen()
|
|
51
|
+
print (i18n.get("welcome.msg.shell"))#welcome.msg.shell
|
|
52
|
+
print (i18n.get("welcome.msg.shell2"))#welcome.msg.shell2
|
|
53
|
+
shell(language)
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
# AllCalc config v používateľskom home
|
|
5
|
+
CONFIG_DIR = Path.home() / ".allcalc"
|
|
6
|
+
config_path = CONFIG_DIR / "config.json"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def ensure_config():
|
|
10
|
+
CONFIG_DIR.mkdir(parents=True, exist_ok=True)
|
|
11
|
+
|
|
12
|
+
if not config_path.exists():
|
|
13
|
+
with open(config_path, "w", encoding="utf-8") as file:
|
|
14
|
+
json.dump(
|
|
15
|
+
{
|
|
16
|
+
"language": "en",
|
|
17
|
+
"active_option": "0",
|
|
18
|
+
"new": "1"
|
|
19
|
+
},
|
|
20
|
+
file,
|
|
21
|
+
indent=4
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def load_language():
|
|
26
|
+
ensure_config()
|
|
27
|
+
|
|
28
|
+
with open(config_path, "r", encoding="utf-8") as file:
|
|
29
|
+
config = json.load(file)
|
|
30
|
+
|
|
31
|
+
return config.get("language", "en")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def edit_language(lang):
|
|
35
|
+
ensure_config()
|
|
36
|
+
|
|
37
|
+
with open(config_path, "r", encoding="utf-8") as file:
|
|
38
|
+
config = json.load(file)
|
|
39
|
+
|
|
40
|
+
config["language"] = lang
|
|
41
|
+
|
|
42
|
+
with open(config_path, "w", encoding="utf-8") as file:
|
|
43
|
+
json.dump(config, file, indent=4)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def load_active_option():
|
|
47
|
+
ensure_config()
|
|
48
|
+
|
|
49
|
+
with open(config_path, "r", encoding="utf-8") as file:
|
|
50
|
+
config = json.load(file)
|
|
51
|
+
|
|
52
|
+
return config.get("active_option", "0")
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def save_acive_option(option):
|
|
56
|
+
ensure_config()
|
|
57
|
+
|
|
58
|
+
with open(config_path, "r", encoding="utf-8") as file:
|
|
59
|
+
config = json.load(file)
|
|
60
|
+
|
|
61
|
+
config["active_option"] = option
|
|
62
|
+
|
|
63
|
+
with open(config_path, "w", encoding="utf-8") as file:
|
|
64
|
+
json.dump(config, file, indent=4)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def delete_active_option():
|
|
68
|
+
ensure_config()
|
|
69
|
+
|
|
70
|
+
with open(config_path, "r", encoding="utf-8") as file:
|
|
71
|
+
config = json.load(file)
|
|
72
|
+
|
|
73
|
+
if "active_option" in config:
|
|
74
|
+
del config["active_option"]
|
|
75
|
+
|
|
76
|
+
with open(config_path, "w", encoding="utf-8") as file:
|
|
77
|
+
json.dump(config, file, indent=4)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def new_user_check():
|
|
81
|
+
ensure_config()
|
|
82
|
+
|
|
83
|
+
with open(config_path, "r", encoding="utf-8") as file:
|
|
84
|
+
config = json.load(file)
|
|
85
|
+
|
|
86
|
+
return config.get("new", "1")
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def edit_new(option):
|
|
90
|
+
ensure_config()
|
|
91
|
+
|
|
92
|
+
with open(config_path, "r", encoding="utf-8") as file:
|
|
93
|
+
config = json.load(file)
|
|
94
|
+
|
|
95
|
+
config["new"] = option
|
|
96
|
+
|
|
97
|
+
with open(config_path, "w", encoding="utf-8") as file:
|
|
98
|
+
json.dump(config, file, indent=4)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from .i18n import I18n
|
|
2
|
+
"""
|
|
3
|
+
This script check if inputed number is even or odd
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
def check(number, language):
|
|
7
|
+
|
|
8
|
+
i18n = I18n(language)
|
|
9
|
+
work = (number/2)
|
|
10
|
+
|
|
11
|
+
if number.is_integer() and work.is_integer():
|
|
12
|
+
print (f"{i18n.get('number')} {number} {i18n.get('is.even')}")
|
|
13
|
+
return
|
|
14
|
+
else:
|
|
15
|
+
print (f"{i18n.get('number')} {number} {i18n.get('is.odd')}")
|
|
16
|
+
return
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from .i18n import I18n
|
|
2
|
+
def check (score, language ):
|
|
3
|
+
i18n = I18n(language)
|
|
4
|
+
if score >= 90:
|
|
5
|
+
grade = i18n.get("grade.exel")
|
|
6
|
+
elif score >= 75:
|
|
7
|
+
grade = i18n.get("grade.very.good")
|
|
8
|
+
elif score >= 50:
|
|
9
|
+
grade = i18n.get("grade.good")
|
|
10
|
+
elif score >= 0:
|
|
11
|
+
grade = i18n.get("grade.faild")
|
|
12
|
+
else:
|
|
13
|
+
grade = i18n.get("grade.invalid")
|
|
14
|
+
print (f"{i18n.get('grade.score')} {score} {i18n.get('grade.is')} {grade}")#SCORE = grade.score IS = grade.is
|
|
15
|
+
return
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#Note this code is AI generated and may contain errors. Please review it carefully before using it in production. i will make my own in future but this is just wotking placeholder so please don hate on me THANKS >
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class I18n:
|
|
8
|
+
def __init__(self, language="sk"):
|
|
9
|
+
self.language = language
|
|
10
|
+
self.translations = {}
|
|
11
|
+
self.load()
|
|
12
|
+
|
|
13
|
+
def load(self):
|
|
14
|
+
path = Path(__file__).parent / "language" / f"{self.language}.json"
|
|
15
|
+
|
|
16
|
+
with open(path, "r", encoding="utf-8") as file:
|
|
17
|
+
self.translations = json.load(file)
|
|
18
|
+
|
|
19
|
+
def get(self, key, **kwargs):
|
|
20
|
+
text = self.translations.get(key, key)
|
|
21
|
+
|
|
22
|
+
if kwargs:
|
|
23
|
+
text = text.format(**kwargs)
|
|
24
|
+
|
|
25
|
+
return text
|
|
26
|
+
def getalllang(self):
|
|
27
|
+
path = Path(__file__).parent / "language"
|
|
28
|
+
return [file.stem for file in path.glob("*.json")]
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"textonpick.main": "Wählen Sie aus, was Sie berechnen möchten:",
|
|
3
|
+
"1.main.pick": "1. Prüfen, ob eine Zahl positiv, negativ oder null ist",
|
|
4
|
+
"2.main.pick": "2. Prüfen, ob eine Zahl gerade oder ungerade ist",
|
|
5
|
+
"3.main.pick": "3. Note überprüfen",
|
|
6
|
+
"4.main.pick": "4. BasicCalc-Shell",
|
|
7
|
+
"5.main.pick": "5. Oberflächenrechner",
|
|
8
|
+
"set.main.pick": "SET. Einstellungen",
|
|
9
|
+
"quit.main.pick": "Q. Programm beenden",
|
|
10
|
+
"pls.provide.pos.neg.main": "Sie haben die Prüfung einer positiven/negativen Zahl ausgewählt. Bitte geben Sie eine Zahl ein",
|
|
11
|
+
"pls.num.inp.main": "Geben Sie eine Zahl ein: ",
|
|
12
|
+
"pls.provide.even.odd.main": "Sie haben die Prüfung einer geraden/ungeraden Zahl ausgewählt. Bitte geben Sie eine Zahl ein",
|
|
13
|
+
"pls.provide.grade.main": "Sie haben die Notenprüfung ausgewählt. Bitte geben Sie Ihre Punktzahl ein",
|
|
14
|
+
"pls.score.inp.main": "Geben Sie Ihre Punktzahl ein: ",
|
|
15
|
+
"choose.basic.calc.main": "Sie haben den einfachen Taschenrechner ausgewählt",
|
|
16
|
+
"choose.surface.calc.main": "Sie haben den Oberflächenrechner ausgewählt",
|
|
17
|
+
"exit.msg": "Auf Wiedersehen! Einen schönen Tag noch!",
|
|
18
|
+
"debug.msg": "Debug-Modus aktiviert.",
|
|
19
|
+
"invalid.choice.msg": "Ungültige Auswahl. Bitte wählen Sie 1, 2 oder 3.",
|
|
20
|
+
"input.choice.msg": "Geben Sie Ihre Auswahl ein",
|
|
21
|
+
"is.even": "ist eine gerade Zahl",
|
|
22
|
+
"is.odd": "ist eine ungerade Zahl",
|
|
23
|
+
"number": "Zahl",
|
|
24
|
+
"grade.exel": "Ausgezeichnet",
|
|
25
|
+
"grade.very.good": "Sehr gut",
|
|
26
|
+
"grade.good": "Gut",
|
|
27
|
+
"grade.faild": "Nicht bestanden",
|
|
28
|
+
"grade.invalid": "Die Punktzahl liegt außerhalb des gültigen Bereichs",
|
|
29
|
+
"grade.score": "Punktzahl",
|
|
30
|
+
"grade.is": "Ist",
|
|
31
|
+
"pls.pick.settings.main": "Wählen Sie aus, was Sie bearbeiten möchten",
|
|
32
|
+
"language.settings": "Sprache",
|
|
33
|
+
"enter.choice.settings": "Geben Sie Ihre Auswahl ein: ",
|
|
34
|
+
"enter.lang.settings": "Geben Sie die Sprache ein, zu der Sie wechseln möchten: ",
|
|
35
|
+
"ave.lang.settings": "Verfügbare Sprachen sind: ",
|
|
36
|
+
"positive.negposcheck": "ist eine positive Zahl",
|
|
37
|
+
"negative.negposcheck": "ist eine negative Zahl",
|
|
38
|
+
"zero.negposcheck": "ist null",
|
|
39
|
+
"y.have.select": "Sie haben ",
|
|
40
|
+
"pls.enter.length": "Geben Sie die Seitenlänge ein ",
|
|
41
|
+
"pls.enter.radius": "Geben Sie den Radius ein ",
|
|
42
|
+
"pls.enter.height": "Geben Sie die Höhe ein ",
|
|
43
|
+
"is": "ist",
|
|
44
|
+
"ans.cube.surface": "Oberfläche des Würfels mit der Seitenlänge ",
|
|
45
|
+
"ans.cuboid.surface": "Oberfläche des Quaders mit den Seitenlängen ",
|
|
46
|
+
"ans.sphere.surface": "Oberfläche der Kugel mit dem Radius ",
|
|
47
|
+
"ans.cylinder.surface": "Oberfläche des Zylinders mit dem Radius ",
|
|
48
|
+
"a.height": "und der Höhe",
|
|
49
|
+
"cube": "Würfel",
|
|
50
|
+
"cuboid": "Quader",
|
|
51
|
+
"sphere": "Kugel",
|
|
52
|
+
"cylinder": "Zylinder",
|
|
53
|
+
"pls.select.shape": "Wählen Sie eine Form: ",
|
|
54
|
+
"pls.enter.unit": "Geben Sie die Einheit ein (cm/mm/m): ",
|
|
55
|
+
"text.msg.shell": "Die BasicCalc-Shell ermöglicht Ihnen die Durchführung grundlegender Berechnungen.",
|
|
56
|
+
"help.msg.calc": "Die BasicCalc-Shell ermöglicht Ihnen die Durchführung grundlegender Berechnungen.",
|
|
57
|
+
"help.msg.exit": "zum Beenden der Shell.",
|
|
58
|
+
"help.msg.clear": "zum Leeren des Bildschirms.",
|
|
59
|
+
"help.msg.back": "zur Rückkehr zum Hauptmenü.",
|
|
60
|
+
"help.msg.help": "um diese Nachricht erneut anzuzeigen.",
|
|
61
|
+
"exit": "Beenden",
|
|
62
|
+
"clear": "Löschen",
|
|
63
|
+
"back": "Zurück",
|
|
64
|
+
"help": "Hilfe",
|
|
65
|
+
"error": "Fehler: ",
|
|
66
|
+
"back.msg.shell": "Rückkehr zum Hauptmenü.",
|
|
67
|
+
"ai.msg.shell": "In diesem Projekt wird keine KI verwendet und das wird auch so bleiben :) KI-Funktionen kommen jedoch bald.",
|
|
68
|
+
"error.msg.shell": "Bitte geben Sie einen gültigen mathematischen Ausdruck ein.",
|
|
69
|
+
"welcome.msg.shell": "Willkommen in der BasicCalc-Shell",
|
|
70
|
+
"welcome.msg.shell2": "Für Hilfe geben Sie help ein und zum Beenden exit",
|
|
71
|
+
"exit.msg.shell": "BasicCalc-Shell wird beendet.",
|
|
72
|
+
"help.msg.shell": "Die BasicCalc-Shell ermöglicht Ihnen die Durchführung grundlegender Berechnungen.",
|
|
73
|
+
"welcome.new": "Willkommen bei AllCalc",
|
|
74
|
+
"new.msg.1": "Diese Ersteinrichtung führt dich durch einige Grundeinstellungen!",
|
|
75
|
+
"press.setup.new": "Drücke Enter, um die Einrichtung zu starten.",
|
|
76
|
+
"gtg.new": "OK, dann kannst du AllCalc jetzt verwenden :)",
|
|
77
|
+
"press.start.new": "Drücke Enter, um AllCalc zu starten."
|
|
78
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"textonpick.main": "Please choose what you want to calculate:",
|
|
3
|
+
"1.main.pick": "1. Check if a number is positive, negative or zero",
|
|
4
|
+
"2.main.pick": "2. Check if a number is even or odd",
|
|
5
|
+
"3.main.pick": "3. Check your grade",
|
|
6
|
+
"4.main.pick": "4. Basic calculator shell",
|
|
7
|
+
"5.main.pick": "5. Surface calculator",
|
|
8
|
+
"set.main.pick": "SET. Settings",
|
|
9
|
+
"quit.main.pick": "Q. Exit program",
|
|
10
|
+
"pls.provide.pos.neg.main": "You have selected the positive/negative number check. Please enter a number",
|
|
11
|
+
"pls.num.inp.main": "Enter a number: ",
|
|
12
|
+
"pls.provide.even.odd.main": "You have selected the even/odd check. Please enter a number",
|
|
13
|
+
"pls.provide.grade.main": "You have selected the grade check. Please enter your score",
|
|
14
|
+
"pls.score.inp.main": "Enter your score: ",
|
|
15
|
+
"choose.basic.calc.main": "You have selected the basic calculator",
|
|
16
|
+
"choose.surface.calc.main": "You have selected the surface calculator",
|
|
17
|
+
"exit.msg": "Goodbye! Have a nice day!",
|
|
18
|
+
"debug.msg": "Debug mode enabled.",
|
|
19
|
+
"invalid.choice.msg": "Invalid choice. Please choose 1, 2 or 3.",
|
|
20
|
+
"input.choice.msg": "Enter your choice",
|
|
21
|
+
"is.even": "is an even number",
|
|
22
|
+
"is.odd": "is an odd number",
|
|
23
|
+
"number": "number",
|
|
24
|
+
"grade.exel": "Excellent",
|
|
25
|
+
"grade.very.good": "Very good",
|
|
26
|
+
"grade.good": "Good",
|
|
27
|
+
"grade.faild": "Failed",
|
|
28
|
+
"grade.invalid": "The score is outside the valid range",
|
|
29
|
+
"grade.score": "Score",
|
|
30
|
+
"grade.is": "Is",
|
|
31
|
+
"pls.pick.settings.main": "Choose what you want to edit",
|
|
32
|
+
"language.settings": "Language",
|
|
33
|
+
"enter.choice.settings": "Enter your choice: ",
|
|
34
|
+
"enter.lang.settings": "Enter the language you want to switch to: ",
|
|
35
|
+
"ave.lang.settings": "Available languages are: ",
|
|
36
|
+
"positive.negposcheck": "is a positive number",
|
|
37
|
+
"negative.negposcheck": "is a negative number",
|
|
38
|
+
"zero.negposcheck": "is zero",
|
|
39
|
+
"y.have.select": "You have selected ",
|
|
40
|
+
"pls.enter.length": "Enter the side length ",
|
|
41
|
+
"pls.enter.radius": "Enter the radius ",
|
|
42
|
+
"pls.enter.height": "Enter the height ",
|
|
43
|
+
"is": "is",
|
|
44
|
+
"ans.cube.surface": "Surface area of the cube with side length ",
|
|
45
|
+
"ans.cuboid.surface": "Surface area of the cuboid with side lengths ",
|
|
46
|
+
"ans.sphere.surface": "Surface area of the sphere with radius ",
|
|
47
|
+
"ans.cylinder.surface": "Surface area of the cylinder with radius ",
|
|
48
|
+
"a.height": "and height",
|
|
49
|
+
"cube": "cube",
|
|
50
|
+
"cuboid": "cuboid",
|
|
51
|
+
"sphere": "sphere",
|
|
52
|
+
"cylinder": "cylinder",
|
|
53
|
+
"pls.select.shape": "Select a shape: ",
|
|
54
|
+
"pls.enter.unit": "Enter the unit (cm/mm/m): ",
|
|
55
|
+
"text.msg.shell": "BasicCalc shell allows you to perform basic calculations.",
|
|
56
|
+
"help.msg.calc": "BasicCalc shell allows you to perform basic calculations.",
|
|
57
|
+
"help.msg.exit": "to exit the shell.",
|
|
58
|
+
"help.msg.clear": "to clear the screen.",
|
|
59
|
+
"help.msg.back": "to return to the main menu.",
|
|
60
|
+
"help.msg.help": "to see this message again.",
|
|
61
|
+
"exit": "Exit",
|
|
62
|
+
"clear": "Clear",
|
|
63
|
+
"back": "Back",
|
|
64
|
+
"help": "Help",
|
|
65
|
+
"error": "Error: ",
|
|
66
|
+
"back.msg.shell": "Returning to main menu.",
|
|
67
|
+
"ai.msg.shell": "No AI is used in this project and none will be :) But AI features are coming soon.",
|
|
68
|
+
"error.msg.shell": "Please enter a valid mathematical expression.",
|
|
69
|
+
"welcome.msg.shell": "Welcome to BasicCalc shell",
|
|
70
|
+
"welcome.msg.shell2": "For help type help and for exit type exit",
|
|
71
|
+
"exit.msg.shell": "Exiting BasicCalc shell.",
|
|
72
|
+
"help.msg.shell": "BasicCalc shell allows you to perform basic calculations.",
|
|
73
|
+
"welcome.new": "Welcome to AllCalc",
|
|
74
|
+
"new.msg.1": "This initial setup will guide you through some setup!",
|
|
75
|
+
"press.setup.new": "Press enter to start setup.",
|
|
76
|
+
"gtg.new": "OK, so you're good to go and use AllCalc :)",
|
|
77
|
+
"press.start.new": "Press enter to start AllCalc."
|
|
78
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"textonpick.main": "Vyberte, čo chcete vypočítať:",
|
|
3
|
+
"1.main.pick": "1. Zistiť, či je číslo kladné, záporné alebo nula",
|
|
4
|
+
"2.main.pick": "2. Zistiť, či je číslo párne alebo nepárne",
|
|
5
|
+
"3.main.pick": "3. Skontrolovať známku",
|
|
6
|
+
"4.main.pick": "4. Shell základnej kalkulačky",
|
|
7
|
+
"5.main.pick": "5. Kalkulačka povrchu",
|
|
8
|
+
"set.main.pick": "SET. Nastavenia",
|
|
9
|
+
"quit.main.pick": "Q. Ukončiť program",
|
|
10
|
+
"pls.provide.pos.neg.main": "Vybrali ste kontrolu kladného/záporného čísla. Zadajte číslo",
|
|
11
|
+
"pls.num.inp.main": "Zadajte číslo: ",
|
|
12
|
+
"pls.provide.even.odd.main": "Vybrali ste kontrolu párneho/nepárneho čísla. Zadajte číslo",
|
|
13
|
+
"pls.provide.grade.main": "Vybrali ste kontrolu známky. Zadajte svoje skóre",
|
|
14
|
+
"pls.score.inp.main": "Zadajte svoje skóre: ",
|
|
15
|
+
"choose.basic.calc.main": "Vybrali ste základnú kalkulačku",
|
|
16
|
+
"choose.surface.calc.main": "Vybrali ste kalkulačku povrchu",
|
|
17
|
+
"exit.msg": "Dovidenia! Prajem pekný deň!",
|
|
18
|
+
"debug.msg": "Režim ladenia bol povolený.",
|
|
19
|
+
"invalid.choice.msg": "Neplatná voľba. Vyberte 1, 2 alebo 3.",
|
|
20
|
+
"input.choice.msg": "Zadajte svoju voľbu",
|
|
21
|
+
"is.even": "je párne číslo",
|
|
22
|
+
"is.odd": "je nepárne číslo",
|
|
23
|
+
"number": "číslo",
|
|
24
|
+
"grade.exel": "Výborné",
|
|
25
|
+
"grade.very.good": "Veľmi dobré",
|
|
26
|
+
"grade.good": "Dobré",
|
|
27
|
+
"grade.faild": "Neúspešné",
|
|
28
|
+
"grade.invalid": "Skóre je mimo platného rozsahu",
|
|
29
|
+
"grade.score": "Skóre",
|
|
30
|
+
"grade.is": "Je",
|
|
31
|
+
"pls.pick.settings.main": "Vyberte, čo chcete upraviť",
|
|
32
|
+
"language.settings": "Jazyk",
|
|
33
|
+
"enter.choice.settings": "Zadajte svoju voľbu: ",
|
|
34
|
+
"enter.lang.settings": "Zadajte jazyk, na ktorý chcete prepnúť: ",
|
|
35
|
+
"ave.lang.settings": "Dostupné jazyky sú: ",
|
|
36
|
+
"positive.negposcheck": "je kladné číslo",
|
|
37
|
+
"negative.negposcheck": "je záporné číslo",
|
|
38
|
+
"zero.negposcheck": "je nula",
|
|
39
|
+
"y.have.select": "Vybrali ste ",
|
|
40
|
+
"pls.enter.length": "Zadajte dĺžku strany ",
|
|
41
|
+
"pls.enter.radius": "Zadajte polomer ",
|
|
42
|
+
"pls.enter.height": "Zadajte výšku ",
|
|
43
|
+
"is": "je",
|
|
44
|
+
"ans.cube.surface": "Povrch kocky so stranou dĺžky ",
|
|
45
|
+
"ans.cuboid.surface": "Povrch kvádra s dĺžkami strán ",
|
|
46
|
+
"ans.sphere.surface": "Povrch gule s polomerom ",
|
|
47
|
+
"ans.cylinder.surface": "Povrch valca s polomerom ",
|
|
48
|
+
"a.height": "a výškou",
|
|
49
|
+
"cube": "kocka",
|
|
50
|
+
"cuboid": "kváder",
|
|
51
|
+
"sphere": "guľa",
|
|
52
|
+
"cylinder": "valec",
|
|
53
|
+
"pls.select.shape": "Vyberte tvar: ",
|
|
54
|
+
"pls.enter.unit": "Zadajte jednotku (cm/mm/m): ",
|
|
55
|
+
"text.msg.shell": "Shell BasicCalc vám umožňuje vykonávať základné výpočty.",
|
|
56
|
+
"help.msg.calc": "Shell BasicCalc vám umožňuje vykonávať základné výpočty.",
|
|
57
|
+
"help.msg.exit": "na ukončenie shellu.",
|
|
58
|
+
"help.msg.clear": "na vyčistenie obrazovky.",
|
|
59
|
+
"help.msg.back": "na návrat do hlavnej ponuky.",
|
|
60
|
+
"help.msg.help": "na opätovné zobrazenie tejto správy.",
|
|
61
|
+
"exit": "Ukončiť",
|
|
62
|
+
"clear": "Vyčistiť",
|
|
63
|
+
"back": "Späť",
|
|
64
|
+
"help": "Pomoc",
|
|
65
|
+
"error": "Chyba: ",
|
|
66
|
+
"back.msg.shell": "Návrat do hlavnej ponuky.",
|
|
67
|
+
"ai.msg.shell": "V tomto projekte sa nepoužíva žiadna AI a ani nebude :) AI funkcie však čoskoro prídu.",
|
|
68
|
+
"error.msg.shell": "Zadajte platný matematický výraz.",
|
|
69
|
+
"welcome.msg.shell": "Vitajte v BasicCalc shelli",
|
|
70
|
+
"welcome.msg.shell2": "Pre pomoc zadajte help a pre ukončenie zadajte exit",
|
|
71
|
+
"exit.msg.shell": "Ukončujem BasicCalc shell.",
|
|
72
|
+
"help.msg.shell": "Shell BasicCalc vám umožňuje vykonávať základné výpočty.",
|
|
73
|
+
"welcome.new": "Vitaj v AllCalc",
|
|
74
|
+
"new.msg.1": "Toto úvodné nastavenie ťa prevedie základným nastavením!",
|
|
75
|
+
"press.setup.new": "Stlač Enter pre spustenie nastavenia.",
|
|
76
|
+
"gtg.new": "OK, takže AllCalc môžeš používať :)",
|
|
77
|
+
"press.start.new": "Stlač Enter pre spustenie AllCalc."
|
|
78
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from .i18n import I18n
|
|
2
|
+
|
|
3
|
+
def check (number, language):
|
|
4
|
+
i18n = I18n(language)
|
|
5
|
+
if number > 0:
|
|
6
|
+
print (f"{i18n.get('number')} {number} {i18n.get('positive.negposcheck')}")#Number= number
|
|
7
|
+
return
|
|
8
|
+
elif number < 0:
|
|
9
|
+
print (f"{i18n.get('number')} {number} {i18n.get('negative.negposcheck')} ")
|
|
10
|
+
return
|
|
11
|
+
elif number == 0:
|
|
12
|
+
print (f"{i18n.get('number')} {number} {i18n.get('zero.negposcheck')}")
|
|
13
|
+
return
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from . import settings as st
|
|
2
|
+
from .i18n import I18n as I18n
|
|
3
|
+
from . import basic as bs
|
|
4
|
+
from . import config as con
|
|
5
|
+
|
|
6
|
+
def nw(langg, v):
|
|
7
|
+
i18n = I18n(langg)
|
|
8
|
+
print(f"""
|
|
9
|
+
░███ ░██ ░██ ░██████ ░██ ░██ ░██████
|
|
10
|
+
░██░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██
|
|
11
|
+
░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██
|
|
12
|
+
░█████████ ░██ ░██ ░██ ░█████████ ░██ ░██
|
|
13
|
+
░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██
|
|
14
|
+
░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██
|
|
15
|
+
░██ ░██ ░████████ ░████████ ░██████ ░██ ░██ ░████████ ░██████
|
|
16
|
+
V {v}
|
|
17
|
+
By Denis Varga made with <3 and code in Python 3.11.4
|
|
18
|
+
|
|
19
|
+
""")
|
|
20
|
+
print(i18n.get("welcome.new"))
|
|
21
|
+
print (i18n.get("new.msg.1"))
|
|
22
|
+
input (i18n.get("press.setup.new"))
|
|
23
|
+
def finish():
|
|
24
|
+
print (i18n.get("gtg.new"))
|
|
25
|
+
input (i18n.get("press.start.new"))
|
|
26
|
+
con.edit_new("0")
|
|
27
|
+
bs.restart_app()
|
|
28
|
+
def pick(choice,):
|
|
29
|
+
if choice == "1":
|
|
30
|
+
print(i18n.get("ave.lang.settings"), i18n.getalllang())#ave.lang.settings
|
|
31
|
+
lang = input(i18n.get("enter.lang.settings"))#enter.lang.settings
|
|
32
|
+
con.edit_language(lang)
|
|
33
|
+
bs.clear_screen()
|
|
34
|
+
finish()
|
|
35
|
+
def prompt():
|
|
36
|
+
pick (input(i18n.get("enter.choice.settings")),)#enter.choice.settings
|
|
37
|
+
|
|
38
|
+
def run():
|
|
39
|
+
print(i18n.get("pls.pick.settings.main"))#pls.pick.settings.main
|
|
40
|
+
print("1. " + i18n.get("language.settings"))#language.settings
|
|
41
|
+
prompt()
|
|
42
|
+
run()
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from . import config as cfg
|
|
2
|
+
from .i18n import I18n
|
|
3
|
+
from rich.console import Console
|
|
4
|
+
|
|
5
|
+
console = Console()
|
|
6
|
+
|
|
7
|
+
def printmenu(language, v):
|
|
8
|
+
global i18n
|
|
9
|
+
i18n = I18n(language)
|
|
10
|
+
print(f"""
|
|
11
|
+
░███ ░██ ░██ ░██████ ░██ ░██ ░██████
|
|
12
|
+
░██░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██
|
|
13
|
+
░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██
|
|
14
|
+
░█████████ ░██ ░██ ░██ ░█████████ ░██ ░██
|
|
15
|
+
░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██
|
|
16
|
+
░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██
|
|
17
|
+
░██ ░██ ░████████ ░████████ ░██████ ░██ ░██ ░████████ ░██████
|
|
18
|
+
V {v}
|
|
19
|
+
By Denis Varga made with <3 and code in Python 3.11.4
|
|
20
|
+
|
|
21
|
+
""")
|
|
22
|
+
print (i18n.get("textonpick.main"))
|
|
23
|
+
if cfg.load_active_option() == "1":
|
|
24
|
+
console.print (f"[#1E3A8A]{i18n.get('1.main.pick')}[/#1E3A8A]")
|
|
25
|
+
else:
|
|
26
|
+
print (i18n.get("1.main.pick"))
|
|
27
|
+
if cfg.load_active_option() == "2":
|
|
28
|
+
console.print (f"[#1E3A8A]{i18n.get('2.main.pick')}[/#1E3A8A]")
|
|
29
|
+
else:
|
|
30
|
+
print (i18n.get("2.main.pick"))
|
|
31
|
+
if cfg.load_active_option() == "3":
|
|
32
|
+
console.print (f"[#1E3A8A]{i18n.get('3.main.pick')}[/#1E3A8A]")
|
|
33
|
+
else:
|
|
34
|
+
print (i18n.get("3.main.pick"))
|
|
35
|
+
if cfg.load_active_option() == "4":
|
|
36
|
+
console.print (f"[#1E3A8A]{i18n.get('4.main.pick')}[/#1E3A8A]")
|
|
37
|
+
else:
|
|
38
|
+
print (i18n.get("4.main.pick"))
|
|
39
|
+
if cfg.load_active_option() == "5":
|
|
40
|
+
console.print (f"[#1E3A8A]{i18n.get('5.main.pick')}[/#1E3A8A]")
|
|
41
|
+
else:
|
|
42
|
+
print (i18n.get("5.main.pick"))
|
|
43
|
+
print (i18n.get("set.main.pick"))
|
|
44
|
+
print (i18n.get("quit.main.pick"))
|
|
45
|
+
|
|
46
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
from .i18n import I18n
|
|
5
|
+
from . import config as con
|
|
6
|
+
|
|
7
|
+
def restart_app():
|
|
8
|
+
os.execl(sys.executable, sys.executable, *sys.argv)
|
|
9
|
+
def pick(choice, lang):
|
|
10
|
+
i18n = I18n(lang)
|
|
11
|
+
if choice == "1":
|
|
12
|
+
print(i18n.get("ave.lang.settings"), i18n.getalllang())#ave.lang.settings
|
|
13
|
+
lang = input(i18n.get("enter.lang.settings"))#enter.lang.settings
|
|
14
|
+
con.edit_language(lang)
|
|
15
|
+
restart_app()
|
|
16
|
+
def prompt(lang):
|
|
17
|
+
i18n = I18n(lang)
|
|
18
|
+
pick (input(i18n.get("enter.choice.settings")), lang)#enter.choice.settings
|
|
19
|
+
|
|
20
|
+
def run(langg):
|
|
21
|
+
i18n = I18n(langg)
|
|
22
|
+
print(i18n.get("pls.pick.settings.main"))#pls.pick.settings.main
|
|
23
|
+
print("1. " + i18n.get("language.settings"))#language.settings
|
|
24
|
+
prompt(langg)
|
|
25
|
+
|
|
26
|
+
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import math
|
|
2
|
+
from .i18n import I18n
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def cube(a):
|
|
7
|
+
work = a*a
|
|
8
|
+
return 6* work
|
|
9
|
+
|
|
10
|
+
def cuboid(a, b, c):
|
|
11
|
+
ab = (a*b)
|
|
12
|
+
ac = (a*c)
|
|
13
|
+
bc = (b*c)
|
|
14
|
+
return 2*(ab + ac + bc)
|
|
15
|
+
|
|
16
|
+
def sphere(radius):
|
|
17
|
+
|
|
18
|
+
surface = 4 * math.pi * radius ** 2
|
|
19
|
+
return surface
|
|
20
|
+
|
|
21
|
+
def cylinder(radius, height):
|
|
22
|
+
surface = 2 * math.pi * radius ** 2+2 * math.pi * radius * height
|
|
23
|
+
return surface
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def pick(shape, unit, language):
|
|
27
|
+
i18n = I18n(language)
|
|
28
|
+
if shape == 1:
|
|
29
|
+
print (f"{i18n.get('y.have.select')}{i18n.get('cube').lower()}")# y.have.select
|
|
30
|
+
a = float(input(f"{i18n.get('pls.enter.length')}a:"))
|
|
31
|
+
print(f"{i18n.get('ans.cube.surface')}a = {a} {unit} {i18n.get('is')} {cube(a)} {unit}²")
|
|
32
|
+
return
|
|
33
|
+
elif shape == 2:
|
|
34
|
+
print (f"{i18n.get('y.have.select')}{i18n.get('cuboid').lower()}")# y.have.select
|
|
35
|
+
a = float(input(f"{i18n.get('pls.enter.length')}a:"))
|
|
36
|
+
b = float(input(f"{i18n.get('pls.enter.length')}b:"))
|
|
37
|
+
c = float(input(f"{i18n.get('pls.enter.length')}c:"))
|
|
38
|
+
print(f"{i18n.get('ans.cuboid.surface')}a = {a} {unit}, b = {b} {unit}, c = {c} {unit} {i18n.get('is')} {cuboid(a, b, c)} {unit}²")
|
|
39
|
+
return
|
|
40
|
+
elif shape == 3:
|
|
41
|
+
r = (float(input(f"{i18n.get('pls.enter.radius')}{i18n.get('sphere').lower()}: ")))
|
|
42
|
+
print (f"{i18n.get('ans.sphere.surface')} = {r} {unit} {i18n.get('is')} {sphere(r)} {unit}²")
|
|
43
|
+
|
|
44
|
+
elif shape == 4:
|
|
45
|
+
r = (float(input(f"{i18n.get('pls.enter.radius')}{i18n.get('cylinder').lower()}: ")))
|
|
46
|
+
h = (float(input(f"{i18n.get('pls.enter.height')}{i18n.get('cylinder').lower()}: ")))
|
|
47
|
+
print (f"{i18n.get('ans.cylinder.surface')} = {r} {unit} {i18n.get('a.height')} = {h} {unit} {i18n.get('is')} {cylinder(r, h)} {unit}²")
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def run(language):
|
|
52
|
+
i18n = I18n(language)
|
|
53
|
+
print (f"1. {i18n.get('cube')}")
|
|
54
|
+
print (f"2. {i18n.get('cuboid')}")
|
|
55
|
+
print (f"3. {i18n.get('sphere')}")
|
|
56
|
+
print (f"4. {i18n.get('cylinder')}")
|
|
57
|
+
shap = int(input(f"{i18n.get('pls.select.shape')}"))
|
|
58
|
+
uni = input(f"{i18n.get('pls.enter.unit')}")
|
|
59
|
+
pick(shap, uni, language)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77", "wheel", "build"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "allcalc"
|
|
7
|
+
version = "4.1.0"
|
|
8
|
+
description = "A simple CLI calculator with multiple math tools"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Denis Varga", email = "mail@denisvarga.eu" }
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
license = { file = "LICENSE" }
|
|
17
|
+
|
|
18
|
+
dependencies = [
|
|
19
|
+
"rich",
|
|
20
|
+
"simpleeval"
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[project.scripts]
|
|
24
|
+
allcalc = "app:main"
|
|
25
|
+
|
|
26
|
+
[tool.setuptools]
|
|
27
|
+
py-modules = ["app"]
|
|
28
|
+
|
|
29
|
+
[tool.setuptools.packages.find]
|
|
30
|
+
include = ["modules*"]
|
|
31
|
+
|
|
32
|
+
[tool.setuptools.package-data]
|
|
33
|
+
modules = [
|
|
34
|
+
"language/*.json"
|
|
35
|
+
]
|
allcalc-4.1.0/setup.cfg
ADDED