straditize.widgets.tutorial.beginner module

The tutorial of straditize

This module contains a guided tour to get started with straditize

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

CleanImagePage(filename, tutorial)

Tutorial page to clean the diagram part

ColumnNames(filename, tutorial)

The page for recognizing column names

ControlIntro(filename, tutorial)

Tutorial page for the control

CreateReader(filename, tutorial)

The page for creating the reader

DigitizePage(filename, tutorial)

The page for digitizing the diagram

FinishPage(filename, tutorial)

The last page of the tutorial

LoadImage(filename, tutorial)

TutorialPage for loading the straditizer image

SamplesPage(filename, tutorial)

The page for finding and editing the samples

SelectDataPart(filename, tutorial)

TutorialPage for selecting the data part

SeparateColumns(filename, tutorial)

The page for separating the columns

TranslateXAxis(filename, tutorial)

The tutorial page for translating the y-axis

TranslateYAxis(filename, tutorial)

The tutorial page for translating the y-axis

Tutorial(straditizer_widgets)

A tutorial for digitizing an area diagram

TutorialDocs(*args, **kwargs)

A documentation viewer for the tutorial docs

TutorialNavigation(nsteps, validate, *args, …)

A widget for navigating through the tutorial.

TutorialPage(filename, tutorial)

A base class for the tutorial pages

class straditize.widgets.tutorial.beginner.CleanImagePage(filename, tutorial)[source]

Bases: straditize.widgets.tutorial.beginner.TutorialPage

Tutorial page to clean the diagram part

Parameters
  • filename (str) – The basename (without ending) of the RST file corresponding to this tutorial page

  • tutorial (Tutorial) – The tutorial instance

Methods

activate()

Method that is called, when the page is activated

clicked_btn_remove_xaxes()

clicked_btn_remove_yaxes()

deactivate()

Method that is called, when the page is deactivated

hint()

A method that should display a hint to the user

icon_to_bytes(icon)

skip()

Skip the steps in this page

Attributes

btn_remove_xaxes_clicked

bool(x) -> bool

btn_remove_yaxes_clicked

bool(x) -> bool

is_finished

Boolean that is True, if the steps are all finished

activate()[source]

Method that is called, when the page is activated

btn_remove_xaxes_clicked = False
btn_remove_yaxes_clicked = False
clicked_btn_remove_xaxes()[source]
clicked_btn_remove_yaxes()[source]
deactivate()[source]

Method that is called, when the page is deactivated

hint()[source]

A method that should display a hint to the user

icon_to_bytes(icon)[source]
property is_finished

Boolean that is True, if the steps are all finished

skip()[source]

Skip the steps in this page

class straditize.widgets.tutorial.beginner.ColumnNames(filename, tutorial)[source]

Bases: straditize.widgets.tutorial.beginner.TutorialPage

The page for recognizing column names

Parameters
  • filename (str) – The basename (without ending) of the RST file corresponding to this tutorial page

  • tutorial (Tutorial) – The tutorial instance

Methods

activate()

Method that is called, when the page is activated

clicked_select_names_button()

deactivate()

Method that is called, when the page is deactivated

hint()

A method that should display a hint to the user

hint_for_start_editing()

hint_for_wrong_name(col, curr, ref)

Display a hint if a name is not correctly set

skip()

Skip the steps in this page

Attributes

column_names

The column names in the diagram

is_finished

Boolean that is True, if the steps are all finished

select_names_button_clicked

bool(x) -> bool

activate()[source]

Method that is called, when the page is activated

clicked_select_names_button()[source]
column_names = ['Pinus', 'Juniperus', 'Quercus ilex-type', 'Chenopodiaceae']

The column names in the diagram

deactivate()[source]

Method that is called, when the page is deactivated

hint()[source]

A method that should display a hint to the user

hint_for_start_editing()[source]
hint_for_wrong_name(col, curr, ref)[source]

Display a hint if a name is not correctly set

property is_finished

Boolean that is True, if the steps are all finished

select_names_button_clicked = False
skip()[source]

Skip the steps in this page

class straditize.widgets.tutorial.beginner.ControlIntro(filename, tutorial)[source]

Bases: straditize.widgets.tutorial.beginner.TutorialPage

