Commit 5f7d7be5 authored by Joel Collins's avatar Joel Collins
Browse files

Removed old example extensions

parent ffafd938
Loading
Loading
Loading
Loading
+0 −60
Original line number Diff line number Diff line
from labthings.server.extensions import BaseExtension
from labthings.server.view import View
from labthings.server.decorators import ThingProperty, PropertySchema, use_args
from labthings.server import fields
from labthings.server.find import find_component
from labthings.core.utilities import path_relative_to

from openflexure_microscope.paths import settings_file_path, check_rw
from openflexure_microscope.config import OpenflexureSettingsFile

from openflexure_microscope.api.utilities.gui import build_gui

from flask import abort, url_for
import logging
import os
import psutil

from sys import platform


class CustomElementExtension(BaseExtension):
    def __init__(self):
        BaseExtension.__init__(
            self,
            "org.openflexure.customelement",
            description="Testing HTML components in an extension",
            static_folder=path_relative_to(__file__, "static", "dist"),
        )

        # Register the on_microscope function to run when the microscope is attached
        self.on_component("org.openflexure.microscope", self.on_microscope)

    def on_microscope(self, microscope_obj):
        """Function to automatically call when the parent LabThing has a microscope attached."""
        logging.debug(f"CustomElementExtension found microscope {microscope_obj}")


customelement_extension_v2 = CustomElementExtension()


def wc_func():
    return {
        "href": customelement_extension_v2.static_file_url("vue-web-component.min.js"),
        "name": "vue-web-component",
    }


def gui_func():
    return {
        "icon": "grid_on",
        "title": "Med Scan",
        "viewPanel": "stream",
        "wc": wc_func(),
    }


customelement_extension_v2.add_meta("wc", wc_func)
customelement_extension_v2.add_meta(
    "gui", build_gui(gui_func, customelement_extension_v2)
)
+0 −2
Original line number Diff line number Diff line
> 1%
last 2 versions
+0 −1
Original line number Diff line number Diff line
dist/* filter=lfs diff=lfs merge=lfs -text
+0 −23
Original line number Diff line number Diff line
.DS_Store
node_modules

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# Override and include dist
!/dist
 No newline at end of file
+0 −22
Original line number Diff line number Diff line
# Example Web Component using Vue framework

## Structure

### Web component

* `/src/components/VueWebComponent.vue`

### Debug app

* For debugging purposes, the component can be mounted into a demo app

* `/src/App.vue` and `/src/main.js` provide demo app functionality, and do not affect the final built web component


## Building

* Run `npm run build`

## Debugging

* Run `npm run serve` to serve the demo app. This can be used to debug the component. Note, the base URL will be set to it's default value of a localhost microscope server
 No newline at end of file
Loading