예제 #1
0
 def __init__(self, position_picked=None, absolute_move=None):
     super().__init__()
     self.position_picked = position_picked
     self.absolute_move = absolute_move
     self.positions_tree = ui.Tree(
         header=("Name", "X", "Y", "Z", "Comment"),
         root_is_decorated=False,
         selected=self.on_position_selected,
         double_clicked=self.on_position_double_clicked)
     self.pick_button = ui.Button(
         text="Assign &Position",
         tool_tip="Assign current table position to selected position item",
         clicked=self.on_pick_position,
         enabled=False)
     self.add_button = ui.Button(text="&Add",
                                 tool_tip="Add new position item",
                                 clicked=self.on_add_position)
     self.edit_button = ui.Button(text="&Edit",
                                  tool_tip="Edit selected position item",
                                  clicked=self.on_edit_position,
                                  enabled=False)
     self.remove_button = ui.Button(
         text="&Remove",
         tool_tip="Remove selected position item",
         clicked=self.on_remove_position,
         enabled=False)
     self.move_button = ui.Button(text="&Move",
                                  tool_tip="Move to selected position",
                                  clicked=self.on_move,
                                  enabled=False)
     self.append(self.positions_tree)
     self.append(
         ui.Column(self.pick_button, self.move_button, ui.Spacer(),
                   self.add_button, self.edit_button, self.remove_button))
     self.stretch = 1, 0
예제 #2
0
 def __init__(self, *args, table_move=None, table_contact=None, **kwargs):
     super().__init__(*args, **kwargs)
     self.table_move = table_move
     self.table_contact = table_contact
     self.use_table = False
     self._position_valid = False
     self.title = "Contact"
     self._position_widget = PositionWidget()
     self._position_widget.title = "Contact Position"
     self._move_button = ui.Button(
         text="Move",
         tool_tip="Move table to position with safe Z position.",
         clicked=self.on_move,
         enabled=False)
     self._contact_button = ui.Button(
         text="Contact",
         tool_tip="Move table to position and contact with sample.",
         clicked=self.on_contact,
         enabled=False)
     self.layout.insert(
         2,
         ui.Row(self._position_widget,
                ui.GroupBox(title="Table Control",
                            layout=ui.Column(self._move_button,
                                             self._contact_button,
                                             ui.Spacer())),
                ui.Spacer(vertical=False),
                stretch=(0, 0, 1)))
     self.layout.insert(3, ui.Spacer())
     self.layout.stretch = 0, 0, 0, 1
예제 #3
0
 def __init__(self):
     super().__init__()
     # Properties
     self.title = "Sequence Manager"
     # Layout
     self.resize(640, 480)
     self._sequence_tree = ui.Tree(header=("Name", "Filename"),
                                   indentation=0,
                                   selected=self.on_sequence_tree_selected)
     self._add_button = ui.Button(text="&Add", clicked=self.on_add_sequence)
     self._remove_button = ui.Button(text="&Remove",
                                     enabled=False,
                                     clicked=self.on_remove_sequence)
     self._preview_tree = ui.Tree(header=["Key", "Value"])
     self.layout = ui.Column(ui.Row(ui.Column(self._sequence_tree,
                                              self._preview_tree,
                                              stretch=(4, 3)),
                                    ui.Column(self._add_button,
                                              self._remove_button,
                                              ui.Spacer()),
                                    stretch=(1, 0)),
                             ui.DialogButtonBox(buttons=("ok", "cancel"),
                                                accepted=self.accept,
                                                rejected=self.reject),
                             stretch=(1, 0))
예제 #4
0
 def __init__(self, position_picked=None, absolute_move=None):
     super().__init__()
     self.position_picked = position_picked
     self.absolute_move = absolute_move
     self.contacts_tree = ui.Tree(header=("Contact", "X", "Y", "Z", None),
                                  selected=self.on_contacts_selected)
     self.contacts_tree.fit()
     self.pick_button = ui.Button(
         text="Assign &Position",
         tool_tip="Assign current table position to selected position item",
         clicked=self.on_pick_position,
         enabled=False)
     self.calculate_button = ui.Button(text="&Calculate",
                                       clicked=self.on_calculate,
                                       enabled=False)
     self.move_button = ui.Button(text="&Move",
                                  tool_tip="Move to selected position",
                                  clicked=self.on_move,
                                  enabled=False)
     self.reset_button = ui.Button(text="&Reset",
                                   clicked=self.on_reset,
                                   enabled=False)
     self.reset_all_button = ui.Button(text="Reset &All",
                                       clicked=self.on_reset_all)
     self.append(self.contacts_tree)
     self.append(
         ui.Column(self.pick_button, self.move_button,
                   self.calculate_button, ui.Spacer(), self.reset_button,
                   self.reset_all_button))
     self.stretch = 1, 0
예제 #5
0
def main():
    app = comet.Application()
    app.title = "Measurement"

    def on_finish():
        start_button.enabled = True
        stop_button.enabled = False
        current_number.value = 0

    def on_reading(value):
        print(value)
        current_number.value = value

    def on_start():
        start_button.enabled = False
        stop_button.enabled = True
        process = app.processes.get("measure")
        process.start()

    def on_stop():
        start_button.enabled = False
        stop_button.enabled = False
        process = app.processes.get("measure")
        process.stop()

    def on_voltage(value):
        process = app.processes.get("measure")
        process.set('voltage', value)

    process = comet.Process(target=measure)
    process.finished = on_finish
    process.failed = ui.show_exception
    process.reading = on_reading
    app.processes.add("measure", process)

    voltage_number = ui.Number(value=0, minimum=0, maximum=1000, decimals=1, suffix="V", changed=on_voltage)
    current_number = ui.Number(readonly=True, value=0, decimals=3, suffix="mA", stylesheet="color: red")
    start_button = ui.Button(text="Start", clicked=on_start)
    stop_button = ui.Button(text="Stop", enabled=False, clicked=on_stop)

    l = ui.Column(
        ui.Label("Voltage"),
        voltage_number,
        ui.Label("Current"),
        current_number,
        start_button,
        stop_button,
        ui.Spacer()
    )
    app.layout = l

    return app.run()
예제 #6
0
 def __init__(self, joystick_toggled=None, control_clicked=None, **kwargs):
     super().__init__(**kwargs)
     self.title = "Table"
     self.checkable = True
     self._joystick_button = ToggleButton(
         text="Joystick",
         tool_tip="Toggle table joystick",
         checkable=True,
         toggled=self.on_joystick_toggled
     )
     self._position_label = ui.Label(
         text="...",
         tool_tip="Current table position."
     )
     self._control_button = ui.Button(
         text="Control...",
         tool_tip="Open table controls dialog.",
         clicked=self.on_control_clicked
     )
     self.layout=ui.Row(
         self._joystick_button,
         ui.Widget(),
         self._position_label,
         ui.Widget(),
         self._control_button
     )
     # Callbacks
     self.joystick_toggled = joystick_toggled
     self.control_clicked = control_clicked
