-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccountinfo.py
59 lines (49 loc) · 1.98 KB
/
accountinfo.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
from tkinter import *
from tkinter import ttk
import json
class AccountInfo:
#########################
# pArray: json array of platform detail records
def __init__(self, parent):
accountFrame = ttk.LabelFrame(parent, text='Account Info', padding="3 3 12 12")
accountFrame.grid(column=0, row=0, sticky=(N, W, E, S))
accountFrame.columnconfigure(0, weight=1)
accountFrame.rowconfigure(0, weight=1)
with open("platforms.json") as file:
pList= json.load(file)
pArray = pList["platforms"]
maxWidth = 0
for plat in pArray:
if plat["active"] == "true":
if len(plat["name"]) > maxWidth:
maxWidth = len(plat["name"])
maxWidth = maxWidth * 2
# self.frame = ttk.Frame(accountFrame, borderwidth=5, relief="sunken", width=500, height=300)
# self.frame.grid(column=0, row=0, sticky=(N, W, E, S))
self.tview = ttk.Treeview(parent, height=10, columns=('platform','details'))
self.tview.column("platform", minwidth=0, width=maxWidth, stretch=YES)
self.tview.column("details", minwidth=0, width=maxWidth, stretch=YES)
self.tview = ttk.Treeview(accountFrame, height=10)
self.tview.grid(column=0, row=0, sticky=(N, W, E, S))
for plat in pArray:
if plat["active"] == "true":
self.tview.insert('','end',plat["id"],text=plat["name"])
self.tview.insert(plat["id"],'end',plat,text=plat)
self.tview.grid(column=0, row=0, sticky=NW)
#########################
def execute(self,args):
accountParams={
'safeName': self.project.get(),
'accountName': "MySQL-Dev",
'platformId': "MySQL",
'address': "conjur-master-mac",
'userName': "javauser1",
'secretType': "Password",
'secretValue': "RAndom=12345"
}
accountResponse = requests.post(baseUrl+'/accounts', params=accountParams);
print("accountResponse: "+accountResponse.text);
#########################
def print(self):
print("\"accountRequests\": ")
print(json.dumps(self.tview.selection(), indent=2))