Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def init(self):
super().init()
with flx.VBox():
flx.Label(text='You should see 5 pairs of buttons')
with flx.HFix(): # Use minsize in CSS of button widget
with flx.GroupWidget(title='asdas'):
with flx.HFix():
flx.Button(text='foo')
flx.Button(text='bar')
with flx.HFix(minsize=50): # Set minsize prop on container
flx.Button(text='foo')
flx.Button(text='bar')
with flx.HFix(): # Set minsize prop on widget
flx.Button(text='foo', minsize=50)
flx.Button(text='bar')
def init(self):
with flx.HBox():
with flx.VBox(flex=0, minsize=150):
self.b1 = flx.RadioButton(text='Linear')
self.b2 = flx.RadioButton(text='Basis')
self.b3 = flx.RadioButton(text='Cardinal', checked=True)
self.b4 = flx.RadioButton(text='Catmull Rom')
self.b5 = flx.RadioButton(text='Lagrange')
self.b6 = flx.RadioButton(text='Lanczos')
flx.Widget(minsize=10)
closed = flx.CheckBox(text='Closed')
flx.Widget(minsize=10)
self.tension = flx.Slider(min=-0.5, max=1, value=0.5,
text='Tension: {value}')
flx.Widget(flex=1)
with flx.VBox(flex=1):
flx.Label(text=GENERAL_TEXT, wrap=True, style='font-size: 12px;')
self.explanation = flx.Label(text=CARDINAL_TEXT, wrap=True,
self.server_name = topic.split("/")[1]
self.service_name = "/" + self.server_name + "/start_stop"
self.nodes = {}
self.subscribe(topic, "rosmon_msgs/State", self.callback)
self.list_container = flx.VBox(flex=1)
with self.list_container:
with flx.HBox(flex=1):
self.expand = flx.Button(flex=0, text=">")
self.label = flx.Label(flex=0, text=self.server_name + ":")
self.launch_state = flx.Label(flex=0, text="IDLE", style='color: #F00;')
#self.expand = flx.Button(text="Expand")
flx.Widget(flex=1)
self.start_stop = flx.Button(flex=0, text="Stop")
self.base_layout = flx.VBox(flex=1, style='border:1px solid #777;')
with self.base_layout:
with flx.HFix():
flx.Label(text="Name")
flx.Label(text="State")
flx.Label(text="CPU")
flx.Label(text="Memory")
flx.Label(text="Restarts")
flx.Label(text="Action")
self.base_layout.set_parent(None)
def init(self):
with flx.VBox():
flx.Label(html='<h3>Server monitor</h3>')
if flx.current_server().serving[0] == 'localhost':
# Don't do this for a public server
self.button = flx.Button(text='Do some work')
self.button.reaction(self._do_work, 'pointer_down')
self.view = MonitorView(flex=1)
def init(self, model):
super().init()
self.model = model
# App layout
with flx.VBox():
flx.Label(flex=0, text=lambda: model.status)
flx.Widget(flex=1)
with flx.HBox(flex=2):
flx.Widget(flex=1)
self.canvas = flx.CanvasWidget(flex=0, minsize=400, maxsize=400)
flx.Widget(flex=1)
flx.Widget(flex=1)
# Init context to draw to
self._ctx = self.canvas.node.getContext('2d')
def init(self):
combo_options = ['Paris', 'New York', 'Enschede', 'Tokio']
with flx.HBox():
self.tree = TreeWithControls(flex=1, max_selected=1)
with flx.VBox(flex=1):
self.combo = flx.ComboBox(options=combo_options, editable=True)
flx.Widget(flex=1) # combobox needs space below it to show dropdown
with self.tree:
for cat in ('foo', 'bar', 'spam'):
with flx.TreeItem(text=cat):
for name in ('Martin', 'Kees', 'Hans'):
item = flx.TreeItem(title=name)
item.set_checked(cat=='foo' or None)
def init(self):
self.set_title("Openlayers example")
with flx.VBox():
with flx.HBox():
self.map = Ol(flex=1)
self.btn = flx.Button(text="", disabled=True)
with flx.VBox():
self.btnosm = flx.Button(text='Load Openstreetmap')
self.btna = flx.Button(text='Load GEOJSON')
self.btnr = flx.Button(text='Remove GEOJSON')
self.btndraw = flx.Button(text='Draw Points')
self.btn_stop_draw = flx.Button(text='Stop Drawing')
flx.Widget(flex=1)
self.coords = flx.Label(flex=1)
def init(self):
with flx.VBox():
flx.Label(style='background:#cfc;', wrap=1,
text='Here is some content at the top for which we want to '
'use minimal size. Thus the use of a VBox. '
'Below is a splitter, with a box layout on the left '
'and a fix layout on the right.')
with flx.HSplit(flex=1):
with flx.VBox(style='border:1px solid #777;'):
flx.Label(text='Flex 0 0 0')
with flx.HBox(flex=0):
self.b1 = flx.Button(text='Hi')
self.b2 = flx.Button(text='Helloooo world!')
self.b3 = flx.Button(text='Foo bar')
flx.Label(text='Flex 1 1 1')
with flx.HBox(flex=0):
self.b1 = flx.Button(flex=1, text='Hi')
self.b2 = flx.Button(flex=1, text='Helloooo world!')
self.b3 = flx.Button(flex=1, text='Foo bar')
flx.Label(text='Flex 1 0 3')
with flx.HBox(flex=0):
self.b1 = flx.Button(flex=1, text='Hi')
def init(self):
with flx.VBox():
with flx.HBox():
self.first_edit = flx.LineEdit(placeholder_text='first name',
text='Jane')
self.last_edit = flx.LineEdit(placeholder_text='last name',
text='Doe')
flx.Widget(flex=1) # spacer
with flx.HBox():
flx.Label(text=lambda: self.root.first_name,
style='border:1px solid red')
flx.Label(text=lambda: self.root.last_name,
style='border:1px solid red')
flx.Widget(flex=1) # spacer
MyPersonLabel(style='border:1px solid blue')
with flx.VBox(flex=0, minsize=150):
self.b1 = flx.RadioButton(text='Linear')
self.b2 = flx.RadioButton(text='Basis')
self.b3 = flx.RadioButton(text='Cardinal', checked=True)
self.b4 = flx.RadioButton(text='Catmull Rom')
self.b5 = flx.RadioButton(text='Lagrange')
self.b6 = flx.RadioButton(text='Lanczos')
flx.Widget(minsize=10)
closed = flx.CheckBox(text='Closed')
flx.Widget(minsize=10)
self.tension = flx.Slider(min=-0.5, max=1, value=0.5,
text='Tension: {value}')
flx.Widget(flex=1)
with flx.VBox(flex=1):
flx.Label(text=GENERAL_TEXT, wrap=True, style='font-size: 12px;')
self.explanation = flx.Label(text=CARDINAL_TEXT, wrap=True,
style='font-size: 12px;')
self.spline = SplineWidget(flex=1,
closed=lambda: closed.checked,
tension=lambda: self.tension.value)