def onWrite(path): filePath=gf.expandPath(path) if os.access(filePath, os.W_OK): with open(filePath, "a") as f: f.write(""" try: import figureInfo figureInfo.setNameDescPath(""" + pprint.pformat(name) + ", " + pprint.pformat(description) + """, __file__) except ImportError: pass""")
def onWrite(path): filePath = gf.expandPath(path) if os.access(filePath, os.W_OK): with open(filePath, "a") as f: f.write(""" try: import figureInfo figureInfo.setNameDescPath(""" + pprint.pformat(name) + ", " + pprint.pformat(description) + """, __file__) except ImportError: pass""")
def openFileRelative(offset): import figureInfo currPath = figureInfo.getPath() currDir = None currFile = None if currPath: currDir, currFile = os.path.split(currPath) if not currPath or not os.access(currDir, os.F_OK): currDir = gf.expandPath("%/figures") files = os.listdir(currDir) files = [f for f in files if f[-3:] == '.py'] files.sort() try: i = files.index(currFile) except: i = -1 i = (i + offset) % len(files) gf.open(os.path.join(currDir, files[i]))
def openFileRelative(offset): import figureInfo currPath=figureInfo.getPath() currDir=None currFile=None if currPath: currDir,currFile=os.path.split(currPath) if not currPath or not os.access(currDir, os.F_OK): currDir=gf.expandPath("%/figures") files=os.listdir(currDir) files=[f for f in files if f[-3:]=='.py'] files.sort() try: i=files.index(currFile) except: i=-1 i= (i+offset) % len(files) gf.open(os.path.join(currDir, files[i]))