autooptions.qtutil module

class autooptions.qtutil.PlotWidget(viewer: napari.viewer.Viewer)[source]

Bases: QWidget

A widget that contains a pyplot plot.

addData(X, Y, formatString=None)[source]

Add the data and the format string.

clear()[source]

Remove everything from the plot.

createLayout()[source]

Create the layout of the widget.

display()[source]

Display the plot as a dock widget in napari.

class autooptions.qtutil.TableView(data, *args)[source]

Bases: QTableWidget

A table that allows to copy the selected cells to the system-clipboard.

copyDataToClipboard()[source]

Copy the data in the selected table-cells into the system clipboard.

getSelectedDataAsString()[source]

Get the data in the selected cells as a string. Columns are separated by tabs and lines by newlines”.

keyPressEvent(event)[source]

Copy the selected table data to the system clipboard if the key-event is ctrl+C.

Parameters:

event – The received key-pressed event.

resetView()[source]

Resets the view to the data of the table view

setData(table)[source]

Clear the table and replace the data in the table with the input table

class autooptions.qtutil.WidgetTool[source]

Bases: object

Utility methods for working with qt-widgets.

static getCheckbox(parent, labelText, defaultValue, fieldWidth, callback)[source]

Answers a label and a checkbox checked or unchecked depeding on the default value.

Parameters:
  • parent – The parent widget of the label and the input field

  • labelText – The text of the label

  • defaultValue – The boolean default value

  • fieldWidth – The maximum width of the checkbox

  • callback – A callback function

Returns:

A tupel of a label and a checkbox

static getComboInput(parent, labelText, values, callback=None)[source]

Returns a label displaying the given text and a combo-box with the given values.

Parameters:
  • parent – The parent widget of the label and the input field

  • labelText – The text of the label

  • values – The values in the list of the combo-box

  • callback – A callback function that is called with the new text when the selected text changes.

Returns:

A tupel of the label and the input field

Return type:

(QLabel, QComboBox)

static getLineInput(parent, labelText, defaultValue, fieldWidth, callback)[source]

Returns a label displaying the given text and an input field with the given default value.

Parameters:
  • parent – The parent widget of the label and the input field

  • labelText – The text of the label

  • defaultValue – The value initailly displayed in the input field

  • fieldWidth – The width of the input field

  • callback – A callback function with a parameter text. The function is called with the new text when the content of the input field changes

Returns:

A tupel of the label and the input field

Return type:

(QLabel, QLineEdit)

static replaceItemsInComboBox(comboBox, newItems)[source]

Replace the items in the combo-box with newItems

Parameters:
  • comboBox – The combo-box in which the items will be replaced

  • newItems – The new items that will replace the current items in the combo-box.