splitting python complete

This commit is contained in:
Oleksandr Bezdieniezhnykh
2025-08-12 14:48:56 +03:00
parent fc6e5db795
commit ad782bcbaa
31 changed files with 834 additions and 369 deletions
+22 -1
View File
@@ -80,7 +80,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="35"></RowDefinition>
<RowDefinition Height="35"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
</Grid.RowDefinitions>
<controls:DetectionClasses
x:Name="LvClasses"
@@ -93,6 +93,27 @@
Click="ShowWithObjectsOnly_OnClick">
Показувати лише анотації з об'єктами
</CheckBox>
<Grid Name="LeftPaneSearch"
ShowGridLines="False"
Background="Black"
HorizontalAlignment="Stretch"
Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label
Grid.Column="0"
Grid.Row="0"
HorizontalAlignment="Stretch"
Margin="1"
Foreground="LightGray"
Content="Фільтр: "/>
<TextBox Name="TbSearch" TextChanged="TbSearch_OnTextChanged"
Grid.Column="1"
Foreground="Gray"/>
</Grid>
</Grid>
<TabControl
Name="Switcher"
+10 -2
View File
@@ -40,6 +40,8 @@ public partial class DatasetExplorer
public AnnotationThumbnail? CurrentAnnotation { get; set; }
private static readonly Guid SearchActionId = Guid.NewGuid();
public DatasetExplorer(
IOptions<AppConfig> appConfig,
ILogger<DatasetExplorer> logger,
@@ -199,9 +201,8 @@ public partial class DatasetExplorer
};
SwitchTab(toEditor: true);
var time = ann.Time;
ExplorerEditor.RemoveAllAnns();
ExplorerEditor.CreateDetections(time, ann.Detections, _appConfig.AnnotationConfig.DetectionClasses, ExplorerEditor.RenderSize);
ExplorerEditor.CreateDetections(ann, _appConfig.AnnotationConfig.DetectionClasses, ExplorerEditor.RenderSize);
}
catch (Exception e)
{
@@ -261,6 +262,7 @@ public partial class DatasetExplorer
SelectedAnnotationDict.Clear();
var annThumbnails = _annotationsDict[ExplorerEditor.CurrentAnnClass.YoloId]
.WhereIf(withDetectionsOnly, x => x.Value.Detections.Any())
.WhereIf(TbSearch.Text.Length > 2, x => x.Key.ToLower().Contains(TbSearch.Text))
.Select(x => new AnnotationThumbnail(x.Value, _azaionApi.CurrentUser.Role.IsValidator()))
.OrderBy(x => !x.IsSeed)
.ThenByDescending(x =>x.Annotation.CreatedDate);
@@ -295,4 +297,10 @@ public partial class DatasetExplorer
_configUpdater.Save(_appConfig);
await ReloadThumbnails();
}
private void TbSearch_OnTextChanged(object sender, TextChangedEventArgs e)
{
TbSearch.Foreground = TbSearch.Text.Length > 2 ? Brushes.Black : Brushes.Gray;
ThrottleExt.Throttle(ReloadThumbnails, SearchActionId, TimeSpan.FromMilliseconds(400));;
}
}
@@ -70,7 +70,7 @@ public class DatasetExplorerEventHandler(
.Select(x => new Detection(a.Name, x.ToYoloLabel(datasetExplorer.ExplorerEditor.RenderSize)))
.ToList();
var index = datasetExplorer.ThumbnailsView.SelectedIndex;
var annotation = await annotationService.SaveAnnotation(a.OriginalMediaName, a.Time, detections, token: token);
var annotation = await annotationService.SaveAnnotation(a.OriginalMediaName, a.Name, a.Time, detections, token: token);
await ValidateAnnotations([annotation], token);
await datasetExplorer.EditAnnotation(index + 1);
break;