Skip to content

Commit

Permalink
Limit metric selection to only what metrics are selected for analysis…
Browse files Browse the repository at this point in the history
… in the Analysis Explorer #510
  • Loading branch information
KellyMWhitehead committed Oct 15, 2024
1 parent 0cf64f4 commit aae2422
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/view/frm_analysis_explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,15 @@ def on_analysis_changed(self, index):

self.analysis: Analysis = self.cmbAnalysis.currentData(Qt.UserRole)

metrics = DBItemModel(self.qris_project.metrics)
self.cmbMetric.clear()
analysis_metrics = {i: analysis_metric.metric for i, analysis_metric in self.analysis.analysis_metrics.items()}
metrics = DBItemModel(analysis_metrics)
self.cmbMetric.setModel(metrics)

sample_frame_features = get_sample_frame_ids(self.qris_project.project_file, self.analysis.sample_frame.id)
self.cmbSampleFrameFeature.setModel(DBItemModel(sample_frame_features))

self.cmbEvent.clear()
events = DBItemModel(self.qris_project.events)
self.cmbEvent.setModel(events)

Expand All @@ -90,7 +93,8 @@ def metric_over_time(self):
self.cmbSampleFrameFeature.currentIndexChanged.connect(self.on_sample_frame_feature_changed)
self.cmbMetric.currentIndexChanged.connect(self.on_metric_changed)

self.plot_metric_over_time(self.cmbMetric.currentData(Qt.UserRole).id)
if self.cmbMetric.count() > 0:
self.plot_metric_over_time(self.cmbMetric.currentData(Qt.UserRole).id)

def on_sample_frame_feature_changed(self, index):

Expand Down Expand Up @@ -131,6 +135,12 @@ def get_metric_values(self, analysis_id, metric_id):
return cursor.fetchall()


def reload_metrics(self):

self.cmbMetric.clear()
metrics = DBItemModel(self.qris_project.metrics)
self.cmbMetric.setModel(metrics)

def get_event_dates(self):

gpkg = self.qris_project.project_file
Expand Down

0 comments on commit aae2422

Please sign in to comment.