forked from BBN-Q/PyQLab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExpSettingsView.enaml
More file actions
93 lines (84 loc) · 2.63 KB
/
ExpSettingsView.enaml
File metadata and controls
93 lines (84 loc) · 2.63 KB
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
from enaml.widgets.api import MainWindow, Container, Notebook, Page, GroupBox, Label, ToolBar, \
Action, FileDialog, ComboBox, PushButton
from enaml.widgets.include import Include
from enaml.layout.api import hbox, vbox, spacer
from enaml.core.api import Looper, Include
from QGL.ChannelsViews import ChannelLibraryView
from instruments.InstrumentManagerView import InstrumentManagerView
from SweepsViews import SweepManager
from MeasFiltersViews import MeasFilterManager
#See what's in the quick pick file to enumerate it
import config, json
try:
with open(config.quickpickFile, 'r') as FID:
quickPicks = json.load(FID)
quickpickList = quickPicks.keys()
except IOError:
print('No quick pick file found.')
quickpickList = []
def get_update_script_file_callback(expSettings):
def update_script_file_callback(dlg):
if dlg.result == 'accepted': #if the pressed "open" otherwise we get 'rejected'
expSettings.curFileName = dlg.path
return update_script_file_callback
enamldef ExpSettingsView(MainWindow):
id: main
attr expSettings
attr curFileName := expSettings.curFileName
title = 'Experiment Settings'
ToolBar:
Action:
text = 'Save'
tool_tip << 'Save to {}'.format(curFileName)
triggered :: expSettings.write_to_file()
Action:
text = 'Change File'
tool_tip = 'Update script file output location.'
triggered ::
dlg = FileDialog(root_object(), title='Choose a script file..', mode='save_file',
callback=get_update_script_file_callback(expSettings), filters=['*.json'])
dlg.open()
Action:
text = 'CW Mode'
checkable = True
checked := expSettings.CWMode
Action:
text = 'Debug'
tool_tip << 'Start debugger console'
triggered :: import pdb; pdb.set_trace()
Container:
padding = 5
Notebook:
tab_style = 'preferences'
Page:
title = 'Channels'
closable = False
ChannelLibraryView:
channelLib := expSettings.channels
instrumentLib := expSettings.instruments
Page:
title = 'Instruments'
closable = False
InstrumentManagerView:
instrLib := expSettings.instruments
Page:
title = "Measurements"
closable = False
MeasFilterManager:
filterLib := expSettings.measurements
Page:
title = "Sweeps"
closable = False
SweepManager:
sweepLib := expSettings.sweeps
GroupBox:
title = 'Quick Picker'
constraints = [hbox(quickpickCombo, quickpickApply, spacer.flex())]
ComboBox: quickpickCombo:
items << quickpickList
hug_width = 'medium'
PushButton: quickpickApply:
text = 'Apply'
clicked ::
expSettings.apply_quickpick(quickpickList[quickpickCombo.index])
hug_width = 'medium'