def saveTableFromWidget(display, path): if path is None or len(path) <= 0: raise Exception("Invalid or empty file name") path = FileUtil.workspacePathToSysPath(path) if path is None: raise Exception("Save Error", "Invalid file name or path") table_scan = getTableFromWidget(display) table_scan.save(path) # Force a workspace refresh on the new file ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(Path(path)).refreshLocal(0, None)
def saveTableFromWidget(display, path): if path is None or len(path) <= 0: raise Exception("Invalid or empty file name") path = FileUtil.workspacePathToSysPath(path) if path is None: raise Exception("Save Error", "Invalid file name or path") table_scan = getTableFromWidget(display) table_scan.save(path) # Force a workspace refresh on the new file ResourcesPlugin.getWorkspace().getRoot().getFileForLocation( Path(path)).refreshLocal(0, None)
def getTableFromPath(path): path = FileUtil.workspacePathToSysPath(path) if path: return loadTableScan(path) else: raise Exception("No file to load")
from org.csstudio.opibuilder.scriptUtil import PVUtil, FileUtil from org.csstudio.opibuilder.util import ResourceUtil from java.lang import System opiPath = display.getModel().getOpiFilePath() isWorkspaceFile = ResourceUtil.isExistingWorkspaceFile(opiPath) opiFolderPath = ResourceUtil.buildAbsolutePath(display.getModel(), ResourceUtil.getPathFromString("./")).toString() if isWorkspaceFile: opiFolderPath = FileUtil.workspacePathToSysPath(opiFolderPath) System.setProperty("shellScript2.dir", opiFolderPath)
from org.csstudio.opibuilder.scriptUtil import PVUtil from org.csstudio.opibuilder.scriptUtil import FileUtil import os opifilepath = display.getModel().getOpiFilePath().toString() workspacepath = FileUtil.workspacePathToSysPath("/") path = workspacepath + opifilepath path = path[::-1] pathsplit = path.split("/",1) folder = pathsplit[1] configfilepath = folder[::-1] configfile = configfilepath + "/cbhv_config.txt" test = os.path.isfile(configfile) print test
from org.csstudio.opibuilder.scriptUtil import PVUtil, FileUtil from org.csstudio.opibuilder.util import ResourceUtil from java.lang import System opiPath = display.getModel().getOpiFilePath() isWorkspaceFile = ResourceUtil.isExistingWorkspaceFile(opiPath) opiFolderPath = ResourceUtil.buildAbsolutePath( display.getModel(), ResourceUtil.getPathFromString("./")).toString() if isWorkspaceFile: opiFolderPath = FileUtil.workspacePathToSysPath(opiFolderPath) System.setProperty("shellScript2.dir", opiFolderPath)
return (d) # read in file to create test screens for fin = str(PVUtil.getString(pvs[1]))[1:] # read in go button to initiate screen creation go = PVUtil.getDouble(pvs[0]) == 1 # flag used to include PV in rules list if macros are used macroFlag = False check = PVUtil.getDouble(pvs[3]) == 1 if go and fin != '': fin = str(FileUtil.workspacePathToSysPath(fin)) # performs PV check if selected if check: # read in and parse OPI file for relevant info tree = ET.parse(fin) root = tree.getroot() relevant = [ 'x', 'y', 'height', 'width', 'pv_name', 'text', 'widget_type' ] screenProps = {} widgets = [] macros = {} for child in root: if child.tag in relevant: if child.tag == 'background_color' or child.tag == 'foreground_color':
from org.csstudio.opibuilder.scriptUtil import PVUtil, ScriptUtil, FileUtil,\ ConsoleUtil import csv from array import zeros, array from java.lang import String from java.util import Arrays from java.lang.reflect import Array table = display.getWidget("ScanTable1").getTable() inWorkspace=display.getWidget("inWorkspace").getValue() path = FileUtil.openFileDialog(inWorkspace) if path != None and path.endswith('csv'): if inWorkspace: path = FileUtil.workspacePathToSysPath(path) reader = csv.reader(open(path)) lineList=[] for row in reader: lineList.append(row) content = Array.newInstance(String, len(lineList), len(row)) for r in range(len(lineList)): for c in range(len(row)): content[r][c] = lineList[r][c] table.setContent(content)
from org.csstudio.opibuilder.scriptUtil import PVUtil, FileUtil from java.lang import System sysPath = FileUtil.workspacePathToSysPath( "/BOY Examples/Miscellaneous/ExecuteShellScript") System.setProperty("shellScript.dir", sysPath)
from org.csstudio.opibuilder.scriptUtil import PVUtil, ScriptUtil, FileUtil,\ ConsoleUtil import csv from array import zeros, array from java.lang import String from java.util import Arrays from java.lang.reflect import Array table = display.getWidget("ScanTable1").getTable() inWorkspace = display.getWidget("inWorkspace").getValue() path = FileUtil.openFileDialog(inWorkspace) if path != None and path.endswith('csv'): if inWorkspace: path = FileUtil.workspacePathToSysPath(path) reader = csv.reader(open(path)) lineList = [] for row in reader: lineList.append(row) content = Array.newInstance(String, len(lineList), len(row)) for r in range(len(lineList)): for c in range(len(row)): content[r][c] = lineList[r][c] table.setContent(content)
from org.csstudio.opibuilder.scriptUtil import PVUtil, FileUtil from java.lang import System sysPath = FileUtil.workspacePathToSysPath("/BOY Examples/Miscellaneous/ExecuteShellScript") System.setProperty("shellScript.dir", sysPath)