1 import PyQt4.QtCore
2 import PyQt4.QtGui
3
4 import Constants
5 import DataGuesser
6 import Widget
7 import Holders
8
13
15 box = PyQt4.QtGui.QGroupBox ("Commands")
16 layout = PyQt4.QtGui.QHBoxLayout ()
17 box.setLayout (layout)
18
19 executeButton = Constants.BQPushButton ("Perform", layout)
20 PyQt4.QtCore.QObject.connect (executeButton, PyQt4.QtCore.SIGNAL ("clicked ()"), self.perform)
21
22 clearButton = Constants.BQPushButton ("Clear", layout)
23 PyQt4.QtCore.QObject.connect (clearButton, PyQt4.QtCore.SIGNAL ("clicked ()"), self.clear)
24
25 return box
26
28 outline = PyQt4.QtGui.QGroupBox ("Data Selection")
29 self.list = Holders.FreeHolderGroup (self._bridge, self._inList, self._outList)
30 outline.setLayout (self.list.layout)
31
32 return outline
33
35 self.list.clear ()
36 for holder in self.list._inList:
37 holder.clear ()
38 for holder in self.list._outList:
39 holder.clear ()
40
42 if attr == None:
43 return
44
45 if attr.Type () == "ALIAS":
46 attr = attr._item
47
48 if attr.Type () == "ATTRIBUTE" \
49 or (attr.Type () == "VALUE" and attr._type == "_basin.Attribute"):
50 for holder in self.list._inList:
51 if holder.SetItem (attr, clobber = False) == True:
52 return True
53 return False
54
61
93
94
97 self._displayName = "Center of Mass"
98 self._displayIcon = PyQt4.QtGui.QIcon (Constants.ICON_DIR + "/stellar_dynamics/centerofmass.png")
99 self._description = ""
100 self._inList = ["x", "y", "z"]
101 self._outList = ["cm_out"]
102 AbstractStellarDynamics.__init__ (self, parent, bridge)
103 self.m = Holders.ChildAttributeHolder (bridge, self.list)
104 self.list.layout.addWidget (PyQt4.QtGui.QLabel ("mass:"), 4, 0)
105 self.list.layout.addWidget (self.m, 4, 1)
106
113
117
123
151
152
155 self._displayName = "Local Density"
156 self._displayIcon = PyQt4.QtGui.QIcon (Constants.ICON_DEFAULT)
157 self._description = ""
158 self._inList = ["x", "y", "z", "m"]
159 self._outList = ["ld_out"]
160 AbstractStellarDynamics.__init__ (self, parent, bridge)
161 self.m = Holders.ChildAttributeHolder (bridge, self.list)
162 self.list.layout.addWidget (PyQt4.QtGui.QLabel ("m:"), 4, 0)
163 self.list.layout.addWidget (self.m, 4, 1)
164
165
168 self._displayName = "Density List"
169 self._displayIcon = PyQt4.QtGui.QIcon (Constants.ICON_DEFAULT)
170 self._description = ""
171 self._inList = ["x", "y", "z", "mass"]
172 self._outList = ["dl_out"]
173 AbstractStellarDynamics.__init__ (self, parent, bridge)
174
175 self._neighbors = PyQt4.QtGui.QSpinBox ()
176 self._neighbors.setRange (0, 100)
177 self._neighbors.setSingleStep (1)
178 self.list.layout.addWidget (PyQt4.QtGui.QLabel ("Neighbors:"), 4, 0, 1, 2, PyQt4.QtCore.Qt.AlignRight)
179 self.list.layout.addWidget (self._neighbors, 4, 2, 1, 2, PyQt4.QtCore.Qt.AlignLeft)
180
184
209
210
213 self._funcName = "density_center"
214 self._displayName = "Density Center"
215 self._displayIcon = PyQt4.QtGui.QIcon (Constants.ICON_DEFAULT)
216 self._description = ""
217 self._inList = ["x", "y", "z", "dens_list"]
218 self._outList = ["dens_center"]
219 AbstractStellarDynamics.__init__ (self, parent, bridge)
220
221
224 self._displayName = "Radial Profile"
225 self._displayIcon = PyQt4.QtGui.QIcon (Constants.ICON_DEFAULT)
226 self._description = ""
227 self._inList = ["x", "y", "z", "a"]
228 self._outList = ["out"]
229 AbstractStellarDynamics.__init__ (self, parent, bridge)
230 self.mass = Holders.ChildAttributeHolder (bridge, self.list)
231 PyQt4.QtCore.QObject.connect (self.mass, PyQt4.QtCore.SIGNAL ("textChanged (const QString&)"), self.checkMass)
232 self.list.layout.addWidget (PyQt4.QtGui.QLabel ("mass (opt):"), 4, 0, PyQt4.QtCore.Qt.AlignRight)
233 self.list.layout.addWidget (self.mass, 4, 1)
234 self.massRange = Holders.ChildListHolder (bridge, self.list)
235 self.massRange.setEnabled (False)
236 self.list.layout.addWidget (PyQt4.QtGui.QLabel ("mass range:"), 5, 0, PyQt4.QtCore.Qt.AlignRight)
237 self.list.layout.addWidget (self.massRange, 5, 1, PyQt4.QtCore.Qt.AlignLeft)
238
239 self.bins = PyQt4.QtGui.QSpinBox ()
240 self.bins.setRange (1, 999999999)
241 self.list.layout.addWidget (PyQt4.QtGui.QLabel ("bins:"), 2, 2, PyQt4.QtCore.Qt.AlignRight)
242 self.list.layout.addWidget (self.bins, 2, 3, PyQt4.QtCore.Qt.AlignLeft)
243 self.rmin = PyQt4.QtGui.QDoubleSpinBox ()
244 self.rmin.setRange (0.0, 999999999.0)
245 self.rmin.setDecimals (Constants.DOUBLE_PRECISION)
246 self.list.layout.addWidget (PyQt4.QtGui.QLabel ("rmin:"), 3, 2, PyQt4.QtCore.Qt.AlignRight)
247 self.list.layout.addWidget (self.rmin, 3, 3, PyQt4.QtCore.Qt.AlignLeft)
248 self.rmax = PyQt4.QtGui.QDoubleSpinBox ()
249 self.rmax.setRange (0.0, 999999999.0)
250 self.rmax.setDecimals (Constants.DOUBLE_PRECISION)
251 self.list.layout.addWidget (PyQt4.QtGui.QLabel ("rmax:"), 4, 2, PyQt4.QtCore.Qt.AlignRight)
252 self.list.layout.addWidget (self.rmax, 4, 3, PyQt4.QtCore.Qt.AlignLeft)
253 self.scale = PyQt4.QtGui.QCheckBox ("log scale?")
254 self.list.layout.addWidget (self.scale, 5, 2, 1, 2)
255
257 if str (text) == "None":
258 self.massRange.setEnabled (False)
259 else:
260 self.massRange.setEnabled (True)
261
269
305
306
309 self._displayName = "Density Profile"
310 self._displayIcon = PyQt4.QtGui.QIcon (Constants.ICON_DEFAULT)
311 self._description = ""
312 self._inList = ["x", "y", "z", "mass"]
313 self._outList = ["out"]
314 AbstractStellarDynamics.__init__ (self, parent, bridge)
315 self.massRange = Holders.ChildListHolder (bridge, self.list)
316 self.list.layout.addWidget (PyQt4.QtGui.QLabel ("m range:"), 4, 0, PyQt4.QtCore.Qt.AlignRight)
317 self.list.layout.addWidget (self.massRange, 4, 1, PyQt4.QtCore.Qt.AlignLeft)
318
319 comboList = PyQt4.QtCore.QStringList ("mn")
320 comboList.append ("mass")
321 comboList.append ("number")
322 self.compute = PyQt4.QtGui.QComboBox ()
323 self.compute.addItems (comboList)
324 self.list.layout.addWidget (self.compute, 1, 2, 1, 2, PyQt4.QtCore.Qt.AlignHCenter)
325
326 self.bins = PyQt4.QtGui.QSpinBox ()
327 self.bins.setRange (1, 999999999)
328 self.list.layout.addWidget (PyQt4.QtGui.QLabel ("bins:"), 2, 2, PyQt4.QtCore.Qt.AlignRight)
329 self.list.layout.addWidget (self.bins, 2, 3, PyQt4.QtCore.Qt.AlignLeft)
330 self.rmin = PyQt4.QtGui.QDoubleSpinBox ()
331 self.rmin.setRange (0.0, 999999999.0)
332 self.rmin.setDecimals (Constants.DOUBLE_PRECISION)
333 self.list.layout.addWidget (PyQt4.QtGui.QLabel ("rmin:"), 3, 2, PyQt4.QtCore.Qt.AlignRight)
334 self.list.layout.addWidget (self.rmin, 3, 3, PyQt4.QtCore.Qt.AlignLeft)
335 self.rmax = PyQt4.QtGui.QDoubleSpinBox ()
336 self.rmax.setRange (0.0, 999999999.0)
337 self.rmax.setDecimals (Constants.DOUBLE_PRECISION)
338 self.list.layout.addWidget (PyQt4.QtGui.QLabel ("rmax:"), 4, 2, PyQt4.QtCore.Qt.AlignRight)
339 self.list.layout.addWidget (self.rmax, 4, 3, PyQt4.QtCore.Qt.AlignLeft)
340 self.scale = PyQt4.QtGui.QCheckBox ("log scale?")
341 self.list.layout.addWidget (self.scale, 5, 2, 1, 2)
342
349
385
386
389 self._displayName = "Disp Profile"
390 self._displayIcon = PyQt4.QtGui.QIcon (Constants.ICON_DEFAULT)
391 self._description = \
392 ""
393 self._inList = ["x", "y", "z", "A"]
394 self._outList = ["out"]
395 AbstractStellarDynamics.__init__ (self, parent, bridge)
396 self.massRange = Holders.ChildListHolder (bridge, self.list)
397 self.list.layout.addWidget (PyQt4.QtGui.QLabel ("scale:"), 4, 0, PyQt4.QtCore.Qt.AlignRight)
398 self.list.layout.addWidget (self.massRange, 4, 1, PyQt4.QtCore.Qt.AlignLeft)
399
400 comboList = PyQt4.QtCore.QStringList ("log")
401 comboList.append ("normal")
402 self.compute = PyQt4.QtGui.QComboBox ()
403 self.compute.addItems (comboList)
404 self.list.layout.addWidget (self.compute, 1, 2, 1, 2, PyQt4.QtCore.Qt.AlignHCenter)
405
406 self.bins = PyQt4.QtGui.QSpinBox ()
407 self.bins.setRange (1, 999999999)
408 self.list.layout.addWidget (PyQt4.QtGui.QLabel ("bins:"), 2, 2, PyQt4.QtCore.Qt.AlignRight)
409 self.list.layout.addWidget (self.bins, 2, 3, PyQt4.QtCore.Qt.AlignLeft)
410 self.rmin = PyQt4.QtGui.QDoubleSpinBox ()
411 self.rmin.setRange (0.0, 999999999.9)
412 self.rmin.setDecimals (Constants.DOUBLE_PRECISION)
413 self.list.layout.addWidget (PyQt4.QtGui.QLabel ("rmin:"), 3, 2, PyQt4.QtCore.Qt.AlignRight)
414 self.list.layout.addWidget (self.rmin, 3, 3, PyQt4.QtCore.Qt.AlignLeft)
415 self.rmax = PyQt4.QtGui.QDoubleSpinBox ()
416 self.rmax.setRange (0.0, 999999999.9)
417 self.rmax.setDecimals (Constants.DOUBLE_PRECISION)
418 self.list.layout.addWidget (PyQt4.QtGui.QLabel ("rmax:"), 4, 2, PyQt4.QtCore.Qt.AlignRight)
419 self.list.layout.addWidget (self.rmax, 4, 3, PyQt4.QtCore.Qt.AlignLeft)
420 self.scale = PyQt4.QtGui.QCheckBox ("log scale?")
421 self.list.layout.addWidget (self.scale, 5, 2, 1, 2)
422
429
465