Skip to content

Commit 300ded7

Browse files
schubsenclaude
andcommitted
Take the export counts settings from the analysis config
Remove the count interval, the counting event, the file stem and the suffix badge from the ExportCountsDialog and read them through use cases instead, so a project configures them once. The interval stays a choice, but only when more than one is configured. The file stem is composed of save name and save suffix the way a cli run composes it; a project that names no export keeps the suggested stem, so exporting works without configuring a name first. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 573a36d commit 300ded7

5 files changed

Lines changed: 430 additions & 243 deletions

File tree

‎OTAnalytics/application/resources/resource_manager.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ class ExportCountsDialogKeys(ResourceKey):
109109
LABEL_END_DATE = "label-end-date"
110110
LABEL_END_TIME = "label-end-time"
111111
LABEL_INTERVAL_MINUTES = "label-interval-minutes"
112-
LABEL_COUNTING_EVENT = "label-counting-event"
113112
LABEL_OUTPUT_FILE = "label-output-file"
114113

115114

@@ -248,7 +247,6 @@ class WorkspaceKeys(ResourceKey):
248247
FileChooserDialogKeys.LABEL_DIRECTORY: "Directory",
249248
FileChooserDialogKeys.LABEL_BROWSE: "Browse",
250249
ExportCountsDialogKeys.LABEL_INTERVAL_MINUTES: "Interval (minutes)",
251-
ExportCountsDialogKeys.LABEL_COUNTING_EVENT: "Counting Event",
252250
ExportCountsDialogKeys.LABEL_OUTPUT_FILE: "Output File",
253251
ExportCountsDialogKeys.LABEL_EXPORT_COUNTS: "Export Counts",
254252
ExportCountsDialogKeys.LABEL_TIME_RANGE: "Time Range",

‎OTAnalytics/plugin_ui/nicegui_application.py‎