Tutorial page for the control

Parameters
  • filename (str) – The basename (without ending) of the RST file corresponding to this tutorial page

  • tutorial (Tutorial) – The tutorial instance

Methods

activate()

Method that is called, when the page is activated

activate()[source]

Method that is called, when the page is activated

class straditize.widgets.tutorial.beginner.CreateReader(filename, tutorial)[source]

Bases: straditize.widgets.tutorial.beginner.TutorialPage

The page for creating the reader

Parameters
  • filename (str) – The basename (without ending) of the RST file corresponding to this tutorial page

  • tutorial (Tutorial) – The tutorial instance

Methods

hint()

A method that should display a hint to the user

skip()

Skip the steps in this page

Attributes

is_finished

Boolean that is True, if the steps are all finished

hint()[source]

A method that should display a hint to the user

property is_finished

Boolean that is True, if the steps are all finished

skip()[source]

Skip the steps in this page

class straditize.widgets.tutorial.beginner.DigitizePage(filename, tutorial)[source]

Bases: straditize.widgets.tutorial.beginner.TutorialPage

The page for digitizing the diagram

Parameters
  • filename (str) – The basename (without ending) of the RST file corresponding to this tutorial page

  • tutorial (Tutorial) – The tutorial instance

Methods

hint()

A method that should display a hint to the user

skip()

Skip the steps in this page

Attributes

is_finished

Boolean that is True, if the steps are all finished

hint()[source]

A method that should display a hint to the user

property is_finished

Boolean that is True, if the steps are all finished

skip()[source]

Skip the steps in this page

class straditize.widgets.tutorial.beginner.FinishPage(filename, tutorial)[source]

Bases: straditize.widgets.tutorial.beginner.TutorialPage

The last page of the tutorial

Parameters
  • filename (str) – The basename (without ending) of the RST file corresponding to this tutorial page

  • tutorial (Tutorial) – The tutorial instance

Methods

show()

Reimplemented to release the help explorer lock

show()[source]

Reimplemented to release the help explorer lock

class straditize.widgets.tutorial.beginner.LoadImage(filename, tutorial)[source]

Bases: straditize.widgets.tutorial.beginner.TutorialPage

TutorialPage for loading the straditizer image

Parameters
  • filename (str) – The basename (without ending) of the RST file corresponding to this tutorial page

  • tutorial (Tutorial) – The tutorial instance

Methods

activate()

Method that is called, when the page is activated

deactivate()

Method that is called, when the page is deactivated

hint()

A method that should display a hint to the user

skip()

Skip the steps in this page

Attributes

is_finished

Boolean that is True, if the steps are all finished

activate()[source]

Method that is called, when the page is activated

deactivate()[source]

Method that is called, when the page is deactivated

hint()[source]

A method that should display a hint to the user

property is_finished

Boolean that is True, if the steps are all finished

skip()[source]

Skip the steps in this page

class straditize.widgets.tutorial.beginner.SamplesPage(filename, tutorial)[source]

Bases: straditize.widgets.tutorial.beginner.TutorialPage

The page for finding and editing the samples

Parameters
  • filename (str) – The basename (without ending) of the RST file corresponding to this tutorial page

  • tutorial (Tutorial) – The tutorial instance

Methods

activate()

Method that is called, when the page is activated

clicked_correct_button()

deactivate()

Method that is called, when the page is deactivated

hint()

A method that should display a hint to the user

skip()

Skip the steps in this page

Attributes

correct_button_clicked

bool(x) -> bool

is_finished

Boolean that is True, if the steps are all finished

activate()[source]

Method that is called, when the page is activated

clicked_correct_button()[source]
correct_button_clicked = False
deactivate()[source]

Method that is called, when the page is deactivated

hint()[source]

A method that should display a hint to the user

property is_finished

Boolean that is True, if the steps are all finished

skip()[source]

Skip the steps in this page

class straditize.widgets.tutorial.beginner.SelectDataPart(filename, tutorial)[source]

Bases: straditize.widgets.tutorial.beginner.TutorialPage

TutorialPage for selecting the data part

Parameters
  • filename (str) – The basename (without ending) of the RST file corresponding to this tutorial page

  • tutorial (Tutorial) – The tutorial instance

