Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] SelectByDataIndex: data info displayed in the status bar #4595

Merged
merged 1 commit into from
Apr 2, 2020

Conversation

aturanjanin
Copy link
Contributor

Description of changes

Input/output data info displayed in the status bar.

Includes
  • Code changes
  • Tests
  • Documentation

@codecov
Copy link

codecov bot commented Mar 30, 2020

Codecov Report

Merging #4595 into master will decrease coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #4595      +/-   ##
==========================================
- Coverage   83.61%   83.59%   -0.03%     
==========================================
  Files         281      276       -5     
  Lines       56189    55387     -802     
==========================================
- Hits        46982    46300     -682     
+ Misses       9207     9087     -120     

@@ -62,6 +69,18 @@ def set_data_subset(self, data):
self.infoBoxExtraData.setText(self.data_info_text(data))

def handleNewSignals(self):
if self.data and self.data_subset:
data_list = [('Data', self.data), ('Data subset', self.data_subset)]
summary = f"{len(self.data)}, {len(self.data_subset)}"
Copy link
Contributor

@VesnaT VesnaT Apr 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When creating summary text self.info.format_number() should be used to format the numbers.

self.info.set_input_summary(summary, details, format=Qt.RichText)
elif not self.data and not self.data_subset:
self.info.set_input_summary(self.info.NoInput)
else:
Copy link
Contributor

@VesnaT VesnaT Apr 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two inputs are considered equivalent, so I would omit this else and replace the upper condition self.data and self.data_subset with self.data or self.data_subset.

When only one dataset is on the input, just show 0 in the summary.
Something like:

        summary, detail, kwargs = self.info.NoInput, "", {}
        if self.data or self.data_subset:
            n_data = len(self.data) if self.data else 0
            n_data_subset = len(self.data_subset) if self.data_subset else 0
            summary = f"{self.info.format_number(n_data)}, " \
                      f"{self.info.format_number(n_data_subset)}"
            kwargs = {"format": Qt.RichText}
            detail = format_multiple_summaries([
                ("Data", self.data),
                ("Data subset", self.data_subset)
            ])
        self.info.set_input_summary(summary, detail, **kwargs)

@@ -89,6 +108,10 @@ def commit(self):
matching_output = self.data[row_sel]
non_matching_output = self.data[~row_sel]
annotated_output = create_annotated_table(self.data, row_sel)

summary = len(matching_output) if matching_output else self.info.NoOutput
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not true.
matching_output evaluates to False when len(matching_output) == 0, causing summary = self.info.NoOutput, even though dataset with 0 instances was send to the output.

@aturanjanin aturanjanin changed the title [ENH] SelectByDataIndex: data info displayed in the status bar [WIP] [ENH] SelectByDataIndex: data info displayed in the status bar Apr 1, 2020
@aturanjanin aturanjanin force-pushed the owselectbydataindex branch 2 times, most recently from 3597cf4 to 92a47c7 Compare April 2, 2020 14:10
@aturanjanin aturanjanin changed the title [WIP] [ENH] SelectByDataIndex: data info displayed in the status bar [ENH] SelectByDataIndex: data info displayed in the status bar Apr 2, 2020
@VesnaT VesnaT merged commit 163485e into biolab:master Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants