예제 #1
0
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)
예제 #2
0
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)
예제 #3
0
def getTableFromPath(path):
    path = FileUtil.workspacePathToSysPath(path)
    if path:
        return loadTableScan(path)
    else:
        raise Exception("No file to load")
예제 #4
0
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)
예제 #5
0
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
예제 #6
0
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)
예제 #7
0
def getTableFromPath(path):
    path = FileUtil.workspacePathToSysPath(path)
    if path:
        return loadTableScan(path)
    else:
        raise Exception("No file to load")
예제 #8
0
    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':
예제 #9
0
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)
예제 #11
0
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)
예제 #12
0
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)