Methods

activate()

Method that is called, when the page is activated

check_mark(mark)

clicked_correct_button()

deactivate()

Method that is called, when the page is deactivated

display_reference_marks()

hint()

A method that should display a hint to the user

is_valid_x(x)

is_valid_y(y)

skip()

Skip the steps in this page

validate_corners()

Attributes

correct_button_clicked

bool(x) -> bool

is_finished

Boolean that is True, if the steps are all finished

marks

Built-in mutable sequence.

ref_lims

The reference x- and y- limits

remove_data_box

true if the data box should be removed at the end

valid_xlims

Valid ranges for xmin and xmax

valid_ylims

Valid ranges for ymin and ymax

activate()[source]

Method that is called, when the page is activated

check_mark(mark)[source]
clicked_correct_button()[source]
correct_button_clicked = False
deactivate()[source]

Method that is called, when the page is deactivated

display_reference_marks()[source]
hint()[source]

A method that should display a hint to the user

property is_finished

Boolean that is True, if the steps are all finished

is_valid_x(x)[source]
is_valid_y(y)[source]
marks = []
ref_lims = array([[ 258, 1803], [ 375, 1666]])

The reference x- and y- limits

remove_data_box = True

true if the data box should be removed at the end

skip()[source]

Skip the steps in this page

valid_xlims = array([[ 221, 263], [1730, 1922]])

Valid ranges for xmin and xmax

valid_ylims = array([[ 346, 403], [1648, 1701]])

Valid ranges for ymin and ymax

validate_corners()[source]
class straditize.widgets.tutorial.beginner.SeparateColumns(filename, tutorial)[source]

Bases: straditize.widgets.tutorial.beginner.TutorialPage

The page for separating the columns

Parameters
  • filename (str) – The basename (without ending) of the RST file corresponding to this tutorial page

  • tutorial (Tutorial) – The tutorial instance

Methods

activate()

Method that is called, when the page is activated

clicked_correct_button()

deactivate()

Method that is called, when the page is deactivated

hint()

A method that should display a hint to the user

skip()

Skip the steps in this page

Attributes

correct_button_clicked

bool(x) -> bool

is_finished

Boolean that is True, if the steps are all finished

ncols

int([x]) -> integer

activate()[source]

Method that is called, when the page is activated

clicked_correct_button()[source]
correct_button_clicked = False
deactivate()[source]

Method that is called, when the page is deactivated

hint()[source]

A method that should display a hint to the user

property is_finished

Boolean that is True, if the steps are all finished

ncols = 4
skip()[source]

Skip the steps in this page

class straditize.widgets.tutorial.beginner.TranslateXAxis(filename, tutorial)[source]

Bases: straditize.widgets.tutorial.beginner.TutorialPage

The tutorial page for translating the y-axis

Parameters
  • filename (str) – The basename (without ending) of the RST file corresponding to this tutorial page

  • tutorial (Tutorial) – The tutorial instance

Methods

activate()

Method that is called, when the page is activated

clicked_correct_button()

deactivate()

Method that is called, when the page is deactivated

hint()

A method that should display a hint to the user

skip()

Skip the steps in this page

Attributes

correct_button_clicked

bool(x) -> bool

is_finished

Boolean that is True, if the steps are all finished

activate()[source]

Method that is called, when the page is activated

clicked_correct_button()[source]
correct_button_clicked = False
deactivate()[source]

Method that is called, when the page is deactivated

hint()[source]

A method that should display a hint to the user

property is_finished

Boolean that is True, if the steps are all finished

skip()[source]

Skip the steps in this page

class straditize.widgets.tutorial.beginner.TranslateYAxis(filename, tutorial)[source]

Bases: straditize.widgets.tutorial.beginner.TutorialPage

The tutorial page for translating the y-axis

Parameters
  • filename (str) – The basename (without ending) of the RST file corresponding to this tutorial page

  • tutorial (Tutorial) – The tutorial instance

Methods

activate()

Method that is called, when the page is activated

clicked_correct_button()

deactivate()

Method that is called, when the page is deactivated

hint()

A method that should display a hint to the user

skip()

Skip the steps in this page