Lines changed: 169 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
RefuseAnyProjectLocation,
1414
ValidateProjectLocation,
1515
)
16+
from OTAnalytics.application.state import CurrentExportConfigState
1617
from OTAnalytics.application.upload_otconfig import NoOtconfigUpload, UploadOtconfig
1718
from OTAnalytics.application.use_cases.ask_for_load_window import AskForLoadWindow
1819
from OTAnalytics.application.use_cases.provide_input_files import (
@@ -261,57 +262,172 @@ def visualization_offset_slider_form(self) -> VisualizationOffSetSliderForm:
261262
def project_form(self) -> ProjectForm:
262263
return ProjectForm(self.view_model, self.resource_manager)
263264

265+
@cached_property
266+
def get_do_events_of_current_analysis_config(
267+
self,
268+
) -> GetDoEventsOfCurrentAnalysisConfig:
269+
return GetDoEventsOfCurrentAnalysisConfig(
270+
self.current_static_analysis_config_state
271+
)
272+
273+
@cached_property
274+
def get_do_counting_of_current_analysis_config(
275+
self,
276+
) -> GetDoCountingOfCurrentAnalysisConfig:
277+
return GetDoCountingOfCurrentAnalysisConfig(
278+
self.current_static_analysis_config_state
279+
)
280+
281+
@cached_property
282+
def get_save_name_of_current_analysis_config(
283+
self,
284+
) -> GetSaveNameOfCurrentAnalysisConfig:
285+
return GetSaveNameOfCurrentAnalysisConfig(self.current_export_config_state)
286+
287+
@cached_property
288+
def get_save_suffix_of_current_analysis_config(
289+
self,
290+
) -> GetSaveSuffixOfCurrentAnalysisConfig:
291+
return GetSaveSuffixOfCurrentAnalysisConfig(self.current_export_config_state)
292+
293+
@cached_property
294+
def get_event_formats_of_current_analysis_config(
295+
self,
296+
) -> GetEventFormatsOfCurrentAnalysisConfig:
297+
return GetEventFormatsOfCurrentAnalysisConfig(self.current_export_config_state)
298+
299+
@cached_property
300+
def get_count_intervals_of_current_analysis_config(
301+
self,
302+
) -> GetCountIntervalsOfCurrentAnalysisConfig:
303+
return GetCountIntervalsOfCurrentAnalysisConfig(
304+
self.current_export_config_state
305+
)
306+
307+
@cached_property
308+
def get_counting_event_of_current_analysis_config(
309+
self,
310+
) -> GetCountingEventOfCurrentAnalysisConfig:
311+
return GetCountingEventOfCurrentAnalysisConfig(self.current_export_config_state)
312+
313+
@cached_property
314+
def get_num_processes_of_current_analysis_config(
315+
self,
316+
) -> GetNumProcessesOfCurrentAnalysisConfig:
317+
return GetNumProcessesOfCurrentAnalysisConfig(
318+
self.current_static_analysis_config_state
319+
)
320+
321+
@cached_property
322+
def get_logfile_of_current_analysis_config(
323+
self,
324+
) -> GetLogfileOfCurrentAnalysisConfig:
325+
return GetLogfileOfCurrentAnalysisConfig(
326+
self.current_static_analysis_config_state
327+
)
328+
329+
@cached_property
330+
def set_do_events_in_current_analysis_config(
331+
self,
332+
) -> SetDoEventsInCurrentAnalysisConfig:
333+
return SetDoEventsInCurrentAnalysisConfig(
334+
self.current_static_analysis_config_state,
335+
self.static_analysis_config_changed,
336+
)
337+
338+
@cached_property
339+
def set_do_counting_in_current_analysis_config(
340+
self,
341+
) -> SetDoCountingInCurrentAnalysisConfig:
342+
return SetDoCountingInCurrentAnalysisConfig(
343+
self.current_static_analysis_config_state,
344+
self.static_analysis_config_changed,
345+
)
346+
347+
@cached_property
348+
def set_save_name_in_current_analysis_config(
349+
self,
350+
) -> SetSaveNameInCurrentAnalysisConfig:
351+
return SetSaveNameInCurrentAnalysisConfig(
352+
self.current_export_config_state, self.static_analysis_config_changed
353+
)
354+
355+
@cached_property
356+
def set_save_suffix_in_current_analysis_config(
357+
self,
358+
) -> SetSaveSuffixInCurrentAnalysisConfig:
359+
return SetSaveSuffixInCurrentAnalysisConfig(
360+
self.current_export_config_state, self.static_analysis_config_changed
361+
)
362+
363+
@cached_property
364+
def set_event_formats_in_current_analysis_config(
365+
self,
366+
) -> SetEventFormatsInCurrentAnalysisConfig:
367+
return SetEventFormatsInCurrentAnalysisConfig(
368+
self.current_export_config_state, self.static_analysis_config_changed
369+
)
370+
371+
@cached_property
372+
def set_count_intervals_in_current_analysis_config(
373+
self,
374+
) -> SetCountIntervalsInCurrentAnalysisConfig:
375+
return SetCountIntervalsInCurrentAnalysisConfig(
376+
self.current_export_config_state, self.static_analysis_config_changed
377+
)
378+
379+
@cached_property
380+
def set_counting_event_in_current_analysis_config(
381+
self,
382+
) -> SetCountingEventInCurrentAnalysisConfig:
383+
return SetCountingEventInCurrentAnalysisConfig(
384+
self.current_export_config_state, self.static_analysis_config_changed
385+
)
386+
387+
@cached_property
388+
def set_num_processes_in_current_analysis_config(
389+
self,
390+
) -> SetNumProcessesInCurrentAnalysisConfig:
391+
return SetNumProcessesInCurrentAnalysisConfig(
392+
self.current_static_analysis_config_state,
393+
self.static_analysis_config_changed,
394+
)
395+
396+
@cached_property
397+
def set_logfile_in_current_analysis_config(
398+
self,
399+
) -> SetLogfileInCurrentAnalysisConfig:
400+
return SetLogfileInCurrentAnalysisConfig(
401+
self.current_static_analysis_config_state,
402+
self.static_analysis_config_changed,
403+
)
404+
405+
@cached_property
406+
def current_export_config_state(self) -> CurrentExportConfigState:
407+
return self.current_static_analysis_config_state.export_config
408+
264409
@cached_property
265410
def static_analysis_config_form(self) -> StaticAnalysisConfigForm:
266-
analysis_config_state = self.current_static_analysis_config_state
267-
export_config_state = analysis_config_state.export_config
268-
config_changed = self.static_analysis_config_changed
269411
return StaticAnalysisConfigForm(
270412
resource_manager=self.resource_manager,
271-
get_do_events=GetDoEventsOfCurrentAnalysisConfig(analysis_config_state),
272-
set_do_events=SetDoEventsInCurrentAnalysisConfig(
273-
analysis_config_state, config_changed
274-
),
275-
get_do_counting=GetDoCountingOfCurrentAnalysisConfig(analysis_config_state),
276-
set_do_counting=SetDoCountingInCurrentAnalysisConfig(
277-
analysis_config_state, config_changed
278-
),
279-
get_save_name=GetSaveNameOfCurrentAnalysisConfig(export_config_state),
280-
set_save_name=SetSaveNameInCurrentAnalysisConfig(
281-
export_config_state, config_changed
282-
),
283-
get_save_suffix=GetSaveSuffixOfCurrentAnalysisConfig(export_config_state),
284-
set_save_suffix=SetSaveSuffixInCurrentAnalysisConfig(
285-
export_config_state, config_changed
286-
),
287-
get_event_formats=GetEventFormatsOfCurrentAnalysisConfig(
288-
export_config_state
289-
),
290-
set_event_formats=SetEventFormatsInCurrentAnalysisConfig(
291-
export_config_state, config_changed
292-
),
293-
get_count_intervals=GetCountIntervalsOfCurrentAnalysisConfig(
294-
export_config_state
295-
),
296-
set_count_intervals=SetCountIntervalsInCurrentAnalysisConfig(
297-
export_config_state, config_changed
298-
),
299-
get_counting_event=GetCountingEventOfCurrentAnalysisConfig(
300-
export_config_state
301-
),
302-
set_counting_event=SetCountingEventInCurrentAnalysisConfig(
303-
export_config_state, config_changed
304-
),
305-
get_num_processes=GetNumProcessesOfCurrentAnalysisConfig(
306-
analysis_config_state
307-
),
308-
set_num_processes=SetNumProcessesInCurrentAnalysisConfig(
309-
analysis_config_state, config_changed
310-
),
311-
get_logfile=GetLogfileOfCurrentAnalysisConfig(analysis_config_state),
312-
set_logfile=SetLogfileInCurrentAnalysisConfig(
313-
analysis_config_state, config_changed
314-
),
413+
get_do_events=self.get_do_events_of_current_analysis_config,
414+
set_do_events=self.set_do_events_in_current_analysis_config,
415+
get_do_counting=self.get_do_counting_of_current_analysis_config,
416+
set_do_counting=self.set_do_counting_in_current_analysis_config,
417+
get_save_name=self.get_save_name_of_current_analysis_config,
418+
set_save_name=self.set_save_name_in_current_analysis_config,
419+
get_save_suffix=self.get_save_suffix_of_current_analysis_config,
420+
set_save_suffix=self.set_save_suffix_in_current_analysis_config,
421+
get_event_formats=self.get_event_formats_of_current_analysis_config,
422+
set_event_formats=self.set_event_formats_in_current_analysis_config,
423+
get_count_intervals=self.get_count_intervals_of_current_analysis_config,
424+
set_count_intervals=self.set_count_intervals_in_current_analysis_config,
425+
get_counting_event=self.get_counting_event_of_current_analysis_config,
426+
set_counting_event=self.set_counting_event_in_current_analysis_config,
427+
get_num_processes=self.get_num_processes_of_current_analysis_config,
428+
set_num_processes=self.set_num_processes_in_current_analysis_config,
429+
get_logfile=self.get_logfile_of_current_analysis_config,
430+
set_logfile=self.set_logfile_in_current_analysis_config,
315431
)
316432

317433
@cached_property
@@ -351,7 +467,12 @@ def track_statistic_form(self) -> TrackStatisticForm:
351467
@cached_property
352468
def ui_factory(self) -> UiFactory:
353469
return NiceGuiUiFactory(
354-
self.resource_manager, self.run_config.file_picker_directory
470+
self.resource_manager,
471+
get_count_intervals=self.get_count_intervals_of_current_analysis_config,
472+
get_counting_event=self.get_counting_event_of_current_analysis_config,
473+
get_save_name=self.get_save_name_of_current_analysis_config,
474+
get_save_suffix=self.get_save_suffix_of_current_analysis_config,
475+
base_directory=self.run_config.file_picker_directory,
355476
)
356477

357478
@cached_property

0 commit comments

Comments
 (0)