-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
basics of rendering temporal annotations
- Loading branch information
1 parent
db68837
commit e5e4a63
Showing
19 changed files
with
547 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from django.contrib import admin | ||
|
||
from bats_ai.core.models import TemporalAnnotations | ||
|
||
|
||
@admin.register(TemporalAnnotations) | ||
class TemporalAnnotationsAdmin(admin.ModelAdmin): | ||
list_display = [ | ||
'pk', | ||
'recording', | ||
'owner', | ||
'start_time', | ||
'end_time', | ||
'type', | ||
'comments', | ||
] | ||
list_select_related = True | ||
autocomplete_fields = ['owner'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<script lang="ts"> | ||
import { defineComponent, PropType } from "vue"; | ||
import { SpectroInfo } from './geoJS/geoJSUtils'; | ||
import { SpectrogramTemporalAnnotation } from "../api/api"; | ||
import useState from "../use/useState"; | ||
import { watch } from "vue"; | ||
export default defineComponent({ | ||
name: "TemporalList", | ||
components: { | ||
}, | ||
props: { | ||
spectroInfo: { | ||
type: Object as PropType<SpectroInfo | undefined>, | ||
default: () => undefined, | ||
}, | ||
annotations: { | ||
type: Array as PropType<SpectrogramTemporalAnnotation[]>, | ||
default: () => [], | ||
}, | ||
selectedId: { | ||
type: Number as PropType<number | null>, | ||
default: null, | ||
}, | ||
}, | ||
emits: ['select'], | ||
setup(props) { | ||
const { annotationState, setAnnotationState } = useState(); | ||
const scrollToId = (id: number) => { | ||
const el = document.getElementById(`annotation-${id}`); | ||
if (el) { | ||
el.scrollIntoView({block: 'end', behavior: 'smooth'}); | ||
} | ||
}; | ||
watch(() => props.selectedId, () => { | ||
if (props.selectedId !== null) { | ||
scrollToId(props.selectedId); | ||
} | ||
}); | ||
return { | ||
annotationState, | ||
setAnnotationState, | ||
}; | ||
}, | ||
}); | ||
</script> | ||
|
||
<template> | ||
<v-card class="pa-0 ma-0"> | ||
<v-card-title> | ||
<v-row class="pa-2"> | ||
Temporal Annotations | ||
<v-spacer /> | ||
<v-btn | ||
:disabled="annotationState === 'creating'" | ||
@click="annotationState = 'creating'" | ||
> | ||
Add<v-icon>mdi-plus</v-icon> | ||
</v-btn> | ||
</v-row> | ||
</v-card-title> | ||
<v-list> | ||
<v-list-item> | ||
<v-row dense> | ||
<v-col><b>Time</b></v-col> | ||
</v-row> | ||
</v-list-item> | ||
<v-list-item | ||
v-for="annotation in annotations" | ||
:id="`annotation-${annotation.id}`" | ||
:key="annotation.id" | ||
:class="{selected: annotation.id===selectedId}" | ||
class="annotation-item" | ||
@click="$emit('select', annotation.id)" | ||
> | ||
<v-row> | ||
<v-col class="annotation-time"> | ||
<span>{{ annotation.start_time }}-{{ annotation.end_time }}ms</span> | ||
</v-col> | ||
</v-row> | ||
<v-row | ||
class="ma-0 pa-0" | ||
> | ||
<v-col class="ma-0 pa-0"> | ||
<div class="type-name"> | ||
{{ annotation.type }} | ||
</div> | ||
</v-col> | ||
</v-row> | ||
</v-list-item> | ||
</v-list> | ||
</v-card> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
.annotation-id { | ||
cursor:pointer; | ||
text-decoration: underline; | ||
} | ||
.annotation-time { | ||
font-size: 1em; | ||
} | ||
.annotation-item { | ||
border: 1px solid gray; | ||
} | ||
.type-name { | ||
font-weight: bold; | ||
font-size: 1em; | ||
}.selected { | ||
background-color: cyan; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.