def __init__(self, parameters, function, xVals, plotItem): QtGui.QWidget.__init__(self) #make frame-less: self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) #TODO: # #go to current screen: # d = QtGui.QApplication.desktop() # n = d.screenNumber(self) # self.setGeometry(d.screenGeometry(n)) self.xVals = xVals self.plotItem = plotItem self.function = function layout = QtGui.QGridLayout() self.setLayout(layout) self.s = [] #all spinboxes for n, (name, value) in enumerate(parameters.items()): layout.addWidget(QtGui.QLabel(name), n, 0) s = QtGui.QDoubleSpinBox() s.setValue(value) s.setMaximum(1e6) s.setMinimum(-1e6) s.valueChanged.connect(self._valueChanged) layout.addWidget(s, n, 1) self.s.append(s) btn_done = QtGui.QPushButton('Done') btn_done.clicked.connect(self.done) layout.addWidget(btn_done, n + 1, 0, 1, 2) self._valueChanged()
def __init__(self, gui): QtGui.QWidget.__init__(self) self.gui = gui rab = self.rabbitMQServer = RabbitMQServer(gui) self._wf = wf = WatchFolder(gui) s = gui.app.session #CONNECT SAVE/RESTORE: s.sigSave.connect(self._save) s.sigRestore.connect(self._restore) #CONNECT CLOSE gui.app.lastWindowClosed.connect(rab.stop) #LAYOUT: layout = QtGui.QVBoxLayout() layout.setAlignment(QtCore.Qt.AlignTop) self.setLayout(layout) #WATCH FOLDER ############# self.cb_watchFolder = QtGui.QCheckBox('Watch folder') self.cb_watchFolder.toggled.connect(self._watchFolderChanged) layout.addWidget(self.cb_watchFolder) self._folder_opts = QtGui.QWidget() layout.addWidget(self._folder_opts) gl = QtGui.QGridLayout() self._folder_opts.setLayout(gl) self._folder_opts.hide() self._wf_folderEdit = QtGui.QLineEdit('-') self._wf_folderEdit.setReadOnly(True) gl.addWidget(self._wf_folderEdit, 0, 0) btn = QtGui.QPushButton('Change') btn.clicked.connect(self._wf_folderChanged) gl.addWidget(btn, 0, 1) self._cb_filesOnly = QtGui.QCheckBox('Files only') self._cb_filesOnly.setChecked(wf.opts['files only']) self.cb_watchFolder.toggled.connect( lambda val: wf.opts.__setitem__('files only', val)) gl.addWidget(self._cb_filesOnly, 1, 0) gl.addWidget(QtGui.QLabel('refreshrate [msec]'), 2, 0) self._wf_refRate = QtGui.QSpinBox() self._wf_refRate.setRange(1, 100000) self._wf_refRate.setValue(wf.opts['refreshrate']) self._wf_refRate.valueChanged.connect(self._wf_refRateChanged) gl.addWidget(self._wf_refRate, 2, 1) #RABBIT MQ ########## hlayout = QtGui.QHBoxLayout() layout.addLayout(hlayout) self.cb_allowRabbit = QtGui.QCheckBox( 'Allow inter-process communication\nusing the RabbitMQ server') self.cb_allowRabbit.toggled.connect(self._allowRabbitMQchanged) hlayout.addWidget(self.cb_allowRabbit) self.cb_confirm = QtGui.QCheckBox('Confirm received messages') self.cb_confirm.hide() self.cb_confirm.setChecked(rab.opts['corfirmPosts']) self.cb_confirm.toggled.connect( lambda val: rab.opts.__setitem__('corfirmPosts', val)) hlayout.addWidget(self.cb_confirm) self._rab_opts = QtGui.QWidget() layout.addWidget(self._rab_opts) gl = QtGui.QGridLayout() self._rab_opts.setLayout(gl) self._rab_opts.hide() gl.addWidget(QtGui.QLabel('refreshrate [msec]'), 0, 0) self._rab_refRate = QtGui.QSpinBox() self._rab_refRate.setRange(1, 1000) self._rab_refRate.setValue(rab.opts['refreshrate']) self._rab_refRate.valueChanged.connect( lambda val: rab.opts.__setitem__('refreshrate', val)) gl.addWidget(self._rab_refRate, 0, 1) gl.addWidget(QtGui.QLabel('host'), 1, 0) self.le_host = QtGui.QLineEdit() self.le_host.setText(rab.opts['host']) self.le_host.textChanged.connect( lambda val: rab.opts.__setitem__('host', val)) gl.addWidget(self.le_host, 1, 1) gl.addWidget(QtGui.QLabel('timeout [msec]'), 2, 0) self.sb_timeout = QtGui.QSpinBox() self.sb_timeout.setRange(0, 1000) self.sb_timeout.setValue(rab.opts['timeout']) self.sb_timeout.valueChanged.connect( lambda val: rab.opts.__setitem__('timeout', val)) gl.addWidget(self.sb_timeout, 2, 1) gl.addWidget(QtGui.QLabel('<b>....listen to queues named:</b>'), 3, 0) for n, (queue, action) in enumerate(rab.listenTo.iteritems()): gl.addWidget(QtGui.QLabel(queue), 4 + n, 0) gl.addWidget(QtGui.QLabel(action.__doc__), 4 + n, 1)