예제 #7
0
 def __init__(self, joystick_toggled=None, control_clicked=None, **kwargs):
     super().__init__(**kwargs)
     self.title = "Table"
     self.checkable = True
     self._joystick_button = ToggleButton(text="Joystick",
                                          tool_tip="Toggle table joystick",
                                          checkable=True,
                                          toggled=self.on_joystick_toggled)
     self._position_widget = PositionWidget()
     self._calibration_widget = CalibrationWidget()
     self._control_button = ui.Button(
         text="Control...",
         tool_tip="Open table controls dialog.",
         clicked=self.on_control_clicked)
     self.layout = ui.Row(self._position_widget,
                          self._calibration_widget,
                          ui.Spacer(),
                          ui.Column(ui.Spacer(), self._control_button,
                                    self._joystick_button, ui.Spacer()),
                          stretch=(0, 0, 1, 0))
     # Callbacks
     self.joystick_toggled = joystick_toggled
     self.control_clicked = control_clicked
     self._joystick_limits = [0, 0, 0]
     self.calibration_valid = False
예제 #8
0
 def __init__(self, reload=None):
     super().__init__(title="Status")
     self.reload = reload
     self.matrix_model_text = ui.Text(readonly=True)
     self.matrix_channels_text = ui.Text(readonly=True)
     self.hvsrc_model_text = ui.Text(readonly=True)
     self.vsrc_model_text = ui.Text(readonly=True)
     self.lcr_model_text = ui.Text(readonly=True)
     self.elm_model_text = ui.Text(readonly=True)
     self.table_model_text = ui.Text(readonly=True)
     self.table_state_text = ui.Text(readonly=True)
     self.env_model_text = ui.Text(readonly=True)
     self.reload_status_button = ui.Button("&Reload",
                                           clicked=self.on_reload)
     self.layout = ui.Column(
         ui.GroupBox(title="Matrix",
                     layout=ui.Column(
                         ui.Row(ui.Label("Model:"),
                                self.matrix_model_text,
                                stretch=(1, 7)),
                         ui.Row(ui.Label("Closed channels:"),
                                self.matrix_channels_text,
                                stretch=(1, 7)))),
         ui.GroupBox(title="HVSource",
                     layout=ui.Row(ui.Label("Model:"),
                                   self.hvsrc_model_text,
                                   stretch=(1, 7))),
         ui.GroupBox(title="VSource",
                     layout=ui.Row(ui.Label("Model:"),
                                   self.vsrc_model_text,
                                   stretch=(1, 7))),
         ui.GroupBox(title="LCRMeter",
                     layout=ui.Row(ui.Label("Model:"),
                                   self.lcr_model_text,
                                   stretch=(1, 7))),
         ui.GroupBox(title="Electrometer",
                     layout=ui.Row(ui.Label("Model:"),
                                   self.elm_model_text,
                                   stretch=(1, 7))),
         ui.GroupBox(title="Table",
                     layout=ui.Column(
                         ui.Row(ui.Label("Model:"),
                                self.table_model_text,
                                stretch=(1, 7)),
                         ui.Row(ui.Label("State:"),
                                self.table_state_text,
                                stretch=(1, 7)))),
         ui.GroupBox(title="Environment Box",
                     layout=ui.Column(
                         ui.Row(ui.Label("Model:"),
                                self.env_model_text,
                                stretch=(1, 7)))), ui.Spacer(),
         self.reload_status_button)
예제 #9
0
 def __init__(self, *args, table_move_to=None, table_contact=None, **kwargs):
     super().__init__(*args, **kwargs)
     self.table_move_to = table_move_to
     self.table_contact = table_contact
     self.title = "Contact"
     self.pos_x_label = PositionLabel()
     self.pos_y_label = PositionLabel()
     self.pos_z_label = PositionLabel()
     # self.move_to_button = ui.Button(
     #     text="Move to",
     #     tool_tip="Move table to position with safe Z distance.",
     #     clicked=self.on_move_to,
     #     enabled=False
     # )
     self.contact_button = ui.Button(
         text="Contact",
         tool_tip="Move table to position and contact.",
         clicked=self.on_contact,
         enabled=False
     )
     self.layout.insert(2, ui.Row(
         ui.GroupBox(
             title="Position",
             layout=ui.Row(
                 ui.Column(
                     ui.Label("X"),
                     ui.Label("Y"),
                     ui.Label("Z")
                 ),
                 ui.Column(
                     self.pos_x_label,
                     self.pos_y_label,
                     self.pos_z_label,
                 )
             )
         ),
         ui.GroupBox(
             title="Table Actions",
             layout=ui.Column(
                 # self.move_to_button,
                 self.contact_button
             )
         ),
         ui.Spacer(vertical=False),
     ))
예제 #10
0
 def __init__(self, restore=None):
     super().__init__(title="Measurement")
     self.restore = restore
     self.panels = PanelStack()
     self.measure_restore_button = ui.Button(
         text="Restore Defaults",
         tool_tip="Restore default measurement parameters.",
         clicked=self.on_measure_restore
     )
     self.measure_controls = ui.Row(
         self.measure_restore_button,
         ui.Spacer(),
         visible=False
     )
     self.layout = ui.Column(
         self.panels,
         self.measure_controls,
         stretch=(1, 0)
     )
예제 #11
0
 def __init__(self, position_picked=None, **kwargs):
     super().__init__(**kwargs)
     self.position_picked = position_picked
     self._name_text = ui.Text(value="Unnamed")
     self._x_number = ui.Number(value=0.,
                                minimum=0.,
                                maximum=1000.,
                                decimals=3,
                                suffix="mm")
     self._y_number = ui.Number(value=0.,
                                minimum=0.,
                                maximum=1000.,
                                decimals=3,
                                suffix="mm")
     self._z_number = ui.Number(value=0.,
                                minimum=0.,
                                maximum=1000.,
                                decimals=3,
                                suffix="mm")
     self._comment_text = ui.Text()
     self._assign_button = ui.Button(
         text="Assign Position",
         tool_tip="Assign current table position.",
         clicked=self.on_assign_clicked)
     self._button_box = ui.DialogButtonBox(buttons=("ok", "cancel"),
                                           accepted=self.accept,
                                           rejected=self.reject)
     self.layout = ui.Column(
         ui.Label("Name", tool_tip="Position name"), self._name_text,
         ui.Row(
             ui.Column(ui.Label("X", tool_tip="Position X coordinate"),
                       self._x_number),
             ui.Column(ui.Label("Y", tool_tip="Position Y coordinate"),
                       self._y_number),
             ui.Column(ui.Label("Z", tool_tip="Position Z coordinate"),
                       self._z_number),
             ui.Column(
                 ui.Spacer(),
                 self._assign_button,
             )), ui.Label("Comment", tool_tip="Optional position comment"),
         self._comment_text, ui.Spacer(), self._button_box)
