blob: 37899fa4cfbfdd96ff284dacc3e532d7c7554c93 [file] [log] [blame]
emayecs5656b2b2021-08-04 12:44:13 -04001#!/usr/bin/env python3
emayecs5966a532021-07-29 10:07:02 -04002#
3#-----------------------------------------------------------
emayecs14748312021-08-05 14:21:26 -04004# Settings window for the characterization tool
emayecs5966a532021-07-29 10:07:02 -04005#
6#-----------------------------------------------------------
7# Written by Tim Edwards
8# efabless, inc.
9# March 17, 2017
10# Version 0.1
11#--------------------------------------------------------
12
13import re
14import tkinter
15from tkinter import ttk
16
17class Settings(tkinter.Toplevel):
emayecs14748312021-08-05 14:21:26 -040018 """characterization tool settings management."""
emayecs5966a532021-07-29 10:07:02 -040019
20 def __init__(self, parent=None, fontsize = 11, callback = None, *args, **kwargs):
21 '''See the __init__ for Tkinter.Toplevel.'''
22 tkinter.Toplevel.__init__(self, parent, *args, **kwargs)
23
24 s = ttk.Style()
25 s.configure('normal.TButton', font=('Helvetica', fontsize), border = 3, relief = 'raised')
26 self.protocol("WM_DELETE_WINDOW", self.close)
27 self.parent = parent
28 self.withdraw()
emayecs14748312021-08-05 14:21:26 -040029 self.title('Characterization Tool Settings')
emayecs5966a532021-07-29 10:07:02 -040030 self.sframe = tkinter.Frame(self)
31 self.sframe.grid(column = 0, row = 0, sticky = "news")
32
33 self.sframe.stitle = ttk.Label(self.sframe,
34 style='title.TLabel', text = 'Settings')
35 self.sframe.stitle.pack(side = 'top', fill = 'x', expand = 'true')
36 self.sframe.sbar = ttk.Separator(self.sframe, orient='horizontal')
37 self.sframe.sbar.pack(side = 'top', fill = 'x', expand = 'true')
38
39 self.doforce = tkinter.IntVar(self.sframe)
40 self.doforce.set(0)
41 self.sframe.force = ttk.Checkbutton(self.sframe, text='Force netlist regeneration',
42 variable = self.doforce)
43 self.sframe.force.pack(side = 'top', anchor = 'w')
44
45 self.doedit = tkinter.IntVar(self.sframe)
46 self.doedit.set(0)
47 self.sframe.edit = ttk.Checkbutton(self.sframe, text='Allow edit of all parameters',
48 variable = self.doedit)
49 self.sframe.edit.pack(side = 'top', anchor = 'w')
50
51 self.dokeep = tkinter.IntVar(self.sframe)
52 self.dokeep.set(0)
53 self.sframe.keep = ttk.Checkbutton(self.sframe, text='Keep simulation files',
54 variable = self.dokeep)
55 self.sframe.keep.pack(side = 'top', anchor = 'w')
56
57 self.doplot = tkinter.IntVar(self.sframe)
58 self.doplot.set(1)
59 self.sframe.plot = ttk.Checkbutton(self.sframe, text='Create plot files locally',
60 variable = self.doplot)
61 self.sframe.plot.pack(side = 'top', anchor = 'w')
62
63 self.dotest = tkinter.IntVar(self.sframe)
64 self.dotest.set(0)
65 self.sframe.test = ttk.Checkbutton(self.sframe, text='Submission test-only mode',
66 variable = self.dotest)
67 self.sframe.test.pack(side = 'top', anchor = 'w')
68
69 self.doschem = tkinter.IntVar(self.sframe)
70 self.doschem.set(0)
71 self.sframe.schem = ttk.Checkbutton(self.sframe,
72 text='Force submit as schematic only',
73 variable = self.doschem)
74 self.sframe.schem.pack(side = 'top', anchor = 'w')
75
76 self.dosubmitfailed = tkinter.IntVar(self.sframe)
77 self.dosubmitfailed.set(0)
78 self.sframe.submitfailed = ttk.Checkbutton(self.sframe,
79 text='Allow submission of unsimulated/failing design',
80 variable = self.dosubmitfailed)
81 self.sframe.submitfailed.pack(side = 'top', anchor = 'w')
82
83 self.dolog = tkinter.IntVar(self.sframe)
84 self.dolog.set(0)
85 self.sframe.log = ttk.Checkbutton(self.sframe, text='Log simulation output',
86 variable = self.dolog)
87 self.sframe.log.pack(side = 'top', anchor = 'w')
88
89 self.loadsave = tkinter.IntVar(self.sframe)
90 self.loadsave.set(0)
91 self.sframe.loadsave = ttk.Checkbutton(self.sframe, text='Unlimited loads/saves',
92 variable = self.loadsave)
93 self.sframe.loadsave.pack(side = 'top', anchor = 'w')
94
95 # self.sframe.sdisplay.sopts(side = 'top', fill = 'x', expand = 'true')
96
97 self.bbar = ttk.Frame(self)
98 self.bbar.grid(column = 0, row = 1, sticky = "news")
99 self.bbar.close_button = ttk.Button(self.bbar, text='Close',
100 command=self.close, style = 'normal.TButton')
101 self.bbar.close_button.grid(column=0, row=0, padx = 5)
102
103 # Callback-on-close
104 self.callback = callback
105
106 def grid_configure(self, padx, pady):
107 pass
108
109 def redisplay(self):
110 pass
111
112 def get_force(self):
113 # return the state of the "force netlist regeneration" checkbox
114 return False if self.doforce.get() == 0 else True
115
116 def get_edit(self):
117 # return the state of the "edit all parameters" checkbox
118 return False if self.doedit.get() == 0 else True
119
120 def get_keep(self):
121 # return the state of the "keep simulation files" checkbox
122 return False if self.dokeep.get() == 0 else True
123
124 def get_plot(self):
125 # return the state of the "create plot files locally" checkbox
126 return False if self.doplot.get() == 0 else True
127
128 def get_test(self):
129 # return the state of the "submit test mode" checkbox
130 return False if self.dotest.get() == 0 else True
131
132 def get_schem(self):
133 # return the state of the "submit as schematic" checkbox
134 return False if self.doschem.get() == 0 else True
135
136 def get_submitfailed(self):
137 # return the state of the "submit failed" checkbox
138 return False if self.dosubmitfailed.get() == 0 else True
139
140 def get_log(self):
141 # return the state of the "log simulation output" checkbox
142 return False if self.dolog.get() == 0 else True
143
144 def get_loadsave(self):
145 # return the state of the "unlimited loads/saves" checkbox
146 return False if self.loadsave.get() == 0 else True
147
148 def close(self):
149 # pop down settings window
150 self.withdraw()
151 # execute the callback function, if one is given
152 if self.callback:
153 self.callback()
154
155 def open(self):
156 # pop up settings window
157 self.deiconify()
158 self.lift()