Git Product home page Git Product logo

demystify-lite's Introduction

demystify-lite

Pyscript PoC of Demystify

demystify-lite's People

Contributors

prettybits avatar ross-spencer avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

demystify-lite's Issues

Doesn't work on Firefox?

Seeing an exception:

  • Exception: showOpenFilePicker 16 [pyodide.asm.js:14:219573](https://cdn.jsdelivr.net/pyodide/v0.20.0/full/pyodide.asm.js)

I'm not sure what's the cause at the minute. Will also need to confirm what happens on Edge or Safari.

Display python-wheel commit?

Not sure what we can do here, but we use a python wheel to deliver demystify. I mean, this could be a pypi download too. We could get the version of the script but that's fallible. A commit would be better. How do we write this into the wheel/package?

Drag and drop doesn't work

Mixed problems with this using pyscript. Last attempt saw the drag action working, but the default behavior of the action continued to open the file in another browser window. It shouldn't. Further, the listener didn't seem to pick up on the action to trigger it.

async def dnd_file_select(event):
    """Handle file select and follow-on actions from HTML/Pyscript."""
    clear_data()
    event.stopPropagation()
    event.preventDefault()
    DRAG_AND_DROP = "Drag and drop is not yet supported, please use the file-picker"
    document.getElementById("content").contentDocument.body.innerText = DRAG_AND_DROP
    return False


def handle_drop_over(event):
    """Manage the drop-over event."""
    event.stopPropagation()
    event.preventDefault()
    event.dataTransfer.dropEffect = "copy"
    console.log("Registered drop-over")


def setup_button():
    # Create a Python proxy for the callback function
    file_select_proxy = create_proxy(file_select)
    dnd_file_select_proxy = create_proxy(dnd_file_select)
    handle_drop_over_proxy = create_proxy(handle_drop_over)

    # Set the listener to the callback
    document.getElementById("file_select").addEventListener(
        "click", file_select_proxy, False
    )

    # Setup the drag-and-drop listeners.
    #
    # Pyscript may not support this yet...
    #
    dz = document.getElementById("drop_zone")
    dz.addEventListener("dragover", handle_drop_over_proxy, False)
    dz.addEventListener("drop", dnd_file_select_proxy, False)

    console.log("File handler registered")
          <div class="drag" id="drop_zone">
            <label class="custom-file-upload">
              <input type="file" id="file_select" name="files[]" single />
              Choose file
            </label>
            or drop files here
          </div>

Drag-and-drop code is based on HTML5 rocks: https://www.html5rocks.com/en/tutorials/file/dndfiles//

File-handler opens twice

There's a controller issue where the file-open dialog opens twice. It should open once. The user has to manually cancel the second panel. This might be down to the CSS trickery used to make the input button, but I'm not sure.

Use Skeleton CSS

I use Skeleton on ffdev.info. The styling of this site so far has been for expedience. Converting it to Skeleton in the near future may make it more user friendly.

Create new entry-point for Demystify using IO interface

Currently reading the file twice for convenience through Pyscript:

  1. Reading from disk into memory.
  2. Writing to a temporary location accessible to the browser sandbox.
  3. Reading from new temporary location for Demystify.

The current entry-point for demystify is file-paths all the way down, so we need a file-path to run the analysis. We can fix this using an IO object.

Fix-up demystify

The current version of the demystify code for demystify-lite breaks a handful of things. Tests don't work for example, and we change a few of the happier paths in the code to be less happy.

Couple of things to think about:

  • Fixup tests.
  • Fixup code-paths.
  • Make config options work differently, i.e. from disk they are incompatible with demystify-lite, but then, they're harder to configure.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.