1 from __future__
import division, absolute_import
5 from twisted.internet
import defer
7 RO.Comm.Generic.setFramework(
"twisted")
10 from .fakeAxisCtrl
import FakeAxisCtrl
12 __all__ = [
"FakeAxisCtrlWdg",
"FakeAxisCtrlSetWdg"]
14 sampleMSDump =
"""time position velocity error edge correction
15 1266860307.600 74.814029 0.241533 0.000954 1 0.000524
16 1266816131.180 59.597493 1.485286 -0.003319 0 0.000000
17 1266816131.330 59.819334 1.485286 -0.000797 1 -0.002057
18 1266839360.530 59.810348 -1.376835 0.006240 0 0.000000
19 1266839360.680 59.590300 -1.376835 0.001925 1 0.004082
20 1266839369.990 44.817815 -1.607564 0.012479 0 0.000000
21 1266839370.120 44.606302 -1.605523 -0.007002 1 0.002738
22 1266860253.490 44.615251 0.252483 -0.014001 0 0.000000
23 1266860254.160 44.825963 0.252483 0.006281 1 -0.003860
24 1266860268.360 59.597959 1.462901 -0.003784 0 0.000000
25 1266860268.510 59.821265 1.462901 -0.002728 1 -0.003256
26 1266860306.680 74.595496 0.336560 0.000096 0 0.000000
27 1266860307.600 74.814029 0.241533 0.000954 1 0.000524"""
29 sampleID =
"axis code: 2009-10-16 379M, axis.ini version $Revision: 1.41 $"
32 """!Variant of FakeAxisCtrl that sets some widgets
34 def __init__(self, name, port, logReplies, logWdg, cmdPVTWdg, advTimeStatsWdg):
35 """!Construct a FakeAxisCtrlWithWdg
37 @param[in] name name of axis controller
38 @param[in] port port on which to command axis controller
39 @param[in] logReplies log all replies? Set False for less chatter
40 @param[in] logWdg an RO.Wdg.LogWdg in which to log replies
41 @param[in] cmdPVTWdg a RO.Wdg.StrLabel in which to display commanded position, velocity and time
42 @param[in] advTimeStatsWdg a RO.Wdg.StrLabel in which to display advanced time statistics
47 FakeAxisCtrl.__init__(self, name=name, port=port, logReplies=logReplies)
50 self.logWdg.addMsg(msgStr)
52 @FakeAxisCtrl.cmdPVT.setter
55 self.cmdPVTWdg.set(
"%0.3f %0.3f %0.3f" % (self.cmdPVT.pos, self.cmdPVT.vel, self.cmdPVT.t))
58 FakeAxisCtrl.addAdvTime(self, advTime)
59 advTimeStatsDict = self.advTimeStats.getStats()
60 self.advTimeStatsWdg.set(
"min=%(min)0.2f, median=%(median)0.2f stdDev=%(stdDev)0.2f" % advTimeStatsDict)
64 """!A widget that emulates an axis controller and displays information as a summary and log
66 def __init__(self, master, name, port, borderwidth=0, logReplies=True):
67 """!Construct a fake axis controller widget
69 @param[in] master master widget
70 @param[in] name name of axis controller
71 @param[in] port port on which to command axis controller
72 @param[in] borderwidth border width of enclosing frame
73 @param[in] logReplies log all replies? Set False for a very slow connection
77 Tkinter.Frame.__init__(self, master, borderwidth=borderwidth)
79 statusFrame = Tkinter.Frame(self)
81 RO.Wdg.StrLabel(master=statusFrame, text=
"%s Last PVT" % (self.
name,)).grid(row=row, column=0, sticky=
"e")
82 self.
cmdPVTWdg = RO.Wdg.StrLabel(master=statusFrame)
83 self.cmdPVTWdg.grid(row=row, column=1, sticky=
"w")
85 RO.Wdg.Button(master=statusFrame, text=
"Adv Time", callFunc=self.
resetAdvTime).grid(row=row, column=0, sticky=
"e")
87 self.advTimeStatsWdg.grid(row=row, column=1, sticky=
"w")
89 statusFrame.grid(row=0, column=0, sticky=
"w")
91 self.
logWdg = RO.Wdg.LogWdg(master=self, height=10)
92 self.logWdg.grid(row=1, column=0, sticky=
"nsew")
93 self.grid_rowconfigure(0, weight=1)
94 self.grid_columnconfigure(0, weight=1)
99 logReplies=logReplies,
106 self.advTimeStats.clear()
107 self.advTimeStatsWdg.set(
"")
111 def __init__(self, master, namePortList, logReplies=True):
112 """!Create a FakeAxisCtrlSetWdg
114 @param[in] master master widget
115 @param[in] namePortList list of (dev name, port)
116 @param[in] logReplies log all replies? Set False for a very slow connection
118 Tkinter.Frame.__init__(self, master)
120 for axisName, port
in namePortList:
125 logReplies=logReplies,
128 rdList.append(wdg.fakeAxisCtrl.readyDeferred)
129 wdg.pack(side=
"top", fill=
"both", expand=
True)
def __init__
Create a FakeAxisCtrlSetWdg.
def __init__
Construct a FakeAxisCtrlWithWdg.
A widget that emulates an axis controller and displays information as a summary and log...
Variant of FakeAxisCtrl that sets some widgets.
def __init__
Construct a fake axis controller widget.