-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofileLoad.py
268 lines (223 loc) · 9.38 KB
/
profileLoad.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
import tkinter
import requests
import json
from functools import partial
buttonStore = []
lastLocation = 0
def saveProfile(): #NOTE Saves Payment Profile.
global lastLocation
ValidationCheck = False
profile = {'email': emailEntry.get(), 'firstName': firstNameEntry.get(), 'lastName': lastNameEntry.get(), 'address1': addressEntry.get(), 'city': cityEntry.get(), 'address2': address2Entry.get(), 'stateFull': stateFullEntry.get(),
'zipcode': zipEntry.get(), 'phone': phoneEntry.get(), 'creditCard': creditCardEntry.get(), 'creditMonth': creditMonthEntry.get(), 'creditYear': creditYearEntry.get(), 'creditCvv': creditCvvEntry.get(), 'proxy': proxyEntry.get()}
for x in buttonStore:
if x['email'] == profile['email']:
x['button'].updateButton(profile)
x['button'].placeButton()
ValidationCheck = True
break
if ValidationCheck == True:
print('updated exisiting profile')
writeFile()
else:
button = createButton(lastLocation, profile)
button.placeButton()
buttonDict = {'email': profile['email'], 'button': button}
buttonStore.append(buttonDict)
lastLocation += 25
writeFile()
def writeFile():
tempSaveList = []
for x in buttonStore:
tempSaveList.append(x['button'].profile)
savefile = open("profiles.json", "w")
savefile.write(json.dumps(tempSaveList))
def loadFile():
try:
savefile = open("profiles.json")
profileList = json.loads(savefile.read())
except:
profileList = []
return profileList
def loadIT(profile):
print('Loading')
firstNameVar.set(profile['firstName'])
lastNameVar.set(profile['lastName'])
emailVar.set(profile['email'])
addressVar.set(profile['address1'])
cityVar.set(profile['city'])
address2Var.set(profile['address2'])
stateFullVar.set(profile['stateFull'])
zipVar.set(profile['zipcode'])
phoneVar.set(profile['phone'])
creditCardVar.set(profile['creditCard'])
creditMonthVar.set(profile['creditMonth'])
creditYearVar.set(profile['creditYear'])
creditCvvVar.set(profile['creditCvv'])
proxyVar.set(profile['proxy'])
def displayProfiles(): #NOTE issue with previous method: old buttons aren't removed. Solution use classes to edit/update existing or add new
global lastLocation
initialSpot = 100
for x in profileList:
button = createButton(initialSpot, x)
button.placeButton()
buttonDict = {'email': x['email'], 'button': button}
buttonStore.append(buttonDict)
initialSpot += 25
print(button.profile)
lastLocation = initialSpot
class createButton(object):
def __init__(self, vertLocation, profile):
self.profile = profile
self.vertLocation = vertLocation
def updateButton(self, newProfile):
self.profile = newProfile
def placeButton(self):
action_with_arg = partial(loadIT, self.profile)
runButton = tkinter.Button(root, text =str(self.profile['email']), command = action_with_arg)
runButton.pack(side="top")
runButton.place(x = 500,y = self.vertLocation)
'''
GUI Code Below this point
'''
profileList = loadFile()
root = tkinter.Tk()
root.title("Manage Checkout Slots")
my_canvas = tkinter.Canvas(root, width=1000, height=500)
my_canvas.pack()
var = tkinter.StringVar()
label = tkinter.Label(root, textvariable=var, relief="flat", font=("Futura", 40), fg="black")
var.set("Manage Shopify Profiles")
label.pack(fill='both', expand='yes')
label.place(x = 50,y = 0)
result = tkinter.StringVar()
resultLabel = tkinter.Label(root, textvariable=result, relief="flat", font=("Futura", 20), fg="black")
result.set("Waiting...")
resultLabel.pack(fill='both', expand='yes')
resultLabel.place(x = 350,y = 300)
#First Name Entry
firstNameLabel = tkinter.Label(root, text="First Name", relief="flat", font=("Futura", 16), fg="black")
firstNameLabel.pack(fill='both', expand='yes')
firstNameLabel.place(x = 50,y = 75)
firstNameVar = tkinter.StringVar()
firstNameEntry = tkinter.Entry(root, textvariable=firstNameVar, relief='ridge')
firstNameEntry.pack(side='top')
firstNameEntry.place(x = 50,y = 100)
#Last Name Entry
lastNameLabel = tkinter.Label(root, text="Last Name", relief="flat", font=("Futura", 16), fg="black")
lastNameLabel.pack(fill='both', expand='yes')
lastNameLabel.place(x = 50,y = 125)
lastNameVar = tkinter.StringVar()
lastNameEntry = tkinter.Entry(root, textvariable=lastNameVar, relief='ridge')
lastNameEntry.pack(side='top')
lastNameEntry.place(x = 50,y = 150)
#Address Entry
addressLabel = tkinter.Label(root, text="Address", relief="flat", font=("Futura", 16), fg="black")
addressLabel.pack(fill='both', expand='yes')
addressLabel.place(x = 50,y = 175)
addressVar = tkinter.StringVar()
addressEntry = tkinter.Entry(root, textvariable=addressVar, relief='ridge')
addressEntry.pack(side='top')
addressEntry.place(x = 50,y = 200)
#StateAbrev Entry stateAbrev
address2Label = tkinter.Label(root, text="Address2", relief="flat", font=("Futura", 16), fg="black")
address2Label.pack(fill='both', expand='yes')
address2Label.place(x = 50,y = 225)
address2Var = tkinter.StringVar()
address2Entry = tkinter.Entry(root, textvariable=address2Var, relief='ridge')
address2Entry.pack(side='top')
address2Entry.place(x = 50,y = 250)
#City Entry
cityLabel = tkinter.Label(root, text="City", relief="flat", font=("Futura", 16), fg="black")
cityLabel.pack(fill='both', expand='yes')
cityLabel.place(x = 50,y = 275)
cityVar = tkinter.StringVar()
cityEntry = tkinter.Entry(root, textvariable=cityVar, relief='ridge')
cityEntry.pack(side='top')
cityEntry.place(x = 50,y = 300)
#stateFull
stateFullLabel = tkinter.Label(root, text="State (Full)", relief="flat", font=("Futura", 16), fg="black")
stateFullLabel.pack(fill='both', expand='yes')
stateFullLabel.place(x = 50,y = 325)
stateFullVar = tkinter.StringVar()
stateFullEntry = tkinter.Entry(root, textvariable=stateFullVar, relief='ridge')
stateFullEntry.pack(side='top')
stateFullEntry.place(x = 50,y = 350)
#Zip Entry
zipLabel = tkinter.Label(root, text="Zip", relief="flat", font=("Futura", 16), fg="black")
zipLabel.pack(fill='both', expand='yes')
zipLabel.place(x = 50,y = 375)
zipVar = tkinter.StringVar()
zipEntry = tkinter.Entry(root, textvariable=zipVar, relief='ridge')
zipEntry.pack(side='top')
zipEntry.place(x = 50,y = 400)
#creditCard Entry
creditCardLabel = tkinter.Label(root, text="Credit Card Number", relief="flat", font=("Futura", 16), fg="black")
creditCardLabel.pack(fill='both', expand='yes')
creditCardLabel.place(x = 250,y = 75)
creditCardVar = tkinter.StringVar()
creditCardEntry = tkinter.Entry(root, textvariable=creditCardVar, relief='ridge')
creditCardEntry.pack(side='top')
creditCardEntry.place(x = 250,y = 100)
#creditMonth Entry
creditMonthLabel = tkinter.Label(root, text="Credit Card Month (XX)", relief="flat", font=("Futura", 16), fg="black")
creditMonthLabel.pack(fill='both', expand='yes')
creditMonthLabel.place(x = 250,y = 125)
creditMonthVar = tkinter.StringVar()
creditMonthEntry = tkinter.Entry(root, textvariable=creditMonthVar, relief='ridge')
creditMonthEntry.pack(side='top')
creditMonthEntry.place(x = 250,y = 150)
#creditYear Entry
creditYearLabel = tkinter.Label(root, text="Credit Card Year (XXXX)", relief="flat", font=("Futura", 16), fg="black")
creditYearLabel.pack(fill='both', expand='yes')
creditYearLabel.place(x = 250,y = 175)
creditYearVar = tkinter.StringVar()
creditYearEntry = tkinter.Entry(root, textvariable=creditYearVar, relief='ridge')
creditYearEntry.pack(side='top')
creditYearEntry.place(x = 250,y = 200)
#creditCvv Entry
creditCvvLabel = tkinter.Label(root, text="Credit Card CVV", relief="flat", font=("Futura", 16), fg="black")
creditCvvLabel.pack(fill='both', expand='yes')
creditCvvLabel.place(x = 250,y = 225)
creditCvvVar = tkinter.StringVar()
creditCvvEntry = tkinter.Entry(root, textvariable=creditCvvVar, relief='ridge')
creditCvvEntry.pack(side='top')
creditCvvEntry.place(x = 250,y = 250)
#Phone Entry
phoneLabel = tkinter.Label(root, text="Mobile Phone", relief="flat", font=("Futura", 16), fg="black")
phoneLabel.pack(fill='both', expand='yes')
phoneLabel.place(x = 250,y = 275)
phoneVar = tkinter.StringVar()
phoneEntry = tkinter.Entry(root, textvariable=phoneVar, relief='ridge')
phoneEntry.pack(side='top')
phoneEntry.place(x = 250,y = 300)
#email Entry
emailLabel = tkinter.Label(root, text="Email Address", relief="flat", font=("Futura", 16), fg="black")
emailLabel.pack(fill='both', expand='yes')
emailLabel.place(x = 250,y = 325)
emailVar = tkinter.StringVar()
emailEntry = tkinter.Entry(root, textvariable=emailVar, relief='ridge')
emailEntry.pack(side='top')
emailEntry.place(x = 250,y = 350)
#proxy Entry
proxyLabel = tkinter.Label(root, text="Proxy (127.0.0.0:8080) or None", relief="flat", font=("Futura", 16), fg="black")
proxyLabel.pack(fill='both', expand='yes')
proxyLabel.place(x = 250,y = 375)
proxyVar = tkinter.StringVar()
proxyEntry = tkinter.Entry(root, textvariable=proxyVar, relief='ridge')
proxyEntry.pack(side='top')
proxyEntry.place(x = 250,y = 400)
proxyLabel = tkinter.Label(root, text="Proxy (127.0.0.0:8080) or None", relief="flat", font=("Futura", 16), fg="black")
proxyLabel.pack(fill='both', expand='yes')
proxyLabel.place(x = 250,y = 375)
proxyVar = tkinter.StringVar()
proxyEntry = tkinter.Entry(root, textvariable=proxyVar, relief='ridge')
proxyEntry.pack(side='top')
proxyEntry.place(x = 250,y = 400)
profilesLabel = tkinter.Label(root, text="Currently Saved Profiles", relief="flat", font=("Futura", 16), fg="black")
profilesLabel.pack(fill='both', expand='yes')
profilesLabel.place(x = 500,y = 75)
displayProfiles()
runButton = tkinter.Button(root, text ="Save Profile", command = saveProfile)
runButton.pack(side="top")
runButton.place(x = 200,y = 450)
tkinter.mainloop()