def generate_thread_table(self): """Render a simple table with thread statuses.""" rows = [c.text_colored("Thread status:", 'yellow')] if self.task_statuses: for i, status in enumerate(self.task_statuses): rows.append(c.text(f"{i}: {status}")) return c.collapsing_header("Thread status", c.optional(bool(self.task_statuses), c.orr, rows), open=False)
def __auth_view(self): view = c.orr([ c.collapsing_header( text="Languages", widget=c.orr([ c.radio_button( label='English', active=True if self.language == 'default' else False, tag='english'), c.same_line(), c.radio_button( label='Russian', active=True if self.language == 'cyrillic' else False, tag='cyrillic'), c.same_line(), c.radio_button( label='Korean', active=True if self.language == 'korean' else False, tag='korean'), c.same_line(), c.radio_button( label='Japanese', active=True if self.language == 'japanese' else False, tag='japanese'), c.same_line(), c.radio_button(label='Chinese', active=True if self.language == 'chinese_full' else False, tag='chinese_full'), c.same_line(), c.radio_button( label='German', active=True if self.language == 'latin' else False, tag='latin'), ]), open=True), self.custom_spacing(1, 1), c.text("Username:"******"", value=self.username, tag="username"), c.text("Password:"******"", value=self.password, tag="password"), c.button("Terminate", tag='terminate') if self.process else self.dynamic_popup_button( label="Login", error=self.evaluate_popup_behaviour({ 'user': self.username, 'password': self.password }), tag='login'), ]) return view
def demo_window(state): while True: tag, value = yield from c.window( "Concur Demo", c.orr([ c.text("Concur says hello. (TODO: version)"), c.collapsing_header("Help", c.orr([ c.text("Not implemented."), ]), False), c.collapsing_header("Configuration", c.orr([ c.text("Not implemented."), ]), False), c.collapsing_header("Window options", c.orr([ c.text("Not implemented."), ]), False), c.collapsing_header( "Widgets", c.orr([ c.tree_node("Basic", c.orr([ c.button("Button"), ]), False), ]), False), c.collapsing_header("Layout & Scrolling", c.orr([ c.text("Not implemented."), ]), False), c.collapsing_header("Popups & Modal windows", c.orr([ c.text("Not implemented."), ]), False), c.collapsing_header("Columns", c.orr([ c.text("Not implemented."), ]), False), c.collapsing_header("Filtering", c.orr([ c.text("Not implemented."), ]), False), c.collapsing_header("Inputs, Navigation & Focus", c.orr([ c.text("Not implemented."), ]), False), ])) yield
def test_collapsing_header(tester): def ctrl(): yield from tester.click_marked("H") yield from tester.click_marked("B") res = yield from c.orr([ tester.mark( "H", c.collapsing_header("Header", tester.mark("B", c.button("Button")), open=False)), ctrl(), ]) assert res == ("Button", None)
def app(): im1 = c.Image(Image.open("examples/lenna.png")) im2 = c.Image(Image.open("examples/lenna.png")) while True: k, v = yield from c.orr([ c.button("Hello,"), c.button("world!"), c.orr_same_line([ c.text("Hello,"), c.nothing(), c.text_tooltip("Text tooltip", c.text("world!")), c.text_tooltip("Orr tooltip", c.orr([ c.text_tooltip("Button tooltip", c.button("Button1")), c.button("Button2"), ])), c.orr([ c.button("Button3"), c.button("Button4"), ]), c.text("Finish line."), ]), c.draggable("Drag", c.orr([c.button("Draggable Button"), c.forever(c.button, "Another")])), c.input_text("Hello", "world!", 123), c.collapsing_header("Image", c.orr([ c.tooltip(c.orr([c.text("Hello!"), c.image("", im1, width=300, height=200), c.event(("Key", "Tooltip value"))]), c.image("Im1", im1, width=30, height=20)), c.image("Im2", im2, width=30, height=20), ])), c.input_text("Hello", "world!", 123), c.key_press("Key", glfw.KEY_SPACE), ]) if k == "Im1": im1 = v if k == "Im2": im2 = v print(k, v) yield