Qwael 3.9.4__tar.gz → 3.9.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-3.9.4 → qwael-3.9.6}/PKG-INFO +1 -1
- {qwael-3.9.4 → qwael-3.9.6}/Qwael/MultiDB.py +30 -7
- {qwael-3.9.4 → qwael-3.9.6}/Qwael.egg-info/PKG-INFO +1 -1
- {qwael-3.9.4 → qwael-3.9.6}/setup.py +1 -1
- {qwael-3.9.4 → qwael-3.9.6}/LICENSE +0 -0
- {qwael-3.9.4 → qwael-3.9.6}/Qwael/DR/304/260VE.py" +0 -0
- {qwael-3.9.4 → qwael-3.9.6}/Qwael/DoIP.py +0 -0
- {qwael-3.9.4 → qwael-3.9.6}/Qwael/__init__.py +0 -0
- {qwael-3.9.4 → qwael-3.9.6}/Qwael/filesz.py +0 -0
- {qwael-3.9.4 → qwael-3.9.6}/Qwael.egg-info/SOURCES.txt +0 -0
- {qwael-3.9.4 → qwael-3.9.6}/Qwael.egg-info/dependency_links.txt +0 -0
- {qwael-3.9.4 → qwael-3.9.6}/Qwael.egg-info/requires.txt +0 -0
- {qwael-3.9.4 → qwael-3.9.6}/Qwael.egg-info/top_level.txt +0 -0
- {qwael-3.9.4 → qwael-3.9.6}/README.md +0 -0
- {qwael-3.9.4 → qwael-3.9.6}/setup.cfg +0 -0
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import json
|
|
3
|
+
import time
|
|
4
|
+
|
|
5
|
+
# --- KIVY ANDROID DOSYA DESTEĞİ EKLENDİ ---
|
|
6
|
+
try:
|
|
7
|
+
from kivy.utils import platform
|
|
8
|
+
from kivy.app import App
|
|
9
|
+
except:
|
|
10
|
+
platform = None
|
|
11
|
+
# ------------------------------------------
|
|
12
|
+
|
|
3
13
|
|
|
4
14
|
class MultiDB:
|
|
5
15
|
def __init__(self, filename="database.mdb"):
|
|
16
|
+
|
|
17
|
+
# --- Android için doğru klasör ayarı ---
|
|
18
|
+
if platform == "android":
|
|
19
|
+
app = App.get_running_app()
|
|
20
|
+
|
|
21
|
+
if app:
|
|
22
|
+
# App çalışıyorsa user_data_dir kullan
|
|
23
|
+
filename = os.path.join(app.user_data_dir, filename)
|
|
24
|
+
else:
|
|
25
|
+
# App başlamamışsa geçici güvenli klasör
|
|
26
|
+
filename = os.path.join(os.getcwd(), filename)
|
|
27
|
+
# ---------------------------------------
|
|
28
|
+
|
|
6
29
|
self.filename = filename
|
|
7
30
|
self.lockfile = filename + ".lock"
|
|
8
31
|
|
|
@@ -14,6 +37,9 @@ class MultiDB:
|
|
|
14
37
|
# LOCK SYSTEM
|
|
15
38
|
# -----------------------------
|
|
16
39
|
def _lock(self):
|
|
40
|
+
while os.path.exists(self.lockfile):
|
|
41
|
+
time.sleep(0.05)
|
|
42
|
+
|
|
17
43
|
with open(self.lockfile, "w") as f:
|
|
18
44
|
f.write("locked")
|
|
19
45
|
|
|
@@ -127,7 +153,6 @@ class MultiDB:
|
|
|
127
153
|
# GIVE (DEĞİŞKEN DESTEKLİ)
|
|
128
154
|
# -----------------------------
|
|
129
155
|
def give(self, table, values, output_list=None):
|
|
130
|
-
# Değişken → liste dönüşümü
|
|
131
156
|
if not isinstance(values, (list, tuple)):
|
|
132
157
|
values = [values]
|
|
133
158
|
|
|
@@ -144,7 +169,6 @@ class MultiDB:
|
|
|
144
169
|
|
|
145
170
|
final_values = []
|
|
146
171
|
|
|
147
|
-
# AUTO ID
|
|
148
172
|
if len(values) + 1 == len(col_names) and "ID" in rules.values():
|
|
149
173
|
auto_id = 1
|
|
150
174
|
idx = tpos + 3
|
|
@@ -162,7 +186,6 @@ class MultiDB:
|
|
|
162
186
|
else:
|
|
163
187
|
final_values = list(values)
|
|
164
188
|
|
|
165
|
-
# VALIDATION
|
|
166
189
|
for i, col in enumerate(col_names):
|
|
167
190
|
rule = rules[col]
|
|
168
191
|
if not self._validate(final_values[i], rule, lines, tpos, i):
|
|
@@ -294,7 +317,7 @@ class MultiDB:
|
|
|
294
317
|
self._unlock()
|
|
295
318
|
|
|
296
319
|
# -----------------------------
|
|
297
|
-
# CONTROL SYSTEM
|
|
320
|
+
# CONTROL SYSTEM
|
|
298
321
|
# -----------------------------
|
|
299
322
|
def control(self, table, conditions: dict, output_list=None):
|
|
300
323
|
if not isinstance(conditions, dict):
|
|
@@ -326,7 +349,7 @@ class MultiDB:
|
|
|
326
349
|
return found
|
|
327
350
|
|
|
328
351
|
# -----------------------------
|
|
329
|
-
# FIND
|
|
352
|
+
# FIND
|
|
330
353
|
# -----------------------------
|
|
331
354
|
def find(self, table, conditions: dict, output_list=None):
|
|
332
355
|
if not isinstance(conditions, dict):
|
|
@@ -334,7 +357,7 @@ class MultiDB:
|
|
|
334
357
|
|
|
335
358
|
lines = self._read()
|
|
336
359
|
tpos = self._find_table(lines, table)
|
|
337
|
-
if tpos == -1:
|
|
360
|
+
if tpos == - -1:
|
|
338
361
|
raise ValueError("Tablo bulunamadı!")
|
|
339
362
|
|
|
340
363
|
col_names = json.loads(lines[tpos + 1])
|
|
@@ -356,7 +379,7 @@ class MultiDB:
|
|
|
356
379
|
return found_id
|
|
357
380
|
|
|
358
381
|
# -----------------------------
|
|
359
|
-
# PULL
|
|
382
|
+
# PULL
|
|
360
383
|
# -----------------------------
|
|
361
384
|
def pull(self, row_id, columns: dict, output_list=None):
|
|
362
385
|
|
|
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
|