straditize.widgets.colnames module¶
Widget for handling column names
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
|
Manage the column names of the reader |
|
Reimplemented NavigationToolbar2 just to add an _init_toolbar method |
-
class
straditize.widgets.colnames.
ColumnNamesManager
(straditizer_widgets, item=None, *args, **kwargs)[source]¶ Bases:
straditize.widgets.StraditizerControlBase
,psyplot_gui.common.DockMixin
,PyQt5.QtWidgets.QSplitter
Manage the column names of the reader
- 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
Attributes
str(object=’’) -> str
str(object=’’) -> str
A QPushButton to find column names in the visible part of the
A QPushButton to load the highres image
A QPushButton to recognize text in the
colpic
A checkable QPushButton to initialize a
selector
to select theThe QPushButton in the
straditize.widgets.StraditizerWidgets
A QCheckBox to find the column names (see
btn_find
) for allA QCheckBox to set the
straditize.colnames.ColNamesReader.mirror
A QCheckBox to set the
straditize.colnames.ColNamesReader.flip
A QCheckBox to ignore the part within the
A QTableWidget to display the column names
The
PIL.Image.Image
of the column name (see alsoThe
matplotlib.axes.Axes
to display thecolpic_im
The canvas to display the
colpic_im
The extents of the
colpic
in theim_rotated
The matplotlib image of the
colpic
The currently selected column
The original height of the
main_canvas
The original width of the
main_canvas
The matplotlib image of the
The
matplotlib.axes.Axes
to display theim_rotated
The canvas to display the
im_rotated
The rectangle to highlight a column (see
highlight_selected_col()
)True if the widget is refreshing
The
matplotlib.widgets.RectangleSelector
to select theA QLineEdit to set the
straditize.colnames.ColNamesReader.rotate
Methods
Adjust the limits of the
main_ax
to fill the entire figureadjust_lims_after_resize
(event)Adjust the limits of the
main_ax
after resize of the figureStop the colpic selection in the
im_rotated
change_ignore_data_part
(checked)colname_changed
(row, column)Update the column name in the
colnames_reader
Create the
selector
to enablecolpic
selectionenable_or_disable_btn_find
(*args, **kwargs)find_colnames
([warn, full_image, all_cols])Find the column names automatically
flip
(checked)TFlip the image
Highlight the column selected in the
colnames_tables
Load a high resolution image
mirror
(checked)Mirror the image
Plot the
colpic
in thecolpic_ax
Recognize the text in the
colpic
refresh
()Refresh from the straditizer
Remove the
im_rotated
and thecolpic_im
Remove and disconnect the
selector
Remove and replot the
im_rotated
Reset the dialog
rotate
(val)Rotate the image
Set the x- and y-center before rotating or flipping
setup_children
(item)Setup the children for this control
Check if a widget should be enabled
to_dock
(main[, title, position])Enable or disable the colpic selection
Close the dialog when the
btn_select_names
button is clickedupdate_image
(*args, **kwargs)Update the
colpic
with the extents of theselector
-
NAVIGATION_LABEL
= 'Use left-click of your mouse to move the image below and right-click to zoom in and out.'¶
-
SELECT_LABEL
= 'Left-click and hold on the image to select the column name'¶
-
adjust_lims_after_resize
(event)[source]¶ Adjust the limits of the
main_ax
after resize of the figure
-
btn_find
= None¶ A QPushButton to find column names in the visible part of the
im_rotated
-
btn_load_image
= None¶ A QPushButton to load the highres image
-
btn_select_names
= None¶ The QPushButton in the
straditize.widgets.StraditizerWidgets
to toggle the column names dialog
-
cancel_colpic_selection
()[source]¶ Stop the colpic selection in the
im_rotated
-
cb_find_all_cols
= None¶ A QCheckBox to find the column names (see
btn_find
) for all columns and not just the one selected in thecolnames_table
-
cb_fliph
= None¶ A QCheckBox to set the
straditize.colnames.ColNamesReader.mirror
-
cb_flipv
= None¶ A QCheckBox to set the
straditize.colnames.ColNamesReader.flip
-
cb_ignore_data_part
= None¶ A QCheckBox to ignore the part within the
straditize.colnames.ColNamesReader.data_ylim
-
colname_changed
(row, column)[source]¶ Update the column name in the
colnames_reader
This method is called when a cell in the
colnames_table
has been changed and updates the corresponding name in thecolnames_reader
- Parameters
row (int) – The row of the cell in the
colnames_table
that changedcolumn (int) – The column of the cell in the
colnames_table
that changed
-
property
colnames_reader
¶ The
straditize.straditizer.Straditizer.colnames_reader
of the current straditizer
-
colnames_table
= None¶ A QTableWidget to display the column names
-
colpic
= None¶ The
PIL.Image.Image
of the column name (see alsostraditize.colnames.ColNamesReader.colpics
)
-
colpic_ax
= None¶ The
matplotlib.axes.Axes
to display thecolpic_im
-
colpic_extents
= None¶ The extents of the
colpic
in theim_rotated
-
property
current_col
¶ The currently selected column
-
fig_h
= None¶ The original height of the
main_canvas
-
fig_w
= None¶ The original width of the
main_canvas
-
find_colnames
(warn=True, full_image=False, all_cols=None)[source]¶ Find the column names automatically
-
im_rotated
= None¶ The matplotlib image of the
straditize.colnames.ColNamesReader.rotated_image
-
main_ax
= None¶ The
matplotlib.axes.Axes
to display theim_rotated
-
main_canvas
= None¶ The canvas to display the
im_rotated
-
rect
= None¶ The rectangle to highlight a column (see
highlight_selected_col()
)
-
property
refreshing
¶ True if the widget is refreshing
-
remove_images
()[source]¶ Remove the
im_rotated
and thecolpic_im
-
replot_figure
()[source]¶ Remove and replot the
im_rotated
-
selector
= None¶ The
matplotlib.widgets.RectangleSelector
to select thecolpic
-
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
-
toggle_dialog
()[source]¶ Close the dialog when the
btn_select_names
button is clicked
-
txt_rotate
= None¶ A QLineEdit to set the
straditize.colnames.ColNamesReader.rotate
Bases:
matplotlib.backend_bases.NavigationToolbar2
Reimplemented NavigationToolbar2 just to add an _init_toolbar method
Methods
set_cursor
(cursor)Set the current cursor to one of the
Cursors
enums values.Set the current cursor to one of the
Cursors
enums values.If required by the backend, this method should trigger an update in the backend event loop after the cursor is set, as this method may be called e.g. before a long-running task during which the GUI is not updated.