straditize.widgets.marker_control module

A widget for controlling the appearance of markers

This module defines the MarkerControl to control the appearance and behaviour of CrossMarks instances in the straditize.straditizer.Straditizer.marks attribute

Disclaimer

Copyright (C) 2018-2019 Philipp S. Sommer

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Classes

ColorLabel([color])

A QTableWidget with one cell and no headers to just display a color

MarkerControl(straditizer_widgets, item, …)

Widget to control the appearance of the marks

class straditize.widgets.marker_control.ColorLabel(color='w', *args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QTableWidget

A QTableWidget with one cell and no headers to just display a color

The color to display

Parameters

color (object) – Either a QtGui.QColor object or a color that can be converted to RGBA using the matplotlib.colors.to_rgba() function

Methods

adjust_height()

Adjust the height to match the row height

select_color(*args)

Select a color using PyQt5.QtWidgets.QColorDialog.getColor()

set_color(color)

Set the color of the label

sizeHint()

Reimplemented to use the rowHeight as height

Attributes

color

QtCore.QColor.

color_changed(*args, **kwargs)

a signal that is emitted with an rgba color if the chosen color changes

adjust_height()[source]

Adjust the height to match the row height

color = None

QtCore.QColor. The current color that is displayed

color_changed(*args, **kwargs)

a signal that is emitted with an rgba color if the chosen color changes

select_color(*args)[source]

Select a color using PyQt5.QtWidgets.QColorDialog.getColor()

set_color(color)[source]

Set the color of the label

This method sets the given color as background color for the cell and emits the color_changed signal

Parameters

color (object) – Either a QtGui.QColor object or a color that can be converted to RGBA using the matplotlib.colors.to_rgba() function

sizeHint()[source]

Reimplemented to use the rowHeight as height

class straditize.widgets.marker_control.MarkerControl(straditizer_widgets, item, *args, **kwargs)[source]

Bases: straditize.widgets.StraditizerControlBase, PyQt5.QtWidgets.QWidget

Widget to control the appearance of the marks

This widget controls the appearance of the straditize.cross_mark.CrossMarks instances in the marks attribute of the straditizer

Parameters
  • straditizer_widgets (StraditizerWidgets) – The main widget for the straditizer GUI

  • item (QTreeWidgetItem) – The parent item in the StraditizerWidgets.tree. If given, the setup_children() is called with this item

Methods

add_toolbar_widgets(mark)

Add the navigation actions to the toolbar

change_auto_hide(auto_hide)

Toggle the auto_hide

change_hline_draggable(state)

Enable or disable the dragging of horizontal lines

change_hline_selectable(state)

Enable or disable the selection of horizontal lines

change_line_style(i)

Change the line style of the marks

change_line_widths(lw)

Change the linewidth of the marks

change_marker_size(markersize)

Change the size of the markers

change_marker_style(i)

Change the marker style of the marks

change_select_colors(color)

Change the selection color of the marks

change_selection_line_widths(lw)

Change the linewidth for selected marks

change_show_connected_artists(show)

Change the visibility of connected artists

change_show_hlines(state)

Enable of disable the visibility of horizontal lines

change_show_vlines(state)

Enable of disable the visibility of vertical lines

change_unselect_colors(color)

Change the straditize.cross_mark.CrossMark.cunselect color

change_vline_draggable(state)

Enable or disable the dragging of vertical lines

change_vline_selectable(state)

Enable or disable the selection of vertical lines

draw_figs()

Draw the figures of the marks

enable_or_disable_widgets(b)

Renabled to use the refresh() method

fill_after_adding(mark)

fill_from_mark(mark)

Set the widgets of this MarkerControl from a mark

fill_linestyles()

Fill the combo_line_style combobox

fill_markerstyles()

Fill the combo_marker_style combobox

go_to_greater_x_mark(x)

Move the plot to the next mark with a x-position greater than x

go_to_greater_y_mark(y)

Move the plot to the next mark with a y-position greater than y

go_to_left_mark()

Move the plot to the previous left cross mark

go_to_lower_mark()

Go to the next mark below the current y-limits

go_to_right_mark()

Move the plot to the next right cross mark

go_to_smaller_x_mark(x)

Move the plot to the next mark with a x-position smaller than x

go_to_smaller_y_mark(y)

Move the plot to the next mark with a y-position smaller than x

go_to_upper_mark()

Go to the next mark above the current y-limits

refresh()

Reimplemented to also set the properties of this widget

remove_actions()

Remove the navigation actions from the toolbar

set_line_style_item(ls)

Switch the combo_line_style to the given linestyle

set_marker_item(marker)

Switch the combo_marker_style to the given marker

should_be_enabled(w)

Check if a widget w should be enabled or disabled

update_mark(mark)

Update the properties of a mark to match the settings

Attributes

line_props

The properties of the lines as a dict

marks

The CrossMarks of the straditizer

select_props

The properties of selected marks as a dict

add_toolbar_widgets(mark)[source]

Add the navigation actions to the toolbar

change_auto_hide(auto_hide)[source]

Toggle the auto_hide

This method disables or enables the auto_hide of the marks

Parameters

auto_hide (bool or PyQt5.QtGui.Qt.Checked or PyQt5.QtGui.Qt.Unchecked) – The value to use for the auto_hide. PyQt5.QtGui.Qt.Checked is equivalent to True

change_hline_draggable(state)[source]

Enable or disable the dragging of horizontal lines

Parameters

state (Qt.Checked or Qt.Unchecked) – If Qt.Checked, the horizontal lines can be dragged and dropped

change_hline_selectable(state)[source]

Enable or disable the selection of horizontal lines

Parameters

state (Qt.Checked or Qt.Unchecked) – If Qt.Checked, the horizontal lines can be selected

change_line_style(i)[source]

Change the line style of the marks

Parameters

i (int) – The index of the line style in the line_styles attribute to use

change_line_widths(lw)[source]

Change the linewidth of the marks

Parameters

lw (float) – The line width to use

change_marker_size(markersize)[source]

Change the size of the markers

Parameters

markersize (float) – The size of the marker to use

change_marker_style(i)[source]

Change the marker style of the marks

Parameters

i (int) – The index of the marker style in the marker_styles attribute to use

change_select_colors(color)[source]

Change the selection color of the marks

Change the selection color of the marks to the given color.

Parameters

color (PyQt5.QtGui.QColor or a matplotlib color) – The color to use

change_selection_line_widths(lw)[source]

Change the linewidth for selected marks

Parameters

lw (float) – The linewidth for selected marks

change_show_connected_artists(show)[source]

Change the visibility of connected artists

Parameters

show (bool) – The visibility for the straditize.cross_mark.CrossMarks.set_connected_artists_visible() method

change_show_hlines(state)[source]

Enable of disable the visibility of horizontal lines

Parameters

state (Qt.Checked or Qt.Unchecked) – If Qt.Checked, all horizontal lines are hidden

change_show_vlines(state)[source]

Enable of disable the visibility of vertical lines

Parameters

state (Qt.Checked or Qt.Unchecked) – If Qt.Checked, all vertical lines are hidden

change_unselect_colors(color)[source]

Change the straditize.cross_mark.CrossMark.cunselect color

Change the unselection color of the marks to the given color.

Parameters

color (PyQt5.QtGui.QColor or a matplotlib color) – The color to use

change_vline_draggable(state)[source]

Enable or disable the dragging of vertical lines

Parameters

state (Qt.Checked or Qt.Unchecked) – If Qt.Checked, the vertical lines can be dragged and dropped

change_vline_selectable(state)[source]

Enable or disable the selection of vertical lines

Parameters

state (Qt.Checked or Qt.Unchecked) – If Qt.Checked, the vertical lines can be selected

draw_figs()[source]

Draw the figures of the marks

enable_or_disable_widgets(b)[source]

Renabled to use the refresh() method

fill_after_adding(mark)[source]
fill_from_mark(mark)[source]

Set the widgets of this MarkerControl from a mark

This method sets the color labels, combo boxes, check boxes and text edits to match the properties of the given mark

Parameters

mark (straditize.cross_mark.CrossMark) – The mark to use the attributes from

fill_linestyles()[source]

Fill the combo_line_style combobox

fill_markerstyles()[source]

Fill the combo_marker_style combobox

go_to_greater_x_mark(x)[source]

Move the plot to the next mark with a x-position greater than x

Parameters

x (float) – The reference x-position that shall be smaller than the new centered mark

go_to_greater_y_mark(y)[source]

Move the plot to the next mark with a y-position greater than y

Parameters

y (float) – The reference y-position that shall be smaller than the new centered mark

go_to_left_mark()[source]

Move the plot to the previous left cross mark

go_to_lower_mark()[source]

Go to the next mark below the current y-limits

go_to_right_mark()[source]

Move the plot to the next right cross mark

go_to_smaller_x_mark(x)[source]

Move the plot to the next mark with a x-position smaller than x

Parameters

x (float) – The reference x-position that shall be greater than the new centered mark

go_to_smaller_y_mark(y)[source]

Move the plot to the next mark with a y-position smaller than x

Parameters

y (float) – The reference y-position that shall be smaller than the new centered mark

go_to_upper_mark()[source]

Go to the next mark above the current y-limits

property line_props

The properties of the lines as a dict

property marks

The CrossMarks of the straditizer

refresh()[source]

Reimplemented to also set the properties of this widget

remove_actions()[source]

Remove the navigation actions from the toolbar

property select_props

The properties of selected marks as a dict

set_line_style_item(ls)[source]

Switch the combo_line_style to the given linestyle

Parameters

ls (str) – The matplotlib linestyle string

set_marker_item(marker)[source]

Switch the combo_marker_style to the given marker

Parameters

marker (str) – A matplotlib marker string

should_be_enabled(w)[source]

Check if a widget w should be enabled or disabled

Parameters

w (PyQt5.QtWidgets.QWidget) – The widget to (potentially) enable

Returns

True if the straditizer of this instance has marks. Otherwise False

Return type

bool

update_mark(mark)[source]

Update the properties of a mark to match the settings

Parameters

mark (straditize.cross_mark.CrossMarks) – The mark to update