Skip to content

Commit

Permalink
Add better text for filter and filteroption
Browse files Browse the repository at this point in the history
  • Loading branch information
jfeil committed Mar 22, 2022
1 parent f46e2a6 commit 1e5780f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
14 changes: 14 additions & 0 deletions src/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,20 @@ class FilterOption(Enum):
equal = auto()
contains = auto()

def __str__(self):
if self == FilterOption.smaller_equal:
return 'kleiner/gleich als'
elif self == FilterOption.smaller:
return 'kleiner als'
elif self == FilterOption.larger:
return 'größer als'
elif self == FilterOption.larger_equal:
return 'größer/gleich als'
elif self == FilterOption.equal:
return 'gleich'
elif self == FilterOption.contains:
return 'beinhaltet'


class Question(Base):
# LNR[0:2] = group_id
Expand Down
10 changes: 7 additions & 3 deletions src/main_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,15 @@ def add_filter(self, list_entry: Union[QListWidgetItem, bool] = False):
del list_entry
elif editor.result == QDialogButtonBox.ButtonRole.AcceptRole:
# Closed via Save
dict_key, filter_option, filter_value = editor.current_configuration()
if not edit_mode:
RuleSortFilterProxyModel.filters += [(editor.create_filter(), editor.current_configuration())]
self.ui.filter_list.addItem(QListWidgetItem(f"Filter {self.ui.filter_list.count() + 1}"))
RuleSortFilterProxyModel.filters += [(editor.create_filter(), (dict_key, filter_option, filter_value))]
self.ui.filter_list.addItem(
QListWidgetItem(f"{properties[dict_key].table_header} {filter_option} '{filter_value}'"))
else:
RuleSortFilterProxyModel.filters[index] = (editor.create_filter(), editor.current_configuration())
RuleSortFilterProxyModel.filters[index] = (
editor.create_filter(), (dict_key, filter_option, filter_value))
list_entry.setText(f"{properties[dict_key].table_header} {filter_option} '{filter_value}'")
elif editor.result == QDialogButtonBox.ButtonRole.RejectRole:
# Closed via Cancel
return
Expand Down

0 comments on commit 1e5780f

Please sign in to comment.