예제 #12
0
def main():
    app = comet.Application()
    app.title = "Plot"
    app.about = "An example plot application."

    def on_reset():
        for series in plot.series.values():
            series.clear()
        plot.fit()

    def on_reading(value):
        time, temp, humid = value
        plot.series.get("temp").append(time, temp)
        plot.series.get("humid").append(time, humid)
        if plot.zoomed:
            plot.update("x")
        else:
            plot.fit()

    plot = ui.Plot(legend="bottom")
    plot.add_axis("x", align="bottom", type="datetime")
    plot.add_axis("y1", align="left", text="Temperature [°C]", color="red")
    plot.add_axis("y2", align="right", text="Humidity [%rH]", color="blue")
    plot.add_series("temp", "x", "y1", text="Temperature", color="red")
    plot.add_series("humid", "x", "y2", text="Humidity", color="blue")

    reset_button = ui.Button(text="Reset", clicked=on_reset)

    app.layout = ui.Column(plot, reset_button)

    process = comet.Process(target=fake_data)
    process.reading = on_reading
    process.failed = ui.show_exception
    process.start()
    app.processes.add("process", process)

    return app.run()
예제 #13
0
    def __init__(self):
        super().__init__(title="Table")
        self.temporary_z_limit_changed = None
        self._steps_tree = ui.Tree(header=("Size", "Z-Limit", "Color"),
                                   root_is_decorated=False)
        # Hide Z-Limit column
        self._steps_tree.qt.setColumnHidden(1, True)
        self._steps_tree.selected = self.on_position_selected
        self._steps_tree.double_clicked = self.on_steps_tree_double_clicked
        self._steps_tree.qt.setItemDelegateForColumn(
            0, ItemDelegate(self._steps_tree.qt))
        self._steps_tree.qt.setItemDelegateForColumn(
            1, ItemDelegate(self._steps_tree.qt))
        self._add_step_button = ui.Button(text="&Add",
                                          tool_tip="Add table step",
                                          clicked=self.on_add_step_clicked)
        self._edit_step_button = ui.Button(text="&Edit",
                                           tool_tip="Edit selected table step",
                                           enabled=False,
                                           clicked=self.on_edit_step_clicked)
        self._remove_step_button = ui.Button(
            text="&Remove",
            tool_tip="Remove selected table step",
            enabled=False,
            clicked=self.on_remove_step_clicked)
        self._z_limit_movement_number = ui.Number(
            minimum=0,
            maximum=128.0,
            decimals=3,
            suffix="mm",
            changed=self.on_z_limit_movement_changed)

        def create_number():
            return ui.Number(minimum=0,
                             maximum=1000.0,
                             decimals=3,
                             suffix="mm")

        self._probecard_limit_x_maximum_number = create_number()
        self._probecard_limit_y_maximum_number = create_number()
        self._probecard_limit_z_maximum_number = create_number()
        self._probecard_limit_z_maximum_checkbox = ui.CheckBox(
            text="Temporary Z-Limit",
            tool_tip="Select to show temporary Z-Limit notice.")
        self._joystick_limit_x_maximum_number = create_number()
        self._joystick_limit_y_maximum_number = create_number()
        self._joystick_limit_z_maximum_number = create_number()
        self._probecard_contact_delay_number = ui.Number(minimum=0,
                                                         maximum=3600,
                                                         decimals=2,
                                                         step=.1,
                                                         suffix="s")
        self._recontact_overdrive_number = ui.Number(minimum=0,
                                                     maximum=0.025,
                                                     decimals=3,
                                                     step=.001,
                                                     suffix="mm")
        self.layout = ui.Column(
            ui.GroupBox(title="Control Steps (mm)",
                        layout=ui.Row(self._steps_tree,
                                      ui.Column(self._add_step_button,
                                                self._edit_step_button,
                                                self._remove_step_button,
                                                ui.Spacer()),
                                      stretch=(1, 0))),
            ui.GroupBox(title="Movement Z-Limit",
                        layout=ui.Column(self._z_limit_movement_number)),
            ui.GroupBox(title="Probe Card Limts",
                        layout=ui.Row(
                            ui.Column(ui.Label("X"),
                                      self._probecard_limit_x_maximum_number),
                            ui.Column(ui.Label("Y"),
                                      self._probecard_limit_y_maximum_number),
                            ui.Column(ui.Label("Z"),
                                      self._probecard_limit_z_maximum_number),
                            ui.Column(
                                ui.Label(),
                                ui.Label("Maximum"),
                            ), ui.Spacer(),
                            ui.Column(
                                ui.Label(),
                                self._probecard_limit_z_maximum_checkbox,
                            ))),
            ui.GroupBox(title="Joystick Limits",
                        layout=ui.Row(
                            ui.Column(ui.Label("X"),
                                      self._joystick_limit_x_maximum_number),
                            ui.Column(ui.Label("Y"),
                                      self._joystick_limit_y_maximum_number),
                            ui.Column(ui.Label("Z"),
                                      self._joystick_limit_z_maximum_number),
                            ui.Column(
                                ui.Label(),
                                ui.Label("Maximum"),
                            ), ui.Spacer())),
            ui.Row(ui.GroupBox(title="Probecard Contact Delay",
                               layout=ui.Row(
                                   self._probecard_contact_delay_number)),
                   ui.GroupBox(title="Re-Contact Z-Overdrive (1x)",
                               layout=ui.Row(
                                   self._recontact_overdrive_number)),
                   stretch=(0, 1)),
            stretch=(1, 0, 0, 0, 0))
