From 69260d197391a10a4c9c9c3b96782452d0a2eba8 Mon Sep 17 00:00:00 2001 From: jaknapper Date: Tue, 13 May 2025 15:51:11 +0100 Subject: [PATCH 1/7] stitch available property, allowing GUI to only stitch when needed --- .../things/smart_scan.py | 6 ++++++ .../tabContentComponents/scanListContent.vue | 12 ++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/openflexure_microscope_server/things/smart_scan.py b/src/openflexure_microscope_server/things/smart_scan.py index 839d64b5..819a1a3b 100644 --- a/src/openflexure_microscope_server/things/smart_scan.py +++ b/src/openflexure_microscope_server/things/smart_scan.py @@ -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 diff --git a/webapp/src/components/tabContentComponents/scanListContent.vue b/webapp/src/components/tabContentComponents/scanListContent.vue index 3d018826..60a29998 100644 --- a/webapp/src/components/tabContentComponents/scanListContent.vue +++ b/webapp/src/components/tabContentComponents/scanListContent.vue @@ -41,8 +41,7 @@ class="uk-padding-remove-top" uk-lightbox="toggle: .lightbox-link" > - - + @@ -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; From e1110bfe5d548e02dd5dfd8287e233d0a3df1a6f Mon Sep 17 00:00:00 2001 From: jaknapper Date: Tue, 13 May 2025 17:07:51 +0100 Subject: [PATCH 2/7] Removed border from logo svg --- webapp/public/titleiconpink.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/public/titleiconpink.svg b/webapp/public/titleiconpink.svg index 5ef0d260..8300e4e5 100644 --- a/webapp/public/titleiconpink.svg +++ b/webapp/public/titleiconpink.svg @@ -3,7 +3,7 @@ - + From 3eea4bbaf6a4cacffad6f64615db8592f111c531 Mon Sep 17 00:00:00 2001 From: jaknapper Date: Tue, 13 May 2025 17:08:09 +0100 Subject: [PATCH 3/7] Log each line individually to ensure line breaks --- src/openflexure_microscope_server/things/smart_scan.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/openflexure_microscope_server/things/smart_scan.py b/src/openflexure_microscope_server/things/smart_scan.py index 819a1a3b..51b56e24 100644 --- a/src/openflexure_microscope_server/things/smart_scan.py +++ b/src/openflexure_microscope_server/things/smart_scan.py @@ -965,12 +965,9 @@ class SmartScanThing(Thing): def log_buffer(buffer): """A short internal function to read everything in the buffer to - a multiline string and log""" - lines = [] + the log""" while line := buffer.readline(): - lines.append(line) - if lines: - logger.info("".join(lines)) + logger.info(line) # Run the command piping stdout into the process for reading and # forwarding the stdrerr to stdout From a5d85a7d9ecf3ea54cfa02650a82ee8f94ff64c0 Mon Sep 17 00:00:00 2001 From: jaknapper Date: Tue, 13 May 2025 17:08:43 +0100 Subject: [PATCH 4/7] Layout improvements and stitch info in scan tab --- webapp/src/App.vue | 1 + webapp/src/assets/less/theme.less | 3 ++- .../tabContentComponents/scanListContent.vue | 17 ++++++++++++----- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/webapp/src/App.vue b/webapp/src/App.vue index 632d2056..b972bec4 100644 --- a/webapp/src/App.vue +++ b/webapp/src/App.vue @@ -438,6 +438,7 @@ html { .thumbnail-fit { max-height: 120px; + max-width: 240px; object-fit: contain; overflow-y: hidden; } diff --git a/webapp/src/assets/less/theme.less b/webapp/src/assets/less/theme.less index 4a7d9134..690192ac 100644 --- a/webapp/src/assets/less/theme.less +++ b/webapp/src/assets/less/theme.less @@ -207,7 +207,8 @@ h4, .uk-h4 { } .uk-card-body { - padding: 20px 16px 8px 16px;; + padding: 20px 16px 8px 16px; + width: 260px; } .uk-card-media-top img { diff --git a/webapp/src/components/tabContentComponents/scanListContent.vue b/webapp/src/components/tabContentComponents/scanListContent.vue index 60a29998..ea5a497c 100644 --- a/webapp/src/components/tabContentComponents/scanListContent.vue +++ b/webapp/src/components/tabContentComponents/scanListContent.vue @@ -64,7 +64,7 @@ /> -

{{ item.name }}

+

{{ item.name }}

  • {{ item.number_of_images }} images
  • -
  • created {{ formatDate(item.created) }}
  • -
  • modified {{ formatDate(item.modified) }}
  • -
  • scan stitched {{ item.stitch_available }}
  • +
  • created: {{ formatDate(item.created) }}
  • +
  • modified: {{ formatDate(item.modified) }}
  • +
  • Not enough images
    to stitch
  • +
  • Scan not stitched
@@ -276,7 +277,7 @@ export default { display: grid; grid-template-columns: repeat(auto-fill, 320px); justify-content: center; - overflow-y: auto; + overflow-y: hidden; } .gallery-grid > div { @@ -290,4 +291,10 @@ export default { margin-left: auto; margin-right: auto; }*/ + +ul { + display: inline-block; + text-align: center; + list-style-type:none; +} \ No newline at end of file From 747bc3d79a46a5e89da093d7d4c9311794f56c08 Mon Sep 17 00:00:00 2001 From: jaknapper Date: Wed, 14 May 2025 11:17:44 +0100 Subject: [PATCH 5/7] Narrower scan tabs --- webapp/src/assets/less/theme.less | 2 +- .../src/components/tabContentComponents/scanListContent.vue | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp/src/assets/less/theme.less b/webapp/src/assets/less/theme.less index 690192ac..df88729b 100644 --- a/webapp/src/assets/less/theme.less +++ b/webapp/src/assets/less/theme.less @@ -208,7 +208,7 @@ h4, .uk-h4 { .uk-card-body { padding: 20px 16px 8px 16px; - width: 260px; + width: 240px; } .uk-card-media-top img { diff --git a/webapp/src/components/tabContentComponents/scanListContent.vue b/webapp/src/components/tabContentComponents/scanListContent.vue index ea5a497c..20f4d461 100644 --- a/webapp/src/components/tabContentComponents/scanListContent.vue +++ b/webapp/src/components/tabContentComponents/scanListContent.vue @@ -85,18 +85,18 @@ submit-label="Stitch Images" thing="smart_scan" action="stitch_scan" + v-if="item.can_stitch" :can-terminate="false" :submit-data="{ scan_name: item.name }" :button-primary="false" :modal-progress="true" - v-if="item.can_stitch" @error="modalError" />
  • {{ item.number_of_images }} images
  • created: {{ formatDate(item.created) }}
  • modified: {{ formatDate(item.modified) }}
  • -
  • Not enough images
    to stitch
  • +
  • Not enough images to stitch
  • Scan not stitched
From 251b0ca77012f2d0ea5ccd609f1c326e8894ab4e Mon Sep 17 00:00:00 2001 From: Joe Knapper Date: Wed, 14 May 2025 10:26:37 +0000 Subject: [PATCH 6/7] Apply 1 suggestion(s) to 1 file(s) Co-authored-by: Julian Stirling --- .../things/smart_scan.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/openflexure_microscope_server/things/smart_scan.py b/src/openflexure_microscope_server/things/smart_scan.py index 51b56e24..7a8f62cc 100644 --- a/src/openflexure_microscope_server/things/smart_scan.py +++ b/src/openflexure_microscope_server/things/smart_scan.py @@ -771,20 +771,15 @@ class SmartScanThing(Thing): images_folder = os.path.join(path, IMG_DIR_NAME) if os.path.isdir(images_folder): folder_contents = os.listdir(images_folder) - scan_images = [x for x in folder_contents if IMAGE_REGEX.search(x)] + scan_images = [i for i in folder_contents if IMAGE_REGEX.search(x)] + stitches = [i for i in folder_contents if i.endswith("_stitched.jpg")] number_of_images = len(scan_images) + stitch_available = len(stitches) > 0 else: number_of_images = 0 + stitch_available = False modified = max(os.stat(root).st_mtime for root, _, _ in os.walk(path)) - # If number of images is 0, should the scan be appended or ignored? - # When deleting images, empty scans should be deleted. When displaying - # 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, From 99e52bcb2f8a3847812226d64d95b7c6c1243201 Mon Sep 17 00:00:00 2001 From: jaknapper Date: Wed, 14 May 2025 12:23:01 +0100 Subject: [PATCH 7/7] Formatting and fixing wrong variable in loop --- src/openflexure_microscope_server/things/smart_scan.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/openflexure_microscope_server/things/smart_scan.py b/src/openflexure_microscope_server/things/smart_scan.py index 7a8f62cc..c6b7ebe9 100644 --- a/src/openflexure_microscope_server/things/smart_scan.py +++ b/src/openflexure_microscope_server/things/smart_scan.py @@ -771,15 +771,17 @@ class SmartScanThing(Thing): images_folder = os.path.join(path, IMG_DIR_NAME) if os.path.isdir(images_folder): folder_contents = os.listdir(images_folder) - scan_images = [i for i in folder_contents if IMAGE_REGEX.search(x)] - stitches = [i for i in folder_contents if i.endswith("_stitched.jpg")] + scan_images = [i for i in folder_contents if IMAGE_REGEX.search(i)] + stitches = [ + i for i in folder_contents if i.endswith("_stitched.jpg") + ] number_of_images = len(scan_images) stitch_available = len(stitches) > 0 else: number_of_images = 0 stitch_available = False modified = max(os.stat(root).st_mtime for root, _, _ in os.walk(path)) - + scans.append( ScanInfo( name=f,