Commit b7ceca5e38b2b939900df4416316c8258a54b135
1 parent
050af22188
Exists in
master
datalogger-gui.py: add sampling time spinbox
Showing 1 changed file with 16 additions and 3 deletions Side-by-side Diff
datalogger-gui.py
... | ... | @@ -10,7 +10,7 @@ |
10 | 10 | #============================================================================== |
11 | 11 | |
12 | 12 | class acq_routine(): |
13 | - def __init__(self, instrument, channels, vtypes, address, path = os.getcwd(), samplingtime = 1, fileduration = 24*3600): | |
13 | + def __init__(self, instrument, channels, vtypes, address, samplingtime, path = os.getcwd(), fileduration = 24*3600): | |
14 | 14 | exec('self.instrument = instruments.%s.%s(%s, %s, "%s")'%(instrument, instrument, channels, vtypes, address)) |
15 | 15 | self.path = path |
16 | 16 | self.samplingtime = samplingtime |
... | ... | @@ -103,6 +103,15 @@ |
103 | 103 | self.address.setMaximumWidth(140) |
104 | 104 | self.layout.addWidget(self.address, 0, 1) |
105 | 105 | |
106 | + self.samplingtime = QtGui.QDoubleSpinBox() | |
107 | + #self.samplingtime.setMinimumWidth(60) | |
108 | + #self.samplingtime.setMaximumWidth(60) | |
109 | + self.samplingtime.setMinimum(0.1) | |
110 | + self.samplingtime.setMaximum(1000) | |
111 | + self.samplingtime.setSingleStep(0.1) | |
112 | + self.samplingtime.setValue(1) | |
113 | + self.layout.addWidget(self.samplingtime, 0, 2) | |
114 | + | |
106 | 115 | self.startButton = QtGui.QPushButton() |
107 | 116 | self.startButton.setText('Start log') |
108 | 117 | self.layout.addWidget(self.startButton, 99, 0) |
... | ... | @@ -174,6 +183,7 @@ |
174 | 183 | self.chListVtypes[i].currentItemChanged.connect(self.infoSignal) |
175 | 184 | |
176 | 185 | self.address.textChanged.connect(self.infoSignal) |
186 | + self.samplingtime.valueChanged.connect(self.infoSignal) | |
177 | 187 | |
178 | 188 | self.infoSignal() |
179 | 189 | |
... | ... | @@ -183,6 +193,7 @@ |
183 | 193 | self.addressToLog = self.address.text() |
184 | 194 | self.chToLog = [] |
185 | 195 | self.vTypeToLog = [] |
196 | + self.ts = self.samplingtime.value() | |
186 | 197 | |
187 | 198 | for i in range(len(self.checkBoxChannels)): |
188 | 199 | if self.checkBoxChannels[i].isChecked(): |
189 | 200 | |
190 | 201 | |
... | ... | @@ -200,15 +211,16 @@ |
200 | 211 | else: |
201 | 212 | self.startButton.setEnabled(True) |
202 | 213 | |
203 | - self.textDisplay.setText('>> %s@%s - %s - %s'%(self.instToLog, self.addressToLog, self.chToLog, self.vTypeToLog)) | |
214 | + self.textDisplay.setText('>> %s@%s - %s - %s - %d'%(self.instToLog, self.addressToLog, self.chToLog, self.vTypeToLog, self.ts)) | |
204 | 215 | |
205 | - self.myLog = acq_routine(self.instToLog, self.chToLog, self.vTypeToLog, self.addressToLog) | |
216 | + self.myLog = acq_routine(self.instToLog, self.chToLog, self.vTypeToLog, self.addressToLog, self.ts) | |
206 | 217 | |
207 | 218 | @pyqtSlot() |
208 | 219 | def startLog(self): |
209 | 220 | self.startButton.setEnabled(False) |
210 | 221 | self.stopButton.setEnabled(True) |
211 | 222 | self.address.setEnabled(False) |
223 | + self.samplingtime.setReadOnly(True) | |
212 | 224 | self.comboInst.setEnabled(False) |
213 | 225 | for i in self.checkBoxChannels: |
214 | 226 | i.setEnabled(False) |
... | ... | @@ -222,6 +234,7 @@ |
222 | 234 | self.startButton.setEnabled(True) |
223 | 235 | self.stopButton.setEnabled(False) |
224 | 236 | self.address.setEnabled(True) |
237 | + self.samplingtime.setReadOnly(False) | |
225 | 238 | self.comboInst.setEnabled(True) |
226 | 239 | for i in range(len(self.checkBoxChannels)): |
227 | 240 | if self.checkBoxChannels[i].isChecked(): |