Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if self.is_init:
for c in ev:
for child in self.vbox.children:
print(child.title, child.text)
if child.title == c:
child.set_text(str(ev[c]))
break
return
print("Event: ", ev)
with self.vbox:
for c in ev:
if c in ["groups", "type", "source"]:
continue
l = flx.LineEdit(title=c, text=str(ev[c]))
flx.Button(text="Set")
flx.Widget(minsize=60)
self.is_init = True
flx.Widget(minsize=20)
self.heading = flx.LineEdit(title="Heading", text="")
self.pitch = flx.LineEdit(title="Pitch", text="")
self.roll = flx.LineEdit(title="Roll", text="")
flx.Widget(minsize=40)
with flx.FormLayout(flex=1):
flx.Widget(minsize=20)
self.depth = flx.LineEdit(title="Depth", text="")
self.xpos = flx.LineEdit(title="X", text="")
self.ypos = flx.LineEdit(title="Y", text="")
flx.Widget(minsize=40)
with flx.FormLayout(flex=1):
flx.Widget(minsize=20)
self.xvel = flx.LineEdit(title="X vel", text="")
self.yvel = flx.LineEdit(title="Y vel", text="")
self.zvel = flx.LineEdit(title="Z vel", text="")
flx.Widget(minsize=40)
with flx.FormLayout(flex=1):
flx.Widget(minsize=20)
self.gps_status = flx.LineEdit(title="GPS Status", text="")
self.dvl_status = flx.LineEdit(title="DVL Status", text="")
self.battery_status = flx.LineEdit(title="Battery level", text="")
flx.Widget(minsize=40)
with flx.FormLayout(flex=1):
flx.Widget(minsize=20)
self.vbs_fb = flx.LineEdit(title="VBS fb", text="")
self.lcg_fb = flx.LineEdit(title="LCG fb", text="")
self.rpm_fb = flx.LineEdit(title="RPM fb", text="")
flx.Widget(minsize=40)
# We subscribe to these topics at full frquency (no extra arg)
self.subscribe("/sam/core/gps", "sensor_msgs/NavSatFix", self.gps_callback)
flx.Widget(minsize=20)
self.xvel = flx.LineEdit(title="X vel", text="")
self.yvel = flx.LineEdit(title="Y vel", text="")
self.zvel = flx.LineEdit(title="Z vel", text="")
flx.Widget(minsize=40)
with flx.FormLayout(flex=1):
flx.Widget(minsize=20)
self.gps_status = flx.LineEdit(title="GPS Status", text="")
self.dvl_status = flx.LineEdit(title="DVL Status", text="")
self.battery_status = flx.LineEdit(title="Battery level", text="")
flx.Widget(minsize=40)
with flx.FormLayout(flex=1):
flx.Widget(minsize=20)
self.vbs_fb = flx.LineEdit(title="VBS fb", text="")
self.lcg_fb = flx.LineEdit(title="LCG fb", text="")
self.rpm_fb = flx.LineEdit(title="RPM fb", text="")
flx.Widget(minsize=40)
# We subscribe to these topics at full frquency (no extra arg)
self.subscribe("/sam/core/gps", "sensor_msgs/NavSatFix", self.gps_callback)
self.subscribe("/sam/core/battery_fb", "sensor_msgs/BatteryState", self.battery_callback)
# We only subscribe to these topics at 1hz
self.subscribe("/sam/dr/odom", "nav_msgs/Odometry", self.odom_callback, 1.)
self.subscribe("/sam/core/vbs_fb", "sam_msgs/PercentStamped", self.vbs_callback, 1.)
self.subscribe("/sam/core/lcg_fb", "sam_msgs/PercentStamped", self.lcg_callback, 1.)
self.subscribe("/sam/ctrl/depth_feedback", "std_msgs/Float64", self.depth_callback, 1.)
self.subscribe("/sam/ctrl/pitch_feedback", "std_msgs/Float64", self.pitch_callback, 1.)
self.subscribe("/sam/ctrl/roll_feedback", "std_msgs/Float64", self.roll_callback, 1.)
self.subscribe("/sam/ctrl/yaw_feedback", "std_msgs/Float64", self.yaw_callback, 1.)
with flx.HBox(flex=1, style="background: #e6e6df;"):
with flx.FormLayout(flex=1):
flx.Widget(minsize=20)
self.heading = flx.LineEdit(title="Heading", text="")
self.pitch = flx.LineEdit(title="Pitch", text="")
self.roll = flx.LineEdit(title="Roll", text="")
flx.Widget(minsize=40)
with flx.FormLayout(flex=1):
flx.Widget(minsize=20)
self.depth = flx.LineEdit(title="Depth", text="")
self.xpos = flx.LineEdit(title="X", text="")
self.ypos = flx.LineEdit(title="Y", text="")
flx.Widget(minsize=40)
with flx.FormLayout(flex=1):
flx.Widget(minsize=20)
self.xvel = flx.LineEdit(title="X vel", text="")
self.yvel = flx.LineEdit(title="Y vel", text="")
self.zvel = flx.LineEdit(title="Z vel", text="")
flx.Widget(minsize=40)
with flx.FormLayout(flex=1):
flx.Widget(minsize=20)
self.gps_status = flx.LineEdit(title="GPS Status", text="")
self.dvl_status = flx.LineEdit(title="DVL Status", text="")
self.battery_status = flx.LineEdit(title="Battery level", text="")
flx.Widget(minsize=40)
with flx.FormLayout(flex=1):
flx.Widget(minsize=20)
self.vbs_fb = flx.LineEdit(title="VBS fb", text="")
self.lcg_fb = flx.LineEdit(title="LCG fb", text="")
self.rpm_fb = flx.LineEdit(title="RPM fb", text="")
flx.Widget(minsize=40)
def init(self):
with flx.Widget():
flx.Label(text='Refreshing the page should '
'maintain the value of the line edit.')
self.edit = flx.LineEdit(placeholder_text='username',
text=self.session.get_cookie('username', ''))
def init(self):
with flx.HFix():
with flx.FormLayout() as self.form:
self.b1 = flx.LineEdit(title='Name:', text='Hola')
self.b2 = flx.LineEdit(title='Age:', text='Hello world')
self.b3 = flx.LineEdit(title='Favorite color:', text='Foo bar')
flx.Button(text='Submit')
with flx.FormLayout() as self.form:
self.b4 = flx.LineEdit(title='Name:', text='Hola')
self.b5 = flx.LineEdit(title='Age:', text='Hello world')
self.b6 = flx.LineEdit(title='Favorite color:', text='Foo bar')
flx.Button(text='Submit')
flx.Widget(flex=1) # Add a spacer
def init(self):
with flx.HFix():
with flx.FormLayout() as self.form:
self.b1 = flx.LineEdit(title='Name:', text='Hola')
self.b2 = flx.LineEdit(title='Age:', text='Hello world')
self.b3 = flx.LineEdit(title='Favorite color:', text='Foo bar')
flx.Button(text='Submit')
with flx.FormLayout() as self.form:
self.b4 = flx.LineEdit(title='Name:', text='Hola')
self.b5 = flx.LineEdit(title='Age:', text='Hello world')
self.b6 = flx.LineEdit(title='Favorite color:', text='Foo bar')
flx.Button(text='Submit')
flx.Widget(flex=1) # Add a spacer
flx.Widget(minsize=40)
with flx.FormLayout(flex=1):
flx.Widget(minsize=20)
self.xvel = flx.LineEdit(title="X vel", text="")
self.yvel = flx.LineEdit(title="Y vel", text="")
self.zvel = flx.LineEdit(title="Z vel", text="")
flx.Widget(minsize=40)
with flx.FormLayout(flex=1):
flx.Widget(minsize=20)
self.gps_status = flx.LineEdit(title="GPS Status", text="")
self.dvl_status = flx.LineEdit(title="DVL Status", text="")
self.battery_status = flx.LineEdit(title="Battery level", text="")
flx.Widget(minsize=40)
with flx.FormLayout(flex=1):
flx.Widget(minsize=20)
self.vbs_fb = flx.LineEdit(title="VBS fb", text="")
self.lcg_fb = flx.LineEdit(title="LCG fb", text="")
self.rpm_fb = flx.LineEdit(title="RPM fb", text="")
flx.Widget(minsize=40)
# We subscribe to these topics at full frquency (no extra arg)
self.subscribe("/sam/core/gps", "sensor_msgs/NavSatFix", self.gps_callback)
self.subscribe("/sam/core/battery_fb", "sensor_msgs/BatteryState", self.battery_callback)
# We only subscribe to these topics at 1hz
self.subscribe("/sam/dr/odom", "nav_msgs/Odometry", self.odom_callback, 1.)
self.subscribe("/sam/core/vbs_fb", "sam_msgs/PercentStamped", self.vbs_callback, 1.)
self.subscribe("/sam/core/lcg_fb", "sam_msgs/PercentStamped", self.lcg_callback, 1.)
self.subscribe("/sam/ctrl/depth_feedback", "std_msgs/Float64", self.depth_callback, 1.)
self.subscribe("/sam/ctrl/pitch_feedback", "std_msgs/Float64", self.pitch_callback, 1.)
self.subscribe("/sam/ctrl/roll_feedback", "std_msgs/Float64", self.roll_callback, 1.)
self.subscribe("/sam/ctrl/yaw_feedback", "std_msgs/Float64", self.yaw_callback, 1.)