Skip to content

Commit

Permalink
Fix issue with smaller/larger switched and introduce better default v…
Browse files Browse the repository at this point in the history
…alues
  • Loading branch information
jfeil committed Mar 21, 2022
1 parent a135979 commit f46e2a6
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/filter_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,16 @@ def __update_filteroptions(self, index):
self.filter = QCheckBox()
elif current_params.datatype == datetime:
self.filter = QDateEdit()
cur_date = datetime.today()
if cur_date.month < 6:
year = cur_date.year - 1
else:
year = cur_date.year
cur_date = cur_date.replace(day=1, month=6, year=year)
self.filter.setDate(cur_date)
elif current_params.datatype == int:
self.filter = QSpinBox()
self.filter.setValue(1)
else:
raise ValueError('Invalid FilterOption!')

Expand All @@ -126,16 +134,16 @@ def create_filter(self) -> Tuple[str, Callable]:

if filter_option == FilterOption.smaller_equal:
def filter_callable(x):
return value <= x
return value >= x
elif filter_option == FilterOption.smaller:
def filter_callable(x):
return value < x
return value > x
elif filter_option == FilterOption.larger_equal:
def filter_callable(x):
return value >= x
return value <= x
elif filter_option == FilterOption.larger:
def filter_callable(x):
return value > x
return value < x
elif filter_option == FilterOption.equal:
def filter_callable(x):
return value == x
Expand Down

0 comments on commit f46e2a6

Please sign in to comment.