stitch available property, allowing GUI to only stitch when needed

This commit is contained in:
jaknapper 2025-05-13 15:51:11 +01:00
parent ecfa0aa479
commit 69260d1973
2 changed files with 10 additions and 8 deletions

View file

@ -76,6 +76,7 @@ class ScanInfo(BaseModel):
created: datetime
modified: datetime
number_of_images: int
stitch_available: bool
DOWNLOADABLE_SCAN_FILES = (
@ -780,12 +781,17 @@ class SmartScanThing(Thing):
# scans in the GUI or choosing a new scan name, should be ignored
# A function to delete empty scan folders from the disk achieves all of this
stitch_available=(
len([i for i in os.listdir(images_folder) if i.endswith("_stitched.jpg")]) > 0
)
scans.append(
ScanInfo(
name=f,
created=os.path.getctime(path),
modified=modified,
number_of_images=number_of_images,
stitch_available=stitch_available,
)
)
return scans

View file

@ -41,8 +41,7 @@
class="uk-padding-remove-top"
uk-lightbox="toggle: .lightbox-link"
>
<!-- Gallery capture cards -->
<!-- Gallery capture cards -->
<div class="gallery-grid uk-grid-match" uk-grid>
<div v-if="scansEmpty">
<h2>No scans available</h2>
@ -90,19 +89,15 @@
:submit-data="{ scan_name: item.name }"
:button-primary="false"
:modal-progress="true"
v-if="item.can_stitch"
@error="modalError"
/>
<ul>
<li>{{ item.number_of_images }} images</li>
<li>created {{ formatDate(item.created) }}</li>
<li>modified {{ formatDate(item.modified) }}</li>
<li>scan stitched {{ item.stitch_available }}</li>
</ul>
<div
class="uk-text-meta uk-margin-remove-top uk-padding-remove uk-width-expand"
>
<time>{{ item.created }}</time>
</div>
</div>
</div>
</div>
@ -198,6 +193,7 @@ export default {
scans.forEach(scan => {
scan.modified = Date.parse(scan.modified);
scan.created = Date.parse(scan.created);
scan.can_stitch = !scan.stitch_available && scan.number_of_images > 3;
});
scans.sort((a, b) => {
return b.modified - a.modified;