-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
191 lines (142 loc) · 5.45 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
import sql_cmd
import copy_png
import time
import sys
from PySide6.QtCore import QObject,Slot
from PySide6.QtGui import QGuiApplication
from PySide6.QtQml import QQmlApplicationEngine
from jinja2 import Template
import datetime
import tempy
client_list=list()
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ata
class Manager(QObject):
def __init__(self, parent=None):
super().__init__(parent)
@Slot(str,str)
def foo(self,inpaaat,kk):
print("clicked "+inpaaat+kk)
@Slot(result=str)
def rett(self):
return "kkkk"
@Slot(str,result=str)
def copy_from_qml_png(self,input_dialog):
ress=copy_png.copy_file_png(input_dialog)
return ress
@Slot(str)
def dbbbb(self,num):
print("clicked "+num)
@Slot(str,str)
def dbbbd(self,num,name):
database = r"my.db3"
conn = sql_cmd.create_connection(database)
print(int(num),name)
sql_cmd.insert_customer(conn,int(num),name)
conn.close()
@Slot(str,str,str)
def db_insert_to_group(self,name,img,radif):
database = r"my.db3"
conn = sql_cmd.create_connection(database)
sql_cmd.insert_group(conn,name,img,int(radif))
conn.close()
@Slot(str,str,int,str,str,str,str,int,str,int)
def db_insert_to_order(self,mobile,qty,time,location,employer_id,Product_name,price,succes,Group_name,shomareh):
database = r"my.db3"
conn = sql_cmd.create_connection(database)
sql_cmd.insert_order(conn,mobile,qty,time,location,employer_id,Product_name,price,succes,Group_name,shomareh)
conn.close()
@Slot(str,str,str,int,str)
def db_insert_client_info(self,name,img,addr,num,mail):
# print(name,img,addr,num,mail)
database = r"my.db3"
conn = sql_cmd.create_connection(database)
sql_cmd.insert_client_info(conn,name,img,addr,num,mail)
conn.close()
# tempy.render_invoice2(name,img,addr,num,mail)
print(name,img,addr,num,mail)
@Slot(list)
def print_to_Fisch(self,fisch_product):
global client_list
# print(fisch_product)
# database = r"my.db3"
# conn = sql_cmd.create_connection(database)
# result=sql_cmd.select_client(conn)
# conn.close()
# return ressult
tempy.render_invoice(fisch_product,client_list)
@Slot(str,str,str,str,str)
def db_insert_to_product(self,name,img,pricee,group_id,Available):
database = r"my.db3"
conn = sql_cmd.create_connection(database)
sql_cmd.insert_product(conn,name,img,float(pricee),int(group_id),int(Available))
conn.close()
@Slot()
def db_delete_client(self):
database = r"my.db3"
conn = sql_cmd.create_connection(database)
sql_cmd.delete_client(conn)
conn.close()
@Slot(str,str)
def db_delete_Groups(self,name,img):
database = r"my.db3"
conn = sql_cmd.create_connection(database)
sql_cmd.delete_Groups(conn,name,img)
conn.close()
@Slot(str,str,str)
def db_delete_product(self,name,img,price):
database = r"my.db3"
conn = sql_cmd.create_connection(database)
sql_cmd.delete_product(conn,name,img,price)
print("hii")
conn.close()
@Slot(result=list)
def db_select_from_client(self):
database = r"my.db3"
conn = sql_cmd.create_connection(database)
ressult=sql_cmd.select_client(conn)
conn.close()
return ressult
@Slot(result=list)
def db_select_from_group(self):
database = r"my.db3"
conn = sql_cmd.create_connection(database)
ressult=sql_cmd.select_group(conn)
conn.close()
return ressult
@Slot(str,result=list)
def db_select_product(self,group_name):
database = r"my.db3"
conn = sql_cmd.create_connection(database)
ressult=sql_cmd.select_product(conn,group_name)
conn.close()
return ressult
@Slot(str,result=int)
def db_select_group_id(self,group_name):
database = r"my.db3"
conn = sql_cmd.create_connection(database)
ressult=sql_cmd.select_group_id(conn,group_name)
conn.close()
return ressult
@Slot(result=int)
def db_take_time(self):
result=int(time.time())
print(result)
return result
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++sa
def main():
global client_list
# +++++++++++++++++++++++++++take client info by list++++++++++++++++++++++++++++++#
database = r"my.db3"
conn = sql_cmd.create_connection(database)
client_list=sql_cmd.select_client(conn)
conn.close()
# tempy.render_invoice2(client_list)
# +++++++++++++++++++++++++++take client info by list++++++++++++++++++++++++++++++#
app = QGuiApplication(sys.argv)
manager = Manager()
engine = QQmlApplicationEngine()
engine.rootContext().setContextProperty("manager", manager)
engine.load("App.qml")
sys.exit(app.exec())
if __name__ == "__main__":
main()