-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
95 lines (82 loc) · 3.46 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
import tkinter, ARINC429
from tkinter import ttk, messagebox, filedialog
IcdTable = ARINC429.ICD()
def bin2logical():
A429Frame=ARINC429.Frame()
FullFields = str("")
Check = A429Frame.Decode(Frame = TxtArincFrame.get(),
ICD = IcdTable,
Channel = CmbChannel.get())
if Check.Code != 0:
messagebox.showerror(title = Check.title,
message = Check.message)
return
LogicalText=A429Frame.GetLogicalData()
TxtLabel.delete(0,'end')
TxtLabel.insert(0,LogicalText["LABEL"])
TxtSSM.delete(0,'end')
TxtSSM.insert(0,LogicalText["SSM"])
TxtSDI.delete(0,'end')
TxtSDI.insert(0,LogicalText["SDI"])
TxtPayload.delete(0,'end')
TxtPayload.insert(0,LogicalText["PAYLOAD"])
for entry in LogicalText:
if entry == "LABEL" or \
entry == "PAYLOAD" or \
entry == "SSM" or \
entry == "SDI" :
continue
FullFields += entry +'\t=> ' + LogicalText[entry] +'\n'
LblFields.config(text=FullFields)
def LoadICD():
FileName = filedialog.askopenfilename()
ErrorCode = IcdTable.Load(FileDir=FileName)
if ErrorCode.Code != 0:
messagebox.showerror(title=ErrorCode.title,
message= ErrorCode.message)
return
CmbChannel.config(values=IcdTable.GetChannelList())
CmbChannel.current(newindex=0)
def ForgetICD():
IcdTable.Invalidate()
CmbChannel.config(values=("No channels available",))
CmbChannel.current(newindex=0)
home = tkinter.Tk(className= "ARINC 429 translator")
home.title("ARINC 429 Translator")
LblArincFrame=ttk.Label(master=home,text="Arinc 429 frame",justify="center")
LblArincFrame.grid(row=0,column=0,columnspan=3)
TxtArincFrame=ttk.Entry(master=home,width=32)
TxtArincFrame.grid(row=1,column=0,columnspan=3)
CmdBin2Logical=ttk.Button(master=home,text="Translate to logical",
command=bin2logical)
CmdBin2Logical.grid(row=2,column=0)
CmdLoadICD=ttk.Button(master=home,text="Load ICD",command=LoadICD)
CmdLoadICD.grid(row=2,column=1)
CmdForgetICD=ttk.Button(master=home,text="Clear ICD",command=ForgetICD)
CmdForgetICD.grid(row=2,column=2)
LblChannel=ttk.Label(master=home,text="Channel\t=> ")
LblChannel.grid(row=3,column=0,sticky='w')
CmbChannel=ttk.Combobox(master=home,justify='center',
values=("No channels available",),
state='readonly',width=21)
CmbChannel.grid(row=3,column=1,columnspan=2,sticky='w')
CmbChannel.current(0)
LblLabel=ttk.Label(master=home,text="Label\t=> ")
LblLabel.grid(row=4,column=0,sticky='w')
TxtLabel=ttk.Entry(master=home,justify='center',width=21)
TxtLabel.grid(row=4,column=1,columnspan=2,sticky='w')
LblSSM=ttk.Label(master=home,text="SSM\t=> ")
LblSSM.grid(row=5,column=0,sticky='w')
TxtSSM=ttk.Entry(master=home,justify='center',width=21)
TxtSSM.grid(row=5,column=1,columnspan=2,sticky='w')
LblSDI=ttk.Label(master=home,text="SDI\t=> ")
LblSDI.grid(row=6,column=0,sticky='w')
TxtSDI=ttk.Entry(master=home,justify='center',width=21)
TxtSDI.grid(row=6,column=1,columnspan=2,sticky='w')
LblPayload=ttk.Label(master=home,text="Payload\t=> ")
LblPayload.grid(row=7,column=0,sticky='w')
TxtPayload=ttk.Entry(master=home,justify='center',width=21)
TxtPayload.grid(row=7,column=1,columnspan=2,sticky='w')
LblFields=ttk.Label(master=home,text="Logical field\t=> value")
LblFields.grid(row=8,column=0,columnspan=3,sticky='w')
home.mainloop()