1 from PyQt4.QtGui import *
2 from PyQt4.QtCore import *
3
4 import Constants
5 import Plotting
6 import Transforms
7 import Cosmology
8 import GeneralFunctions
9 import Statistics
10 import StellarDynamics
11 import LinearAlgebra
12
13 -class Dock (QWidget):
15 QWidget.__init__ (self)
16 self.layout = QHBoxLayout (self)
17
18
19 self._bridge = bridge
20 bridge.setDock (self)
21
22
23 self._gnuplot = Plotting.Gnuplot (self.layout, bridge)
24 self._visit = Plotting.VisItPlot (self.layout, bridge)
25 QObject.connect (bridge, SIGNAL ("updateVisIt (PyQt_PyObject, PyQt_PyObject, PyQt_PyObject, PyQt_PyObject)"), self._visit.Update)
26 self._pylab = Plotting.PyLab (self.layout, bridge)
27
28 self._hubble = Cosmology.Hubble (self.layout, bridge)
29 self._redshifttodistance = Cosmology.RedshiftToDistance (self.layout, bridge)
30 self._redshifttogrowth = Cosmology.RedshiftToGrowth (self.layout, bridge)
31
32 self._equatorialTOxyz = Transforms.Equatorial2XYZ (self.layout, bridge)
33 self._xyzTOequatorial = Transforms.XYZ2Equatorial (self.layout, bridge)
34 self._polarTOxy = Transforms.Polar2XY (self.layout, bridge)
35 self._xyTOpolar = Transforms.XY2Polar (self.layout, bridge)
36 self._sphericalTOxyz = Transforms.Spherical2XYZ (self.layout, bridge)
37 self._xyzTOspherical = Transforms.XYZ2Spherical (self.layout, bridge)
38 self._cylindricalTOxyz = Transforms.Cylindrical2XYZ (self.layout, bridge)
39 self._xyzTOcylindrical = Transforms.XYZ2Cylindrical (self.layout, bridge)
40 self._fft = Transforms.FFT (self.layout, bridge)
41 self._convolve = Transforms.Convolve (self.layout, bridge)
42 self._computedensity = Transforms.ComputeDensity (self.layout, bridge)
43
44 self._mean = Statistics.Mean (self.layout, bridge)
45 self._standarddeviation = Statistics.StandardDeviation (self.layout, bridge)
46 self._histogram = Statistics.Histogram (self.layout, bridge)
47
48 self._matrixinvert = LinearAlgebra.MatrixInvert (self.layout, bridge)
49 self._matrixmult = LinearAlgebra.MatrixMult (self.layout, bridge)
50 self._matrixcreate = LinearAlgebra.MatrixCreate (self.layout, bridge)
51 self._matrixcreateidentity = LinearAlgebra.IdentityMatrixCreate (self.layout, bridge)
52
53 self._centerofmass = StellarDynamics.CenterOfMass (self.layout, bridge)
54 self._localdensity = StellarDynamics.LocalDensity (self.layout, bridge)
55 self._densitylist = StellarDynamics.DensityList (self.layout, bridge)
56 self._densitycenter = StellarDynamics.DensityCenter (self.layout, bridge)
57 self._radialprofile = StellarDynamics.RadialProfile (self.layout, bridge)
58 self._densityprofile = StellarDynamics.DensityProfile (self.layout, bridge)
59 self._dispprofile = StellarDynamics.DispProfile (self.layout, bridge)
60
61 self._abs = GeneralFunctions.AbsoluteValue (self.layout, bridge)
62 self._pow = GeneralFunctions.Pow (self.layout, bridge)
63 self._sqrt = GeneralFunctions.SquareRoot (self.layout, bridge)
64 self._sort = GeneralFunctions.Sort (self.layout, bridge)
65 self._indexsort = GeneralFunctions.IndexSort (self.layout, bridge)
66 self._log = GeneralFunctions.Log (self.layout, bridge)
67 self._log10 = GeneralFunctions.Log10 (self.layout, bridge)
68 self._exp = GeneralFunctions.Exp (self.layout, bridge)
69 self._exp10 = GeneralFunctions.Exp10 (self.layout, bridge)
70 self._sin = GeneralFunctions.Sin (self.layout, bridge)
71 self._cos = GeneralFunctions.Cos (self.layout, bridge)
72 self._cosh = GeneralFunctions.Cosh (self.layout, bridge)
73 self._sinh = GeneralFunctions.Sinh (self.layout, bridge)
74 self._acos = GeneralFunctions.Acos (self.layout, bridge)
75 self._asin = GeneralFunctions.Asin (self.layout, bridge)
76 self._acosh = GeneralFunctions.Acosh (self.layout, bridge)
77 self._asinh = GeneralFunctions.Asinh (self.layout, bridge)
78 self._atan = GeneralFunctions.Atan (self.layout, bridge)
79 self._attributerandom = GeneralFunctions.AttributeRandom (self.layout, bridge)
80 self._attributeconstant = GeneralFunctions.AttributeConstant (self.layout, bridge)
81 self._attributeindex = GeneralFunctions.AttributeIndex (self.layout, bridge)
82 self._real = GeneralFunctions.Real (self.layout, bridge)
83 self._imaginary = GeneralFunctions.Imaginary (self.layout, bridge)
84
85 self.Init (self.layout)
86
87
88 self._current = None
89 self._currentAction = None
90
91
92 parent.addWidget (self)
93
95 self.clear ()
96 action.setEnabled (False)
97 self._currentAction = action
98
99
101 if self._currentAction != None:
102 self._currentAction.setEnabled (True)
103 self._currentAction = None
104 if self._current != None:
105 self._current.setVisible (False)
106 self._current = None
107 else:
108 self._initwidget.setVisible (False)
109
110 - def Init (self, parent):
111 self._initwidget = QWidget ()
112 self.layout = QVBoxLayout ()
113 self._initwidget.setLayout (self.layout)
114
115
116 picLabel = QLabel ()
117 picLabel.setPixmap (QPixmap (Constants.BASE_DIR + "/basin.gif", "GIF"))
118 picLabel.setAlignment (Qt.AlignHCenter)
119
120 self.layout.addWidget (picLabel)
121 parent.addWidget (self._initwidget)
122
123
126
137
138
139
141 if self._current != self._equatorialTOxyz:
142 self._current = self._equatorialTOxyz
143 self.ShowDockWidget ()
144
145
146
148 if self._current != self._xyzTOequatorial:
149 self._current = self._xyzTOequatorial
150 self.ShowDockWidget ()
151
152
153
155 if self._current != self._polarTOxy:
156 self._current = self._polarTOxy
157 self.ShowDockWidget ()
158
159
160
162 if self._current != self._xyTOpolar:
163 self._current = self._xyTOpolar
164 self.ShowDockWidget ()
165
166
167
169 if self._current != self._sphericalTOxyz:
170 self._current = self._sphericalTOxyz
171 self.ShowDockWidget ()
172
173
174
176 if self._current != self._xyzTOspherical:
177 self._current = self._xyzTOspherical
178 self.ShowDockWidget ()
179
180
181
183 if self._current != self._cylindricalTOxyz:
184 self._current = self._cylindricalTOxyz
185 self.ShowDockWidget ()
186
187
188
190 if self._current != self._xyzTOcylindrical:
191 self._current = self._xyzTOcylindrical
192 self.ShowDockWidget ()
193
194
195
197 if self._current != self._gnuplot:
198 self._current = self._gnuplot
199 self.ShowDockWidget ()
200
201
202
204 if self._current != self._visit:
205 self._current = self._visit
206 self.ShowDockWidget ()
207
208
209
211 if self._current != self._pylab:
212 self._current = self._pylab
213 self.ShowDockWidget ()
214
215
216
218 if self._current != self._hubble:
219 self._current = self._hubble
220 self.ShowDockWidget ()
221
222
223
225 if self._current != self._redshifttodistance:
226 self._current = self._redshifttodistance
227 self.ShowDockWidget ()
228
229
230
232 if self._current != self._redshifttogrowth:
233 self._current = self._redshifttogrowth
234 self.ShowDockWidget ()
235
236
237
239 if self._current != self._fft:
240 self._current = self._fft
241 self.ShowDockWidget ()
242
243
244
246 if self._current != self._convolve:
247 self._current = self._convolve
248 self.ShowDockWidget ()
249
250
251
253 if self._current != self._computedensity:
254 self._current = self._computedensity
255 self.ShowDockWidget ()
256
257
258
260 if self._current != self._indexsort:
261 self._current = self._indexsort
262 self.ShowDockWidget ()
263
264
265
267 if self._current != self._sort:
268 self._current = self._sort
269 self.ShowDockWidget ()
270
271
272
274 if self._current != self._abs:
275 self._current = self._abs
276 self.ShowDockWidget ()
277
278
279
281 if self._current != self._log:
282 self._current = self._log
283 self.ShowDockWidget ()
284
285
286
288 if self._current != self._log10:
289 self._current = self._log10
290 self.ShowDockWidget ()
291
292
293
295 if self._current != self._exp:
296 self._current = self._exp
297 self.ShowDockWidget ()
298
299
300
302 if self._current != self._exp10:
303 self._current = self._exp10
304 self.ShowDockWidget ()
305
306
307
309 if self._current != self._sqrt:
310 self._current = self._sqrt
311 self.ShowDockWidget ()
312
313
314
316 if self._current != self._sin:
317 self._current = self._sin
318 self.ShowDockWidget ()
319
320
321
323 if self._current != self._cos:
324 self._current = self._cos
325 self.ShowDockWidget ()
326
327
328
330 if self._current != self._cosh:
331 self._current = self._cosh
332 self.ShowDockWidget ()
333
334
335
337 if self._current != self._sinh:
338 self._current = self._sinh
339 self.ShowDockWidget ()
340
341
342
344 if self._current != self._acos:
345 self._current = self._acos
346 self.ShowDockWidget ()
347
348
349
351 if self._current != self._asin:
352 self._current = self._asin
353 self.ShowDockWidget ()
354
355
356
358 if self._current != self._acosh:
359 self._current = self._acosh
360 self.ShowDockWidget ()
361
362
363
365 if self._current != self._asinh:
366 self._current = self._asinh
367 self.ShowDockWidget ()
368
369
370
372 if self._current != self._atan:
373 self._current = self._atan
374 self.ShowDockWidget ()
375
376
377
379 if self._current != self._attributeconstant:
380 self._current = self._attributeconstant
381 self.ShowDockWidget ()
382
383
384
386 if self._current != self._attributerandom:
387 self._current = self._attributerandom
388 self.ShowDockWidget ()
389
390
391
393 if self._current != self._attributeindex:
394 self._current = self._attributeindex
395 self.ShowDockWidget ()
396
397
398
400 if self._current != self._pow:
401 self._current = self._pow
402 self.ShowDockWidget ()
403
404
405
407 if self._current != self._real:
408 self._current = self._real
409 self.ShowDockWidget ()
410
411
412
414 if self._current != self._imaginary:
415 self._current = self._imaginary
416 self.ShowDockWidget ()
417
418
419
421 if self._current != self._mean:
422 self._current = self._mean
423 self.ShowDockWidget ()
424
425
426
428 if self._current != self._standarddeviation:
429 self._current = self._standarddeviation
430 self.ShowDockWidget ()
431
432
433
435 if self._current != self._histogram:
436 self._current = self._histogram
437 self.ShowDockWidget ()
438
439
440
442 if self._current != self._centerofmass:
443 self._current = self._centerofmass
444 self.ShowDockWidget ()
445
446
447
449 if self._current != self._localdensity:
450 self._current = self._localdensity
451 self.ShowDockWidget ()
452
453
454
456 if self._current != self._densitylist:
457 self._current = self._densitylist
458 self.ShowDockWidget ()
459
460
461
463 if self._current != self._densitycenter:
464 self._current = self._densitycenter
465 self.ShowDockWidget ()
466
467
468
470 if self._current != self._radialprofile:
471 self._current = self._radialprofile
472 self.ShowDockWidget ()
473
474
475
477 if self._current != self._densityprofile:
478 self._current = self._densityprofile
479 self.ShowDockWidget ()
480
481
482
484 if self._current != self._dispprofile:
485 self._current = self._dispprofile
486 self.ShowDockWidget ()
487
488
489
491 if self._current != self._matrixinvert:
492 self._current = self._matrixinvert
493 self.ShowDockWidget ()
494
495
496
498 if self._current != self._matrixmult:
499 self._current = self._matrixmult
500 self.ShowDockWidget ()
501
502
503
505 if self._current != self._matrixcreate:
506 self._current = self._matrixcreate
507 self.ShowDockWidget ()
508
509
510
512 if self._current != self._matrixcreateidentity:
513 self._current = self._matrixcreateidentity
514 self.ShowDockWidget ()
515