sortcontroller
Class info¶
Classes¶
| Name | Children | Inherits |
|---|---|---|
| SortController cutepandas.pandaswidgets.sortcontroller Sort state and sorting of one `DataFrameModel`, driven by header clicks. |
||
| SortableViewerMixin cutepandas.pandaswidgets.sortcontroller Viewer sort API delegating to `self.sorter` (a `SortController`). |
🛈 DocStrings¶
Header-click sorting shared by the DataFrame viewers.
SortController
¶
Bases: Object
Sort state and sorting of one DataFrameModel, driven by header clicks.
request_sort(column) (a header click) emits sort_requested(column, order)
(clicking the sorted column again reverses the order) and, if sortable, sorts:
sort_mode="copy": the model replaces the frame by a sorted copy (GUI thread).sort_mode="permutation": the row order is computed in a worker thread (sorting_changed(True)while it runs,sorting_changed(False)when it was applied or dropped). Only the latest request is applied, and only if the frame was not replaced or edited meanwhile;cancel_sort()drops a running one.
Replacing the frame, or clearing the row order, resets the sort state.
sort_state_changed is emitted with (column, order) or None whenever the
state changes, so a viewer can repaint its sort indicator.
Source code in src/cutepandas/pandaswidgets/sortcontroller.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
cancel_sort
¶
clear_sort
¶
Drop a display-only sort (permutation mode) and the sort state.
get_sort_state
¶
(column, order) of the current sort, None if unsorted.
Source code in src/cutepandas/pandaswidgets/sortcontroller.py
is_sorting
¶
request_sort
¶
Header click on column: emit sort_requested, sort if sortable.
Source code in src/cutepandas/pandaswidgets/sortcontroller.py
set_sort_state
¶
Remember the current sort (the next request for column reverses it).
Replacing the frame resets it; an application that sorts on
sort_requested and then sets the sorted frame restores it here.
Source code in src/cutepandas/pandaswidgets/sortcontroller.py
sort_by
¶
Sort by a column position (in the model's sort_mode).
In permutation mode this returns right away; the order is computed in a
worker thread and applied later (see sorting_changed).
Source code in src/cutepandas/pandaswidgets/sortcontroller.py
SortableViewerMixin
¶
Viewer sort API delegating to self.sorter (a SortController).
The viewer declares the sort_requested / sorting_changed signals and forwards
the controller's (_connect_sorter()).
Source code in src/cutepandas/pandaswidgets/sortcontroller.py
cancel_sort
¶
clear_sort
¶
get_sort_state
¶
is_sorting
¶
set_sort_state
¶
Remember the current sort (the next click on column reverses it).
Replacing the frame resets it; an application that sorts on
sort_requested and then sets the sorted frame restores it here.
Source code in src/cutepandas/pandaswidgets/sortcontroller.py
sort_by
¶
Sort by a column position (see SortController.sort_by).