a2p2 0.2.15__py3-none-any.whl → 0.7.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- a2p2/__main__.py +39 -0
- a2p2/chara/facility.py +51 -3
- a2p2/chara/gui.py +29 -5
- a2p2/client.py +144 -34
- a2p2/facility.py +11 -1
- a2p2/gui.py +32 -1
- a2p2/jmmc/__init__.py +7 -0
- a2p2/jmmc/catalogs.py +129 -0
- a2p2/jmmc/generated_models.py +191 -0
- a2p2/jmmc/models.py +104 -0
- a2p2/jmmc/services.py +16 -0
- a2p2/jmmc/utils.py +130 -0
- a2p2/jmmc/webservices.py +48 -0
- a2p2/ob.py +95 -9
- a2p2/samp.py +17 -0
- a2p2/version.py +205 -137
- a2p2/vlti/conf/GRAVITY_ditTable.json +21 -19
- a2p2/vlti/conf/GRAVITY_rangeTable.json +200 -28
- a2p2/vlti/conf/MATISSE_rangeTable.json +58 -22
- a2p2/vlti/conf/PIONIER_ditTable.json +1 -1
- a2p2/vlti/conf/PIONIER_rangeTable.json +16 -18
- a2p2/vlti/facility.py +156 -118
- a2p2/vlti/gravity.py +243 -311
- a2p2/vlti/gui.py +162 -40
- a2p2/vlti/instrument.py +264 -49
- a2p2/vlti/matisse.py +61 -147
- a2p2/vlti/pionier.py +34 -157
- {a2p2-0.2.15.dist-info → a2p2-0.7.4.dist-info}/METADATA +34 -20
- a2p2-0.7.4.dist-info/RECORD +39 -0
- {a2p2-0.2.15.dist-info → a2p2-0.7.4.dist-info}/WHEEL +1 -1
- {a2p2-0.2.15.dist-info → a2p2-0.7.4.dist-info}/entry_points.txt +0 -1
- a2p2/vlti/confP104/GRAVITY_ditTable.json +0 -122
- a2p2/vlti/confP104/GRAVITY_rangeTable.json +0 -202
- a2p2/vlti/confP104/MATISSE_ditTable.json +0 -2
- a2p2/vlti/confP104/MATISSE_rangeTable.json +0 -202
- a2p2/vlti/confP104/PIONIER_ditTable.json +0 -77
- a2p2/vlti/confP104/PIONIER_rangeTable.json +0 -118
- a2p2/vlti/confP105/GRAVITY_ditTable.json +0 -37
- a2p2/vlti/confP105/GRAVITY_rangeTable.json +0 -42
- a2p2/vlti/confP105/MATISSE_ditTable.json +0 -2
- a2p2/vlti/confP105/MATISSE_rangeTable.json +0 -44
- a2p2/vlti/confP105/PIONIER_ditTable.json +0 -25
- a2p2/vlti/confP105/PIONIER_rangeTable.json +0 -38
- a2p2-0.2.15.dist-info/RECORD +0 -44
- {a2p2-0.2.15.dist-info → a2p2-0.7.4.dist-info}/LICENSE +0 -0
- {a2p2-0.2.15.dist-info → a2p2-0.7.4.dist-info}/top_level.txt +0 -0
a2p2/vlti/gui.py
CHANGED
@@ -4,27 +4,25 @@ __all__ = []
|
|
4
4
|
|
5
5
|
import sys
|
6
6
|
import logging
|
7
|
+
from turtle import bgcolor
|
7
8
|
|
8
9
|
from a2p2.gui import FacilityUI
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
import ttk
|
14
|
-
else:
|
15
|
-
from tkinter import *
|
16
|
-
from tkinter.messagebox import *
|
17
|
-
import tkinter.ttk as ttk
|
11
|
+
from tkinter import ttk
|
12
|
+
from tkinter import *
|
13
|
+
from tkinter.ttk import *
|
18
14
|
|
19
15
|
logger = logging.getLogger(__name__)
|
20
16
|
|
17
|
+
|
21
18
|
class VltiUI(FacilityUI):
|
22
19
|
|
23
20
|
def __init__(self, a2p2client):
|
24
21
|
logger.info("init VltiUI")
|
25
22
|
FacilityUI.__init__(self, a2p2client)
|
26
23
|
|
27
|
-
self.container = Frame(self, bd=3, relief=SUNKEN)
|
24
|
+
#self.container = Frame(self, bd=3, relief=SUNKEN)
|
25
|
+
self.container = Frame(self, relief=SUNKEN)
|
28
26
|
self.container.grid_rowconfigure(0, weight=1)
|
29
27
|
self.container.grid_columnconfigure(0, weight=1)
|
30
28
|
|
@@ -39,25 +37,32 @@ class VltiUI(FacilityUI):
|
|
39
37
|
self.treeItemToRuns = {}
|
40
38
|
self.treeItemToP2Items = {}
|
41
39
|
|
42
|
-
self.ob=None
|
40
|
+
self.ob = None
|
43
41
|
|
44
42
|
def showLoginFrame(self, ob):
|
45
43
|
self.ob = ob
|
46
44
|
self.addToLog(
|
47
|
-
"Sorry, your %s OB can't be submitted, please log in first, select container and
|
45
|
+
"Sorry, your %s OB can't be submitted, please log in first, select container and press submit button." %
|
48
46
|
(ob.instrumentConfiguration.name))
|
49
47
|
self.loginFrame.tkraise()
|
50
48
|
|
49
|
+
def isBusy(self):
|
50
|
+
self.tree.configure(selectmode='none')
|
51
|
+
|
52
|
+
def isIdle(self):
|
53
|
+
self.tree.configure(selectmode='browse')
|
54
|
+
|
51
55
|
def showTreeFrame(self, ob=None):
|
52
56
|
if ob:
|
53
57
|
instrum = ob.instrumentConfiguration.name
|
54
58
|
else:
|
55
59
|
instrum = "incoming"
|
56
|
-
self.addToLog(
|
60
|
+
self.addToLog(
|
61
|
+
"Please select a runId in ESO P2 database to process %s OB" % instrum)
|
57
62
|
self.treeFrame.tkraise()
|
58
63
|
|
59
64
|
def fillTree(self, runs):
|
60
|
-
logger.debug("Start filling tree")
|
65
|
+
logger.debug(f"Start filling tree with {len(runs)} runs")
|
61
66
|
if len(runs) == 0:
|
62
67
|
self.ShowErrorMessage(
|
63
68
|
"No Runs defined, impossible to program ESO's P2 interface.")
|
@@ -74,24 +79,31 @@ class VltiUI(FacilityUI):
|
|
74
79
|
if self.facility.hasSupportedInsname(run['instrument']):
|
75
80
|
cid = run['containerId']
|
76
81
|
self._insertInTree('', run['progId'], cid, run, run)
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
82
|
+
|
83
|
+
def updateTree(self, run, containerId):
|
84
|
+
logger.debug(
|
85
|
+
f"updateTree with run : {run}\n and containerId: {containerId}")
|
86
|
+
items, _ = self.facility.api.getItems(containerId)
|
87
|
+
logger.debug(f"sub items are {items}")
|
88
|
+
logger.debug(f"item keys in tree: {self.treeItemToP2Items.keys()}")
|
89
|
+
for item in items:
|
90
|
+
if item['itemType'] in ['Folder', 'Concatenation', 'Group']:
|
91
|
+
if str(item['containerId']) in self.treeItemToP2Items.keys():
|
92
|
+
logger.debug(f"Item {item['containerId']} already in tree")
|
93
|
+
else:
|
94
|
+
logger.debug(f"adding in tree : {item}")
|
95
|
+
self._insertInTree(
|
96
|
+
containerId, item['name'], item['containerId'], run, item)
|
97
|
+
else:
|
98
|
+
logger.debug(f"not inserted in tree : {item}")
|
99
|
+
# TODO get children of our tree and remove part non present in items
|
100
|
+
|
101
|
+
def selectTreeItem(self, containerId):
|
102
|
+
item = str(containerId)
|
103
|
+
self.tree.selection_set(item)
|
104
|
+
self.tree.see(item)
|
105
|
+
self.facility.containerInfo.store(
|
106
|
+
self.treeItemToRuns[item], self.treeItemToP2Items[item])
|
95
107
|
|
96
108
|
def _insertInTree(self, parentContainerID, name, containerID, run, item):
|
97
109
|
instrument = run['instrument']
|
@@ -110,18 +122,47 @@ class VltiUI(FacilityUI):
|
|
110
122
|
self.treeItemToRuns[e] = run
|
111
123
|
self.treeItemToP2Items[e] = item
|
112
124
|
|
125
|
+
# add a dummy child so we can show to the user he has to walk into the tree
|
126
|
+
if run['itemCount'] > 0:
|
127
|
+
self.tree.insert(containerID, 'end',
|
128
|
+
f"{containerID}_fillme", values=[])
|
129
|
+
# return new tree item
|
130
|
+
return e
|
131
|
+
|
113
132
|
def on_tree_selection_changed(self, selection):
|
133
|
+
logger.debug(f"tree selection change: {selection}")
|
114
134
|
curItem = self.tree.focus()
|
115
135
|
ret = self.tree.item(curItem)
|
116
136
|
if len(ret['values']) > 0:
|
117
137
|
self.facility.containerInfo.store(
|
118
138
|
self.treeItemToRuns[curItem], self.treeItemToP2Items[curItem])
|
139
|
+
self.facility.tryLastOB()
|
119
140
|
|
120
|
-
def
|
121
|
-
|
141
|
+
def on_tree_open(self, selection):
|
142
|
+
logger.debug(f"tree open: {selection}")
|
143
|
+
curItem = self.tree.focus()
|
144
|
+
curChildren = self.tree.get_children(curItem)
|
145
|
+
firstChild = curChildren[0]
|
146
|
+
if not firstChild in self.treeItemToRuns.keys():
|
147
|
+
self.tree.delete(firstChild)
|
148
|
+
|
149
|
+
parentRun = self.treeItemToRuns[curItem]
|
150
|
+
parentContainer = self.treeItemToP2Items[curItem]
|
151
|
+
parentContainerID = parentContainer['containerId']
|
152
|
+
self.updateTree(parentRun, parentContainerID)
|
153
|
+
|
154
|
+
def showOBConfirmationButtons(self, ob=None, showAcqButtons=False):
|
155
|
+
if not (ob):
|
156
|
+
self.treeFrame.enable_buttons(False, showAcqButtons)
|
157
|
+
return
|
158
|
+
else:
|
159
|
+
self.treeFrame.enable_buttons(True, showAcqButtons)
|
122
160
|
|
123
|
-
def
|
124
|
-
self.
|
161
|
+
def getIssVltitypeVars(self):
|
162
|
+
return self.treeFrame.issVltiTypeCheckboxesVars
|
163
|
+
|
164
|
+
def getAcquisitionType(self):
|
165
|
+
return self.treeFrame.acquisitionType.get()
|
125
166
|
|
126
167
|
|
127
168
|
class TreeFrame(Frame):
|
@@ -129,22 +170,24 @@ class TreeFrame(Frame):
|
|
129
170
|
def __init__(self, vltiUI):
|
130
171
|
Frame.__init__(self, vltiUI.container)
|
131
172
|
self.vltiUI = vltiUI
|
132
|
-
|
133
173
|
subframe = Frame(self)
|
134
174
|
|
175
|
+
treeframe = Frame(subframe)
|
135
176
|
self.tree = ttk.Treeview(
|
136
|
-
|
177
|
+
treeframe, columns=('Project ID'), selectmode='browse') # , 'instrument'))#, 'folder ID'))
|
137
178
|
ysb = ttk.Scrollbar(
|
138
|
-
|
179
|
+
treeframe, orient='vertical', command=self.tree.yview)
|
139
180
|
xsb = ttk.Scrollbar(
|
140
|
-
|
181
|
+
treeframe, orient='horizontal', command=self.tree.xview)
|
141
182
|
|
142
183
|
self.tree.configure(yscroll=ysb.set, xscroll=xsb.set)
|
143
184
|
self.tree.heading('#0', text='Project ID', anchor='w')
|
144
185
|
self.tree.heading('#1', text='Instrument', anchor='w')
|
145
186
|
self.tree.heading('#2', text='Container type', anchor='w')
|
146
187
|
self.tree.bind(
|
147
|
-
'
|
188
|
+
'<<TreeviewOpen>>', self.vltiUI.on_tree_open)
|
189
|
+
self.tree.bind(
|
190
|
+
'<<TreeviewSelect>>', self.vltiUI.on_tree_selection_changed)
|
148
191
|
|
149
192
|
# grid layout does not expand and fill all area then move to pack
|
150
193
|
# self.tree.grid(row=0, column=0, sticky='nsew')
|
@@ -154,9 +197,88 @@ class TreeFrame(Frame):
|
|
154
197
|
ysb.pack(side=RIGHT, fill="y")
|
155
198
|
# xsb.pack(side=BOTTOM, fill="y") # will probably require to add
|
156
199
|
# another 2 frames
|
200
|
+
treeframe.pack(side=TOP, fill=BOTH, expand=True)
|
201
|
+
|
202
|
+
# Control button Panel to abort /submit or provide more information to the current OB
|
203
|
+
buttonframe = Frame(subframe)
|
204
|
+
|
205
|
+
cindex = 0
|
206
|
+
|
207
|
+
|
208
|
+
acquisitionFrame = Frame(buttonframe)
|
209
|
+
|
210
|
+
self.acquisitionType = StringVar()
|
211
|
+
self.acquisitionType.set("onaxis") # initialiser
|
212
|
+
self.r1 = Radiobutton(acquisitionFrame, text="onaxis", variable=self.acquisitionType, value="onaxis")
|
213
|
+
self.r2 = Radiobutton(acquisitionFrame, text="offaxis", variable=self.acquisitionType, value="offaxis")
|
214
|
+
self.r3 = Radiobutton(acquisitionFrame, text="wide", variable=self.acquisitionType, value="wide")
|
215
|
+
|
216
|
+
acquisitionFrame.grid(row=0, column=cindex)
|
217
|
+
cindex += 1
|
218
|
+
|
219
|
+
|
220
|
+
label = Label(buttonframe, text="|")
|
221
|
+
label.grid(row=0, column=cindex)
|
222
|
+
cindex += 1
|
223
|
+
|
224
|
+
psection = "p2.iss.vltitype"
|
225
|
+
pvltitypes = self.vltiUI.facility.a2p2client.preferences.getConfigKeys(
|
226
|
+
psection)
|
227
|
+
|
228
|
+
self.issVltiTypeCheckboxesVars = {}
|
229
|
+
for isvt in self.vltiUI.facility.getIssVltiTypes():
|
230
|
+
boolv = BooleanVar()
|
231
|
+
self.issVltiTypeCheckboxesVars[isvt]=boolv
|
232
|
+
boolv.set( not pvltitypes or len(pvltitypes)==0 or isvt in pvltitypes )
|
233
|
+
logger.debug(f"Set preference value for {isvt} : {boolv.get()}")
|
234
|
+
cb = Checkbutton(buttonframe, text=isvt, variable=boolv, onvalue=True, offvalue=False)
|
235
|
+
cb.grid(row=0, column=cindex)
|
236
|
+
cindex += 1
|
237
|
+
|
238
|
+
self.abortButton = Button(buttonframe, text="Abort this OB",
|
239
|
+
command=self.on_abortbutton_clicked, state=DISABLED)
|
240
|
+
style = ttk.Style()
|
241
|
+
sButtonStyle="Custom.TButton"
|
242
|
+
ttk.Style().configure(sButtonStyle, background="green")
|
243
|
+
self.submitButton = Button(
|
244
|
+
buttonframe, text="Submit", command=self.on_submitbutton_clicked, state=DISABLED,
|
245
|
+
style=sButtonStyle)
|
246
|
+
self.abortButton.grid(row=0, column=cindex)
|
247
|
+
cindex += 1
|
248
|
+
self.submitButton.grid(row=0, column=cindex)
|
249
|
+
buttonframe.pack(side=RIGHT)
|
157
250
|
|
158
251
|
subframe.pack(side=TOP, fill=BOTH, expand=True)
|
159
252
|
|
253
|
+
def enable_buttons(self, enableActions, showAcqButtons=False):
|
254
|
+
if showAcqButtons and enableActions:
|
255
|
+
self.r1.pack(side=LEFT)
|
256
|
+
self.r2.pack(side=LEFT)
|
257
|
+
self.r3.pack(side=LEFT)
|
258
|
+
else:
|
259
|
+
self.r1.pack_forget()
|
260
|
+
self.r2.pack_forget()
|
261
|
+
self.r3.pack_forget()
|
262
|
+
|
263
|
+
if enableActions:
|
264
|
+
flag = NORMAL
|
265
|
+
else:
|
266
|
+
flag = DISABLED
|
267
|
+
self.submitButton["state"] = flag
|
268
|
+
self.abortButton["state"] = flag
|
269
|
+
|
270
|
+
# leave abort button always active to let user remove in case of error
|
271
|
+
if self.vltiUI.facility.hasOB():
|
272
|
+
self.abortButton["state"] = NORMAL
|
273
|
+
|
274
|
+
def on_submitbutton_clicked(self):
|
275
|
+
self.vltiUI.facility.popOB()
|
276
|
+
self.enable_buttons(False)
|
277
|
+
|
278
|
+
def on_abortbutton_clicked(self):
|
279
|
+
self.vltiUI.facility.popOB(ignore=True)
|
280
|
+
self.enable_buttons(False)
|
281
|
+
|
160
282
|
|
161
283
|
class LoginFrame(Frame):
|
162
284
|
|