예제 #14
0
def main():
    app = comet.Application()
    app.title = "UI Demo"

    values = ["Chapman", "Cleese", "Gilliam", "Idle", "Jones", "Palin"]

    tab1 = ui.Tab(title="Tab 1",
                  layout=ui.Column(
                      ui.Row(ui.Column(
                          ui.GroupBox(title="Numbers",
                                      layout=ui.Column(
                                          ui.Label(text="Number 1"),
                                          ui.Number(value=1,
                                                    minimum=0,
                                                    maximum=10,
                                                    step=1,
                                                    prefix="#"),
                                          ui.Label(text="Number 2"),
                                          ui.Number(value=2.345,
                                                    minimum=0,
                                                    maximum=10,
                                                    step=.1,
                                                    decimals=3,
                                                    suffix="mV"),
                                          ui.Label(text="Number 3"),
                                          ui.Number(value=1.23,
                                                    minimum=0,
                                                    maximum=10,
                                                    decimals=2,
                                                    suffix="mA",
                                                    readonly=True),
                                          ui.Label(text="Number 4"),
                                          ui.Number(value=4.2,
                                                    minimum=0,
                                                    maximum=10,
                                                    decimals=1,
                                                    suffix="dB",
                                                    enabled=False)))),
                             ui.Column(
                                 ui.GroupBox(title="Text",
                                             layout=ui.Column(
                                                 ui.Label(text="Text 1"),
                                                 ui.Text(value="Chapman"),
                                                 ui.Label(text="Text 2"),
                                                 ui.Text(value="Cleese",
                                                         clearable=True),
                                                 ui.Label(text="Text 3"),
                                                 ui.Text(value="Idle",
                                                         readonly=True),
                                                 ui.Label(text="Text 4"),
                                                 ui.Text(value="Palin",
                                                         enabled=False)))),
                             ui.Spacer(),
                             stretch=(2, 2, 3)),
                      ui.Spacer(),
                      stretch=(0, 1)))

    def on_append():
        list1.append(f"Spam {len(list1)}")
        list1.current = list1[0]

    def on_remove():
        if list1.current is not None:
            list1.remove(list1.current)

    list1 = ui.List()
    tab2 = ui.Tab(title="Tab 2",
                  layout=ui.Column(ui.Row(
                      ui.GroupBox(title="List 1",
                                  layout=ui.Column(
                                      list1,
                                      ui.Button(text="&Add",
                                                clicked=on_append),
                                      ui.Button(text="&Remove",
                                                clicked=on_remove))),
                      ui.GroupBox(title="List 2", layout=ui.List(values)),
                      ui.GroupBox(title="List 3",
                                  layout=ui.List(values, enabled=False))),
                                   ui.Spacer(),
                                   stretch=(0, 1)))

    table1 = ui.Table(header=["Key", "Value"])
    tab3 = ui.Tab(title="Tab 3", layout=ui.Column(table1))

    tree1 = ui.Tree(header=["Key", "Value"])
    tab4 = ui.Tab(title="Tab 4", layout=ui.Column(tree1))

    first = ui.Button(text="Click")
    scroll = ui.ScrollArea(layout=ui.Column(*[
        ui.CheckBox(text=f"Option {i+1}", checked=random.choice([True, False]))
        for i in range(64)
    ]))
    second = ui.Column(scroll)
    tab5 = ui.Tab(title="Tab 5", layout=first)
    tab5.layout = second
    del first

    tab6 = ui.Tab(title="Tab 6",
                  layout=ui.Row(ui.Column(
                      ui.Label("Metric 1"),
                      ui.Metric('V',
                                decimals=3,
                                changed=lambda value: print(value)),
                      ui.Label("Metric 2"),
                      ui.Metric('A',
                                prefixes='munp',
                                changed=lambda value: print(value)),
                      ui.Spacer()),
                                ui.Spacer(),
                                stretch=(1, 2)))

    def on_changed(value):
        app.message = value

    def on_click():
        app.message = combobox1.current

    tabs = ui.Tabs(tab1, tab2, tab3, tab4, tab5, tab6)
    combobox1 = ui.ComboBox(values)

    app.layout = ui.Row(ui.Column(
        ui.GroupBox(title="GroupBox 1",
                    layout=ui.Column(
                        ui.Button(text="Button 1", clicked=on_click),
                        ui.Button(text="Button 2", enabled=False),
                        ui.Button(text="Button 3", checkable=True),
                        ui.Button(text="Button 4",
                                  checkable=True,
                                  enabled=False),
                        ui.Button(text="Button 5",
                                  checkable=True,
                                  checked=True))),
        ui.GroupBox(title="GroupBox 2",
                    layout=ui.Column(
                        ui.CheckBox(text="CheckBox 1"),
                        ui.CheckBox(text="CheckBox 2", enabled=False),
                        ui.CheckBox(text="CheckBox 3",
                                    checked=True,
                                    enabled=False),
                        ui.CheckBox(text="CheckBox 4", checked=True))),
        ui.GroupBox(title="GroupBox 3",
                    layout=ui.Column(
                        ui.ComboBox(), combobox1,
                        ui.ComboBox(values,
                                    current="Cleese",
                                    changed=on_changed),
                        ui.ComboBox(values, current="Idle", enabled=False))),
        ui.Spacer()),
                        tabs,
                        stretch=(2, 7))

    # Populate table
    spam = table1.append(["Spam", 42])
    spam[0].checked = True
    #spam[0].enabled = False
    ham = table1.append(["Ham", 41])
    ham[0].checked = True
    #ham[0].enabled = False

    # Populate tree
    spam = tree1.append(["Spam", 42])
    spam[0].checked = True
    spam.append(["Ham", 41])
    spam.append(["Eggs", 40])

    # Add an remove tab
    tab = ui.Tab()
    tabs.insert(0, tab)
    tab.title = "Spam"
    tabs.remove(tab)

    app.message = "Notification message..."
    app.progress = 3, 4

    return app.run()
