コード例 #1
0
ファイル: XMC.py プロジェクト: vishnu2709/Qrius
	def __init__ (self, oXMC):

		self.oXMC = oXMC
		self._plots = {}
		self._taskq = XTaskQueue()
		self._lastPlotUpdateAt = 0.0
		self._hApplet = self.oXMC.oApp.master.after (50, self._applet)
コード例 #2
0
ファイル: res.py プロジェクト: vishnu2709/Qrius
	def __init__ (self, oRes2):

		self.oRes2 = oRes2
		self._plots = {}
		self._taskq = XTaskQueue()
		self._lastPlotUpdateAt = 0.0
		self._hApplet = self.oRes2.oApp.master.after (50, self.applet)
コード例 #3
0
ファイル: XMC.py プロジェクト: vishnu2709/Qrius
class _Applet:

	def __init__ (self, oXMC):

		self.oXMC = oXMC
		self._plots = {}
		self._taskq = XTaskQueue()
		self._lastPlotUpdateAt = 0.0
		self._hApplet = self.oXMC.oApp.master.after (50, self._applet)

	def _applet (self):

		self._taskq.process()
		oApp = self.oXMC.oApp

		t = systime()
		if t >= self._lastPlotUpdateAt + 2:
			self._lastPlotUpdateAt = t

			for (wPlot, trace) in self._plots.values():
				if wPlot.damaged() : wPlot.redraw()

		self._hApplet = oApp.master.after (50, self._applet)

	def schedule_task (self, task, *args):
		self._taskq.push (task, *args)

	def setConnectionStatus (self, status):
		self.oXMC.oApp.setConnectionStatus (status)

	def setRunControlStatus (self, status):
		self.oXMC.oApp.setRunControlStatus (status)

	def setRunMode (self, runMode):
		self.oXMC.oApp.setRunMode (runMode)
		self.oXMC.runMode = runMode

	def refresh (self):
		self.oXMC.oApp.master.update()

	def close (self):
		oApp = self.oXMC.oApp
		oApp.close()
		oApp.master.after_cancel (self._hApplet)
		oApp.master.destroy()

	# +++++++++++++ GUI set functions +++++++++++++++

	def setProgressBarLimits (self, position, destination):
		lvalue = [position, destination][position > destination]
		rvalue = [position, destination][position < destination]
		self.oXMC.oApp.setMCProgressBarMin (lvalue)
		self.oXMC.oApp.setMCProgressBarMax (rvalue)

	def setDisplayedParameters (self, state, position, remainingDistance):
		self.oXMC.oApp.setMCStatusDisplay (state, position, remainingDistance)
		self.oXMC.oApp.setMCProgressBarDisplay (position)
		self.oXMC.status.set (state, position, remainingDistance)

	def setStatusJammed (self):
		self.oXMC.oApp.setStatusJammed()

	def setPitchSetting (self, pitch):
		self.oXMC.pitch = pitch

	def initPlot (self, thread, title, xlabel, ylabel):
		oApp = self.oXMC.oApp
		wPlot = oApp.newPlot (title)
		wPlot.xlabel (xlabel)
		wPlot.ylabel (ylabel)
		trace = wPlot.new_dataset ('k-')
		wPlot.damage()
		self._plots[thread] = (wPlot, trace)

	def updatePlot (self, thread, time, position):
		(wPlot, trace) = self._plots[thread]
		wPlot.add_datapoint (trace, time, position)
		wPlot.damage()

	def clearPlot (self):
		oApp = self.oXMC.oApp
		oApp.clearPlot()
		self._plots.clear()

	def set_status (self, text):
		self.oXMC.oApp.set_status (text)

	# ++++++++++++++++++++++++++++++++++++++++++++++++++

	def acquisition_atexit (self):
		self.oXMC.releaseAcquisition()

	def devicethread_atexit (self):
		self.oXMC.releaseDeviceThread();
