Пример #1
0
def showAbfParent(pathUrl):
    """
    Display the ABF list and data for a parent ABF.
      - also processes changes to cells.txt
      - also deletes graphs for child ABFs
      - also marks ABFs as ignored
      - also analyzes new ABFs
      - also marks ABFs as ignored
    """
    showRequest(pathUrl, request)
    pathLocal = abfBrowse.getLocalPath(pathUrl)
    if os.path.isfile(pathLocal):

        if ('colorCode' in request.form.keys()):
            print("Processing a change to cells.txt...")
            cellsFile = abfBrowse.CellsFile(request.form['abfFolderPath'])
            cellsFile.modify(request.form['abfID'], request.form['colorCode'],
                             request.form['comment'],
                             abfBrowse.AUTOANALYSIS_FOLDER_NAME)

        if ('deleteGraphsForChildren' in request.args.keys()):
            print("Deleting graphs for children...")
            abfFldr = abfBrowse.AbfFolder(os.path.dirname(pathLocal))
            abfFldr.deleteChildGraphs(os.path.basename(pathLocal))
            print("complete.")

        if ('ignoreABF' in request.args.keys()):
            ignoreAbf = request.args['ignoreABF']
            ignoreAbfPath = os.path.join(os.path.dirname(pathLocal), ignoreAbf)
            print(f"ignoring ABF: {ignoreAbfPath}")
            os.rename(ignoreAbfPath, ignoreAbfPath + ".ignored")

        return abfBrowse.pages.parent.generateHtml(pathLocal)
    else:
        return f"ERROR: does not exist: [{pathLocal}.abf]"
Пример #2
0
def showAbfAnalyze(pathUrl):
    showRequest(pathUrl, request)
    pathLocal = abfBrowse.getLocalPath(pathUrl)
    if os.path.isdir(pathLocal):
        return abfBrowse.pages.analyze.generateHtml(pathLocal)
    else:
        return f"ERROR: does not exist [{pathLocal}]"
Пример #3
0
def showAbfMenu(pathUrl):
    """
    Display the menu for an ABF folder
    """
    showRequest(pathUrl, request)
    pathLocal = abfBrowse.getLocalPath(pathUrl)
    if os.path.isdir(pathLocal):
        return abfBrowse.pages.menu.generateHtml(pathLocal)
    else:
        return f"ERROR: does not exist [{pathLocal}]"
Пример #4
0
def showAbfView(pathUrl):
    """
    Display a frameset containing a menu and an ABFfolder
    """
    showRequest(pathUrl, request)
    pathLocal = abfBrowse.getLocalPath(pathUrl)
    if os.path.isdir(pathLocal):
        return abfBrowse.pages.frames.generateHtml(pathUrl)
    else:
        return f"ERROR: path does not exist [{pathUrl}]"
Пример #5
0
def showAbfExperiment(pathUrl):
    showRequest(pathUrl, request)
    pathLocal = abfBrowse.getLocalPath(pathUrl)
    if os.path.isdir(pathLocal):
        if ('experimentText' in request.form.keys()):
            exp = abfBrowse.experimentNotes.ExperimentNotes(pathLocal)
            exp.write(request.form['experimentText'])
        return abfBrowse.pages.experiment.generateHtml(pathLocal)
    else:
        return f"ERROR: does not exist [{pathLocal}]"
Пример #6
0
def showFileOrFolder(pathUrl):
    """
    Send the binary content of a file on the X drive
    """
    #showRequest(pathUrl, request)
    pathLocal = abfBrowse.getLocalPath("X/" + pathUrl)
    print("  serving", os.path.basename(pathLocal))
    if os.path.isdir(pathLocal):
        return f"directory index of [{pathLocal}]"
    elif os.path.isfile(pathLocal):
        return flask.send_file(pathLocal)
    else:
        return f"ERROR: path does not exist [{pathLocal}]"