예제 #15
0
    def __init__(self, message_changed=None, progress_changed=None, **kwargs):
        super().__init__()
        # Properties
        self.collapsible = False
        # Callbacks
        self.message_changed = message_changed
        self.progress_changed = progress_changed
        # Layout
        self.sequence_tree = SequenceTree(
            selected=self.on_tree_selected,
            double_clicked=self.on_tree_double_clicked
        )
        self.sequence_tree.minimum_width = 360

        self.start_all_action = ui.Action(
            text="&All Samples",
            triggered=self.on_start_all
        )

        self.start_sample_action = ui.Action(
            text="&Sample",
            triggered=self.on_start
        )
        self.start_sample_action.qt.setEnabled(False)

        self.start_contact_action = ui.Action(
            text="&Contact",
            triggered=self.on_start
        )
        self.start_contact_action.qt.setEnabled(False)

        self.start_measurement_action = ui.Action(
            text="&Measurement",
            triggered=self.on_start
        )
        self.start_measurement_action.qt.setEnabled(False)

        self.start_menu = ui.Menu()
        self.start_menu.append(self.start_all_action)
        self.start_menu.append(self.start_sample_action)
        self.start_menu.append(self.start_contact_action)
        self.start_menu.append(self.start_measurement_action)

        self.start_button = ui.Button(
            text="Start",
            tool_tip="Start measurement sequence.",
            stylesheet="QPushButton:enabled{color:green;font-weight:bold;}"
        )
        self.start_button.qt.setMenu(self.start_menu.qt)

        self.stop_button = ui.Button(
            text="Stop",
            tool_tip="Stop measurement sequence.",
            enabled=False,
            clicked=self.on_stop,
            stylesheet="QPushButton:enabled{color:red;font-weight:bold;}"
        )

        self.reset_button = ui.Button(
            text="Reset",
            tool_tip="Reset measurement sequence state.",
            clicked=self.on_reset_sequence_state
        )

        self.reload_config_button = ui.ToolButton(
            icon=make_path('assets', 'icons', 'reload.svg'),
            tool_tip="Reload sequence configurations from file.",
            clicked=self.on_reload_config_clicked
        )

        self.add_sample_button = ui.ToolButton(
            icon=make_path('assets', 'icons', 'add.svg'),
            tool_tip="Add new sample sequence.",
            clicked=self.on_add_sample_clicked
        )
        self.remove_sample_button = ui.ToolButton(
            icon=make_path('assets', 'icons', 'delete.svg'),
            tool_tip="Remove current sample sequence.",
            clicked=self.on_remove_sample_clicked
        )

        self.sequence_groupbox = ui.GroupBox(
            title="Sequence",
            layout=ui.Column(
                self.sequence_tree,
                ui.Row(
                    self.start_button,
                    self.stop_button,
                    self.reset_button,
                    self.reload_config_button,
                    self.add_sample_button,
                    self.remove_sample_button
                )
            )
        )

        # Environment Controls

        self.environment_control_widget = EnvironmentControlWidget(
            toggled=self.on_environment_groupbox_toggled,
            laser_sensor_toggled=self.on_laser_sensor_toggled,
            box_light_toggled=self.on_box_light_toggled,
            microscope_light_toggled=self.on_microscope_light_toggled,
            microscope_camera_toggled=self.on_microscope_camera_toggled,
            microscope_control_toggled=self.on_microscope_control_toggled,
            probecard_light_toggled=self.on_probecard_light_toggled,
            probecard_camera_toggled=self.on_probecard_camera_toggled,
            pid_control_toggled=self.on_pid_control_toggled
        )

        # Table controls

        self.table_control_widget = TableControlWidget(
            toggled=self.on_table_groupbox_toggled,
            joystick_toggled=self.on_table_joystick_toggled,
            control_clicked=self.on_table_control_clicked
        )

        # Operator

        self.operator_widget = OperatorWidget()
        self.operator_widget.load_settings()
        self.operator_groupbox = ui.GroupBox(
            title="Operator",
            layout=self.operator_widget
        )

        # Working directory

        self.output_widget = WorkingDirectoryWidget()

        self.output_groupbox = ui.GroupBox(
            title="Working Directory",
            layout=self.output_widget
        )

        # Controls

        self.control_widget = ui.Column(
            self.sequence_groupbox,
            self.table_control_widget,
            self.environment_control_widget,
            ui.Row(
                self.operator_groupbox,
                self.output_groupbox,
                stretch=(3, 7)
            ),
            stretch=(1, 0, 0)
        )

        # Tabs

        self.measurement_tab = MeasurementTab(restore=self.on_measure_restore)
        self.environment_tab = EnvironmentTab()
        self.status_tab = StatusTab(reload=self.on_status_start)
        self.summary_tab = SummaryTab()

        self.panels = self.measurement_tab.panels
        self.panels.sample_changed = self.on_sample_changed

        self.log_widget = LogWidget()
        self.log_widget.add_logger(logging.getLogger())

        self.logging_tab = ui.Tab(
            title="Logs",
            layout=self.log_widget
        )

        # Tabs

        self.tab_widget = ui.Tabs(
            self.measurement_tab,
            self.environment_tab,
            self.status_tab,
            self.logging_tab,
            self.summary_tab
        )

        # Layout

        self.append(self.control_widget)
        self.append(self.tab_widget)
        self.stretch = 4, 9

        # Setup process callbacks

        self.environ_process = self.processes.get("environ")
        self.environ_process.pc_data_updated = self.on_pc_data_updated

        self.status_process = self.processes.get("status")
        self.status_process.finished = self.on_status_finished

        self.table_process = self.processes.get("table")
        self.table_process.joystick_changed = self.on_table_joystick_changed
        self.table_process.position_changed = self.on_table_position_changed

        self.measure_process = self.processes.get("measure")
        self.measure_process.finished = self.on_finished
        self.measure_process.measurement_state = self.on_measurement_state
        self.measure_process.save_to_image = self.on_save_to_image

        # Experimental

        # Install timer to update environment controls
        self.environment_timer = Timer(timeout=self.sync_environment_controls)
        self.environment_timer.start(self.environment_poll_interval)