コード例 #4
0
ファイル: sus.py プロジェクト: vishnu2709/Qrius
class _Applet:

	def __init__ (self, oSus):

		self.oSus = oSus
		self._plots = {}
		self._taskq = XTaskQueue()
		self._lastPlotUpdateAt = 0.0
		self._hApplet = self.oSus.oApp.master.after (50, self._applet)

	def _applet (self):

		oApp = self.oSus.oApp
		self._taskq.process()

		t = systime()
		if t >= self._lastPlotUpdateAt + 2:
			self._lastPlotUpdateAt = t

			for (wPlot, trace1, trace2) in self._plots.values():
				if wPlot.damaged() : wPlot.redraw()

		self._hApplet = oApp.master.after (50, self._applet)

	def schedule_task (self, task, *args):
		self._taskq.push (task, *args)

	def refresh (self):
		self.oSus.oApp.master.update()

	def close (self):
		oApp = self.oSus.oApp
		oApp.close()
		oApp.master.after_cancel (self._hApplet)
		oApp.master.destroy()

	# +++++++++++++ Acquisition functions +++++++++++++++

	def setRunMode (self, mode):
		oApp = self.oSus.oApp
		oApp.setRunMode (mode)

		oSus = self.oSus
		oSus.runMode = mode

	def setRunControlStatus (self, status):
		oApp = self.oSus.oApp
		oApp.setRunControlStatus (status)

	def setAcqSetting (self, stepSize, maxDepth, probeUp, probeDown):
		self.oSus.linac.set(stepSize, abs(maxDepth), probeUp, probeDown)
		text = ('XL acquisition settings modified.')
		self.oSus.oApp.set_status (text)

	# +++++++++++++ Update display functions +++++++++++++++

	def set_status (self, text):
		self.oSus.oApp.set_status (text)

	# +++++ Plot functions ++++

	def initPlot (self, thread, title, xlabel, ylabel, key1, key2):
		oApp = self.oSus.oApp
		wPlot = oApp.newPlot (title)
		wPlot.xlabel (xlabel)
		wPlot.ylabel (ylabel)
		trace1 = wPlot.new_dataset ('k-', key1)
		trace2 = wPlot.new_dataset ('b-', key2)
		wPlot.damage()
		self._plots[thread] = (wPlot, trace1, trace2)

	# 'linear' or 'log'
	def setPlotScale (self, thread, xscale, yscale):
		if thread in self._plots:
			(wPlot, trace1, trace2) = self._plots[thread]
			wPlot.xscale (xscale)
			wPlot.yscale (yscale)
			wPlot.damage()

	def updatePlot (self, thread, x, y1, y2):
		if thread in self._plots:
			(wPlot, trace1, trace2) = self._plots[thread]
			wPlot.add_datapoint (trace1, x, y1)
			wPlot.add_datapoint (trace2, x, y2)
			wPlot.damage()

	def clearPlot (self):
		oApp = self.oSus.oApp
		oApp.clearPlot()
		self._plots.clear()

	def setProbePosition (self, position):
		oApp = self.oSus.oApp
		oApp.setProbePosition (position)

	def setProbeMinMax (self, probeMinMax):
		oSus = self.oSus
		oSus.linac.probeDown = max (probeMinMax)
		oSus.linac.probeUp   = min (probeMinMax)

	def activate_proceed (self):
		oApp = self.oSus.oApp
		oApp.activate_proceed()

	def deactivate_proceed (self):
		oApp = self.oSus.oApp
		oApp.deactivate_proceed()

	def acquisition_atexit (self):
		self.oSus.releaseAcquisition()
コード例 #5
0
ファイル: res.py プロジェクト: vishnu2709/Qrius
class _Applet:

	def __init__ (self, oRes2):

		self.oRes2 = oRes2
		self._plots = {}
		self._taskq = XTaskQueue()
		self._lastPlotUpdateAt = 0.0
		self._hApplet = self.oRes2.oApp.master.after (50, self.applet)

	def applet (self):

		oApp = self.oRes2.oApp
		self._taskq.process()

		t = systime()
		if t >= self._lastPlotUpdateAt + 2:
			self._lastPlotUpdateAt = t

			for (wPlot, traceID) in self._plots.values():
				if wPlot.damaged() : wPlot.redraw()

		self._hApplet = oApp.master.after (50, self.applet)

	def schedule_task (self, task, *args):
		self._taskq.push (task, *args)

	def refresh (self):
		self.oRes2.oApp.master.update()

	def close (self):
		oApp = self.oRes2.oApp
		oApp.close()
		oApp.master.after_cancel (self._hApplet)
		oApp.master.destroy()

	# +++++++++++++ Acquisition functions +++++++++++++++

	def setRunMode (self, mode):
		oApp = self.oRes2.oApp
		oApp.setRunMode (mode)

		oRes2 = self.oRes2
		oRes2.runMode = mode

	def setRunControlStatus (self, status):
		oApp = self.oRes2.oApp
		oApp.setRunControlStatus (status)

	# +++++++++++++ Update display functions +++++++++++++++

	def set_status (self, text):
		self.oRes2.oApp.set_status (text)

	# +++++ Plot functions ++++

	def initPlot (self, thread, title, xlabel, ylabel):
		oApp = self.oRes2.oApp
		wPlot = oApp.newPlot (title)
		wPlot.xlabel (xlabel)
		wPlot.ylabel (ylabel)
		traceID = wPlot.new_dataset ('k-')
		wPlot.damage()
		self._plots[thread] = (wPlot, traceID)

	def updatePlot (self, thread, x, y):
		(wPlot, traceID) = self._plots[thread]
		wPlot.add_datapoint (traceID, x, y)
		wPlot.damage()

	def clearPlot (self):
		oApp = self.oRes2.oApp
		oApp.clearPlot()
		self._plots.clear()

	# +++++++++++++++++++++++++++++++++++++++++++++++++++++++

	def acquisition_atexit (self):
		self.oRes2.releaseAcquisition()

	# +++++++++++++++++++++++++++++++++++++++++++++++++++++++

	def set_rh_settings (self, total_cycle, H_max, H_step):
		self.oRes2.oApp.set_rh_settings (total_cycle, H_max, H_step)
		self.oRes2.rh_settings.set (total_cycle, H_max, H_step)