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
|
A QTableWidget with one cell and no headers to just display a color |
|
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 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
QtCore.QColor.
color_changed
(*args, **kwargs)a signal that is emitted with an rgba color if the chosen color changes
-
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
-
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
-
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 themarks
attribute of thestraditizer
- Parameters
straditizer_widgets (StraditizerWidgets) – The main widget for the straditizer GUI
item (QTreeWidgetItem) – The parent item in the
StraditizerWidgets.tree
. If given, thesetup_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 the line style of the marks
Change the linewidth of the marks
change_marker_size
(markersize)Change the size of the markers
Change the marker style of the marks
change_select_colors
(color)Change the selection color of the marks
Change the linewidth for selected marks
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
colorchange_vline_draggable
(state)Enable or disable the dragging of vertical lines
change_vline_selectable
(state)Enable or disable the selection of vertical lines
Draw the figures of the
marks
Renabled to use the
refresh()
methodfill_after_adding
(mark)fill_from_mark
(mark)Set the widgets of this
MarkerControl
from a markFill the
combo_line_style
comboboxFill the
combo_marker_style
comboboxMove the plot to the next mark with a x-position greater than x
Move the plot to the next mark with a y-position greater than y
Move the plot to the previous left cross mark
Go to the next mark below the current y-limits
Move the plot to the next right cross mark
Move the plot to the next mark with a x-position smaller than x
Move the plot to the next mark with a y-position smaller than x
Go to the next mark above the current y-limits
refresh
()Reimplemented to also set the properties of this widget
Remove the navigation actions from the toolbar
Switch the
combo_line_style
to the given linestyleset_marker_item
(marker)Switch the
combo_marker_style
to the given markerCheck if a widget w should be enabled or disabled
update_mark
(mark)Update the properties of a mark to match the settings
Attributes
The properties of the lines as a
dict
The
CrossMarks
of the straditizerThe properties of selected marks as a
dict
-
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 toTrue
-
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
colorChange 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
-
fill_from_mark
(mark)[source]¶ Set the widgets of this
MarkerControl
from a markThis 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
-
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_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
-
property
marks
¶ The
CrossMarks
of the straditizer
-
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
-
update_mark
(mark)[source]¶ Update the properties of a mark to match the settings
- Parameters
mark (straditize.cross_mark.CrossMarks) – The mark to update