예제 #16
0
 def __init__(self, process):
     super().__init__()
     self.mount(process)
     self.resize(640, 480)
     self.title = "Table Control"
     self.add_x_button = KeypadButton(text="+X", clicked=self.on_add_x)
     self.sub_x_button = KeypadButton(text="-X", clicked=self.on_sub_x)
     self.add_y_button = KeypadButton(text="+Y", clicked=self.on_add_y)
     self.sub_y_button = KeypadButton(text="-Y", clicked=self.on_sub_y)
     self.add_z_button = KeypadButton(text="+Z", clicked=self.on_add_z)
     self.sub_z_button = KeypadButton(text="-Z", clicked=self.on_sub_z)
     self.control_buttons = (self.add_x_button, self.sub_x_button,
                             self.add_y_button, self.sub_y_button,
                             self.add_z_button, self.sub_z_button)
     self.probecard_light_button = ToggleButton(
         text="PC Light",
         tool_tip="Toggle probe card light",
         checkable=True,
         checked=False,
         enabled=False,
         toggled=self.on_probecard_light_clicked)
     self.microscope_light_button = ToggleButton(
         text="Mic Light",
         tool_tip="Toggle microscope light",
         checkable=True,
         checked=False,
         enabled=False,
         toggled=self.on_microscope_light_clicked)
     self.box_light_button = ToggleButton(text="Box Light",
                                          tool_tip="Toggle box light",
                                          checkable=True,
                                          checked=False,
                                          enabled=False,
                                          toggled=self.on_box_light_clicked)
     # Create movement radio buttons
     self.step_width_buttons = ui.Column()
     for item in self.load_table_step_sizes():
         step_size = item.get('step_size') * comet.ureg('um')
         step_color = item.get('step_color')
         step_size_label = format_metric(step_size.to('m').m,
                                         'm',
                                         decimals=1)
         button = ui.RadioButton(
             text=step_size_label,
             tool_tip=f"Move in {step_size_label} steps.",
             stylesheet=f"QRadioButton:enabled{{color:{step_color};}}",
             checked=len(self.step_width_buttons) == 0,
             toggled=self.on_step_toggled)
         button.movement_width = step_size.to('mm').m
         button.movement_color = step_color
         self.step_width_buttons.append(button)
     self.control_layout = ui.Column(ui.Row(ui.Row(
         ui.Column(KeypadSpacer(), self.sub_y_button, KeypadSpacer()),
         ui.Column(
             self.sub_x_button,
             KeypadSpacer(),
             self.add_x_button,
         ), ui.Column(
             KeypadSpacer(),
             self.add_y_button,
             KeypadSpacer(),
         ), KeypadSpacer(),
         ui.Column(self.add_z_button, KeypadSpacer(), self.sub_z_button)),
                                            ui.Spacer(),
                                            stretch=(0, 1)),
                                     ui.Spacer(),
                                     stretch=(0, 1))
     self.positions_widget = TablePositionsWidget(
         position_picked=self.on_position_picked,
         absolute_move=self.on_absolute_move)
     self.contacts_widget = TableContactsWidget(
         position_picked=self.on_position_picked,
         absolute_move=self.on_absolute_move)
     self.pos_x_label = PositionLabel()
     self.pos_y_label = PositionLabel()
     self.pos_z_label = PositionLabel()
     self.cal_x_label = CalibrationLabel("cal")
     self.cal_y_label = CalibrationLabel("cal")
     self.cal_z_label = CalibrationLabel("cal")
     self.rm_x_label = CalibrationLabel("rm")
     self.rm_y_label = CalibrationLabel("rm")
     self.rm_z_label = CalibrationLabel("rm")
     self.z_limit_label = PositionLabel()
     self.laser_label = SwitchLabel()
     self.calibrate_button = ui.Button(text="Calibrate",
                                       clicked=self.on_calibrate)
     self.update_interval_number = ui.Number(
         value=self.settings.get("table_control_update_interval") or 1.0,
         minimum=.5,
         maximum=10.0,
         decimals=2,
         step=0.25,
         suffix="s",
         changed=self.on_update_interval_changed)
     self.progress_bar = ui.ProgressBar(visible=False)
     self.message_label = ui.Label()
     self.stop_button = ui.Button(text="&Stop",
                                  default=False,
                                  auto_default=False,
                                  enabled=False,
                                  clicked=self.on_stop)
     self.close_button = ui.Button(text="&Close",
                                   default=False,
                                   auto_default=False,
                                   clicked=self.on_close)
     self.layout = ui.Column(
         ui.Row(
             ui.Column(
                 ui.Row(
                     ui.GroupBox(
                         title="Control",
                         layout=ui.Column(
                             ui.Spacer(horizontal=False),
                             self.control_layout,
                             ui.Spacer(horizontal=False)
                         )
                     ),
                     ui.GroupBox(
                         title="Step Width",
                         layout=self.step_width_buttons
                     ),
                     ui.GroupBox(
                         title="Lights",
                         layout=ui.Column(
                             self.probecard_light_button,
                             self.microscope_light_button,
                             self.box_light_button,
                             ui.Spacer()
                         )
                     ),
                     stretch=(0, 1)
                 ),
                 ui.Tabs(
                     ui.Tab(
                         title="Move",
                         layout=self.positions_widget
                     ),
                     ui.Tab(
                         title="Contacts",
                         layout=self.contacts_widget
                     ),
                     ui.Tab(
                         title="Calibrate",
                         layout=ui.Column(
                                 ui.GroupBox(
                                 title="Table Calibration",
                                 layout=ui.Column(
                                     ui.Row(
                                         self.calibrate_button,
                                         ui.Label("Calibrate table by moving into cal/rm switches\nof every axis in" \
                                                  " a safe manner to protect the probe card."),
                                         stretch=(0, 1)
                                     )
                                 )
                             ),
                             ui.Spacer(),
                             stretch=(0, 1)
                         )
                     ),
                     ui.Tab(
                         title="Options",
                         layout=ui.Column(
                             ui.GroupBox(
                                 title="Update Interval",
                                 layout=ui.Row(
                                     self.update_interval_number,
                                     ui.Spacer(),
                                     stretch=(0, 1)
                                 )
                             ),
                             ui.Spacer(),
                             stretch=(0, 1)
                         )
                     )
                 ),
                 stretch=(0, 1)
             ),
             ui.Column(
                 ui.GroupBox(
                     title="Position",
                     layout=ui.Row(
                         ui.Column(
                             ui.Label("X"),
                             ui.Label("Y"),
                             ui.Label("Z")
                         ),
                         ui.Column(
                             self.pos_x_label,
                             self.pos_y_label,
                             self.pos_z_label
                         )
                     )
                 ),
                 ui.GroupBox(
                     title="Calibration",
                     layout=ui.Row(
                         ui.Column(
                             ui.Label("X"),
                             ui.Label("Y"),
                             ui.Label("Z")
                         ),
                         ui.Column(
                             self.cal_x_label,
                             self.cal_y_label,
                             self.cal_z_label
                         ),
                         ui.Column(
                             self.rm_x_label,
                             self.rm_y_label,
                             self.rm_z_label
                         ),
                         stretch=(1, 1)
                     )
                 ),
                 ui.GroupBox(
                     title="Limits",
                     layout=ui.Row(
                         ui.Column(
                             ui.Label("Z")
                         ),
                         ui.Column(
                             self.z_limit_label
                         )
                     )
                 ),
                 ui.GroupBox(
                     title="Safety",
                     layout=ui.Row(
                         ui.Label(
                             text="Laser Sensor"
                         ),
                         self.laser_label
                     )
                 ),
                 ui.Spacer()
             ),
             stretch=(1, 0)
         ),
         ui.Row(
             self.progress_bar,
             self.message_label,
             ui.Spacer(),
             self.stop_button,
             self.close_button
         ),
         stretch=(1, 0)
     )
     self.close_event = self.on_close_event
     self.reset_position()
     self.reset_caldone()
     self.update_limits()
     self.reset_safety()
     self.update_control_buttons()
