本文整理汇总了Python中session.Session.addTrigger方法的典型用法代码示例。如果您正苦于以下问题:Python Session.addTrigger方法的具体用法?Python Session.addTrigger怎么用?Python Session.addTrigger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类session.Session
的用法示例。
在下文中一共展示了Session.addTrigger方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Recorder
# 需要导入模块: from session import Session [as 别名]
# 或者: from session.Session import addTrigger [as 别名]
#.........这里部分代码省略.........
self.startTime = datetime.now()
self.server.start()
except:
print("something went wrong")
self.server.exitFlag = True
raise socket.timeout("Could not connect to Delsys Station")
else:
if self.showRunMeta.ui.cbEternity.checkState() == 0:
duration = self.showRunMeta.ui.timeEdit.time()
d = duration.second() + duration.minute()*60
self.runPinger.start(d*1000)
self.ui.elapsedTime.setRange(0,d)
elif self.showRunMeta.ui.cbEternity.checkState() == 2:
self.ui.elapsedTime.setRange(0,0)
self.pinger.start()
self.ui.tbStop.setEnabled(True)
self.ui.tbTrigger.setEnabled(True)
self.ui.tbStart.setEnabled(False)
name = self.showRunMeta.ui.leCurrentRun.text()
self.session.addRun(name)
if self.kinectRecorder is not None:
self.kinectRecorder.startRecording(self.newpath+'\\'+name+'.oni')
self.ui.elapsedTime.setRange(0,d)
def stop(self):
''' stop recording due to button press or timeout
- setup buttons
- stop timers
- stop server
- kill kinectRecorder
- add item to list of runs
'''
self.ui.tbStop.setEnabled(False)
self.ui.tbTrigger.setEnabled(False)
self.ui.tbStart.setEnabled(True)
self.ui.elapsedTime.reset()
QListWidgetItem(self.showRunMeta.ui.leCurrentRun.text(),
self.showRunMeta.ui.lwRuns)
self.showRunMeta.ui.leCurrentRun.setText(str(len(self.session.runs)))
self.server.exitFlag = True
self.server.stop()
self.runPinger.stop()
self.pinger.stop()
self.session.stopRun(self.server.buffer)
self.server.buffer = None
if self.kinectRecorder is not None:
self.kinectRecorder.stopRecording()
self.server.flush()
def trigger(self):
''' add a trigger '''
print("trigger")
trigger = self.server.buffer[0].shape[1]
self.session.addTrigger(trigger)
def ping(self):
''' update progress bar and plots everytime
new data is available
'''
elapsed = int((datetime.now()-self.startTime).total_seconds())
self.ui.elapsedTime.setValue(elapsed)
for p in range(len(self.plots)):
if self.server.buffer[0].shape[1] < 5000:
self.plots[p].plot(self.server.buffer[0][p], clear=True)
else:
self.plots[p].plot(self.server.buffer[0][p,-5000:], clear=True)
def openPlotter(self, item=None):
if self.plotter is None:
self.plotter = Plotter()
if item is not None:
self.plotter.load([os.path.join(self.session.dir, item.text()) + ".pk"])
self.plotter.show()
def closeEvent(self, event):
if self.notSavedState:
reply = QMessageBox.question(self, 'QMessageBox.question()',
'Do you want to first save the current session?',
QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel)
else:
reply = QMessageBox.No
if reply == QMessageBox.Yes:
self.save()
elif reply == QMessageBox.Cancel:
event.ignore()
return
if not self.server.exitFlag:
self.stop()
event.accept()