mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 10:56:31 +00:00
added better logging to python
add day / winter / night switcher
This commit is contained in:
@@ -93,38 +93,20 @@ public partial class DatasetExplorer
|
||||
AllDetectionClasses = new ObservableCollection<DetectionClass>(
|
||||
new List<DetectionClass> { new() {Id = -1, Name = "All", ShortName = "All"}}
|
||||
.Concat(_annotationConfig.AnnotationClasses));
|
||||
LvClasses.ItemsSource = AllDetectionClasses;
|
||||
LvClasses.DetectionDataGrid.ItemsSource = AllDetectionClasses;
|
||||
|
||||
LvClasses.MouseUp += async (_, _) =>
|
||||
LvClasses.DetectionClassChanged += async (_, args) =>
|
||||
{
|
||||
var selectedClass = (DetectionClass)LvClasses.SelectedItem;
|
||||
ExplorerEditor.CurrentAnnClass = selectedClass;
|
||||
_annotationConfig.LastSelectedExplorerClass = selectedClass.Id;
|
||||
ExplorerEditor.CurrentAnnClass = args.DetectionClass;
|
||||
|
||||
if (Switcher.SelectedIndex == 0)
|
||||
await ReloadThumbnails();
|
||||
else
|
||||
foreach (var ann in ExplorerEditor.CurrentDetections.Where(x => x.IsSelected))
|
||||
ann.DetectionClass = selectedClass;
|
||||
ann.DetectionClass = args.DetectionClass;
|
||||
};
|
||||
|
||||
LvClasses.SelectionChanged += (_, _) =>
|
||||
{
|
||||
if (Switcher.SelectedIndex != 1)
|
||||
return;
|
||||
|
||||
var selectedClass = (DetectionClass)LvClasses.SelectedItem;
|
||||
if (selectedClass == null)
|
||||
return;
|
||||
|
||||
ExplorerEditor.CurrentAnnClass = selectedClass;
|
||||
|
||||
foreach (var ann in ExplorerEditor.CurrentDetections.Where(x => x.IsSelected))
|
||||
ann.DetectionClass = selectedClass;
|
||||
};
|
||||
|
||||
LvClasses.SelectedIndex = _annotationConfig.LastSelectedExplorerClass ?? 0;
|
||||
ExplorerEditor.CurrentAnnClass = (DetectionClass)LvClasses.SelectedItem;
|
||||
ExplorerEditor.CurrentAnnClass = (DetectionClass)LvClasses.CurrentDetectionClass;
|
||||
|
||||
await _dbFactory.Run(async db =>
|
||||
{
|
||||
@@ -256,18 +238,18 @@ public partial class DatasetExplorer
|
||||
{
|
||||
AnnotationsTab.Visibility = Visibility.Collapsed;
|
||||
EditorTab.Visibility = Visibility.Visible;
|
||||
_tempSelectedClassIdx = LvClasses.SelectedIndex;
|
||||
LvClasses.ItemsSource = _annotationConfig.AnnotationClasses;
|
||||
_tempSelectedClassIdx = LvClasses.CurrentClassNumber;
|
||||
LvClasses.DetectionDataGrid.ItemsSource = _annotationConfig.AnnotationClasses;
|
||||
|
||||
Switcher.SelectedIndex = 1;
|
||||
LvClasses.SelectedIndex = Math.Max(0, _tempSelectedClassIdx - 1);
|
||||
LvClasses.SelectNum(Math.Max(0, _tempSelectedClassIdx - 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
AnnotationsTab.Visibility = Visibility.Visible;
|
||||
EditorTab.Visibility = Visibility.Collapsed;
|
||||
LvClasses.ItemsSource = AllDetectionClasses;
|
||||
LvClasses.SelectedIndex = _tempSelectedClassIdx;
|
||||
LvClasses.DetectionDataGrid.ItemsSource = AllDetectionClasses;
|
||||
LvClasses.SelectNum(_tempSelectedClassIdx);
|
||||
Switcher.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class DatasetExplorerEventHandler(
|
||||
if ((int)key >= (int)Key.NumPad1 && (int)key <= (int)Key.NumPad9) keyNumber = key - Key.NumPad1;
|
||||
|
||||
if (keyNumber.HasValue)
|
||||
datasetExplorer.LvClasses.SelectedIndex = keyNumber.Value;
|
||||
datasetExplorer.LvClasses.SelectNum(keyNumber.Value);
|
||||
else
|
||||
{
|
||||
if (datasetExplorer.Switcher.SelectedIndex == 1 && _keysControlEnumDict.TryGetValue(key, out var value))
|
||||
@@ -88,13 +88,11 @@ public class DatasetExplorerEventHandler(
|
||||
public async Task Handle(AnnotationCreatedEvent notification, CancellationToken cancellationToken)
|
||||
{
|
||||
var annotation = notification.Annotation;
|
||||
var selectedClass = ((DetectionClass?)datasetExplorer.LvClasses.SelectedItem)?.Id;
|
||||
if (selectedClass == null)
|
||||
return;
|
||||
var selectedClass = datasetExplorer.LvClasses.CurrentClassNumber;
|
||||
|
||||
//TODO: For editing existing need to handle updates
|
||||
datasetExplorer.AddAnnotationToDict(annotation);
|
||||
if (annotation.Classes.Contains(selectedClass.Value))
|
||||
if (annotation.Classes.Contains(selectedClass))
|
||||
{
|
||||
var annThumb = new AnnotationThumbnail(annotation);
|
||||
datasetExplorer.SelectedAnnotations.Add(annThumb);
|
||||
|
||||
Reference in New Issue
Block a user