Qwael 4.0.0.1.4__tar.gz → 4.0.0.1.6__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.
- {qwael-4.0.0.1.4 → qwael-4.0.0.1.6}/PKG-INFO +1 -1
- {qwael-4.0.0.1.4 → qwael-4.0.0.1.6}/Qwael/__init__.py +1 -3
- qwael-4.0.0.1.6/Qwael/filesz.py +89 -0
- qwael-4.0.0.1.6/Qwael/pgif.py +51 -0
- {qwael-4.0.0.1.4 → qwael-4.0.0.1.6}/Qwael.egg-info/PKG-INFO +1 -1
- {qwael-4.0.0.1.4 → qwael-4.0.0.1.6}/Qwael.egg-info/SOURCES.txt +1 -0
- {qwael-4.0.0.1.4 → qwael-4.0.0.1.6}/setup.py +1 -1
- qwael-4.0.0.1.4/Qwael/filesz.py +0 -110
- {qwael-4.0.0.1.4 → qwael-4.0.0.1.6}/LICENSE +0 -0
- {qwael-4.0.0.1.4 → qwael-4.0.0.1.6}/Qwael/DR/304/260VE.py" +0 -0
- {qwael-4.0.0.1.4 → qwael-4.0.0.1.6}/Qwael/DoIP.py +0 -0
- {qwael-4.0.0.1.4 → qwael-4.0.0.1.6}/Qwael/MultiDB.py +0 -0
- {qwael-4.0.0.1.4 → qwael-4.0.0.1.6}/Qwael/Multidata.py +0 -0
- {qwael-4.0.0.1.4 → qwael-4.0.0.1.6}/Qwael.egg-info/dependency_links.txt +0 -0
- {qwael-4.0.0.1.4 → qwael-4.0.0.1.6}/Qwael.egg-info/requires.txt +0 -0
- {qwael-4.0.0.1.4 → qwael-4.0.0.1.6}/Qwael.egg-info/top_level.txt +0 -0
- {qwael-4.0.0.1.4 → qwael-4.0.0.1.6}/README.md +0 -0
- {qwael-4.0.0.1.4 → qwael-4.0.0.1.6}/setup.cfg +0 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import json
|
|
3
|
+
import base64
|
|
4
|
+
import hashlib
|
|
5
|
+
from kivy.app import App
|
|
6
|
+
from cryptography.fernet import Fernet
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class EasyDB:
|
|
10
|
+
def __init__(self, name, password):
|
|
11
|
+
app = App.get_running_app()
|
|
12
|
+
base_dir = os.path.join(app.user_data_dir, "easydb_data")
|
|
13
|
+
os.makedirs(base_dir, exist_ok=True)
|
|
14
|
+
|
|
15
|
+
self.path = os.path.join(base_dir, f"{name}.db")
|
|
16
|
+
self.key = self._make_key(password)
|
|
17
|
+
self.cipher = Fernet(self.key)
|
|
18
|
+
|
|
19
|
+
if not os.path.exists(self.path):
|
|
20
|
+
self.data = {}
|
|
21
|
+
self._save()
|
|
22
|
+
else:
|
|
23
|
+
self._safe_load()
|
|
24
|
+
|
|
25
|
+
def _make_key(self, password):
|
|
26
|
+
digest = hashlib.sha256(password.encode()).digest()
|
|
27
|
+
return base64.urlsafe_b64encode(digest)
|
|
28
|
+
|
|
29
|
+
def _safe_load(self):
|
|
30
|
+
try:
|
|
31
|
+
with open(self.path, "rb") as f:
|
|
32
|
+
encrypted = f.read()
|
|
33
|
+
decrypted = self.cipher.decrypt(encrypted)
|
|
34
|
+
self.data = json.loads(decrypted.decode())
|
|
35
|
+
except Exception:
|
|
36
|
+
self.data = {}
|
|
37
|
+
self._save()
|
|
38
|
+
|
|
39
|
+
def _save(self):
|
|
40
|
+
raw = json.dumps(self.data, ensure_ascii=False).encode()
|
|
41
|
+
encrypted = self.cipher.encrypt(raw)
|
|
42
|
+
with open(self.path, "wb") as f:
|
|
43
|
+
f.write(encrypted)
|
|
44
|
+
|
|
45
|
+
def create(self, table):
|
|
46
|
+
if table not in self.data:
|
|
47
|
+
self.data[table] = []
|
|
48
|
+
self._save()
|
|
49
|
+
return self
|
|
50
|
+
|
|
51
|
+
def add(self, table, record: dict):
|
|
52
|
+
if table not in self.data:
|
|
53
|
+
self.create(table)
|
|
54
|
+
|
|
55
|
+
record["id"] = len(self.data[table]) + 1
|
|
56
|
+
self.data[table].append(record)
|
|
57
|
+
self._save()
|
|
58
|
+
return record["id"]
|
|
59
|
+
|
|
60
|
+
def all(self, table):
|
|
61
|
+
return self.data.get(table, [])
|
|
62
|
+
|
|
63
|
+
def find(self, table, **filters):
|
|
64
|
+
return [
|
|
65
|
+
item for item in self.data.get(table, [])
|
|
66
|
+
if all(item.get(k) == v for k, v in filters.items())
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
def delete(self, table, record_id):
|
|
70
|
+
if table not in self.data:
|
|
71
|
+
return 0
|
|
72
|
+
|
|
73
|
+
for item in self.data[table]:
|
|
74
|
+
if item.get("id") == record_id:
|
|
75
|
+
self.data[table].remove(item)
|
|
76
|
+
self._save()
|
|
77
|
+
return 1
|
|
78
|
+
return 0
|
|
79
|
+
|
|
80
|
+
def update(self, table, record_id, **updates):
|
|
81
|
+
if table not in self.data:
|
|
82
|
+
return 0
|
|
83
|
+
|
|
84
|
+
for item in self.data[table]:
|
|
85
|
+
if item.get("id") == record_id:
|
|
86
|
+
item.update(updates)
|
|
87
|
+
self._save()
|
|
88
|
+
return 1
|
|
89
|
+
return 0
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from kivy.uix.image import Image
|
|
2
|
+
from kivy.clock import Clock
|
|
3
|
+
from kivy.properties import ListProperty, NumericProperty
|
|
4
|
+
|
|
5
|
+
class gif(Image):
|
|
6
|
+
source_list = ListProperty([])
|
|
7
|
+
time = NumericProperty(0.1)
|
|
8
|
+
umit = NumericProperty(0)
|
|
9
|
+
|
|
10
|
+
def __init__(self, **kwargs):
|
|
11
|
+
super().__init__(**kwargs)
|
|
12
|
+
self.index = 0
|
|
13
|
+
self.turn = 0
|
|
14
|
+
self._event = None
|
|
15
|
+
|
|
16
|
+
Clock.schedule_once(self._start)
|
|
17
|
+
|
|
18
|
+
def _start(self, dt):
|
|
19
|
+
if not self.source_list:
|
|
20
|
+
return
|
|
21
|
+
|
|
22
|
+
self.source = self.source_list[0]
|
|
23
|
+
self._event = Clock.schedule_interval(
|
|
24
|
+
self._update,
|
|
25
|
+
self.time
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
def _update(self, dt):
|
|
29
|
+
self.index += 1
|
|
30
|
+
|
|
31
|
+
if self.index >= len(self.source_list):
|
|
32
|
+
self.index = 0
|
|
33
|
+
self.turn += 1
|
|
34
|
+
|
|
35
|
+
if self.umit != 0 and self.turn >= self.umit:
|
|
36
|
+
self.stop()
|
|
37
|
+
return
|
|
38
|
+
|
|
39
|
+
self.source = self.source_list[self.index]
|
|
40
|
+
|
|
41
|
+
def stop(self):
|
|
42
|
+
if self._event:
|
|
43
|
+
self._event.cancel()
|
|
44
|
+
self._event = None
|
|
45
|
+
|
|
46
|
+
def play(self):
|
|
47
|
+
if not self._event:
|
|
48
|
+
self._event = Clock.schedule_interval(
|
|
49
|
+
self._update,
|
|
50
|
+
self.time
|
|
51
|
+
)
|
qwael-4.0.0.1.4/Qwael/filesz.py
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import os, json
|
|
2
|
-
|
|
3
|
-
class EasyDB:
|
|
4
|
-
def __init__(self, name):
|
|
5
|
-
os.makedirs("easydb_data", exist_ok=True)
|
|
6
|
-
self.path = f"easydb_data/{name}.json"
|
|
7
|
-
if not os.path.exists(self.path):
|
|
8
|
-
with open(self.path, "w", encoding="utf-8") as f:
|
|
9
|
-
json.dump({}, f)
|
|
10
|
-
self._safe_load()
|
|
11
|
-
|
|
12
|
-
def _safe_load(self):
|
|
13
|
-
try:
|
|
14
|
-
with open(self.path, "r", encoding="utf-8") as f:
|
|
15
|
-
text = f.read().strip()
|
|
16
|
-
self.data = json.loads(text) if text else {}
|
|
17
|
-
except Exception:
|
|
18
|
-
print(f"[Uyarı] {self.path} bozuktu, sıfırdan oluşturuldu.")
|
|
19
|
-
self.data = {}
|
|
20
|
-
self._save()
|
|
21
|
-
|
|
22
|
-
def _save(self):
|
|
23
|
-
with open(self.path, "w", encoding="utf-8") as f:
|
|
24
|
-
json.dump(self.data, f, indent=2, ensure_ascii=False)
|
|
25
|
-
|
|
26
|
-
def create(self, table):
|
|
27
|
-
if table not in self.data:
|
|
28
|
-
self.data[table] = []
|
|
29
|
-
self._save()
|
|
30
|
-
return self
|
|
31
|
-
|
|
32
|
-
def _value_conflict(self, table, value):
|
|
33
|
-
is_special = isinstance(value, str) and value.startswith("'") and value.endswith("'")
|
|
34
|
-
val_clean = value.strip("'") if is_special else value
|
|
35
|
-
|
|
36
|
-
for item in self.data.get(table, []):
|
|
37
|
-
for v in item.values():
|
|
38
|
-
if not isinstance(v, str):
|
|
39
|
-
continue
|
|
40
|
-
v_special = v.startswith("'") and v.endswith("'")
|
|
41
|
-
v_clean = v.strip("'") if v_special else v
|
|
42
|
-
|
|
43
|
-
# Aynı özel tekrar edemez
|
|
44
|
-
if is_special and v_special and v_clean == val_clean:
|
|
45
|
-
return True
|
|
46
|
-
# Normal ↔ özel çakışması
|
|
47
|
-
if (is_special and not v_special or not is_special and v_special) and v_clean == val_clean:
|
|
48
|
-
return True
|
|
49
|
-
return False
|
|
50
|
-
|
|
51
|
-
def add(self, table, record: dict):
|
|
52
|
-
if table not in self.data:
|
|
53
|
-
self.create(table)
|
|
54
|
-
|
|
55
|
-
for key, value in record.items():
|
|
56
|
-
if isinstance(value, str) and self._value_conflict(table, value):
|
|
57
|
-
print(f"[Uyarı] {value} çakışma nedeniyle eklenmedi.")
|
|
58
|
-
return None
|
|
59
|
-
|
|
60
|
-
record["id"] = len(self.data[table]) + 1
|
|
61
|
-
self.data[table].append(record)
|
|
62
|
-
self._save()
|
|
63
|
-
return record["id"]
|
|
64
|
-
|
|
65
|
-
def all(self, table):
|
|
66
|
-
return self.data.get(table, [])
|
|
67
|
-
|
|
68
|
-
def find(self, table, **filters):
|
|
69
|
-
result = []
|
|
70
|
-
for item in self.data.get(table, []):
|
|
71
|
-
if all(item.get(k) == v for k, v in filters.items()):
|
|
72
|
-
result.append(item)
|
|
73
|
-
return result
|
|
74
|
-
|
|
75
|
-
# 🔹 Yeni: ID bazlı silme
|
|
76
|
-
def delete(self, table, record_id, field=None):
|
|
77
|
-
if table not in self.data:
|
|
78
|
-
print(f"[Hata] '{table}' tablosu yok.")
|
|
79
|
-
return 0
|
|
80
|
-
|
|
81
|
-
for item in self.data[table]:
|
|
82
|
-
if item.get("id") == record_id:
|
|
83
|
-
if field is None:
|
|
84
|
-
self.data[table].remove(item)
|
|
85
|
-
print(f"[Silindi] ID {record_id} tamamen silindi.")
|
|
86
|
-
else:
|
|
87
|
-
if field in item:
|
|
88
|
-
print(f"[Silindi] ID {record_id} kaydındaki '{field}' alanı silindi.")
|
|
89
|
-
del item[field]
|
|
90
|
-
self._save()
|
|
91
|
-
return 1
|
|
92
|
-
|
|
93
|
-
print(f"[Uyarı] ID {record_id} bulunamadı.")
|
|
94
|
-
return 0
|
|
95
|
-
|
|
96
|
-
# 🔹 Yeni: ID bazlı güncelleme
|
|
97
|
-
def update(self, table, record_id, **updates):
|
|
98
|
-
if table not in self.data:
|
|
99
|
-
print(f"[Hata] '{table}' tablosu yok.")
|
|
100
|
-
return 0
|
|
101
|
-
|
|
102
|
-
for item in self.data[table]:
|
|
103
|
-
if item.get("id") == record_id:
|
|
104
|
-
item.update(updates)
|
|
105
|
-
self._save()
|
|
106
|
-
print(f"[Güncellendi] ID {record_id} başarıyla güncellendi.")
|
|
107
|
-
return 1
|
|
108
|
-
|
|
109
|
-
print(f"[Uyarı] ID {record_id} bulunamadı.")
|
|
110
|
-
return 0
|
|
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
|