mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 11:16:30 +00:00
visual fixes
This commit is contained in:
@@ -7,9 +7,10 @@ using Azaion.Common.Extensions;
|
||||
|
||||
namespace Azaion.Common.DTO;
|
||||
|
||||
public class AnnotationThumbnail(Annotation annotation) : INotifyPropertyChanged
|
||||
public class AnnotationThumbnail(Annotation annotation, bool isValidator) : INotifyPropertyChanged
|
||||
{
|
||||
public Annotation Annotation { get; set; } = annotation;
|
||||
public bool IsValidator { get; set; } = isValidator;
|
||||
|
||||
private BitmapImage? _thumbnail;
|
||||
public BitmapImage? Thumbnail
|
||||
@@ -29,7 +30,7 @@ public class AnnotationThumbnail(Annotation annotation) : INotifyPropertyChanged
|
||||
|
||||
public string ImageName => Path.GetFileName(Annotation.ImagePath);
|
||||
public string CreatedEmail => Annotation.CreatedEmail;
|
||||
public bool IsSeed => Annotation.AnnotationStatus == AnnotationStatus.Created;
|
||||
public bool IsSeed => IsValidator && Annotation.AnnotationStatus == AnnotationStatus.Created;
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
|
||||
|
||||
@@ -8,6 +8,7 @@ using Azaion.Common.DTO.Config;
|
||||
using Azaion.Common.Events;
|
||||
using Azaion.Common.Services;
|
||||
using Azaion.CommonSecurity.DTO;
|
||||
using Azaion.CommonSecurity.Services;
|
||||
using LinqToDB;
|
||||
using MediatR;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -36,6 +37,7 @@ public partial class DatasetExplorer
|
||||
private readonly IMediator _mediator;
|
||||
|
||||
public readonly List<DetectionClass> AnnotationsClasses;
|
||||
private IAzaionApi _azaionApi;
|
||||
|
||||
|
||||
public bool ThumbnailLoading { get; set; }
|
||||
@@ -49,7 +51,8 @@ public partial class DatasetExplorer
|
||||
IGalleryService galleryService,
|
||||
FormState formState,
|
||||
IDbFactory dbFactory,
|
||||
IMediator mediator)
|
||||
IMediator mediator,
|
||||
IAzaionApi azaionApi)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
@@ -59,6 +62,7 @@ public partial class DatasetExplorer
|
||||
_galleryService = galleryService;
|
||||
_dbFactory = dbFactory;
|
||||
_mediator = mediator;
|
||||
_azaionApi = azaionApi;
|
||||
|
||||
var photoModes = Enum.GetValues(typeof(PhotoMode)).Cast<PhotoMode>().ToList();
|
||||
_annotationsDict = _annotationConfig.DetectionClasses.SelectMany(cls => photoModes.Select(mode => (int)mode + cls.Id))
|
||||
@@ -87,6 +91,7 @@ public partial class DatasetExplorer
|
||||
ThumbnailsView.SelectionChanged += (_, _) =>
|
||||
{
|
||||
StatusText.Text = $"Обрано: {ThumbnailsView.SelectedItems.Count} | {ThumbnailsView.SelectedIndex} / {SelectedAnnotations.Count}";
|
||||
|
||||
ValidateBtn.Visibility = ThumbnailsView.SelectedItems.Cast<AnnotationThumbnail>().Any(x => x.IsSeed)
|
||||
? Visibility.Visible
|
||||
: Visibility.Hidden;
|
||||
@@ -288,7 +293,7 @@ public partial class DatasetExplorer
|
||||
.OrderBy(x => x.Value.AnnotationStatus)
|
||||
.ThenByDescending(x => x.Value.CreatedDate))
|
||||
{
|
||||
var annThumb = new AnnotationThumbnail(ann.Value);
|
||||
var annThumb = new AnnotationThumbnail(ann.Value, _azaionApi.CurrentUser.Role.IsValidator());
|
||||
SelectedAnnotations.Add(annThumb);
|
||||
SelectedAnnotationDict.Add(annThumb.Annotation.Name, annThumb);
|
||||
}
|
||||
|
||||
@@ -7,18 +7,23 @@ using Azaion.Common.DTO;
|
||||
using Azaion.Common.DTO.Queue;
|
||||
using Azaion.Common.Events;
|
||||
using Azaion.Common.Services;
|
||||
using Azaion.CommonSecurity.DTO;
|
||||
using Azaion.CommonSecurity.Services;
|
||||
using MediatR;
|
||||
|
||||
namespace Azaion.Dataset;
|
||||
|
||||
public class DatasetExplorerEventHandler(
|
||||
DatasetExplorer datasetExplorer,
|
||||
IAnnotationService annotationService) :
|
||||
IAnnotationService annotationService,
|
||||
IAzaionApi azaionApi) :
|
||||
INotificationHandler<KeyEvent>,
|
||||
INotificationHandler<DatasetExplorerControlEvent>,
|
||||
INotificationHandler<AnnotationCreatedEvent>,
|
||||
INotificationHandler<AnnotationsDeletedEvent>
|
||||
{
|
||||
private readonly IAzaionApi _azaionApi = azaionApi;
|
||||
|
||||
private readonly Dictionary<Key, PlaybackControlEnum> _keysControlEnumDict = new()
|
||||
{
|
||||
{ Key.Enter, PlaybackControlEnum.SaveAnnotations },
|
||||
@@ -122,7 +127,7 @@ public class DatasetExplorerEventHandler(
|
||||
if (annotation.Classes.Contains(selectedClass) || selectedClass == -1)
|
||||
{
|
||||
var index = 0;
|
||||
var annThumb = new AnnotationThumbnail(annotation);
|
||||
var annThumb = new AnnotationThumbnail(annotation, _azaionApi.CurrentUser.Role.IsValidator());
|
||||
if (datasetExplorer.SelectedAnnotationDict.ContainsKey(annThumb.Annotation.Name))
|
||||
{
|
||||
datasetExplorer.SelectedAnnotationDict.Remove(annThumb.Annotation.Name);
|
||||
|
||||
Reference in New Issue
Block a user