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]"
def generateHtml(pathLocal): abfFolder = abfBrowse.AbfFolder(pathLocal) html = "" html += readOriginCommandScript() html += specialHtml if len(abfFolder.abfList.abfIDs): html += getJavaBlock(abfFolder) else: html += "this is not an ABF folder..." html = f"<div style='margin: 10px;'>{html}</div>" return abfBrowse.htmlTools.htmlPageWrap(html)
def generateHtml(pathLocal): abfFolder = abfBrowse.AbfFolder(pathLocal) html = "<div class='title' style='font-size: 150%;'>Experiment Notes</div>" if len(abfFolder.abfList.abfIDs): html += getNotesForm(pathLocal) else: html += '<i>this is not an ABF folder</i>' html = f"<div style='padding: 20px;'>{html}</div>" return abfBrowse.htmlTools.htmlPageWrap(html)
def generateHtml(pathLocal): """ This is a file browser menu which displays electrophysiology data if ABFs are present in the current folder. """ abfFolder = abfBrowse.AbfFolder(pathLocal) html = "" # html += "<style>body {background-color: #FAFAFA;}</style>" html += menuDirectoryNavigator(abfFolder.path) if len(abfFolder.abfList.fileNamesAbf): html += menuParentCellList(abfFolder) html += menuFolderContents(abfFolder) return abfBrowse.htmlTools.htmlPageWrap(html)
def generateHtml(pathLocal): """ This page shows all child data for a parent ABF. All child images are shown. Options are available to edit comments for this parent. """ if not os.path.exists(pathLocal): return f"ERROR: file does not exist: [{pathLocal}]" pathFolder = os.path.dirname(pathLocal) parentAbfFileName = os.path.basename(pathLocal) parentAbfId = os.path.splitext(parentAbfFileName)[0] abfFolder = abfBrowse.AbfFolder(pathFolder) if not parentAbfId and len(abfFolder.abfList.family): parentAbfId = list(abfFolder.abfList.family.keys())[0] if not parentAbfId in abfFolder.abfList.family.keys(): html = f"ERROR: [{pathLocal}] is not a parent ABF" return abfBrowse.htmlTools.htmlPageWrap(html) cellsFile = abfBrowse.CellsFile(abfFolder.path) parentNote = cellsFile.getNoteForAbf(parentAbfId) abfFolder.convertTifsOfParent(parentAbfId) html = "" html += pageParentHeader(abfFolder, parentNote) html += pageParentNotes(abfFolder, parentNote) html += pageParentChildAbfList(abfFolder, parentNote) html += pageFolderActions(abfFolder, parentNote) html += pageParentImages(abfFolder, parentNote) html = abfBrowse.htmlTools.htmlPageWrap(html) return html
def test_json_abfFolder(folderPath): print(f"creating JSON for abf folder: {folderPath}") abfFolder = abfBrowse.AbfFolder(folderPath) print() print(abfFolder.toJSON())