workflows.*¶
Workflows for pyspread
-
class
workflows.Workflows(main_window)[source]¶ Bases:
objectWorkflow container class
-
_copy_results_current(grid)[source]¶ Copy cell results for the current cell
- Parameters
grid (
QTableView) – Main grid
-
_copy_results_selection(grid)[source]¶ Copy repr of selected cells result objects to the clipboard
- Parameters
grid (
QTableView) – Main grid
-
_csv_export(filepath)[source]¶ Export to csv file filepath
- Parameters
filepath (
Path) – Path of file to be exported
-
_csv_import(filepath)[source]¶ Import csv from filepath
- Parameters
filepath (
Path) – Path of file to be imported
-
_display_match_msg(find_string, next_match, regexp)[source]¶ Displays find match message in statusbar
-
_get_next_match(find_dialog, start_key=None)[source]¶ Returns tuple of find string and next matching cell key
-
_get_replace_command(next_match, find_string, replace_string, max_=1, description=None)[source]¶ Returns SetCellCode command for replace operations
-
_paste_image(image_data, index)[source]¶ Pastes svg image into cell
- Parameters
image_data (
bytes) – Raw image data. May be anything that QImage handles.index (
QModelIndex) – Target cell index
-
_paste_svg(svg, index)[source]¶ Pastes svg image into cell
- Parameters
svg (
str) – SVG dataindex (
QModelIndex) – Target cell index
-
_paste_to_current(data)[source]¶ Pastes data into grid starting from the current cell
- Parameters
data (
str) – Clipboard text
-
_save(filepath)[source]¶ Save filepath using chosen_filter
Compresses save file if filepath.suffix is .pys
- Parameters
filepath (
Path) – Path of file to be saved
-
cell2dialog= {}¶
-
count_file_lines(filepath)[source]¶ Returns line count of file in filepath
- Parameters
filepath (
Path) – Path of file to be analyzed
-
delete(description_tpl='Delete selection {}')[source]¶ Delete cells in selection
- Parameters
description_tpl (
str) – Description template for QUndoCommand
-
edit_copy_results()[source]¶ Edit -> Copy results workflow
If a selection is present then repr of selected grid cells result objects are copied to the clipboard.
If no selection is present, the current cell results are copied to the clipboard. This can be plain text, html, a png image or an svg image.
-
edit_paste()[source]¶ Edit -> Paste workflow
Pastes text clipboard data
If no selection is present, data is pasted starting with the current cell. If a selection is present, data is pasted fully if the selection is smaller. If the selection is larger then data is duplicated.
-
filepath_open(filepath)[source]¶ Workflow for opening a file if a filepath is known
- Parameters
filepath (
Path) – Path of file to be opened
-
find_dialog_on_find(find_dialog)[source]¶ Edit -> Find workflow, after pressing find button in FindDialog
- Parameters
find_dialog (
FindDialog) – Find dialog of origin
-
format_copy_format()[source]¶ Copies the format of the selected cells to the Clipboard
Cells are shifted so that the top left bbox corner is at 0,0
-
format_paste_format()[source]¶ Pastes cell formats
Pasting starts at cursor or at top left bbox corner
-
handle_changed_since_save(*args, **kwargs)[source]¶ Decorator to handle changes since last saving the document
If changes are present then a dialog is displayed that asks if the changes shall be discarded.
If the user selects Cancel then func is not executed.
If the user selects Save then the file is saved and func is executed.
If the user selects Discard then the file is not saved and func is executed.
If no changes are present then func is directly executed. After executing func,
reset_changed_since_save()and update_main_window_title are called.
-
paint(painter, option, paint_rect, rows, columns)[source]¶ Grid paint workflow for printing and svg export
-
prevent_updates()[source]¶ contextmanagersets the prevent_updates stateThe prevent_updates state prevents updates in main_window.grid.setData
-
print_zoom(zoom=1.0)[source]¶ Decorator for tasks that have to take place in standard zoom
- Parameters
zoom (
float) – Print zoom factor
-
replace_dialog_on_replace(replace_dialog, toggled=False, max_=1)[source]¶ Edit -> Replace workflow when pushing Replace in ReplaceDialog
Returns True if there is a match otherwise False
- Parameters
replace_dialog (
ReplaceDialog) – Replace dialog of origintoggled (
bool) – Replace dialog toggle statemax – Maximum number of replace actions, -1 is unlimited
- Return type
-
replace_dialog_on_replace_all(replace_dialog)[source]¶ Edit -> Replace workflow when pushing ReplaceAll in ReplaceDialog
- Parameters
replace_dialog (
ReplaceDialog) – Replace dialog of origin
-
pyspread