Added in checkbox to use all samples in Concentrations tab (very slow).
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"""
|
||||
Pane showing BC control concentrations summary.
|
||||
"""
|
||||
from PyQt6.QtWidgets import QWidget, QPushButton
|
||||
from PyQt6.QtWidgets import QWidget, QPushButton, QCheckBox, QLabel
|
||||
from .info_tab import InfoPane
|
||||
from backend.excel.reports import ConcentrationMaker
|
||||
from frontend.visualizations.concentrations_chart import ConcentrationsChart
|
||||
@@ -20,6 +20,12 @@ class Concentrations(InfoPane):
|
||||
self.export_button = QPushButton("Save Data", parent=self)
|
||||
self.export_button.pressed.connect(self.save_excel)
|
||||
self.layout.addWidget(self.export_button, 0, 3, 1, 1)
|
||||
check_label = QLabel("Controls Only")
|
||||
self.all_box = QCheckBox()
|
||||
self.all_box.setChecked(True)
|
||||
self.all_box.checkStateChanged.connect(self.update_data)
|
||||
self.layout.addWidget(check_label, 1, 0, 1, 1)
|
||||
self.layout.addWidget(self.all_box, 1, 1, 1, 1)
|
||||
self.fig = None
|
||||
self.report_object = None
|
||||
self.update_data()
|
||||
@@ -33,7 +39,8 @@ class Concentrations(InfoPane):
|
||||
"""
|
||||
super().update_data()
|
||||
months = self.diff_month(self.start_date, self.end_date)
|
||||
chart_settings = dict(start_date=self.start_date, end_date=self.end_date)
|
||||
# logger.debug(f"Box checked: {self.all_box.isChecked()}")
|
||||
chart_settings = dict(start_date=self.start_date, end_date=self.end_date, controls_only=self.all_box.isChecked())
|
||||
self.report_obj = ConcentrationMaker(**chart_settings)
|
||||
self.fig = ConcentrationsChart(df=self.report_obj.df, settings=chart_settings, modes=[], months=months)
|
||||
self.webview.setHtml(self.fig.html)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from typing import List
|
||||
from typing import List, Generator
|
||||
|
||||
from PyQt6.QtCore import Qt, pyqtSlot
|
||||
from PyQt6.QtWebChannel import QWebChannel
|
||||
@@ -37,7 +37,7 @@ class SampleChecker(QDialog):
|
||||
template_path = Path(template.environment.loader.__getattribute__("searchpath")[0])
|
||||
with open(template_path.joinpath("css", "styles.css"), "r") as f:
|
||||
css = f.read()
|
||||
html = template.render(samples=pyd.sample_list, css=css)
|
||||
html = template.render(samples=self.formatted_list, css=css)
|
||||
self.webview.setHtml(html)
|
||||
QBtn = QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel
|
||||
self.buttonBox = QDialogButtonBox(QBtn)
|
||||
@@ -59,8 +59,19 @@ class SampleChecker(QDialog):
|
||||
item = next((sample for sample in self.pyd.samples if int(submission_rank) in sample.submission_rank))
|
||||
except StopIteration:
|
||||
logger.error(f"Unable to find sample {submission_rank}")
|
||||
return
|
||||
item.__setattr__(key, value)
|
||||
|
||||
@property
|
||||
def formatted_list(self) -> List[dict]:
|
||||
output = []
|
||||
for sample in self.pyd.sample_list:
|
||||
if sample['submitter_id'] in [item['submitter_id'] for item in output]:
|
||||
sample['color'] = "red"
|
||||
else:
|
||||
sample['color'] = "black"
|
||||
output.append(sample)
|
||||
return output
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ class SubmissionFormContainer(QWidget):
|
||||
# logger.debug(f"Samples: {pformat(self.pyd.samples)}")
|
||||
checker = SampleChecker(self, "Sample Checker", self.pyd)
|
||||
if checker.exec():
|
||||
logger.debug(pformat(self.pyd.samples))
|
||||
# logger.debug(pformat(self.pyd.samples))
|
||||
self.form = self.pyd.to_form(parent=self)
|
||||
self.layout().addWidget(self.form)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user