예제 #17
0
 def __init__(self, process, lcr_process):
     super().__init__()
     self.lcr_process = lcr_process
     self.lcr_process.finished = self.on_lcr_finished
     self.lcr_process.failed = self.on_lcr_failed
     self.lcr_process.reading = self.on_lcr_reading
     self.mount(process)
     self.resize(640, 480)
     self.title = "Table Control"
     self.add_x_button = KeypadButton(text="+X", clicked=self.on_add_x)
     self.sub_x_button = KeypadButton(text="-X", clicked=self.on_sub_x)
     self.add_y_button = KeypadButton(text="+Y", clicked=self.on_add_y)
     self.sub_y_button = KeypadButton(text="-Y", clicked=self.on_sub_y)
     self.add_z_button = KeypadButton(text="+Z", clicked=self.on_add_z)
     self.sub_z_button = KeypadButton(text="-Z", clicked=self.on_sub_z)
     self.step_up_button = KeypadButton(
         text="↑⇵",
         tool_tip=
         "Step up, move single step up then double step down and double step up (experimental).",
         clicked=self.on_step_up)
     self.control_buttons = (self.add_x_button, self.sub_x_button,
                             self.add_y_button, self.sub_y_button,
                             self.add_z_button, self.sub_z_button,
                             self.step_up_button)
     self._lcr_prim_text = ui.Text(readonly=True)
     self._lcr_sec_text = ui.Text(readonly=True)
     self._lcr_chart = LCRChart()
     self._lcr_groupbox = ui.GroupBox(
         title="Contact Quality (LCR)",
         checkable=True,
         checked=False,
         toggled=self.on_lcr_toggled,
         layout=ui.Column(ui.Row(ui.Label("Cp"), self._lcr_prim_text),
                          ui.Row(ui.Label("Rp"), self._lcr_sec_text),
                          self._lcr_chart))
     self.probecard_light_button = ToggleButton(
         text="PC Light",
         tool_tip="Toggle probe card light",
         checkable=True,
         checked=False,
         enabled=False,
         toggled=self.on_probecard_light_clicked)
     self.microscope_light_button = ToggleButton(
         text="Mic Light",
         tool_tip="Toggle microscope light",
         checkable=True,
         checked=False,
         enabled=False,
         toggled=self.on_microscope_light_clicked)
     self.box_light_button = ToggleButton(text="Box Light",
                                          tool_tip="Toggle box light",
                                          checkable=True,
                                          checked=False,
                                          enabled=False,
                                          toggled=self.on_box_light_clicked)
     # Create movement radio buttons
     self.step_width_buttons = ui.Column()
     for item in self.load_table_step_sizes():
         step_size = item.get('step_size') * comet.ureg('um')
         step_color = item.get('step_color')
         step_size_label = format_metric(step_size.to('m').m,
                                         'm',
                                         decimals=1)
         button = ui.RadioButton(
             text=step_size_label,
             tool_tip=f"Move in {step_size_label} steps.",
             stylesheet=f"QRadioButton:enabled{{color:{step_color};}}",
             checked=len(self.step_width_buttons) == 0,
             toggled=self.on_step_toggled)
         button.movement_width = step_size.to('mm').m
         button.movement_color = step_color
         self.step_width_buttons.append(button)
     self.control_layout = ui.Column(ui.Row(ui.Row(
         ui.Column(KeypadSpacer(), self.sub_y_button, KeypadSpacer()),
         ui.Column(
             self.sub_x_button,
             KeypadSpacer(),
             self.add_x_button,
         ), ui.Column(
             KeypadSpacer(),
             self.add_y_button,
             KeypadSpacer(),
         ), KeypadSpacer(),
         ui.Column(ui.Row(self.add_z_button, self.step_up_button),
                   KeypadSpacer(), self.sub_z_button)),
                                            ui.Spacer(),
                                            stretch=(0, 1)),
                                     ui.Spacer(),
                                     stretch=(0, 1))
     self.positions_widget = TablePositionsWidget(
         enabled=False,
         position_picked=self.on_position_picked,
         absolute_move=self.on_absolute_move)
     self.contacts_widget = TableContactsWidget(
         enabled=False,
         position_picked=self.on_position_picked,
         absolute_move=self.on_absolute_move)
     self._position_widget = PositionWidget()
     self._calibration_widget = CalibrationWidget()
     self.z_limit_label = PositionLabel()
     self.x_hard_limit_label = PositionLabel()
     self.y_hard_limit_label = PositionLabel()
     self.z_hard_limit_label = PositionLabel()
     self.laser_label = SwitchLabel()
     self._calibrate_button = ui.Button(text="Calibrate",
                                        clicked=self.on_calibrate)
     self._update_interval_number = ui.Number(
         value=settings.table_control_update_interval,
         minimum=.5,
         maximum=10.0,
         decimals=2,
         step=0.25,
         suffix="s",
         changed=self.on_update_interval_changed)
     self._interval_groupbox = ui.GroupBox(title="Update Interval",
                                           layout=ui.Row(
                                               self._update_interval_number,
                                               ui.Spacer(),
                                               stretch=(0, 1)))
     self._dodge_height_number = ui.Number(
         tool_tip="Doge height in microns.",
         minimum=0,
         maximum=10000,
         decimals=0,
         step=1,
         suffix="um")
     self._dodge_groupbox = ui.GroupBox(
         title="X/Y Dodge",
         tool_tip="Enables -/+ Z dodge for XY movements.",
         checkable=True,
         layout=ui.Row(ui.Label("Height"),
                       self._dodge_height_number,
                       ui.Spacer(),
                       stretch=(0, 0, 1)))
     self._lcr_reset_on_move_checkbox = ui.CheckBox(
         text="Reset graph on X/Y move")
     self._contact_quality_groupbox = ui.GroupBox(
         title="Contact Quality (LCR)",
         layout=ui.Row(self._lcr_reset_on_move_checkbox,
                       ui.Spacer(),
                       stretch=(0, 1)))
     self._step_up_delay_number = ui.Number(minimum=0,
                                            maximum=1000,
                                            decimals=0,
                                            step=25,
                                            suffix="ms")
     self._step_up_multiply_number = ui.Number(minimum=1,
                                               maximum=10,
                                               decimals=0,
                                               suffix="x")
     self._step_up_groubox = ui.GroupBox(
         title="Step Up (↑⇵)",
         layout=ui.Row(
             ui.Column(ui.Label("Delay"), ui.Label("Multiplicator (⇵)")),
             ui.Column(self._step_up_delay_number,
                       self._step_up_multiply_number), ui.Spacer()))
     self._lcr_update_interval_number = ui.Number(minimum=0,
                                                  maximum=1000,
                                                  decimals=0,
                                                  step=25,
                                                  suffix="ms")
     self._lcr_matrix_channels_text = ui.Text()
     self._lcr_options_groupbox = ui.GroupBox(
         title="Contact Quality (LCR)",
         layout=ui.Row(
             ui.Column(
                 ui.Label("Reading Interval"),
                 ui.Label("Matrix Channels"),
             ),
             ui.Column(
                 ui.Row(self._lcr_update_interval_number, ui.Spacer()),
                 self._lcr_matrix_channels_text)))
     self.progress_bar = ui.ProgressBar(visible=False)
     self.message_label = ui.Label()
     self.stop_button = ui.Button(text="&Stop",
                                  default=False,
                                  auto_default=False,
                                  enabled=False,
                                  clicked=self.on_stop)
     self.close_button = ui.Button(text="&Close",
                                   default=False,
                                   auto_default=False,
                                   clicked=self.on_close)
     self.layout = ui.Column(
         ui.Row(
             ui.Column(
                 ui.Row(
                     ui.GroupBox(
                         title="Control",
                         layout=ui.Column(
                             ui.Spacer(horizontal=False),
                             self.control_layout,
                             ui.Spacer(horizontal=False)
                         )
                     ),
                     ui.GroupBox(
                         title="Step Width",
                         layout=self.step_width_buttons
                     ),
                     self._lcr_groupbox,
                     ui.Column(
                         ui.GroupBox(
                             title="Lights",
                             layout=ui.Column(
                                 self.probecard_light_button,
                                 self.microscope_light_button,
                                 self.box_light_button,
                                 ui.Spacer()
                             )
                         )
                     ),
                     stretch=(0, 0, 1, 0)
                 ),
                 ui.Tabs(
                     ui.Tab(
                         title="Move",
                         layout=self.positions_widget
                     ),
                     ui.Tab(
                         title="Contacts",
                         layout=self.contacts_widget
                     ),
                     ui.Tab(
                         title="Calibrate",
                         layout=ui.Column(
                             ui.GroupBox(
                                 title="Table Calibration",
                                 layout=ui.Column(
                                     ui.Row(
                                         self._calibrate_button,
                                         ui.Label("Calibrate table by moving into cal/rm switches\nof every axis in" \
                                                  " a safe manner to protect the probe card."),
                                         stretch=(0, 1)
                                     )
                                 )
                             ),
                             ui.Spacer(),
                             stretch=(0, 1)
                         )
                     ),
                     ui.Tab(
                         title="Options",
                         layout=ui.Column(
                             ui.Row(
                                 self._interval_groupbox,
                                 self._dodge_groupbox,
                                 self._contact_quality_groupbox,
                                 stretch=(0, 0, 1)
                             ),
                             self._step_up_groubox,
                             self._lcr_options_groupbox,
                             ui.Spacer(),
                             stretch=(0, 0, 0, 1)
                         )
                     )
                 ),
                 stretch=(0, 1)
             ),
             ui.Column(
                 self._position_widget,
                 self._calibration_widget,
                 ui.GroupBox(
                     title="Soft Limits",
                     layout=ui.Row(
                         ui.Column(
                             ui.Label("Z")
                         ),
                         ui.Column(
                             self.z_limit_label
                         )
                     )
                 ),
                 ui.GroupBox(
                     title="Hard Limits",
                     layout=ui.Row(
                         ui.Column(
                             ui.Label("X"),
                             ui.Label("Y"),
                             ui.Label("Z")
                         ),
                         ui.Column(
                             self.x_hard_limit_label,
                             self.y_hard_limit_label,
                             self.z_hard_limit_label
                         )
                     )
                 ),
                 ui.GroupBox(
                     title="Safety",
                     layout=ui.Row(
                         ui.Label(
                             text="Laser Sensor"
                         ),
                         self.laser_label
                     )
                 ),
                 ui.Spacer()
             ),
             stretch=(1, 0)
         ),
         ui.Row(
             self.progress_bar,
             self.message_label,
             ui.Spacer(),
             self.stop_button,
             self.close_button
         ),
         stretch=(1, 0)
     )
     self.close_event = self.on_close_event
     self.reset_position()
     self.reset_caldone()
     self.update_limits()
     self.reset_safety()
     self.update_control_buttons()
