-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.py
768 lines (541 loc) · 24.9 KB
/
index.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
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import sys
import MySQLdb
from PyQt5.uic import loadUiType
import datetime
from xlrd import *
from xlsxwriter import *
ui,_ = loadUiType('library.ui')
login,_ = loadUiType('login.ui')
class Login(QWidget , login):
def __init__(self):
QWidget.__init__(self)
self.setupUi(self)
self.pushButton.clicked.connect(self.Handel_Login)
style = open('themes/darkorange.css' , 'r')
style = style.read()
self.setStyleSheet(style)
def Handel_Login(self):
self.db = MySQLdb.connect(host='localhost' , user='root' , password ='8584' , db='library')
self.cur = self.db.cursor()
username = self.lineEdit.text()
password = self.lineEdit_2.text()
sql = ''' SELECT * FROM users'''
self.cur.execute(sql)
data = self.cur.fetchall()
for row in data :
if username == row[1] and password == row[3]:
print('user match')
self.window2 = MainApp()
self.close()
self.window2.show()
else:
self.label.setText('Make Sure You Enterd Your Username And Password Correctly')
class MainApp(QMainWindow , ui):
def __init__(self):
QMainWindow.__init__(self)
self.setupUi(self)
self.Handel_UI_Changes()
self.Handel_Buttons()
self.Dark_Orange_Theme()
self.Show_Author()
self.Show_Category()
self.Show_Publisher()
self.Show_Category_Combobox()
self.Show_Author_Combobox()
self.Show_Publisher_Combobox()
self.Show_All_Clients()
self.Show_All_Books()
self.Show_All_Operations()
def Handel_UI_Changes(self):
self.Hiding_Themes()
self.tabWidget.tabBar().setVisible(False)
def Handel_Buttons(self):
self.pushButton_5.clicked.connect(self.Show_Themes)
self.pushButton_17.clicked.connect(self.Hiding_Themes)
self.pushButton.clicked.connect(self.Open_Day_To_Day_Tab)
self.pushButton_2.clicked.connect(self.Open_Books_Tab)
self.pushButton_26.clicked.connect(self.Open_CLients_Tab)
self.pushButton_3.clicked.connect(self.Open_Users_Tab)
self.pushButton_4.clicked.connect(self.Open_Settings_Tab)
self.pushButton_7.clicked.connect(self.Add_New_Book)
self.pushButton_9.clicked.connect(self.Search_Books)
self.pushButton_8.clicked.connect(self.Edit_Books)
self.pushButton_10.clicked.connect(self.Delete_Books)
self.pushButton_14.clicked.connect(self.Add_Category)
self.pushButton_15.clicked.connect(self.Add_Author)
self.pushButton_16.clicked.connect(self.Add_Publisher)
self.pushButton_11.clicked.connect(self.Add_New_User)
self.pushButton_12.clicked.connect(self.Login)
self.pushButton_13.clicked.connect(self.Edit_User)
self.pushButton_19.clicked.connect(self.Dark_Orange_Theme)
self.pushButton_18.clicked.connect(self.Dark_Blue_Theme)
self.pushButton_21.clicked.connect(self.Dark_Gray_Theme)
self.pushButton_20.clicked.connect(self.QDark_Theme)
self.pushButton_22.clicked.connect(self.Add_New_Client)
self.pushButton_24.clicked.connect(self.Search_Client)
self.pushButton_23.clicked.connect(self.Edit_Client)
self.pushButton_25.clicked.connect(self.Delete_Client)
self.pushButton_6.clicked.connect(self.Handel_Day_Operations)
self.pushButton_29.clicked.connect(self.Export_Day_Operations)
self.pushButton_27.clicked.connect(self.Export_Books)
self.pushButton_28.clicked.connect(self.Export_Clients)
def Show_Themes(self):
self.groupBox_3.show()
def Hiding_Themes(self):
self.groupBox_3.hide()
########################################
######### opening tabs #################
def Open_Day_To_Day_Tab(self):
self.tabWidget.setCurrentIndex(0)
def Open_Books_Tab(self):
self.tabWidget.setCurrentIndex(1)
def Open_CLients_Tab(self):
self.tabWidget.setCurrentIndex(2)
def Open_Users_Tab(self):
self.tabWidget.setCurrentIndex(3)
def Open_Settings_Tab(self):
self.tabWidget.setCurrentIndex(4)
########################################
######### Day Operations #################
def Handel_Day_Operations(self):
book_title = self.lineEdit.text()
client_name = self.lineEdit_29.text()
type = self.comboBox.currentText()
days_number = self.comboBox_2.currentIndex() + 1
today_date = datetime.date.today()
to_date = today_date + datetime.timedelta(days=days_number)
print(today_date)
print(to_date)
self.db = MySQLdb.connect(host='localhost', user='root', password='8584', db='library')
self.cur = self.db.cursor()
self.cur.execute('''
INSERT INTO dayoperations(book_name, client, type , days , date , to_date )
VALUES (%s , %s , %s, %s , %s , %s)
''' , (book_title ,client_name, type , days_number , today_date , to_date))
self.db.commit()
self.statusBar().showMessage('New Operation Added')
self.Show_All_Operations()
def Show_All_Operations(self):
self.db = MySQLdb.connect(host='localhost', user='root', password='8584', db='library')
self.cur = self.db.cursor()
self.cur.execute('''
SELECT book_name , client , type , date , to_date FROM dayoperations
''')
data = self.cur.fetchall()
print(data)
self.tableWidget.setRowCount(0)
self.tableWidget.insertRow(0)
for row , form in enumerate(data):
for column , item in enumerate(form):
self.tableWidget.setItem(row , column , QTableWidgetItem(str(item)))
column += 1
row_position = self.tableWidget.rowCount()
self.tableWidget.insertRow(row_position)
########################################
######### Books #################
def Show_All_Books(self):
self.db = MySQLdb.connect(host='localhost', user='root', password='8584', db='library')
self.cur = self.db.cursor()
self.cur.execute(''' SELECT book_code,book_name,book_description,book_category,book_author,book_publisher,book_price FROM book''')
data = self.cur.fetchall()
self.tableWidget_5.setRowCount(0)
self.tableWidget_5.insertRow(0)
for row, form in enumerate(data):
for column, item in enumerate(form):
self.tableWidget_5.setItem(row, column, QTableWidgetItem(str(item)))
column += 1
row_position = self.tableWidget_5.rowCount()
self.tableWidget_5.insertRow(row_position)
self.db.close()
def Add_New_Book(self):
self.db = MySQLdb.connect(host='localhost' , user='root' , password ='8584' , db='library')
self.cur = self.db.cursor()
book_title = self.lineEdit_2.text()
book_description = self.textEdit.toPlainText()
book_code = self.lineEdit_3.text()
book_category = self.comboBox_3.currentText()
book_author = self.comboBox_4.currentText()
book_publisher = self.comboBox_5.currentText()
book_price = self.lineEdit_4.text()
self.cur.execute('''
INSERT INTO book(book_name,book_description,book_code,book_category,book_author,book_publisher,book_price)
VALUES (%s , %s , %s , %s , %s , %s , %s)
''' ,(book_title , book_description , book_code , book_category , book_author , book_publisher , book_price))
self.db.commit()
self.statusBar().showMessage('New Book Added')
self.lineEdit_2.setText('')
self.textEdit.setPlainText('')
self.lineEdit_3.setText('')
self.comboBox_3.setCurrentIndex(0)
self.comboBox_4.setCurrentIndex(0)
self.comboBox_5.setCurrentIndex(0)
self.lineEdit_4.setText('')
self.Show_All_Books()
def Search_Books(self):
self.db = MySQLdb.connect(host='localhost' , user='root' , password ='8584' , db='library')
self.cur = self.db.cursor()
book_title = self.lineEdit_5.text()
sql = ''' SELECT * FROM book WHERE book_name = %s'''
self.cur.execute(sql , [(book_title)])
data = self.cur.fetchone()
print(data)
self.lineEdit_8.setText(data[1])
self.textEdit_2.setPlainText(data[2])
self.lineEdit_7.setText(data[3])
self.comboBox_7.setCurrentText(data[4])
self.comboBox_8.setCurrentText(data[5])
self.comboBox_6.setCurrentText(data[6])
self.lineEdit_6.setText(str(data[7]))
def Edit_Books(self):
self.db = MySQLdb.connect(host='localhost' , user='root' , password ='8584' , db='library')
self.cur = self.db.cursor()
book_title = self.lineEdit_8.text()
book_description = self.textEdit_2.toPlainText()
book_code = self.lineEdit_7.text()
book_category = self.comboBox_7.currentText()
book_author = self.comboBox_8.currentText()
book_publisher = self.comboBox_6.currentText()
book_price = self.lineEdit_6.text()
search_book_title = self.lineEdit_5.text()
self.cur.execute('''
UPDATE book SET book_name=%s ,book_description=%s ,book_code=%s ,book_category=%s ,book_author=%s ,book_publisher=%s ,book_price=%s WHERE book_name = %s
''', (book_title,book_description,book_code,book_category,book_author,book_publisher , book_price , search_book_title))
self.db.commit()
self.statusBar().showMessage('book updated')
self.Show_All_Books()
def Delete_Books(self):
self.db = MySQLdb.connect(host='localhost' , user='root' , password ='8584' , db='library')
self.cur = self.db.cursor()
book_title = self.lineEdit_5.text()
warning = QMessageBox.warning(self , 'Delete Book' , "are you sure you want to delete this book" , QMessageBox.Yes | QMessageBox.No)
if warning == QMessageBox.Yes :
sql = ''' DELETE FROM book WHERE book_name = %s '''
self.cur.execute(sql , [(book_title)])
self.db.commit()
self.statusBar().showMessage('Book Deleted')
self.Show_All_Books
########################################
######### Clients #################
def Show_All_Clients(self):
self.db = MySQLdb.connect(host='localhost', user='root', password='8584', db='library')
self.cur = self.db.cursor()
self.cur.execute(''' SELECT client_name , client_email ,client_nationalid FROM clients ''')
data = self.cur.fetchall()
print(data)
self.tableWidget_6.setRowCount(0)
self.tableWidget_6.insertRow(0)
for row, form in enumerate(data):
for column, item in enumerate(form):
self.tableWidget_6.setItem(row, column, QTableWidgetItem(str(item)))
column += 1
row_position = self.tableWidget_6.rowCount()
self.tableWidget_6.insertRow(row_position)
self.db.close()
def Add_New_Client(self):
client_name = self.lineEdit_22.text()
client_email = self.lineEdit_23.text()
client_nationalid = self.lineEdit_24.text()
self.db = MySQLdb.connect(host='localhost' , user='root' , password ='8584' , db='library')
self.cur = self.db.cursor()
self.cur.execute('''
INSERT INTO clients(client_name , client_email , client_nationalid)
VALUES (%s , %s , %s)
''' , (client_name , client_email , client_nationalid))
self.db.commit()
self.db.close()
self.statusBar().showMessage('New CLient Added')
self.Show_All_Clients()
def Search_Client(self):
client_national_id = self.lineEdit_25.text()
self.db = MySQLdb.connect(host='localhost' , user='root' , password ='8584' , db='library')
self.cur = self.db.cursor()
sql = ''' SELECT * FROM clients WHERE client_nationalid = %s '''
self.cur.execute(sql , [(client_national_id)])
data = self.cur.fetchone()
print(data)
self.lineEdit_28.setText(data[1])
self.lineEdit_27.setText(data[2])
self.lineEdit_26.setText(data[3])
def Edit_Client(self):
client_original_national_id = self.lineEdit_25.text()
client_name = self.lineEdit_28.text()
client_email = self.lineEdit_27.text()
client_national_id = self.lineEdit_26.text()
self.db = MySQLdb.connect(host='localhost' , user='root' , password ='8584' , db='library')
self.cur = self.db.cursor()
self.cur.execute('''
UPDATE clients SET client_name = %s , client_email = %s , client_nationalid = %s WHERE client_nationalid = %s
''' , (client_name , client_email , client_national_id , client_original_national_id))
self.db.commit()
self.db.close()
self.statusBar().showMessage('CLient Data Updated ')
self.Show_All_Clients()
def Delete_Client(self):
client_original_national_id = self.lineEdit_25.text()
warning_message = QMessageBox.warning(self , "Delete CLient" , "are you sure you want to delete this client" , QMessageBox.Yes | QMessageBox.No)
if warning_message == QMessageBox.Yes :
self.db = MySQLdb.connect(host='localhost' , user='root' , password ='8584' , db='library')
self.cur = self.db.cursor()
sql = ''' DELETE FROM clients WHERE client_nationalid = %s '''
self.cur.execute(sql , [(client_original_national_id)])
self.db.commit()
self.db.close()
self.statusBar().showMessage('CLient Deleted ')
self.Show_All_Clients()
########################################
######### users #################
def Add_New_User(self):
self.db = MySQLdb.connect(host='localhost' , user='root' , password ='8584' , db='library')
self.cur = self.db.cursor()
username = self.lineEdit_9.text()
email = self.lineEdit_10.text()
password = self.lineEdit_11.text()
password2 = self.lineEdit_12.text()
if password == password2 :
self.cur.execute('''
INSERT INTO users(user_name , user_email , user_password)
VALUES (%s , %s , %s)
''' , (username , email , password))
self.db.commit()
self.statusBar().showMessage('New User Added')
else:
self.label_30.setText('please add a valid password twice')
def Login(self):
self.db = MySQLdb.connect(host='localhost' , user='root' , password ='8584' , db='library')
self.cur = self.db.cursor()
username = self.lineEdit_14.text()
password = self.lineEdit_13.text()
sql = ''' SELECT * FROM users'''
self.cur.execute(sql)
data = self.cur.fetchall()
for row in data :
if username == row[1] and password == row[3]:
print('user match')
self.statusBar().showMessage('Valid Username & Password')
self.groupBox_4.setEnabled(True)
self.lineEdit_17.setText(row[1])
self.lineEdit_15.setText(row[2])
self.lineEdit_16.setText(row[3])
def Edit_User(self):
username = self.lineEdit_17.text()
email = self.lineEdit_15.text()
password = self.lineEdit_16.text()
password2 = self.lineEdit_18.text()
original_name = self.lineEdit_14.text()
if password == password2 :
self.db = MySQLdb.connect(host='localhost', user='root', password='8584', db='library')
self.cur = self.db.cursor()
print(username)
print(email)
print(password)
self.cur.execute('''
UPDATE users SET user_name=%s , user_email=%s , user_password=%s WHERE user_name=%s
''', (username , email , password , original_name))
self.db.commit()
self.statusBar().showMessage('User Data Updated Successfully')
else:
print('make sure you entered you password correctly')
########################################
######### settings #################
def Add_Category(self):
self.db = MySQLdb.connect(host='localhost' , user='root' , password ='8584' , db='library')
self.cur = self.db.cursor()
category_name = self.lineEdit_19.text()
self.cur.execute('''
INSERT INTO category (category_name) VALUES (%s)
''' , (category_name,))
self.db.commit()
self.statusBar().showMessage('New Category Addedd ')
self.lineEdit_19.setText('')
self.Show_Category()
self.Show_Category_Combobox()
def Show_Category(self):
self.db = MySQLdb.connect(host='localhost' , user='root' , password ='8584' , db='library')
self.cur = self.db.cursor()
self.cur.execute(''' SELECT category_name FROM category''')
data = self.cur.fetchall()
if data :
self.tableWidget_2.setRowCount(0)
self.tableWidget_2.insertRow(0)
for row , form in enumerate(data):
for column , item in enumerate(form) :
self.tableWidget_2.setItem(row , column , QTableWidgetItem(str(item)))
column += 1
row_position = self.tableWidget_2.rowCount()
self.tableWidget_2.insertRow(row_position)
def Add_Author(self):
self.db = MySQLdb.connect(host='localhost' , user='root' , password ='8584' , db='library')
self.cur = self.db.cursor()
author_name = self.lineEdit_20.text()
self.cur.execute('''
INSERT INTO authors (author_name) VALUES (%s)
''' , (author_name,))
self.db.commit()
self.lineEdit_20.setText('')
self.statusBar().showMessage('New Author Addedd ')
self.Show_Author()
self.Show_Author_Combobox()
def Show_Author(self):
self.db = MySQLdb.connect(host='localhost', user='root', password='8584', db='library')
self.cur = self.db.cursor()
self.cur.execute(''' SELECT author_name FROM authors''')
data = self.cur.fetchall()
if data:
self.tableWidget_3.setRowCount(0)
self.tableWidget_3.insertRow(0)
for row, form in enumerate(data):
for column, item in enumerate(form):
self.tableWidget_3.setItem(row, column, QTableWidgetItem(str(item)))
column += 1
row_position = self.tableWidget_3.rowCount()
self.tableWidget_3.insertRow(row_position)
def Add_Publisher(self):
self.db = MySQLdb.connect(host='localhost' , user='root' , password ='8584' , db='library')
self.cur = self.db.cursor()
publisher_name = self.lineEdit_21.text()
self.cur.execute('''
INSERT INTO publisher (publisher_name) VALUES (%s)
''' , (publisher_name,))
self.db.commit()
self.lineEdit_21.setText('')
self.statusBar().showMessage('New Publisher Addedd ')
self.Show_Publisher()
self.Show_Publisher_Combobox()
def Show_Publisher(self):
self.db = MySQLdb.connect(host='localhost', user='root', password='8584', db='library')
self.cur = self.db.cursor()
self.cur.execute(''' SELECT publisher_name FROM publisher''')
data = self.cur.fetchall()
if data:
self.tableWidget_4.setRowCount(0)
self.tableWidget_4.insertRow(0)
for row, form in enumerate(data):
for column, item in enumerate(form):
self.tableWidget_4.setItem(row, column, QTableWidgetItem(str(item)))
column += 1
row_position = self.tableWidget_4.rowCount()
self.tableWidget_4.insertRow(row_position)
########################################
######### show settings data in UI #################
def Show_Category_Combobox(self):
self.db = MySQLdb.connect(host='localhost', user='root', password='8584', db='library')
self.cur = self.db.cursor()
self.cur.execute(''' SELECT category_name FROM category ''')
data = self.cur.fetchall()
self.comboBox_3.clear()
for category in data :
self.comboBox_3.addItem(category[0])
self.comboBox_7.addItem(category[0])
def Show_Author_Combobox(self):
self.db = MySQLdb.connect(host='localhost', user='root', password='8584', db='library')
self.cur = self.db.cursor()
self.cur.execute(''' SELECT author_name FROM authors''')
data = self.cur.fetchall()
self.comboBox_4.clear()
for author in data :
self.comboBox_4.addItem(author[0])
self.comboBox_8.addItem(author[0])
def Show_Publisher_Combobox(self):
self.db = MySQLdb.connect(host='localhost', user='root', password='8584', db='library')
self.cur = self.db.cursor()
self.cur.execute(''' SELECT publisher_name FROM publisher''')
data = self.cur.fetchall()
self.comboBox_5.clear()
for publisher in data :
self.comboBox_5.addItem(publisher[0])
self.comboBox_6.addItem(publisher[0])
########################################
######### Export Data #################
def Export_Day_Operations(self):
self.db = MySQLdb.connect(host='localhost', user='root', password='8584', db='library')
self.cur = self.db.cursor()
self.cur.execute('''
SELECT book_name , client , type , date , to_date FROM dayoperations
''')
data = self.cur.fetchall()
wb = Workbook('day_operations.xlsx')
sheet1 = wb.add_worksheet()
sheet1.write(0,0,'book title')
sheet1.write(0,1,'cliant name')
sheet1.write(0,2,'type')
sheet1.write(0,3,'from - date')
sheet1.write(0,4,'to - date')
row_number = 1
for row in data :
column_number = 0
for item in row :
sheet1.write(row_number , column_number , str(item))
column_number += 1
row_number += 1
wb.close()
self.statusBar().showMessage('Report Created Successfully')
def Export_Books(self):
self.db = MySQLdb.connect(host='localhost', user='root', password='8584', db='library')
self.cur = self.db.cursor()
self.cur.execute(''' SELECT book_code,book_name,book_description,book_category,book_author,book_publisher,book_price FROM book''')
data = self.cur.fetchall()
wb = Workbook('all_books.xlsx')
sheet1 = wb.add_worksheet()
sheet1.write(0,0 , 'Book Code')
sheet1.write(0,1 , 'Book Name')
sheet1.write(0,2 , 'Book Description')
sheet1.write(0,3 , 'Book Category')
sheet1.write(0,4 , 'Book Author')
sheet1.write(0,5 , 'Book publisher')
sheet1.write(0,6 , 'Book Price')
row_number = 1
for row in data :
column_number = 0
for item in row :
sheet1.write(row_number , column_number , str(item))
column_number += 1
row_number += 1
wb.close()
self.statusBar().showMessage('Book Report Created Successfully')
def Export_Clients(self):
self.db = MySQLdb.connect(host='localhost', user='root', password='8584', db='library')
self.cur = self.db.cursor()
self.cur.execute(''' SELECT client_name , client_email ,client_nationalid FROM clients ''')
data = self.cur.fetchall()
wb = Workbook('all_CLients.xlsx')
sheet1 = wb.add_worksheet()
sheet1.write(0,0 , 'Client Name')
sheet1.write(0,1 , 'CLient Email')
sheet1.write(0,2 , 'CLient NationalID')
row_number = 1
for row in data :
column_number = 0
for item in row :
sheet1.write(row_number , column_number , str(item))
column_number += 1
row_number += 1
wb.close()
self.statusBar().showMessage('CLients Report Created Successfully')
########################################
######### UI Themes #################
def Dark_Blue_Theme(self):
style = open('themes/darkblue.css' , 'r')
style = style.read()
self.setStyleSheet(style)
def Dark_Gray_Theme(self):
style = open('themes/darkgray.css' , 'r')
style = style.read()
self.setStyleSheet(style)
def Dark_Orange_Theme(self):
style = open('themes/darkorange.css' , 'r')
style = style.read()
self.setStyleSheet(style)
def QDark_Theme(self):
style = open('themes/qdark.css' , 'r')
style = style.read()
self.setStyleSheet(style)
def main():
app = QApplication(sys.argv)
window = Login()
window.show()
app.exec_()
if __name__ == '__main__':
main()