diff options
Diffstat (limited to 'plugins/Toolbox/src/AuthorsModel.py')
-rw-r--r-- | plugins/Toolbox/src/AuthorsModel.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/plugins/Toolbox/src/AuthorsModel.py b/plugins/Toolbox/src/AuthorsModel.py index 81158978b0..04c8ed3a40 100644 --- a/plugins/Toolbox/src/AuthorsModel.py +++ b/plugins/Toolbox/src/AuthorsModel.py @@ -2,15 +2,19 @@ # Cura is released under the terms of the LGPLv3 or higher. import re -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, Union, cast from PyQt5.QtCore import Qt, pyqtProperty from UM.Qt.ListModel import ListModel -## Model that holds cura packages. By setting the filter property the instances held by this model can be changed. class AuthorsModel(ListModel): + """Model that holds cura packages. + + By setting the filter property the instances held by this model can be changed. + """ + def __init__(self, parent = None) -> None: super().__init__(parent) @@ -64,12 +68,14 @@ class AuthorsModel(ListModel): # Execute all filters. filtered_items = list(items) - filtered_items.sort(key = lambda k: k["name"]) + filtered_items.sort(key = lambda k: cast(str, k["name"])) self.setItems(filtered_items) - ## Set the filter of this model based on a string. - # \param filter_dict \type{Dict} Dictionary to do the filtering by. def setFilter(self, filter_dict: Dict[str, str]) -> None: + """Set the filter of this model based on a string. + + :param filter_dict: Dictionary to do the filtering by. + """ if filter_dict != self._filter: self._filter = filter_dict self._update() |