예제 #18
0
from comet import ui

app = comet.Application("comet-example")

# Register resources
app.resources.add("INSTR", comet.Resource("ASRL2::INSTR", visa_library="@sim"))

# Load stored settings (optional)
app.resources.load_settings()

def on_click():
    """Read IDN from IEC60488 compatible resource."""
    try:
        with app.resources.get("INSTR") as instr:
            idn_text.value = comet.IEC60488(instr).identification
    except comet.ResourceError as exc:
        ui.show_exception(exc)

idn_text = ui.Text(readonly=True)

app.layout = ui.Column(
    ui.Row(
        idn_text,
        ui.Button("Reload", clicked=on_click)
    ),
    ui.Spacer(),
    stretch=(0, 1)
)

app.run()
예제 #19
0
    def __init__(self, *, tree_selected, tree_double_clicked, start_all, start,
                 stop, reset_sequence_state, edit_sequence):
        super().__init__()
        self.current_path = user_home()
        self.title = "Sequence"
        self.tree_double_clicked = tree_double_clicked

        self._sequence_tree = SequenceTree(
            selected=tree_selected, double_clicked=self.tree_double_clicked)
        self._sequence_tree.minimum_width = 360

        self._start_all_action = ui.Action(text="&All Samples",
                                           triggered=start_all)

        self._start_sample_action = ui.Action(text="&Sample", triggered=start)
        self._start_sample_action.qt.setEnabled(False)

        self._start_contact_action = ui.Action(text="&Contact",
                                               triggered=start)
        self._start_contact_action.qt.setEnabled(False)

        self._start_measurement_action = ui.Action(text="&Measurement",
                                                   triggered=start)
        self._start_measurement_action.qt.setEnabled(False)

        self._start_menu = ui.Menu()
        self._start_menu.append(self._start_all_action)
        self._start_menu.append(self._start_sample_action)
        self._start_menu.append(self._start_contact_action)
        self._start_menu.append(self._start_measurement_action)

        self._start_button = ui.Button(
            text="Start",
            tool_tip="Start measurement sequence.",
            stylesheet="QPushButton:enabled{color:green;font-weight:bold;}")
        self._start_button.qt.setMenu(self._start_menu.qt)

        self._stop_button = ui.Button(
            text="Stop",
            tool_tip="Stop measurement sequence.",
            enabled=False,
            clicked=stop,
            stylesheet="QPushButton:enabled{color:red;font-weight:bold;}")

        self._reset_button = ui.Button(
            text="Reset",
            tool_tip="Reset measurement sequence state.",
            clicked=reset_sequence_state)

        self._edit_button = ui.Button(
            text="Edit",
            tool_tip="Quick edit properties of sequence items.",
            clicked=edit_sequence)

        self._reload_config_button = ui.ToolButton(
            icon=make_path('assets', 'icons', 'reload.svg'),
            tool_tip="Reload sequence configurations from file.",
            clicked=self.on_reload_config_clicked)

        self._add_sample_button = ui.ToolButton(
            icon=make_path('assets', 'icons', 'add.svg'),
            tool_tip="Add new sample sequence.",
            clicked=self.on_add_sample_clicked)

        self._remove_sample_button = ui.ToolButton(
            icon=make_path('assets', 'icons', 'delete.svg'),
            tool_tip="Remove current sample sequence.",
            clicked=self.on_remove_sample_clicked)

        self._open_button = ui.ToolButton(
            icon=make_path('assets', 'icons', 'document_open.svg'),
            tool_tip="Open sequence tree from file.",
            clicked=self.on_open_clicked)

        self._save_button = ui.ToolButton(
            icon=make_path('assets', 'icons', 'document_save.svg'),
            tool_tip="Save sequence tree to file.",
            clicked=self.on_save_clicked)

        self.layout = ui.Column(
            self._sequence_tree,
            ui.Row(self._start_button, self._stop_button, self._reset_button,
                   self._edit_button, self._reload_config_button,
                   self._add_sample_button, self._remove_sample_button,
                   self._open_button, self._save_button))