straditize.widgets package¶
The straditizer widgets
This module contains widgets to digitize the straditizer diagrams through a GUI
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 QPushButton that emits a signal when enabled |
|
|
A button to display help informations in the help explorer |
A base class for the straditizer widget |
|
|
A widget that contains widgets to control the straditization in a GUI |
Functions
|
Return the path to a documentation file |
|
Return the path of an icon |
|
Get the |
|
Return the content of a rst documentation file |
-
class
straditize.widgets.
EnableButton
[source]¶ Bases:
PyQt5.QtWidgets.QPushButton
A QPushButton that emits a signal when enabled
Attributes
enabled
(*args, **kwargs)A signal that is emitted with a boolean whether if the button is
Methods
setEnabled
(b)Reimplemented to emit the
enabled
signal-
enabled
(*args, **kwargs)¶ A signal that is emitted with a boolean whether if the button is enabled or disabled
-
-
class
straditize.widgets.
InfoButton
(parent, fname=None, rst=None, name=None)[source]¶ Bases:
PyQt5.QtWidgets.QToolButton
A button to display help informations in the help explorer
- Parameters
Methods
Show the docs
-
show_docs
()[source]¶ Show the docs
Shows the docs in the in the
help_explorer
-
class
straditize.widgets.
StraditizerControlBase
[source]¶ Bases:
object
A base class for the straditizer widget
Methods
add_info_button
(child[, fname, rst, name, …])Add an info button to the given QTreeWidgetItem
connect2apply
(*funcs)Connect the functions to the
apply_button
connect2cancel
(*funcs)Connect the functions to the
cancel_button
Enable or disable the widgets in this control
init_straditizercontrol
(straditizer_widgets)Initialize the straditizer control widget
refresh
()Refresh from the straditizer
setup_children
(item)Setup the children for this control
Check if a widget should be enabled
Attributes
The apply button of the
straditizer_widgets
The cancel button of the
straditizer_widgets
The
psyplot_gui.help_explorer.HelpExplorer
of theThe current straditizer from the
straditizer_widgets
The
StraditizierWidgets
controlA list of widgets to disable or enable if the apply_button is enabled
Add an info button to the given QTreeWidgetItem
- Parameters
child (QTreeWidgetItem) – The item to which to add the infobutton
The apply button of the
straditizer_widgets
The cancel button of the
straditizer_widgets
-
connect2apply
(*funcs)[source]¶ Connect the functions to the
apply_button
- Parameters
*funcs – The callables that should be connected to the
apply_button
-
connect2cancel
(*funcs)[source]¶ Connect the functions to the
cancel_button
- Parameters
*funcs – The callables that should be connected to the
cancel_button
-
enable_or_disable_widgets
(b)[source]¶ Enable or disable the widgets in this control
This method enables or disables the
widgets2disable
if theshould_be_enabled()
method evaluates to True- Parameters
b (bool) – If True, enable the widgets, if False, disable them
-
property
help_explorer
¶ The
psyplot_gui.help_explorer.HelpExplorer
of thepsyplot_gui.main.mainwindow
-
init_straditizercontrol
(straditizer_widgets, item=None)[source]¶ Initialize the straditizer control widget
This method should be called by every subclass when initializing. It sets the
straditizer_widgets
, connects theenable_or_disable_widgets()
method and adds a new item to theStraditizerWidgets.tree
- 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
-
setup_children
(item)[source]¶ Setup the children for this control
This method is called to setup the children in the
StraditizerWidgets.tree
. By default, it just creates a child QTreeWidgetItem and sets this control as it’s widget- Parameters
item (QTreeWidgetItem) – The top level item in the
StraditizerWidgets.tree
-
should_be_enabled
(w)[source]¶ Check if a widget should be enabled
This function checks if a given widget w from the
widgets2disable
attribute should be enabled or not- Parameters
w (QWidget) – The widget to check
- Returns
True, if the widget should be enabled
- Return type
-
property
straditizer
¶ The current straditizer from the
straditizer_widgets
-
straditizer_widgets
= None¶ The
StraditizierWidgets
control
-
widgets2disable
= []¶ A list of widgets to disable or enable if the apply_button is enabled
-
class
straditize.widgets.
StraditizerWidgets
(*args, **kwargs)[source]¶ Bases:
PyQt5.QtWidgets.QWidget
,psyplot_gui.common.DockMixin
A widget that contains widgets to control the straditization in a GUI
This widget is the basis of the straditize GUI and implemented as a plugin into the psyplot gui. The open straditizers are handled in the
_straditizer
attribute.The central parts of this widget are
The combobox to manage the open straditizers
The QTreeWidget in the
tree
attribute that contains all the controls to interface the straditizerthe tutorial area
the Apply and Cancel button
Methods
add_info_button
(child[, fname, rst, name, …])Add an infobutton to the
tree
widgetadd_straditizer
(stradi)Add a straditizer to the list of open straditizers
autosave
()Autosave the current straditizer
Close all straditizers
Close the current straditizer
create_straditizer_from_args
(fnames[, …])Create a straditizer from the given file name
Method that is called when the
cancel_button
is clickedEdit the attributes of the current straditizer
get_attr
(stradi, attr)Raise the figures of the current straditizer in the GUI
refresh
()Refresh from the straditizer
Reload the autosaved straditizer and close the old one
Reset the GUI of straditize
Set the i-th straditizer to the current one
Show or hide the toolbar depending on the visibility of this widget
start_tutorial
(state[, tutorial_cls])Start or stop the tutorial
Switch to the straditizer layout
to_dock
(main, *args, **kwargs)Attributes
Boolean that is True if all dialogs should be answered with Yes
The apply button
The button to edit the straditizer attributes
Auto-saved straditizers
The
straditize.widgets.axes_translations.AxesTranslations
toA button to close the current straditizer
A button to open a new straditizer
A button to reload the last autosaved state
The cancel button
The
straditize.widgets.colnames.ColumnNamesManager
to interfaceThe
straditize.widgets.data.DigitizingControl
to interfacebool(x) -> bool
The
straditize.widgets.image_correction.ImageRescaler
class toThe
straditize.widgets.image_correction.ImageRotator
class toAn
InfoButton
to display the docsThe
straditize.widgets.marker_control.MarkerControl
to modifyopen_external
(*args, **kwargs)The
straditize.widgets.plots.PlotControl
to display additionalThe
straditize.widgets.selection_toolbar.SelectionToolbar
toA QComboBox to select the current straditizer
The
straditize.straditizer.Straditizer
instancestr(object=’’) -> str
The QTreeWidget that contains the different widgets for the digitization
The
straditize.widgets.tutorial.Tutorial
classThe button to start a tutorial
Add an infobutton to the
tree
widget- Parameters
child (QTreeWidgetItem) – The item to which to add the infobutton
connections (list of QPushButtons) – Buttons that should be clicked when the info button is clicked
-
always_yes
= False¶ Boolean that is True if all dialogs should be answered with Yes
The apply button
The button to edit the straditizer attributes
-
autosaved
= []¶ Auto-saved straditizers
-
axes_translations
= None¶ The
straditize.widgets.axes_translations.AxesTranslations
to handle the y- and x-axis conversions
-
btn_close_stradi
= None¶ A button to close the current straditizer
-
btn_open_stradi
= None¶ A button to open a new straditizer
-
btn_reload_autosaved
= None¶ A button to reload the last autosaved state
The cancel button
-
colnames_manager
= None¶ The
straditize.widgets.colnames.ColumnNamesManager
to interface the :straditize.straditizer.Straditizer.colnames_reader`
-
create_straditizer_from_args
(fnames, project=None, xlim=None, ylim=None, full=False, reader_type='area')[source]¶ Create a straditizer from the given file name
This method is called when the
psyplot_gui.main.mainwindow
receives a ‘straditize’ callback
-
digitizer
= None¶ The
straditize.widgets.data.DigitizingControl
to interface the :straditize.straditizer.Straditizer.data_reader`
Method that is called when the
cancel_button
is clicked
-
dock_position
= 1¶
-
edit_attrs
()[source]¶ Edit the attributes of the current straditizer
This creates a new dataframe editor to edit the
straditize.straditizer.Straditizer.attrs
meta informations
-
image_rescaler
= None¶ The
straditize.widgets.image_correction.ImageRescaler
class to rescale the image
-
image_rotator
= None¶ The
straditize.widgets.image_correction.ImageRotator
class to rotate the image
An
InfoButton
to display the docs
-
marker_control
= None¶ The
straditize.widgets.marker_control.MarkerControl
to modify the appearance of themarks
of the current straditizer
-
open_external
(*args, **kwargs)¶
-
plot_control
= None¶ The
straditize.widgets.plots.PlotControl
to display additional information on the diagram
-
progress_widget
= None¶ The
straditize.widgets.progress_widget.ProgressWidget
to display the progress of the straditization
-
selection_toolbar
= None¶ The
straditize.widgets.selection_toolbar.SelectionToolbar
to select features in the stratigraphic diagram
-
start_tutorial
(state, tutorial_cls=None)[source]¶ Start or stop the tutorial
- Parameters
state (bool) – If False, the tutorial is stopped. Otherwise it is started
tutorial_cls (straditize.widgets.tutorial.beginner.Tutorial) – The tutorial class to use. If None, it will be asked in a QInputDialog
-
stradi_combo
= None¶ A QComboBox to select the current straditizer
-
straditizer
= None¶ The
straditize.straditizer.Straditizer
instance
-
switch_to_straditizer_layout
()[source]¶ Switch to the straditizer layout
This method makes this widget visible and stacks it with the psyplot content widget
-
title
= 'Stratigraphic diagram digitization'¶
-
tree
= None¶ The QTreeWidget that contains the different widgets for the digitization
-
tutorial
= None¶ The
straditize.widgets.tutorial.Tutorial
class
The button to start a tutorial
-
window_layout_action
= None¶
-
straditize.widgets.
get_straditizer_widgets
(mainwindow=None)[source]¶ Get the
StraditizerWidgets
from the psyplot GUI mainwindow- Parameters
psyplot_gui.main.MainWindow – The mainwindow to use. If None, the
psyplot_gui.main.mainwindow
is used.- Returns
The straditizer widgets of the given mainwindow
- Return type
Subpackages¶
Submodules¶
- straditize.widgets.axes_translations module
- straditize.widgets.colnames module
- straditize.widgets.data module
- straditize.widgets.image_correction module
- straditize.widgets.marker_control module
- straditize.widgets.menu_actions module
- straditize.widgets.pattern_selection module
- straditize.widgets.plots module
- straditize.widgets.progress_widget module
- straditize.widgets.samples_table module
- straditize.widgets.selection_toolbar module
- straditize.widgets.stacked_area_reader module