-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
614 lines (433 loc) · 20.9 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
import cv2
import sys
import random
import psycopg2
import datetime
from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton, QTableWidgetItem, QFileDialog
from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton ,QTableWidgetItem
from PyQt5.QtCore import pyqtSlot, QFile, QTextStream, QTimer
from PyQt5.QtCore import pyqtSlot, QFile, QTextStream
from sidebar_ui import Ui_MainWindow
from PyQt5 import QtWidgets, uic
from PyQt5 import QtCore
from PyQt5.uic import loadUi
from detection import TehseenCode
from PyQt5.QtWidgets import QDialog
from PyQt5.QtGui import QImage, QPixmap
from PyQt5.QtWidgets import QFileDialog
from PyQt5.QtWidgets import QApplication, QMainWindow, QFileDialog
from PyQt5.QtGui import QPixmap, QImage
from PyQt5.QtCore import QTimer, Qt, pyqtSignal, QThread, pyqtSlot
from sidebar_ui import Ui_MainWindow
verit=psycopg2.connect("dbname=Kutuphane_Yonetim_Sistemi user=postgres password=11223344Aa.")
cur=verit.cursor()
#Video Kaydi Uzerinden Yapilan Kod Blogu
class MainWindow(QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.ui.icon_only_widget.hide()
self.ui.stackedWidget.setCurrentIndex(0)
weights_path = "yolov4-tiny-custom.weights"
config_path = "yolov4-tiny-custom.cfg"
class_names_path = "coco.names"
#thread
self.tehseen_thread = TehseenCode()
self.tehseen_thread.setModelParameters(weights_path, config_path, class_names_path)
self.tehseen_thread.frameCaptured.connect(self.displayImage)
self.ui.SHOW.clicked.connect(self.startTehseenThread)
self.ui.CAPTURE.clicked.connect(self.captureImage)
@pyqtSlot()
def startTehseenThread(self):
video_path, _ = QFileDialog.getOpenFileName(self, 'Video Dosyasını Seç', '', 'Video Files (*.mp4 *.avi *.mkv)')
if video_path:
self.ui.TEXT.setText('Lütfen "Resim Çek" düğmesine basarak görüntü çekmeye başlayın.')
# Yeni video seçildiğinde mevcut thread'i durdurun
if self.tehseen_thread.isRunning():
self.tehseen_thread.terminate()
self.tehseen_thread.wait()
weights_path = "yolov4-tiny-custom.weights"
config_path = "yolov4-tiny-custom.cfg"
class_names_path = "coco.names"
self.tehseen_thread = TehseenCode()
self.tehseen_thread.setModelParameters(weights_path, config_path, class_names_path)
self.tehseen_thread.setVideoPath(video_path)
self.tehseen_thread.frameCaptured.connect(self.displayImage)
self.tehseen_thread.start()
@pyqtSlot(object)
def displayImage(self, frame):
self.ui.TEXT.setText('"Resim Çek" düğmesine tekrar basarak görüntünüzü kaydedebilirsiniz.')
self.ui.imgLabel.setPixmap(QPixmap.fromImage(self.convertFrameToImage(frame)))
self.ui.imgLabel.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter)
def captureImage(self):
self.tehseen_thread.logic = 2
def convertFrameToImage(self, img):
qformat = QImage.Format_Indexed8
if len(img.shape) == 3:
if img.shape[2] == 4:
qformat = QImage.Format_RGBA8888
else:
qformat = QImage.Format_RGB888
img = QImage(img.data, img.shape[1], img.shape[0], img.strides[0], qformat)
img = img.rgbSwapped()
return img
## Function for changing page to user page
def on_user_btn_clicked(self):
self.ui.stackedWidget.setCurrentIndex(3)
## Change QPushButton Checkable status when stackedWidget index changed
def on_stackedWidget_currentChanged(self, index):
btn_list = self.ui.icon_only_widget.findChildren(QPushButton) \
+ self.ui.full_menu_widget.findChildren(QPushButton)
for btn in btn_list:
if index in [2, 3]:
btn.setAutoExclusive(False)
btn.setChecked(False)
else:
btn.setAutoExclusive(True)
## functions for changing menu page
def on_kamera_btn_1_toggled(self):
self.ui.stackedWidget.setCurrentIndex(0)
def on_kamera_btn_2_toggled(self):
self.ui.stackedWidget.setCurrentIndex(0)
def on_masalar_btn_1_toggled(self):
self.ui.stackedWidget.setCurrentIndex(1)
def on_masalar_btn_2_toggled(self):
self.ui.stackedWidget.setCurrentIndex(1)
def on_rezervasyon_1_toggled(self):
self.ui.stackedWidget.setCurrentIndex(2)
def on_rezervasyon_2_toggled(self):
self.ui.stackedWidget.setCurrentIndex(2)
def on_pushButton_clicked(self):
no=int(self.ui.lineEdit.text())
yer=str(self.ui.lineEdit_2.text())
tar=datetime.datetime.strptime(self.ui.lineEdit_3.text(),'%d-%m-%Y').date()
bas=datetime.datetime.strptime(self.ui.lineEdit_4.text(),'%H:%M').time()
son=datetime.datetime.strptime(self.ui.lineEdit_5.text(),'%H:%M').time()
merak="INSERT INTO randevu VALUES(%s,%s,%s,%s,%s)"
cur.execute(merak,(no,yer,tar,bas,son))
verit.commit()
def on_pushButton_4_clicked(self):
no=int(self.ui.lineEdit.text())
yer=str(self.ui.lineEdit_2.text())
tar=datetime.datetime.strptime(self.ui.lineEdit_3.text(),'%d-%m-%Y').date()
bas=datetime.datetime.strptime(self.ui.lineEdit_4.text(),'%H:%M').time()
son=datetime.datetime.strptime(self.ui.lineEdit_5.text(),'%H:%M').time()
merak="DELETE FROM randevu WHERE ono=%s AND sandalye_id=%s AND tarih=%s AND baslangic=%s AND bitis=%s"
cur.execute(merak,(no,yer,tar,bas,son))
verit.commit()
def on_pushButton_2_clicked(self):
no=int(self.ui.lineEdit.text())
yer=str(self.ui.lineEdit_2.text())
tar=datetime.datetime.strptime(self.ui.lineEdit_3.text(),'%d-%m-%Y').date()
bas=datetime.datetime.strptime(self.ui.lineEdit_4.text(),'%H:%M').time()
son=datetime.datetime.strptime(self.ui.lineEdit_5.text(),'%H:%M').time()
merak="UPDATE randevu SET (baslangic=%s,AND bitis=%s) WHERE ono=%s AND sandalye_id=%s AND tarih=%s"
cur.execute(merak,(bas,son,no,yer,tar))
verit.commit()
def on_pushButton_3_clicked(self):
yer=str(self.ui.lineEdit_2.text())
guvenlik = ''.join(random.choices("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", k=6))
merak="UPDATE randevu SET (toplanma_saati=CURRENT_TIME,AND güvenlik_kodu=%s) WHERE sandalye_id=%s AND tarih=CURRENT_DATE AND baslangıc<CURRENT_TIME AND bitis>CURRENT_TIME"
cur.execute(merak,(guvenlik,yer))
verit.commit()
def onButtonClicked(self):
button = self.sender()
object_name = button.objectName()
self.ui.lineEdit_2.setText(object_name)
soru="SELECT * FROM randevu WHERE sandalye_id=%s AND tarih=CURRENT_DATE AND baslangic<CURRENT_TIME AND bitis > CURRENT_TIME"
cur.execute(soru,(object_name,))
sonuc=cur.fetchone()
if(sonuc):
self.ui.lineEdit.setText(sonuc[0])
self.ui.lineEdit_3.setText(str(sonuc[2]))
self.ui.lineEdit_4.setText(str(sonuc[3]))
self.ui.lineEdit_5.setText(str(sonuc[4]))
def on_kisiselIptal_clicked(self):
self.ui.kisiselAd.setText("")
self.ui.kisielSoyad.setText("")
self.ui.kisielTel.setText("")
self.ui.kisielMail.setText("")
self.ui.kisiselNo.setText("")
self.ui.mevcutSifre.setText("")
self.ui.yeniSifre.setText("")
self.ui.yeniSifreTekrar.setText("")
def on_kisiselGuncelle_clicked(self):
no=self.ui.kisiselNo.text()
ad= self.ui.kisiselAd.text()
soyad=self.ui.kisielSoyad.text()
tel=self.ui.kisielTel.text()
mail=self.ui.kisielMail.text()
mevcut=self.ui.mevcutSifre.text()
yeni=self.ui.yeniSifre.text()
tekrar=self.ui.yeniSifreTekrar.text()
if(no!=None):
if(ad!=None):
sor="UPDATE eleman SET isim=%s WHERE eleman_id=%s"
cur.execute(sor,(ad,no))
verit.commit()
if(soyad!=None):
sor="UPDATE eleman SET soyisim=%s WHERE eleman_id=%s"
cur.execute(sor,(soyad,no))
verit.commit()
if(tel!=None):
sor="UPDATE eleman SET telefon=%s WHERE eleman_id=%s"
cur.execute(sor,(tel,no))
verit.commit()
if(mail!=None):
sor="UPDATE eleman SET e_posta=%s WHERE eleman_id=%s"
cur.execute(sor,(ad,no))
verit.commit()
if(mevcut!=None and yeni!=None and tekrar!=None and yeni==tekrar):
sor="UPDATE eleman SET sifre=%s WHERE eleman_id=%s AND sifre=%s"
cur.execute(sor,(yeni,no,mevcut))
def on_goster_clicked(self):
tar=datetime.date(self.ui.dateEdit.date().year(),self.ui.dateEdit.date().month(),self.ui.dateEdit.date().day())
if(tar==None):
sorgu="SELECT * FROM randevu"
cur.execute(sorgu)
tablo=cur.fetchall()
else:
sorgu="SELECT * FROM randevu WHERE tarih=%s"
cur.execute(sorgu,(tar,))
tablo=cur.fetchall()
self.ui.tableWidget.setRowCount(0) # Tabloyu temizle
for row_index, row_data in enumerate(tablo):
self.ui.tableWidget.insertRow(row_index)
for col_index, cell_data in enumerate(row_data):
self.ui.tableWidget.setItem(row_index, col_index, QTableWidgetItem(str(cell_data)))
def on_sifirla_clicked(self):
sorgu="SELECT * FROM randevu"
cur.execute(sorgu)
tablo=cur.fetchall()
self.ui.tableWidget.setRowCount(0) # Tabloyu temizle
for row_index, row_data in enumerate(tablo):
self.ui.tableWidget.insertRow(row_index)
for col_index, cell_data in enumerate(row_data):
self.ui.tableWidget.setItem(row_index, col_index, QTableWidgetItem(str(cell_data)))
if __name__ == "__main__":
app = QApplication(sys.argv)
# loading style file
with open("style.qss", "r") as style_file:
style_str = style_file.read()
app.setStyleSheet(style_str)
# loading style file, Example 2
style_file = QFile("style.qss")
style_file.open(QFile.ReadOnly | QFile.Text)
style_stream = QTextStream(style_file)
app.setStyleSheet(style_stream.readAll())
window = MainWindow()
window.show()
sys.exit(app.exec())
#Kamera Ile Calisan Kod Blogu
# class MainWindow(QMainWindow):
# def __init__(self):
# super(MainWindow, self).__init__()
# self.ui = Ui_MainWindow()
# self.ui.setupUi(self)
# self.ui.icon_only_widget.hide()
# self.ui.stackedWidget.setCurrentIndex(0)
# weights_path = "yolov4-tiny.weights"
# config_path = "yolov4-tiny-custom.cfg"
# class_names_path = "coco.names"
# # Thread
# self.tehseen_thread = TehseenCode()
# self.tehseen_thread.setModelParameters(weights_path, config_path, class_names_path)
# self.tehseen_thread.frameCaptured.connect(self.displayImage)
# self.ui.SHOW.clicked.connect(self.startTehseenThread)
# self.ui.CAPTURE.clicked.connect(self.captureImage)
# self.cap = cv2.VideoCapture(0) # Kamerayı başlat
# self.timer = QTimer(self)
# self.timer.timeout.connect(self.updateFrame)
# self.timer.start(30) # Her 30 milisaniyede bir güncelleme
# def updateFrame(self):
# ret, frame = self.cap.read()
# if ret:
# self.displayImage(frame)
# @pyqtSlot()
# def startTehseenThread(self):
# # Kameradan görüntü alındığında mevcut thread'i durdurun
# if self.tehseen_thread.isRunning():
# self.tehseen_thread.terminate()
# self.tehseen_thread.wait()
# self.ui.TEXT.setText('Lütfen "Resim Çek" düğmesine basarak görüntü çekmeye başlayın.')
# weights_path = "yolov4-tiny-custom.weights"
# config_path = "yolov4-tiny-custom.cfg"
# class_names_path = "coco.names"
# self.tehseen_thread = TehseenCode()
# self.tehseen_thread.setModelParameters(weights_path, config_path, class_names_path)
# self.tehseen_thread.setCameraCapture(self.cap)
# self.tehseen_thread.frameCaptured.connect(self.displayImage)
# self.tehseen_thread.start()
# @pyqtSlot(object)
# def displayImage(self, frame):
# self.ui.TEXT.setText('"Resim Çek" düğmesine tekrar basarak görüntünüzü kaydedebilirsiniz.')
# self.ui.imgLabel.setPixmap(QPixmap.fromImage(self.convertFrameToImage(frame)))
# self.ui.imgLabel.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
# def captureImage(self):
# self.tehseen_thread.logic = 2
# def convertFrameToImage(self, img):
# qformat = QImage.Format_Indexed8
# if len(img.shape) == 3:
# if img.shape[2] == 4:
# qformat = QImage.Format_RGBA8888
# else:
# qformat = QImage.Format_RGB888
# img = QImage(img.data, img.shape[1], img.shape[0], img.strides[0], qformat)
# img = img.rgbSwapped()
# return img
# ## Function for changing page to user page
# def on_user_btn_clicked(self):
# self.ui.stackedWidget.setCurrentIndex(3)
# ## Change QPushButton Checkable status when stackedWidget index changed
# def on_stackedWidget_currentChanged(self, index):
# btn_list = self.ui.icon_only_widget.findChildren(QPushButton) \
# + self.ui.full_menu_widget.findChildren(QPushButton)
# for btn in btn_list:
# if index in [2, 3]:
# btn.setAutoExclusive(False)
# btn.setChecked(False)
# else:
# btn.setAutoExclusive(True)
# ## functions for changing menu page
# def on_kamera_btn_1_toggled(self):
# self.ui.stackedWidget.setCurrentIndex(0)
# def on_kamera_btn_2_toggled(self):
# self.ui.stackedWidget.setCurrentIndex(0)
# def on_masalar_btn_1_toggled(self):
# self.ui.stackedWidget.setCurrentIndex(1)
# def on_masalar_btn_2_toggled(self):
# self.ui.stackedWidget.setCurrentIndex(1)
# def on_rezervasyon_1_toggled(self):
# self.ui.stackedWidget.setCurrentIndex(2)
# def on_rezervasyon_2_toggled(self):
# self.ui.stackedWidget.setCurrentIndex(2)
# def on_pushButton_clicked(self):
# # no=int(self.ui.lineEdit.text())
# # yer=str(self.ui.lineEdit_2.text())
# # tar=datetime.datetime.strptime(self.ui.lineEdit_3.text(),'%d-%m-%Y').date()
# # bas=datetime.datetime.strptime(self.ui.lineEdit_4.text(),'%H:%M').time()
# # son=datetime.datetime.strptime(self.ui.lineEdit_5.text(),'%H:%M').time()
# # merak="INSERT INTO randevu VALUES(%s,%s,%s,%s,%s)"
# # cur.execute(merak,(no,yer,tar,bas,son))
# # verit.commit()
# pass
# def on_pushButton_4_clicked(self):
# # no=int(self.ui.lineEdit.text())
# # yer=str(self.ui.lineEdit_2.text())
# # tar=datetime.datetime.strptime(self.ui.lineEdit_3.text(),'%d-%m-%Y').date()
# # bas=datetime.datetime.strptime(self.ui.lineEdit_4.text(),'%H:%M').time()
# # son=datetime.datetime.strptime(self.ui.lineEdit_5.text(),'%H:%M').time()
# # merak="DELETE FROM randevu WHERE ono=%s AND sandalye_id=%s AND tarih=%s AND baslangic=%s AND bitis=%s"
# # cur.execute(merak,(no,yer,tar,bas,son))
# # verit.commit()
# pass
# def on_pushButton_2_clicked(self):
# # no=int(self.ui.lineEdit.text())
# # yer=str(self.ui.lineEdit_2.text())
# # tar=datetime.datetime.strptime(self.ui.lineEdit_3.text(),'%d-%m-%Y').date()
# # bas=datetime.datetime.strptime(self.ui.lineEdit_4.text(),'%H:%M').time()
# # son=datetime.datetime.strptime(self.ui.lineEdit_5.text(),'%H:%M').time()
# # merak="UPDATE randevu SET (baslangic=%s,AND bitis=%s) WHERE ono=%s AND sandalye_id=%s AND tarih=%s"
# # cur.execute(merak,(bas,son,no,yer,tar))
# # verit.commit()
# pass
# def on_pushButton_3_clicked(self):
# # yer=str(self.ui.lineEdit_2.text())
# # guvenlik = ''.join(random.choices("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", k=6))
# # merak="UPDATE randevu SET (toplanma_saati=CURRENT_TIME,AND güvenlik_kodu=%s) WHERE sandalye_id=%s AND tarih=CURRENT_DATE AND baslangıc<CURRENT_TIME AND bitis>CURRENT_TIME"
# # cur.execute(merak,(guvenlik,yer))
# # verit.commit()
# pass
# def onButtonClicked(self):
# # button = self.sender()
# # object_name = button.objectName()
# # self.ui.lineEdit_2.setText(object_name)
# # soru="SELECT * FROM randevu WHERE sandalye_id=%s AND tarih=CURRENT_DATE AND baslangic<CURRENT_TIME AND bitis > CURRENT_TIME"
# # cur.execute(soru,(object_name,))
# # sonuc=cur.fetchone()
# # if(sonuc):
# # self.ui.lineEdit.setText(sonuc[0])
# # self.ui.lineEdit_3.setText(str(sonuc[2]))
# # self.ui.lineEdit_4.setText(str(sonuc[3]))
# # self.ui.lineEdit_5.setText(str(sonuc[4]))
# pass
# def on_kisiselIptal_clicked(self):
# # self.ui.kisiselAd.setText("")
# # self.ui.kisielSoyad.setText("")
# # self.ui.kisielTel.setText("")
# # self.ui.kisielMail.setText("")
# # self.ui.kisiselNo.setText("")
# # self.ui.mevcutSifre.setText("")
# # self.ui.yeniSifre.setText("")
# # self.ui.yeniSifreTekrar.setText("")
# pass
# def on_kisiselGuncelle_clicked(self):
# # no=self.ui.kisiselNo.text()
# # ad= self.ui.kisiselAd.text()
# # soyad=self.ui.kisielSoyad.text()
# # tel=self.ui.kisielTel.text()
# # mail=self.ui.kisielMail.text()
# # mevcut=self.ui.mevcutSifre.text()
# # yeni=self.ui.yeniSifre.text()
# # tekrar=self.ui.yeniSifreTekrar.text()
# # if(no!=None):
# # if(ad!=None):
# # sor="UPDATE eleman SET isim=%s WHERE eleman_id=%s"
# # cur.execute(sor,(ad,no))
# # verit.commit()
# # if(soyad!=None):
# # sor="UPDATE eleman SET soyisim=%s WHERE eleman_id=%s"
# # cur.execute(sor,(soyad,no))
# # verit.commit()
# # if(tel!=None):
# # sor="UPDATE eleman SET telefon=%s WHERE eleman_id=%s"
# # cur.execute(sor,(tel,no))
# # verit.commit()
# # if(mail!=None):
# # sor="UPDATE eleman SET e_posta=%s WHERE eleman_id=%s"
# # cur.execute(sor,(ad,no))
# # verit.commit()
# # if(mevcut!=None and yeni!=None and tekrar!=None and yeni==tekrar):
# # sor="UPDATE eleman SET sifre=%s WHERE eleman_id=%s AND sifre=%s"
# # cur.execute(sor,(yeni,no,mevcut))
# pass
# def on_goster_clicked(self):
# # tar=datetime.date(self.ui.dateEdit.date().year(),self.ui.dateEdit.date().month(),self.ui.dateEdit.date().day())
# # if(tar==None):
# # sorgu="SELECT * FROM randevu"
# # cur.execute(sorgu)
# # tablo=cur.fetchall()
# # else:
# # sorgu="SELECT * FROM randevu WHERE tarih=%s"
# # cur.execute(sorgu,(tar,))
# # tablo=cur.fetchall()
# # self.ui.tableWidget.setRowCount(0) # Tabloyu temizle
# # for row_index, row_data in enumerate(tablo):
# # self.ui.tableWidget.insertRow(row_index)
# # for col_index, cell_data in enumerate(row_data):
# # self.ui.tableWidget.setItem(row_index, col_index, QTableWidgetItem(str(cell_data)))
# # def on_sifirla_clicked(self):
# # sorgu="SELECT * FROM randevu"
# # cur.execute(sorgu)
# # tablo=cur.fetchall()
# # self.ui.tableWidget.setRowCount(0) # Tabloyu temizle
# # for row_index, row_data in enumerate(tablo):
# # self.ui.tableWidget.insertRow(row_index)
# # for col_index, cell_data in enumerate(row_data):
# # self.ui.tableWidget.setItem(row_index, col_index, QTableWidgetItem(str(cell_data)))
# pass
# if __name__ == "__main__":
# app = QApplication(sys.argv)
# ## loading style file
# # with open("style.qss", "r") as style_file:
# # style_str = style_file.read()
# # app.setStyleSheet(style_str)
# ## loading style file, Example 2
# style_file = QFile("style.qss")
# style_file.open(QFile.ReadOnly | QFile.Text)
# style_stream = QTextStream(style_file)
# app.setStyleSheet(style_stream.readAll())
# window = MainWindow()
# window.show()
# sys.exit(app.exec())