Attributes

correct_button_clicked

bool(x) -> bool

is_finished

Boolean that is True, if the steps are all finished

activate()[source]

Method that is called, when the page is activated

clicked_correct_button()[source]
correct_button_clicked = False
deactivate()[source]

Method that is called, when the page is deactivated

hint()[source]

A method that should display a hint to the user

property is_finished

Boolean that is True, if the steps are all finished

skip()[source]

Skip the steps in this page

class straditize.widgets.tutorial.beginner.Tutorial(straditizer_widgets)[source]

Bases: straditize.widgets.StraditizerControlBase, straditize.widgets.tutorial.beginner.TutorialPage

A tutorial for digitizing an area diagram

Methods

close()

Close the tutorial and remove the widgets

display_hint(i)

Display the hint for a tutorial page

get_doc_files()

Get the rst files for the tutorial

goto_page(old, new)

Go to another page

refresh()

Refresh from the straditizer

setup_tutorial_pages()

Setup the pages attribute and initialize the tutorial pages

show()

Show the documentation of the tutorial

skip_page(i)

Skip a tutorial page

validate_page(i[, silent])

Validate a tutorial page

Attributes

current_page

The current page of the tutorial (corresponding to the

load_image_step

The number of the page that loads the diagram image (i.e.

navigation

A TutorialNavigation to navigate through the tutorial

pages

A list of the TutorialPages for this tutorial

tutorial_docs

A TutorialDocs to display the RST-files of the tutorial

close()[source]

Close the tutorial and remove the widgets

property current_page

The current page of the tutorial (corresponding to the TutorialNavigation.current_step)

display_hint(i)[source]

Display the hint for a tutorial page

Parameters

i (int) – The index of the page in the pages attribute

get_doc_files()[source]

Get the rst files for the tutorial

Returns

  • str – The path to the tutorial introduction file

  • list of str – The paths of the remaining tutorial files

goto_page(old, new)[source]

Go to another page

Parameters
property load_image_step

The number of the page that loads the diagram image (i.e. the index of the LoadImage instance in the pages attribute

navigation = None

A TutorialNavigation to navigate through the tutorial

pages = []

A list of the TutorialPages for this tutorial

refresh()[source]

Refresh from the straditizer

setup_tutorial_pages()[source]

Setup the pages attribute and initialize the tutorial pages

show()[source]

Show the documentation of the tutorial

skip_page(i)[source]

Skip a tutorial page

Parameters

i (int) – The index of the page in the pages attribute

tutorial_docs = None

A TutorialDocs to display the RST-files of the tutorial

validate_page(i, silent=False)[source]

Validate a tutorial page

Parameters
Returns

True, if the page is_finished

Return type

bool

class straditize.widgets.tutorial.beginner.TutorialDocs(*args, **kwargs)[source]

Bases: psyplot_gui.help_explorer.UrlHelp, psyplot_gui.common.DockMixin

A documentation viewer for the tutorial docs

This viewer is accessible through the Tutorial.tutorial_docs attribute and shows the src_file for the tutorial pages

Attributes

title

str(object=’’) -> str

dock_position = 2
title = 'Straditize tutorial'
class straditize.widgets.tutorial.beginner.TutorialNavigation(nsteps, validate, *args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QWidget

A widget for navigating through the tutorial. It has a button to go to the previous step and to go to the next step. Furthermore it has a progressbar implemented a hint button

Parameters
  • nsteps (int) – The total number of steps in the Tutorial

  • validate (callable) – A callable that takes the current_step as an argument and returns a bool whether the current step is valid and finished, or not

Attributes

current_step

The current step in the tutorial

hint_requested(*args, **kwargs)

Signal that is emitted if the hint of the current step is requested

skipped(*args, **kwargs)

Signal that is emitted, if the step is skipped

step_changed(*args, **kwargs)

Signal that is emitted, when the step changes.

Methods

display_hint()

Trigger the hint_requested signal with the current step

goto_next_step()

Increase the current_step by one

goto_prev_step()

Decrease the current_step by one

maybe_enable_widgets()

Enable the buttons based on the current_step

setEnabled(enable)

Enable or disable the navigation buttons

set_current_step(i)

Change the current_step

show_info()

Trigger the step_changed signal with the current step

skip()

Skip the current_step and emit the skipped signal

current_step = 0

The current step in the tutorial

display_hint()[source]

Trigger the hint_requested signal with the current step

goto_next_step()[source]

Increase the current_step by one

goto_prev_step()[source]

Decrease the current_step by one

hint_requested(*args, **kwargs)

Signal that is emitted if the hint of the current step is requested

maybe_enable_widgets()[source]

Enable the buttons based on the current_step

setEnabled(enable)[source]

Enable or disable the navigation buttons

Parameters

enable (bool) – Whether to enable or disable the buttons

set_current_step(i)[source]

Change the current_step

Parameters

i (int) – The current_step to switch to

show_info()[source]

Trigger the step_changed signal with the current step

skip()[source]

Skip the current_step and emit the skipped signal

skipped(*args, **kwargs)

Signal that is emitted, if the step is skipped

step_changed(*args, **kwargs)

Signal that is emitted, when the step changes. The first integer is the old step, the second one the current step

class straditize.widgets.tutorial.beginner.TutorialPage(filename, tutorial)[source]

Bases: object

A base class for the tutorial pages

Subclasses show implement the show_hint() method and the is_finished() property

Parameters
  • filename (str) – The basename (without ending) of the RST file corresponding to this tutorial page

  • tutorial (Tutorial) – The tutorial instance

Methods

activate()

Method that is called, when the page is activated

deactivate()

Method that is called, when the page is deactivated

hint()

A method that should display a hint to the user

lock_viewer(lock)

Set or unset the url lock of the HTML viewer

refresh()

show()

Show the page and browse the filename in the tutorial docs

show_hint()

Show a hint to the user

show_tooltip_at_widget(tooltip, widget[, …])

Show a tooltip close to a widget

show_tooltip_in_plot(tooltip, x, y[, …])

Show a tooltip in the matplotlib figure at the given coordinates

skip()

Skip the steps in this page

Attributes

is_finished

Boolean that is True, if the steps are all finished

is_selecting

True if the user clicked the btn_select_data button

src_base

The basename of the stratigraphic diagram image for this tutorial

src_dir

The source directory for the docs

src_file

The complete path to the of the stratigraphic diagram image for this

activate()[source]

Method that is called, when the page is activated

deactivate()[source]

Method that is called, when the page is deactivated

hint()[source]

A method that should display a hint to the user

property is_finished

Boolean that is True, if the steps are all finished

property is_selecting

True if the user clicked the btn_select_data button

lock_viewer(lock)[source]

Set or unset the url lock of the HTML viewer

refresh()[source]
show()[source]

Show the page and browse the filename in the tutorial docs

show_hint()[source]

Show a hint to the user

show_tooltip_at_widget(tooltip, widget, timeout=20000)[source]

Show a tooltip close to a widget

Parameters
  • tooltip (str) – The tooltip to display

  • widget (QWidget) – The widget that should be close to the tooltip

  • timeout (int) – The time that the tool tip shall be displayed, in milliseconds

show_tooltip_in_plot(tooltip, x, y, timeout=20000, transform=None)[source]

Show a tooltip in the matplotlib figure at the given coordinates

Parameters
  • tooltip (str) – The tooltip to display

  • x (float) – The x-coordinate of where to display the tooltip

  • y (float) – The y-coordinate of where to display the tooltip

  • timeout (int) – The time that the tool tip shall be displayed, in milliseconds

  • transform (matplotlib transformation) – The matplotlib transformation to use. If None, the self.stradi.ax.transData transformation is used and x and y are expected to be in data coordinates

skip()[source]

Skip the steps in this page

src_base = 'beginner-tutorial.png'

The basename of the stratigraphic diagram image for this tutorial

src_dir = '/home/docs/checkouts/readthedocs.org/user_builds/straditize/checkouts/latest/straditize/widgets/tutorial/beginner'

The source directory for the docs

src_file = '/home/docs/checkouts/readthedocs.org/user_builds/straditize/checkouts/latest/straditize/widgets/tutorial/beginner/beginner-tutorial.png'

The complete path to the of the stratigraphic diagram image for this tutorial