Skip to content

Commit

Permalink
fix for blank cells when column filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
msrosenberg committed Oct 25, 2024
1 parent c7baf4d commit 97442ac
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
numpy~=1.26.1
PyQt6~=6.6.1
scipy~=1.11.3
matplotlib~=3.8.0
numpy>=1.26.1
PyQt6>=6.6.1
scipy>=1.11.3
matplotlib>=3.8.0
2 changes: 1 addition & 1 deletion src/MetaWinConstants.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

MAJOR_VERSION = 3
MINOR_VERSION = 0
PATCH_VERSION = 16
PATCH_VERSION = 17

# validity check when fetching value from data matrix
VALUE_NUMBER = 0
Expand Down
3 changes: 3 additions & 0 deletions src/MetaWinData.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from MetaWinUtils import format_number
from MetaWinConstants import VALUE_STRING, VALUE_NUMBER
from MetaWinLanguage import get_text


class MetaWinValue:
Expand Down Expand Up @@ -76,6 +77,8 @@ def not_filtered(self) -> bool:
d = self.data.value(self.position(), c)
if d is not None:
d = d.value
else:
d = f"[{get_text("blanks")}]"
if str(d) in col.group_filter:
return False
return True
Expand Down
5 changes: 5 additions & 0 deletions src/MetaWinFilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@ def init_ui(self, data, column):
group_layout = QVBoxLayout()
group_data = []
c = data.col_number(column)
has_none = False
for r in range(data.nrows()):
g = data.value(r, c)
if g is not None:
group_data.append(str(g.value))
else:
has_none = True
self.group_names = sorted(set(group_data))
if has_none:
self.group_names.append(f"[{get_text("blanks")}]")
for group in self.group_names:
new_check_box = QCheckBox(group)
group_layout.addWidget(new_check_box)
Expand Down
1 change: 1 addition & 0 deletions src/MetaWinLanguage.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"Bar Color": "Bar Color",
"Basic Meta-Analysis": "Basic Meta-Analysis",
"Between": "Between",
"blanks": "blanks",
"Bootstrap Mean Effect Size(s)": "Bootstrap Mean Effect Size(s)",
"bootstrap_caption": " Confidence intervals from a boostrap ({:,} iterations) procedure, "
"following {}, are indicated by {}; the bias-corrected bootstrap interval "
Expand Down
12 changes: 10 additions & 2 deletions src/MetaWinMain.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,17 @@ def refresh_data(self) -> None:
else:
new_item = QTableWidgetItem(dat.value)
if not not_filtered:
# if dat is None:
# new_item.setBackground(QColor(self.filtered_row_color))
# elif str(dat.value) in column.group_filter:
# new_item.setBackground(QColor(self.filtered_col_color))
# else:
# new_item.setBackground(QColor(self.filtered_row_color))
if dat is None:
new_item.setBackground(QColor(self.filtered_row_color))
elif str(dat.value) in column.group_filter:
dat_value = f"[{get_text("blanks")}]"
else:
dat_value = str(dat.value)
if dat_value in column.group_filter:
new_item.setBackground(QColor(self.filtered_col_color))
else:
new_item.setBackground(QColor(self.filtered_row_color))
Expand Down

0 comments on commit 97442ac

Please sign in to comment.