Skip to content

SortableViewerMixin

Sub classes

Name Children Inherits
DataFrameViewer
cutepandas.pandaswidgets.dataframeviewer
Data table with synced column / index headers (MultiIndex spans for pandas).
    GridDataFrameViewer
    cutepandas.pandaswidgets.gridviewer
    Four-table 2x2 grid viewer with flush corner, column header, index, and data.
      SimpleDataFrameViewer
      cutepandas.pandaswidgets.simpledataframeviewer
      Lightweight single-table viewer backed by `DataFrameModel`.

        🛈 DocStrings

        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
        class 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()`).
            """
        
            sorter: SortController
            sort_requested: Any  # signals of the viewer class
            sorting_changed: Any
        
            def _connect_sorter(self):
                self.sorter.sort_requested.connect(self.sort_requested)
                self.sorter.sorting_changed.connect(self.sorting_changed)
        
            def sort_by(self, column: int, order: constants.SortOrder = constants.ASCENDING):
                """Sort by a column position (see `SortController.sort_by`)."""
                self.sorter.sort_by(column, order)
        
            def cancel_sort(self):
                """Drop a display-only sort that is still being computed."""
                self.sorter.cancel_sort()
        
            def is_sorting(self) -> bool:
                """True while a display-only sort order is computed."""
                return self.sorter.is_sorting()
        
            def clear_sort(self):
                """Drop a display-only sort (permutation mode) and the sort state."""
                self.sorter.clear_sort()
        
            def set_sort_state(
                self, column: int | None, order: constants.SortOrder | None = None
            ):
                """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.
                """
                self.sorter.set_sort_state(column, order)
        
            def get_sort_state(self) -> tuple[int, constants.SortOrder] | None:
                """(column, order) of the current sort, None if unsorted."""
                return self.sorter.get_sort_state()
        
            def set_sortable(self, value: bool):
                self.sorter.set_sortable(value)
        
            def is_sortable(self) -> bool:
                return self.sorter.is_sortable()
        
            def set_sort_mode(self, mode: SortMode):
                self.sorter.set_sort_mode(mode)
        
            def get_sort_mode(self) -> SortMode:
                return self.sorter.get_sort_mode()
        

        cancel_sort

        cancel_sort()
        

        Drop a display-only sort that is still being computed.

        Source code in src/cutepandas/pandaswidgets/sortcontroller.py
        def cancel_sort(self):
            """Drop a display-only sort that is still being computed."""
            self.sorter.cancel_sort()
        

        clear_sort

        clear_sort()
        

        Drop a display-only sort (permutation mode) and the sort state.

        Source code in src/cutepandas/pandaswidgets/sortcontroller.py
        def clear_sort(self):
            """Drop a display-only sort (permutation mode) and the sort state."""
            self.sorter.clear_sort()
        

        get_sort_state

        get_sort_state() -> tuple[int, SortOrder] | None
        

        (column, order) of the current sort, None if unsorted.

        Source code in src/cutepandas/pandaswidgets/sortcontroller.py
        def get_sort_state(self) -> tuple[int, constants.SortOrder] | None:
            """(column, order) of the current sort, None if unsorted."""
            return self.sorter.get_sort_state()
        

        is_sorting

        is_sorting() -> bool
        

        True while a display-only sort order is computed.

        Source code in src/cutepandas/pandaswidgets/sortcontroller.py
        def is_sorting(self) -> bool:
            """True while a display-only sort order is computed."""
            return self.sorter.is_sorting()
        

        set_sort_state

        set_sort_state(column: int | None, order: SortOrder | None = None)
        

        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
        def set_sort_state(
            self, column: int | None, order: constants.SortOrder | None = None
        ):
            """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.
            """
            self.sorter.set_sort_state(column, order)
        

        sort_by

        sort_by(column: int, order: SortOrder = ASCENDING)
        

        Sort by a column position (see SortController.sort_by).

        Source code in src/cutepandas/pandaswidgets/sortcontroller.py
        def sort_by(self, column: int, order: constants.SortOrder = constants.ASCENDING):
            """Sort by a column position (see `SortController.sort_by`)."""
            self.sorter.sort_by(column, order)
        

        :fa-brands-github: Show source on GitHub