Commit 7f5b270cd1428fb7a4ea403c80abb6a8292fcbba

Authored by Brice Colombier
1 parent 87f01404ef
Exists in master

Moved status bar and tabs to different files

Showing 4 changed files with 56 additions and 37 deletions

GUI/add_frame_elements.py View file @ 7f5b270
... ... @@ -27,7 +27,7 @@
27 27 self.com_port_button_connect.pack(side=LEFT)
28 28 self.com_port_button_disconnect = Button(self.motherboard_frame,
29 29 text="Disconnect",
30   - state=DISABLED,
  30 + state=NORMAL,
31 31 command=self.disconnect)
32 32 self.com_port_button_disconnect.pack(side=LEFT)
33 33 # ------------------------------------------------------
... ... @@ -61,7 +61,7 @@
61 61 self.reconciliation_parameter_initial_block_size_spinbox = Spinbox(self.CASCADE_frame,
62 62 values=(4, 8, 16, 32, 64),
63 63 width=3,
64   - state="disabled")
  64 + state="normal")
65 65 self.reconciliation_parameter_initial_block_size_spinbox.grid(row=0,
66 66 column=2)
67 67 self.reconciliation_parameter_number_of_passes_label=Label(self.CASCADE_frame,
68 68  
... ... @@ -73,13 +73,13 @@
73 73 from_=1,
74 74 to=25,
75 75 width=3,
76   - state="disabled")
  76 + state="normal")
77 77 self.reconciliation_parameter_number_of_passes_spinbox.grid(row=1,
78 78 column=2)
79 79 self.perform_reconciliation_button=Button(self.CASCADE_frame,
80 80 text="Perform reconciliation",
81 81 command=self.perform_reconciliation,
82   - state="disabled")
  82 + state="normal")
83 83 self.perform_reconciliation_button.grid(row=0,
84 84 column=3,
85 85 rowspan=2,
... ... @@ -88,7 +88,7 @@
88 88 text="Get/update reference response",
89 89 command=self.get_PUF_reference_response,
90 90 width=28,
91   - state="disabled")
  91 + state="normal")
92 92 self.get_reference_response_button.pack(side=LEFT)
93 93 self.reference_response_label=Label(self.get_PUF_reference_response_frame,
94 94 textvariable=self.PUF_reference_response_displayed,
... ... @@ -99,7 +99,7 @@
99 99 text="Derive a key from the response",
100 100 command=self.derive_key_from_response,
101 101 width=28,
102   - state="disabled")
  102 + state="normal")
103 103 self.derive_key_button.pack(side=LEFT)
104 104 self.key_saved_label=Label(self.key_derivation_frame,
105 105 textvariable=self.message_key_saved)
106 106  
107 107  
108 108  
... ... @@ -116,26 +116,26 @@
116 116 self.locking_button=Checkbutton(self.modify_design_frame,
117 117 text="Locking with",
118 118 variable=self.locking,
119   - state="disabled")
  119 + state="normal")
120 120 self.locking_button.grid(row=0, column=0, sticky=W)
121 121 self.masking_button=Checkbutton(self.modify_design_frame,
122 122 text="Masking with",
123 123 variable=self.masking,
124   - state="disabled")
  124 + state="normal")
125 125 self.masking_button.grid(row=1, column=0, sticky=W)
126 126 self.locking_overhead_spinbox=Spinbox(self.modify_design_frame,
127 127 from_=1,
128 128 to=100,
129 129 width=4,
130 130 textvariable=self.locking_overhead,
131   - state="disabled")
  131 + state="normal")
132 132 self.locking_overhead_spinbox.grid(row=0, column=1)
133 133 self.masking_overhead_spinbox=Spinbox(self.modify_design_frame,
134 134 from_=1,
135 135 to=100,
136 136 width=4,
137 137 textvariable=self.masking_overhead,
138   - state="disabled")
  138 + state="normal")
139 139 self.masking_overhead_spinbox.grid(row=1, column=1)
140 140 self.locking_overhead_label=Label(self.modify_design_frame,
141 141 text="% area overhead")
142 142  
... ... @@ -193,13 +193,13 @@
193 193 padx=5)
194 194 self.modify_design_button=Button(self.modify_design_frame,
195 195 text="Modify design",
196   - state="disabled",
  196 + state="normal",
197 197 command=self.modify_design)
198 198 self.modify_design_button.grid(row=2, column=0)
199 199 # -------------------------------------------------------
200 200 self.generate_modified_design_button=Button(self.generate_modified_design_frame,
201 201 text="Generate modified design",
202   - state="disabled")
  202 + state="normal")
