corally 1.0.0__py3-none-any.whl
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.
- corally/__init__.py +36 -0
- corally/api/__init__.py +8 -0
- corally/api/free_server.py +259 -0
- corally/api/server.py +190 -0
- corally/cli/__init__.py +9 -0
- corally/cli/calculator.py +59 -0
- corally/cli/currency.py +65 -0
- corally/cli/main.py +208 -0
- corally/core/__init__.py +7 -0
- corally/core/calculator.py +392 -0
- corally/gui/__init__.py +8 -0
- corally/gui/launcher.py +138 -0
- corally/gui/main.py +886 -0
- corally-1.0.0.dist-info/METADATA +192 -0
- corally-1.0.0.dist-info/RECORD +19 -0
- corally-1.0.0.dist-info/WHEEL +5 -0
- corally-1.0.0.dist-info/entry_points.txt +5 -0
- corally-1.0.0.dist-info/licenses/LICENSE +21 -0
- corally-1.0.0.dist-info/top_level.txt +1 -0
corally/gui/launcher.py
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
GUI Launcher for Calculator Suite
|
4
|
+
Modern replacement for Hauptprogramm.py
|
5
|
+
"""
|
6
|
+
|
7
|
+
import tkinter as tk
|
8
|
+
from tkinter import messagebox
|
9
|
+
import sys
|
10
|
+
import os
|
11
|
+
|
12
|
+
def check_dependencies():
|
13
|
+
"""Check if all required dependencies are available"""
|
14
|
+
missing_deps = []
|
15
|
+
|
16
|
+
try:
|
17
|
+
import requests # noqa: F401
|
18
|
+
except ImportError:
|
19
|
+
missing_deps.append("requests")
|
20
|
+
|
21
|
+
try:
|
22
|
+
import uvicorn # noqa: F401
|
23
|
+
except ImportError:
|
24
|
+
missing_deps.append("uvicorn")
|
25
|
+
|
26
|
+
try:
|
27
|
+
import fastapi # noqa: F401
|
28
|
+
except ImportError:
|
29
|
+
missing_deps.append("fastapi")
|
30
|
+
|
31
|
+
try:
|
32
|
+
import httpx # noqa: F401
|
33
|
+
except ImportError:
|
34
|
+
missing_deps.append("httpx")
|
35
|
+
|
36
|
+
try:
|
37
|
+
import dotenv # noqa: F401
|
38
|
+
except ImportError:
|
39
|
+
missing_deps.append("python-dotenv")
|
40
|
+
|
41
|
+
if missing_deps:
|
42
|
+
root = tk.Tk()
|
43
|
+
root.withdraw() # Hide the main window
|
44
|
+
|
45
|
+
deps_str = ", ".join(missing_deps)
|
46
|
+
message = f"""Missing dependencies: {deps_str}
|
47
|
+
|
48
|
+
To install them, run:
|
49
|
+
pip install {" ".join(missing_deps)}
|
50
|
+
|
51
|
+
Would you like to continue anyway?
|
52
|
+
(Some features may not work)"""
|
53
|
+
|
54
|
+
result = messagebox.askyesno("Missing Dependencies", message)
|
55
|
+
root.destroy()
|
56
|
+
|
57
|
+
if not result:
|
58
|
+
sys.exit(1)
|
59
|
+
|
60
|
+
def main():
|
61
|
+
"""Main function to launch the calculator GUI"""
|
62
|
+
# Check dependencies first
|
63
|
+
check_dependencies()
|
64
|
+
|
65
|
+
# Check if required files exist
|
66
|
+
required_files = ["calculator_core.py", "api.py"]
|
67
|
+
missing_files = []
|
68
|
+
|
69
|
+
for file in required_files:
|
70
|
+
if not os.path.exists(file):
|
71
|
+
missing_files.append(file)
|
72
|
+
|
73
|
+
if missing_files:
|
74
|
+
root = tk.Tk()
|
75
|
+
root.withdraw()
|
76
|
+
|
77
|
+
files_str = ", ".join(missing_files)
|
78
|
+
messagebox.showerror("Missing Files",
|
79
|
+
f"Required files not found: {files_str}\n\n"
|
80
|
+
f"Please make sure all calculator files are in the same directory.")
|
81
|
+
root.destroy()
|
82
|
+
sys.exit(1)
|
83
|
+
|
84
|
+
# Import and launch the GUI
|
85
|
+
try:
|
86
|
+
from .main import ModernCalculatorGUI
|
87
|
+
|
88
|
+
root = tk.Tk()
|
89
|
+
app = ModernCalculatorGUI(root)
|
90
|
+
|
91
|
+
# Handle window closing
|
92
|
+
def on_closing():
|
93
|
+
if hasattr(app, 'api_server_running') and app.api_server_running:
|
94
|
+
app.stop_api_server()
|
95
|
+
root.destroy()
|
96
|
+
|
97
|
+
root.protocol("WM_DELETE_WINDOW", on_closing)
|
98
|
+
|
99
|
+
# Center the window
|
100
|
+
root.update_idletasks()
|
101
|
+
width = root.winfo_width()
|
102
|
+
height = root.winfo_height()
|
103
|
+
x = (root.winfo_screenwidth() // 2) - (width // 2)
|
104
|
+
y = (root.winfo_screenheight() // 2) - (height // 2)
|
105
|
+
root.geometry(f"{width}x{height}+{x}+{y}")
|
106
|
+
|
107
|
+
print("š Calculator Suite GUI launched successfully!")
|
108
|
+
print("š Features available:")
|
109
|
+
print(" ⢠Basic Calculator with logging")
|
110
|
+
print(" ⢠Currency Converter (static rates)")
|
111
|
+
print(" ⢠Interest Calculator")
|
112
|
+
print(" ⢠Live Currency API (requires API key)")
|
113
|
+
print("\nš” Tip: For live currency conversion, make sure you have a valid API key in your .env file")
|
114
|
+
|
115
|
+
root.mainloop()
|
116
|
+
|
117
|
+
except ImportError as e:
|
118
|
+
root = tk.Tk()
|
119
|
+
root.withdraw()
|
120
|
+
messagebox.showerror("Import Error",
|
121
|
+
f"Failed to import calculator GUI: {str(e)}\n\n"
|
122
|
+
f"Please make sure the corally package is properly installed.")
|
123
|
+
root.destroy()
|
124
|
+
sys.exit(1)
|
125
|
+
except Exception as e:
|
126
|
+
root = tk.Tk()
|
127
|
+
root.withdraw()
|
128
|
+
messagebox.showerror("Error", f"Failed to launch GUI: {str(e)}")
|
129
|
+
root.destroy()
|
130
|
+
sys.exit(1)
|
131
|
+
|
132
|
+
def launch_gui():
|
133
|
+
"""Launch the GUI application."""
|
134
|
+
main()
|
135
|
+
|
136
|
+
|
137
|
+
if __name__ == "__main__":
|
138
|
+
main()
|