Package client :: Package Dock
[hide private]
[frames] | no frames]

Source Code for Package client.Dock

  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):
14 - def __init__ (self, parent, bridge):
15 QWidget.__init__ (self) 16 self.layout = QHBoxLayout (self) 17 18 # attach it to the bridge 19 self._bridge = bridge 20 bridge.setDock (self) 21 22 # Invisible Dialogs 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 # default with nothing docked 88 self._current = None 89 self._currentAction = None 90 91 # add it to the parent's self.layout 92 parent.addWidget (self)
93
94 - def DisableAction (self, action):
95 self.clear () 96 action.setEnabled (False) 97 self._currentAction = action
98 99 # Removes any widgets in the dock, as well as their right-click menu
100 - def clear (self):
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 # Returns the widget that is currently docked
124 - def GetCurrentWidget (self):
125 return self._current
126
127 - def ShowDockWidget (self):
128 self._current.setVisible (True) 129 try: 130 self._current.guessDefaults () 131 except AttributeError: 132 pass 133 try: 134 self._current.DefaultCheck () 135 except AttributeError: 136 pass
137 138 # Calling this sets the dock widget to the equatorial to cartesian dialog 139 # and grabs appropriate menu from the menubar, which gets sent back on a right click
140 - def EquatorialToXyz (self):
141 if self._current != self._equatorialTOxyz: 142 self._current = self._equatorialTOxyz 143 self.ShowDockWidget ()
144 145 # Calling this sets the dock widget to the cartesian to equatorial dialog 146 # and grabs appropriate menu from the menubar, which gets sent back on a right click
147 - def XyzToEquatorial (self):
148 if self._current != self._xyzTOequatorial: 149 self._current = self._xyzTOequatorial 150 self.ShowDockWidget ()
151 152 # Calling this sets the dock widget to the polar to cartesian dialog 153 # and grabs appropriate menu from the menubar, which gets sent back on a right click
154 - def PolarToXy (self):
155 if self._current != self._polarTOxy: 156 self._current = self._polarTOxy 157 self.ShowDockWidget ()
158 159 # Calling this sets the dock widget to the cartesian to polar dialog 160 # and grabs appropriate menu from the menubar, which gets sent back on a right click
161 - def XyToPolar (self):
162 if self._current != self._xyTOpolar: 163 self._current = self._xyTOpolar 164 self.ShowDockWidget ()
165 166 # Calling this sets the dock widget to the spherical to cartesian dialog 167 # and grabs appropriate menu from the menubar, which gets sent back on a right click
168 - def SphericalToXyz (self):
169 if self._current != self._sphericalTOxyz: 170 self._current = self._sphericalTOxyz 171 self.ShowDockWidget ()
172 173 # Calling this sets the dock widget to the cartesian to spherical dialog 174 # and grabs appropriate menu from the menubar, which gets sent back on a right click
175 - def XyzToSpherical (self):
176 if self._current != self._xyzTOspherical: 177 self._current = self._xyzTOspherical 178 self.ShowDockWidget ()
179 180 # Calling this sets the dock widget to the cylindrical to cartesian dialog 181 # and grabs appropriate menu from the menubar, which gets sent back on a right click
182 - def CylindricalToXyz (self):
183 if self._current != self._cylindricalTOxyz: 184 self._current = self._cylindricalTOxyz 185 self.ShowDockWidget ()
186 187 # Calling this sets the dock widget to the cartesian to cylindrical dialog 188 # and grabs appropriate menu from the menubar, which gets sent back on a right click
189 - def XyzToCylindrical (self):
190 if self._current != self._xyzTOcylindrical: 191 self._current = self._xyzTOcylindrical 192 self.ShowDockWidget ()
193 194 # Calling this sets the dock widget to the gnuplot dialog 195 # and grabs appropriate menu from the menubar, which gets sent back on a right click
196 - def Gnuplot (self):
197 if self._current != self._gnuplot: 198 self._current = self._gnuplot 199 self.ShowDockWidget ()
200 201 # Calling this sets the dock widget to the visit dialog 202 # and grabs appropriate menu from the menubar, which gets sent back on a right click
203 - def VisIt (self):
204 if self._current != self._visit: 205 self._current = self._visit 206 self.ShowDockWidget ()
207 208 # Calling this sets the dock widget to the gnuplot dialog 209 # and grabs appropriate menu from the menubar, which gets sent back on a right click
210 - def PyLab (self):
211 if self._current != self._pylab: 212 self._current = self._pylab 213 self.ShowDockWidget ()
214 215 # Calling this sets the dock widget to the visit dialog 216 # and grabs appropriate menu from the menubar, which gets sent back on a right click
217 - def Hubble (self):
218 if self._current != self._hubble: 219 self._current = self._hubble 220 self.ShowDockWidget ()
221 222 # Calling this sets the dock widget to the visit dialog 223 # and grabs appropriate menu from the menubar, which gets sent back on a right click
224 - def RedshiftToDistance (self):
225 if self._current != self._redshifttodistance: 226 self._current = self._redshifttodistance 227 self.ShowDockWidget ()
228 229 # Calling this sets the dock widget to the visit dialog 230 # and grabs appropriate menu from the menubar, which gets sent back on a right click
231 - def RedshiftToGrowth (self):
232 if self._current != self._redshifttogrowth: 233 self._current = self._redshifttogrowth 234 self.ShowDockWidget ()
235 236 # Calling this sets the dock widget to the gnuplot dialog 237 # and grabs appropriate menu from the menubar, which gets sent back on a right click
238 - def Fft (self):
239 if self._current != self._fft: 240 self._current = self._fft 241 self.ShowDockWidget ()
242 243 # Calling this sets the dock widget to the convolve dialog 244 # and grabs appropriate menu from the menubar, which gets sent back on a right click
245 - def Convolve (self):
246 if self._current != self._convolve: 247 self._current = self._convolve 248 self.ShowDockWidget ()
249 250 # Calling this sets the dock widget to the convolve dialog 251 # and grabs appropriate menu from the menubar, which gets sent back on a right click
252 - def ComputeDensity (self):
253 if self._current != self._computedensity: 254 self._current = self._computedensity 255 self.ShowDockWidget ()
256 257 # Calling this sets the dock widget to the sort dialog 258 # and grabs appropriate menu from the menubar, which gets sent back on a right click
259 - def IndexSort (self):
260 if self._current != self._indexsort: 261 self._current = self._indexsort 262 self.ShowDockWidget ()
263 264 # Calling this sets the dock widget to the sort dialog 265 # and grabs appropriate menu from the menubar, which gets sent back on a right click
266 - def Sort (self):
267 if self._current != self._sort: 268 self._current = self._sort 269 self.ShowDockWidget ()
270 271 # Calling this sets the dock widget to the absolute value dialog 272 # and grabs appropriate menu from the menubar, which gets sent back on a right click
273 - def AbsoluteValue (self):
274 if self._current != self._abs: 275 self._current = self._abs 276 self.ShowDockWidget ()
277 278 # Calling this sets the dock widget to the log dialog 279 # and grabs appropriate menu from the menubar, which gets sent back on a right click
280 - def Log (self):
281 if self._current != self._log: 282 self._current = self._log 283 self.ShowDockWidget ()
284 285 # Calling this sets the dock widget to the log10 dialog 286 # and grabs appropriate menu from the menubar, which gets sent back on a right click
287 - def Log10 (self):
288 if self._current != self._log10: 289 self._current = self._log10 290 self.ShowDockWidget ()
291 292 # Calling this sets the dock widget to the exp dialog 293 # and grabs appropriate menu from the menubar, which gets sent back on a right click
294 - def Exp (self):
295 if self._current != self._exp: 296 self._current = self._exp 297 self.ShowDockWidget ()
298 299 # Calling this sets the dock widget to the exp10 dialog 300 # and grabs appropriate menu from the menubar, which gets sent back on a right click
301 - def Exp10 (self):
302 if self._current != self._exp10: 303 self._current = self._exp10 304 self.ShowDockWidget ()
305 306 # Calling this sets the dock widget to the sqrt dialog 307 # and grabs appropriate menu from the menubar, which gets sent back on a right click
308 - def SquareRoot (self):
309 if self._current != self._sqrt: 310 self._current = self._sqrt 311 self.ShowDockWidget ()
312 313 # Calling this sets the dock widget to the sin dialog 314 # and grabs appropriate menu from the menubar, which gets sent back on a right click
315 - def Sin (self):
316 if self._current != self._sin: 317 self._current = self._sin 318 self.ShowDockWidget ()
319 320 # Calling this sets the dock widget to the cos dialog 321 # and grabs appropriate menu from the menubar, which gets sent back on a right click
322 - def Cos (self):
323 if self._current != self._cos: 324 self._current = self._cos 325 self.ShowDockWidget ()
326 327 # Calling this sets the dock widget to the cosh dialog 328 # and grabs appropriate menu from the menubar, which gets sent back on a right click
329 - def Cosh (self):
330 if self._current != self._cosh: 331 self._current = self._cosh 332 self.ShowDockWidget ()
333 334 # Calling this sets the dock widget to the sinh dialog 335 # and grabs appropriate menu from the menubar, which gets sent back on a right click
336 - def Sinh (self):
337 if self._current != self._sinh: 338 self._current = self._sinh 339 self.ShowDockWidget ()
340 341 # Calling this sets the dock widget to the acos dialog 342 # and grabs appropriate menu from the menubar, which gets sent back on a right click
343 - def Acos (self):
344 if self._current != self._acos: 345 self._current = self._acos 346 self.ShowDockWidget ()
347 348 # Calling this sets the dock widget to the asin dialog 349 # and grabs appropriate menu from the menubar, which gets sent back on a right click
350 - def Asin (self):
351 if self._current != self._asin: 352 self._current = self._asin 353 self.ShowDockWidget ()
354 355 # Calling this sets the dock widget to the acosh dialog 356 # and grabs appropriate menu from the menubar, which gets sent back on a right click
357 - def Acosh (self):
358 if self._current != self._acosh: 359 self._current = self._acosh 360 self.ShowDockWidget ()
361 362 # Calling this sets the dock widget to the asinh dialog 363 # and grabs appropriate menu from the menubar, which gets sent back on a right click
364 - def Asinh (self):
365 if self._current != self._asinh: 366 self._current = self._asinh 367 self.ShowDockWidget ()
368 369 # Calling this sets the dock widget to the atan dialog 370 # and grabs appropriate menu from the menubar, which gets sent back on a right click
371 - def Atan (self):
372 if self._current != self._atan: 373 self._current = self._atan 374 self.ShowDockWidget ()
375 376 # Calling this sets the dock widget to the attribute_random dialog 377 # and grabs appropriate menu from the menubar, which gets sent back on a right click
378 - def AttributeConstant (self):
379 if self._current != self._attributeconstant: 380 self._current = self._attributeconstant 381 self.ShowDockWidget ()
382 383 # Calling this sets the dock widget to the attribute_random dialog 384 # and grabs appropriate menu from the menubar, which gets sent back on a right click
385 - def AttributeRandom (self):
386 if self._current != self._attributerandom: 387 self._current = self._attributerandom 388 self.ShowDockWidget ()
389 390 # Calling this sets the dock widget to the attribute_index dialog 391 # and grabs appropriate menu from the menubar, which gets sent back on a right click
392 - def AttributeIndex (self):
393 if self._current != self._attributeindex: 394 self._current = self._attributeindex 395 self.ShowDockWidget ()
396 397 # Calling this sets the dock widget to the power dialog 398 # and grabs appropriate menu from the menubar, which gets sent back on a right click
399 - def Pow (self):
400 if self._current != self._pow: 401 self._current = self._pow 402 self.ShowDockWidget ()
403 404 # Calling this sets the dock widget to the real dialog 405 # and grabs appropriate menu from the menubar, which gets sent back on a right click
406 - def Real (self):
407 if self._current != self._real: 408 self._current = self._real 409 self.ShowDockWidget ()
410 411 # Calling this sets the dock widget to the imaginary dialog 412 # and grabs appropriate menu from the menubar, which gets sent back on a right click
413 - def Imaginary (self):
414 if self._current != self._imaginary: 415 self._current = self._imaginary 416 self.ShowDockWidget ()
417 418 # Calling this sets the dock widget to the mean dialog 419 # and grabs appropriate menu from the menubar, which gets sent back on a right click
420 - def Mean (self):
421 if self._current != self._mean: 422 self._current = self._mean 423 self.ShowDockWidget ()
424 425 # Calling this sets the dock widget to the standard deviation dialog 426 # and grabs appropriate menu from the menubar, which gets sent back on a right click
427 - def StandardDeviation (self):
428 if self._current != self._standarddeviation: 429 self._current = self._standarddeviation 430 self.ShowDockWidget ()
431 432 # Calling this sets the dock widget to the histogram dialog 433 # and grabs appropriate menu from the menubar, which gets sent back on a right click
434 - def Histogram (self):
435 if self._current != self._histogram: 436 self._current = self._histogram 437 self.ShowDockWidget ()
438 439 # Calling this sets the dock widget to the center of mass dialog 440 # and grabs appropriate menu from the menubar, which gets sent back on a right click
441 - def CenterOfMass (self):
442 if self._current != self._centerofmass: 443 self._current = self._centerofmass 444 self.ShowDockWidget ()
445 446 # Calling this sets the dock widget to the local density dialog 447 # and grabs appropriate menu from the menubar, which gets sent back on a right click
448 - def LocalDensity (self):
449 if self._current != self._localdensity: 450 self._current = self._localdensity 451 self.ShowDockWidget ()
452 453 # Calling this sets the dock widget to the density list dialog 454 # and grabs appropriate menu from the menubar, which gets sent back on a right click
455 - def DensityList (self):
456 if self._current != self._densitylist: 457 self._current = self._densitylist 458 self.ShowDockWidget ()
459 460 # Calling this sets the dock widget to the density center dialog 461 # and grabs appropriate menu from the menubar, which gets sent back on a right click
462 - def DensityCenter (self):
463 if self._current != self._densitycenter: 464 self._current = self._densitycenter 465 self.ShowDockWidget ()
466 467 # Calling this sets the dock widget to the radial profile dialog 468 # and grabs appropriate menu from the menubar, which gets sent back on a right click
469 - def RadialProfile (self):
470 if self._current != self._radialprofile: 471 self._current = self._radialprofile 472 self.ShowDockWidget ()
473 474 # Calling this sets the dock widget to the density profile dialog 475 # and grabs appropriate menu from the menubar, which gets sent back on a right click
476 - def DensityProfile (self):
477 if self._current != self._densityprofile: 478 self._current = self._densityprofile 479 self.ShowDockWidget ()
480 481 # Calling this sets the dock widget to the disp profile dialog 482 # and grabs appropriate menu from the menubar, which gets sent back on a right click
483 - def DispProfile (self):
484 if self._current != self._dispprofile: 485 self._current = self._dispprofile 486 self.ShowDockWidget ()
487 488 # Calling this sets the dock widget to the matrix invert dialog 489 # and grabs appropriate menu from the menubar, which gets sent back on a right click
490 - def MatrixInvert (self):
491 if self._current != self._matrixinvert: 492 self._current = self._matrixinvert 493 self.ShowDockWidget ()
494 495 # Calling this sets the dock widget to the matrix multiply dialog 496 # and grabs appropriate menu from the menubar, which gets sent back on a right click
497 - def MatrixMult (self):
498 if self._current != self._matrixmult: 499 self._current = self._matrixmult 500 self.ShowDockWidget ()
501 502 # Calling this sets the dock widget to the matrix create dialog 503 # and grabs appropriate menu from the menubar, which gets sent back on a right click
504 - def MatrixCreate (self):
505 if self._current != self._matrixcreate: 506 self._current = self._matrixcreate 507 self.ShowDockWidget ()
508 509 # Calling this sets the dock widget to the matrix create dialog 510 # and grabs appropriate menu from the menubar, which gets sent back on a right click
511 - def MatrixCreateIdentity (self):
512 if self._current != self._matrixcreateidentity: 513 self._current = self._matrixcreateidentity 514 self.ShowDockWidget ()
515