203 203 self.generate_modified_design_button.pack(side=LEFT)
204 204 # -------------------------------------------------------
205 205 self.label_program=Label(self.program_daughterboard_frame,
GUI/build_tabs.py View file @ 7f5b270
  1 +from Tkinter import *
  2 +from ttk import *
  3 +
  4 +
  5 +def build_tabs(self, master):
  6 + self.note = Notebook(master, width = 762)
  7 + self.tab_logic_modifier = Frame(self.note)
  8 + self.note.add(self.tab_logic_modifier,
  9 + text="Logic modifier",
  10 + padding=[0, 5, 0, 0])
  11 + self.tab_enrolment = Frame(self.note)
  12 + self.tab_HECTOR_board_management = Frame(self.note)
  13 + self.note.add(self.tab_HECTOR_board_management,
  14 + text="HECTOR board management",
  15 + padding=[0, 5, 0, 0])
  16 + self.note.add(self.tab_enrolment, text="Enrolment",
  17 + padding=[0, 5, 0, 0])
  18 + self.tab_activation = Frame(self.note)
  19 + self.note.add(self.tab_activation, text="Activation",
  20 + padding=[0, 5, 0, 0])
  21 + self.note.pack(side = "top", fill="y", expand="yes")
GUI/status_bar.py View file @ 7f5b270
  1 +from Tkinter import *
  2 +from ttk import *
  3 +
  4 +
  5 +def status_bar(self, master):
  6 +
  7 + self.status_bar_frame = Frame(master, borderwidth=1, relief="ridge")
  8 + self.status_bar_frame.pack(side="bottom",fill="x")
  9 + self.status_label = Label(self.status_bar_frame,
  10 + textvariable=self.status,
  11 + foreground="red",
  12 + relief="ridge",
  13 + padding=[5, 0, 5, 0])
  14 + self.status_label.pack(side="right")
GUI/tabbed_app.py View file @ 7f5b270
... ... @@ -17,6 +17,8 @@
17 17 import declare_initialize_variables
18 18 import declare_pack_frames
19 19 import add_frame_elements
  20 +import build_tabs
  21 +import status_bar
20 22  
21 23  
22 24 import sys
... ... @@ -42,23 +44,8 @@
42 44 master.iconbitmap(default='./contents/icon.ico')
43 45  
44 46 # Tabs and status bar
45   - self.note = Notebook(master, width = 762)
46   - self.tab_logic_modifier = Frame(self.note)
47   - self.note.add(self.tab_logic_modifier,
48   - text="Logic modifier",
49   - padding=[0, 5, 0, 0])
50   - self.tab_enrolment = Frame(self.note)
51   - self.tab_HECTOR_board_management = Frame(self.note)
52   - self.note.add(self.tab_HECTOR_board_management,
53   - text="HECTOR board management",
54   - padding=[0, 5, 0, 0])
55   - self.note.add(self.tab_enrolment, text="Enrolment",
56   - padding=[0, 5, 0, 0])
57   - self.tab_activation = Frame(self.note)
58   - self.note.add(self.tab_activation, text="Activation",
59   - padding=[0, 5, 0, 0])
60   - self.note.pack(side = "top", fill="y", expand="yes")
61   -
  47 + build_tabs.build_tabs(self, master)
  48 +
62 49 # Menu bar
63 50 build_menu.build_menu(self, master)
64 51  
... ... @@ -71,14 +58,8 @@
71 58 # Frame elements
72 59 add_frame_elements.add_frame_elements(self)
73 60  
74   - self.status_bar_frame = Frame(master, borderwidth=1, relief="ridge")
75   - self.status_bar_frame.pack(side="bottom",fill="x")
76   - self.status_label = Label(self.status_bar_frame,
77   - textvariable=self.status,
78   - foreground="red",
79   - relief="ridge",
80   - padding=[5, 0, 5, 0])
81   - self.status_label.pack(side="right")
  61 + # Status bar
  62 + status_bar.status_bar(self, master)
82 63  
83 64  
84 65 def open_file(self):
... ... @@ -198,6 +179,7 @@
198 179 self.key = ''.join('{0:08b}'.format(ord(x), 'b') for x in PRK_f.final()).replace("0b", "")
199 180 key_file_name = "./../User_space/key_"+""+".txt"
200 181 with open(key_file_name, "w") as key_file:
  182 + key_file.write("Salt = "+self.salt+"\n")
201 183 key_file.write("Key = "+self.key)
202 184 self.message_key_saved.set("Key saved under "+key_file_name)
203 185