def AutoAdjust(self): #self.Source.clear() a, b, c, d = Infos.List_All_Globals(option="numericalonly", Builtin=False) self.Source.addItems(list(set(a))) self.Source.addItems(list(set(a))) Min = numpy.nanmin(eval(self.Source.currentText())) Max = numpy.nanmax(eval(self.Source.currentText())) self.Min.setText(str(Min)) self.Max.setText(str(Max)) self.N.setValue(10) self.autoadjusted = False self.adjust()
def Manager(self): try: self.Wid = QtGui.QWidget() self.Wid.setMinimumSize(900, 500) self.Wid.setWindowTitle("Histogram Tools") self.hbox = QtGui.QHBoxLayout() self.Hist_Widget = QtGui.QWidget() self.hbox.addWidget(self.Hist_Widget) self.vbox = QtGui.QVBoxLayout() self.Source = QtGui.QComboBox(self.Hist_Widget) a, b, c, d = Infos.List_All_Globals(option="numericalonly", Builtin=False) self.Source.addItems(list(set(a))) self.Source.addItems(list(set(b))) self.Source_Label = QtGui.QLabel(self.Hist_Widget) self.Source_Label.setText('Source') Min = numpy.nanmin(eval(self.Source.currentText())) if Min == numpy.nan: Min = -1 Max = numpy.nanmax(eval(self.Source.currentText())) if Max == numpy.nan: Max = 1 self.Min = QtGui.QLineEdit(self.Hist_Widget) self.Min.setText(str(Min)) self.Min_Label = QtGui.QLabel(self.Hist_Widget) self.Min_Label.setText('Minimum') self.Max = QtGui.QLineEdit(self.Hist_Widget) self.Max.setText(str(Max)) self.Max_Label = QtGui.QLabel(self.Hist_Widget) self.Max_Label.setText('Maximum') self.N = QtGui.QSpinBox(self.Hist_Widget) self.N.setValue(int(round((Max - Min) / 10.))) self.N.setSingleStep(1) self.N.setRange(1, 1000) self.N_Label = QtGui.QLabel(self.Hist_Widget) self.N_Label.setText('Number of Bins') self.Size = QtGui.QLineEdit(self.Hist_Widget) self.Size.setText('10') self.Size_Label = QtGui.QLabel(self.Hist_Widget) self.Size_Label.setText('Bin Size') self.Destination = QtGui.QLineEdit(self.Hist_Widget) self.Destination.setText('self.hist') self.Destination_Label = QtGui.QLabel(self.Hist_Widget) self.Destination_Label.setText('Destination Wave') self.SendtoFit = QtGui.QPushButton(self.Hist_Widget) self.SendtoFit.setText('Send to Fitting Module') self.vbox.addWidget(self.Source_Label) self.vbox.addWidget(self.Source) self.vbox.addWidget(self.Min_Label) self.vbox.addWidget(self.Min) self.vbox.addWidget(self.Max_Label) self.vbox.addWidget(self.Max) self.vbox.addWidget(self.N_Label) self.vbox.addWidget(self.N) self.vbox.addWidget(self.Size_Label) self.vbox.addWidget(self.Size) self.vbox.addWidget(self.Destination_Label) self.vbox.addWidget(self.Destination) self.vbox.addWidget(self.SendtoFit) self.hbox.addLayout(self.vbox) self.Show_Hist = MyMplWidget() self.Show_Hist.setMinimumSize(600, 400) self.Show_Hist.setWindowTitle("Display") self.hbox.addWidget(self.Show_Hist) self.Wid.setLayout(self.hbox) QtCore.QObject.connect(self.Source, QtCore.SIGNAL('activated(int)'), self.AutoAdjust) QtCore.QObject.connect(self.Min, QtCore.SIGNAL('editingFinished()'), self.adjust) QtCore.QObject.connect(self.Max, QtCore.SIGNAL('editingFinished()'), self.adjust) QtCore.QObject.connect(self.N, QtCore.SIGNAL('editingFinished()'), self.adjust) QtCore.QObject.connect(self.Size, QtCore.SIGNAL('editingFinished()'), self.adjust) QtCore.QObject.connect(self.Destination, QtCore.SIGNAL('editingFinished()'), self.adjust) QtCore.QObject.connect(self.SendtoFit, QtCore.SIGNAL('clicked()'), Fitting.FittingWindowInput) self.Wid.show() self.adjust() except SyntaxError: msgBox = QtGui.QMessageBox() msgBox.setText(""" <b>No numerical Array yet</b> <p>Load some numerical data first """) msgBox.exec_()