crystalwindow 4.0__tar.gz → 4.2__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.
- {crystalwindow-4.0/crystalwindow.egg-info → crystalwindow-4.2}/PKG-INFO +1 -1
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/__init__.py +4 -4
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/ai.py +76 -17
- {crystalwindow-4.0 → crystalwindow-4.2/crystalwindow.egg-info}/PKG-INFO +1 -1
- {crystalwindow-4.0 → crystalwindow-4.2}/setup.py +1 -1
- {crystalwindow-4.0 → crystalwindow-4.2}/LICENSE +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/MANIFEST.in +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/README.md +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/FileHelper.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/Icons/default_icon.png +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/animation.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/assets.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/camera.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/clock.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/collision.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/color_handler.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/crystal3d.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/docs/getting_started.md +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/docs/index.md +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/draw_helpers.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/draw_rects.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/draw_text_helper.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/draw_tool.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/fun_helpers.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/gametests/3dsquare.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/gametests/__init__.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/gametests/__main__.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/gametests/gravitytest.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/gametests/guitesting.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/gametests/sandbox.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/gametests/squaremove.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/gametests/windowtesting.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/gravity.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/gui.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/gui_ext.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/math.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/player.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/sprites.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/tilemap.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/ver_warner.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow/window.py +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow.egg-info/SOURCES.txt +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow.egg-info/dependency_links.txt +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/crystalwindow.egg-info/top_level.txt +0 -0
- {crystalwindow-4.0 → crystalwindow-4.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crystalwindow
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.2
|
|
4
4
|
Summary: A Tkinter powered window + GUI toolkit made by Crystal (MEEEEEE)! Easier apps, smoother UI and all-in-one helpers!
|
|
5
5
|
Home-page: https://pypi.org/project/crystalwindow/
|
|
6
6
|
Author: CrystalBallyHereXD
|
|
@@ -29,7 +29,7 @@ from .animation import Animation
|
|
|
29
29
|
from .collision import check_collision, resolve_collision
|
|
30
30
|
|
|
31
31
|
# === GUI & Extensions ===
|
|
32
|
-
from .gui import Button, Label, GUIManager,
|
|
32
|
+
from .gui import Button, Label, GUIManager, hex_to_rgb, Fade
|
|
33
33
|
from .gui_ext import Toggle, Slider
|
|
34
34
|
|
|
35
35
|
# === Time ===
|
|
@@ -42,7 +42,7 @@ from .draw_text_helper import DrawTextManager
|
|
|
42
42
|
from .draw_tool import CrystalDraw
|
|
43
43
|
|
|
44
44
|
# === Misc Helpers ===
|
|
45
|
-
from .fun_helpers import random_name, DebugOverlay
|
|
45
|
+
from .fun_helpers import random_name, DebugOverlay, random_color, random_palette, lerp
|
|
46
46
|
from .camera import Camera
|
|
47
47
|
from .color_handler import Colors, Color
|
|
48
48
|
|
|
@@ -81,10 +81,10 @@ __all__ = [
|
|
|
81
81
|
"Clock",
|
|
82
82
|
|
|
83
83
|
# --- Drawing ---
|
|
84
|
-
"gradient_rect", "CameraShake", "DrawHelper", "DrawTextManager", "CrystalDraw",
|
|
84
|
+
"gradient_rect", "CameraShake", "DrawHelper", "DrawTextManager", "CrystalDraw",
|
|
85
85
|
|
|
86
86
|
# --- Misc ---
|
|
87
|
-
"random_name", "DebugOverlay", "Camera", "Colors", "Color",
|
|
87
|
+
"random_name", "DebugOverlay", "Camera", "Colors", "Color", "random_palette", "lerp"
|
|
88
88
|
|
|
89
89
|
# --- 3D ---
|
|
90
90
|
"CW3D",
|
|
@@ -11,6 +11,8 @@ import os
|
|
|
11
11
|
import ast
|
|
12
12
|
import difflib
|
|
13
13
|
from typing import Optional, Dict, Any
|
|
14
|
+
import requests
|
|
15
|
+
import groq
|
|
14
16
|
|
|
15
17
|
|
|
16
18
|
# ==========================================================
|
|
@@ -149,44 +151,101 @@ class AI:
|
|
|
149
151
|
self.memory.pop(0)
|
|
150
152
|
|
|
151
153
|
# ==========================================================
|
|
152
|
-
# LOCAL FALLBACK AI (
|
|
154
|
+
# LOCAL FALLBACK AI (modern, useful, not dumb)
|
|
153
155
|
# ==========================================================
|
|
154
156
|
def _local_ai(self, prompt, file_data):
|
|
155
157
|
"""
|
|
156
|
-
|
|
157
|
-
|
|
158
|
+
Improved fallback mode:
|
|
159
|
+
- If file provided → real AST analysis
|
|
160
|
+
- If general question → helpful offline response
|
|
161
|
+
- No more random jokes or irrelevant "forgot a colon"
|
|
158
162
|
"""
|
|
163
|
+
|
|
164
|
+
# --- If file provided, try real Python AST parsing ---
|
|
159
165
|
if file_data and not file_data.startswith("[CrystalAI]"):
|
|
160
166
|
try:
|
|
161
167
|
ast.parse(file_data)
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
168
|
+
return (
|
|
169
|
+
"[LocalAI] I was able to parse the file successfully.\n"
|
|
170
|
+
"There are no syntax errors.\n"
|
|
171
|
+
"Ask me to explain, summarize, refactor, or improve something."
|
|
172
|
+
)
|
|
165
173
|
except SyntaxError as se:
|
|
166
|
-
# Syntax help
|
|
167
174
|
lineno = se.lineno or 0
|
|
168
175
|
offset = se.offset or 0
|
|
169
|
-
msg =
|
|
176
|
+
msg = (
|
|
177
|
+
f"[LocalAI] SyntaxError detected:\n"
|
|
178
|
+
f"• Message: {se.msg}\n"
|
|
179
|
+
f"• Line: {lineno}\n"
|
|
180
|
+
f"• Column: {offset}\n\n"
|
|
181
|
+
)
|
|
170
182
|
snippet = self._snippet(file_data, lineno)
|
|
171
|
-
return msg +
|
|
183
|
+
return msg + snippet
|
|
184
|
+
|
|
185
|
+
# --- General offline fallback (safe + useful) ---
|
|
186
|
+
lower = prompt.lower()
|
|
187
|
+
|
|
188
|
+
# Code-related queries
|
|
189
|
+
if "fix" in lower or "error" in lower or "bug" in lower:
|
|
190
|
+
return (
|
|
191
|
+
"[LocalAI] I can't reach Groq right now,\n"
|
|
192
|
+
"but here's what I can do offline:\n"
|
|
193
|
+
"• Check for syntax problems if you provide a file\n"
|
|
194
|
+
"• Suggest common Python mistakes\n\n"
|
|
195
|
+
"Tip: try again once Groq is reachable for full debugging."
|
|
196
|
+
)
|
|
172
197
|
|
|
173
|
-
#
|
|
174
|
-
if "
|
|
175
|
-
return
|
|
198
|
+
# Regular questions (time, math, writing, etc.)
|
|
199
|
+
if any(x in lower for x in ["time", "story", "game", "explain", "python"]):
|
|
200
|
+
return (
|
|
201
|
+
"[LocalAI] I'm offline, but I can still give general help:\n"
|
|
202
|
+
"- Ask me Python questions\n"
|
|
203
|
+
"- Ask for concepts, writing tips, structure examples\n"
|
|
204
|
+
"- Provide a file and I can analyze it with AST\n"
|
|
205
|
+
)
|
|
176
206
|
|
|
177
|
-
|
|
207
|
+
# Catch-all fallback
|
|
208
|
+
return (
|
|
209
|
+
"[LocalAI] Offline mode enabled.\n"
|
|
210
|
+
"I can still analyze Python code and help with general knowledge.\n"
|
|
211
|
+
"Once online, Groq will give full intelligent responses."
|
|
212
|
+
)
|
|
178
213
|
|
|
179
214
|
# ==========================================================
|
|
180
|
-
# ASK
|
|
215
|
+
# ASK (Groq → fallback)
|
|
181
216
|
# ==========================================================
|
|
182
217
|
def ask(self, text, file=None):
|
|
183
218
|
file_data = self._read_file(file)
|
|
184
219
|
prompt = self._build_prompt(text, file_data)
|
|
185
220
|
|
|
186
|
-
#
|
|
221
|
+
# Try to call Groq normally
|
|
187
222
|
try:
|
|
188
|
-
|
|
189
|
-
|
|
223
|
+
url = "https://api.groq.com/openai/v1/chat/completions"
|
|
224
|
+
headers = {
|
|
225
|
+
"Authorization": f"Bearer {self.key}",
|
|
226
|
+
"Content-Type": "application/json"
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
payload = {
|
|
230
|
+
"model": "llama-3.3-70b-versatile",
|
|
231
|
+
"messages": [
|
|
232
|
+
{"role": "system", "content": self.personality},
|
|
233
|
+
{"role": "user", "content": prompt}
|
|
234
|
+
],
|
|
235
|
+
"temperature": 0.3
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
import requests
|
|
239
|
+
r = requests.post(url, json=payload, headers=headers, timeout=8)
|
|
240
|
+
data = r.json()
|
|
241
|
+
|
|
242
|
+
if "error" in data:
|
|
243
|
+
raise RuntimeError(data["error"])
|
|
244
|
+
|
|
245
|
+
resp = data["choices"][0]["message"]["content"]
|
|
246
|
+
|
|
247
|
+
except Exception:
|
|
248
|
+
# Groq unreachable → fallback
|
|
190
249
|
resp = self._local_ai(prompt, file_data)
|
|
191
250
|
|
|
192
251
|
self._save_memory(text, resp)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crystalwindow
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.2
|
|
4
4
|
Summary: A Tkinter powered window + GUI toolkit made by Crystal (MEEEEEE)! Easier apps, smoother UI and all-in-one helpers!
|
|
5
5
|
Home-page: https://pypi.org/project/crystalwindow/
|
|
6
6
|
Author: CrystalBallyHereXD
|
|
@@ -7,7 +7,7 @@ with open("README.md", encoding="utf-8") as f:
|
|
|
7
7
|
|
|
8
8
|
setup(
|
|
9
9
|
name="crystalwindow",
|
|
10
|
-
version="4.
|
|
10
|
+
version="4.2", # Force metadata refresh
|
|
11
11
|
packages=find_packages(include=["crystalwindow", "crystalwindow.*"]),
|
|
12
12
|
|
|
13
13
|
include_package_data=True, # include package_data files
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|