Python pyqtgraph 模块,setConfigOptions() 实例源码

我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用pyqtgraph.setConfigOptions()

项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def test_getArrayRegion(transpose=False):
    pr = pg.PolyLineROI([[0, 0], [27, 0], [0, 28]], closed=True)
    pr.setPos(1, 1)
    rois = [
        (pg.ROI([1, 1], [27, 28], pen='y'), 'baseroi'),
        (pg.RectROI([1, 1], [27, 28], pen='y'), 'rectroi'),
        (pg.EllipseROI([1, 1], [27, 28], pen='y'), 'ellipseroi'),
        (pr, 'polylineroi'),
    ]
    for roi, name in rois:
        # For some ROIs, resize should not be used.
        testResize = not isinstance(roi, pg.PolyLineROI)

        origMode = pg.getConfigOption('imageAxisOrder')
        try:
            if transpose:
                pg.setConfigOptions(imageAxisOrder='row-major')
                check_getArrayRegion(roi, 'roi/'+name, testResize, transpose=True)
            else:
                pg.setConfigOptions(imageAxisOrder='col-major')
                check_getArrayRegion(roi, 'roi/'+name, testResize)
        finally:
            pg.setConfigOptions(imageAxisOrder=origMode)
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def test_getArrayRegion(transpose=False):
    pr = pg.PolyLineROI([[0, 0], [27, 0], [0, 28]], closed=True)
    pr.setPos(1, 1)
    rois = [
        (pg.ROI([1, 1], [27, 28], pen='y'), 'baseroi'),
        (pg.RectROI([1, 1], [27, 28], pen='y'), 'rectroi'),
        (pg.EllipseROI([1, 1], [27, 28], pen='y'), 'ellipseroi'),
        (pr, 'polylineroi'),
    ]
    for roi, name in rois:
        # For some ROIs, resize should not be used.
        testResize = not isinstance(roi, pg.PolyLineROI)

        origMode = pg.getConfigOption('imageAxisOrder')
        try:
            if transpose:
                pg.setConfigOptions(imageAxisOrder='row-major')
                check_getArrayRegion(roi, 'roi/'+name, testResize, transpose=True)
            else:
                pg.setConfigOptions(imageAxisOrder='col-major')
                check_getArrayRegion(roi, 'roi/'+name, testResize)
        finally:
            pg.setConfigOptions(imageAxisOrder=origMode)
项目:uavClassification    作者:BENR0    | 项目源码 | 文件源码
def __init__(self, parent=None):
        #pyqtgraph.setConfigOptions(imageAxisOrder='row-major')
        super(self.__class__, self).__init__()
        self.setupUi(self)
        self.slider_spatialr.valueChanged.connect(self.runSegment)
        self.slider_ranger.valueChanged.connect(self.runSegment)
        self.slider_classes.valueChanged.connect(self.runClassification)
        self.imageItem = pyqtgraph.ImageItem()
        self.view = pyqtgraph.ViewBox()
        self.view.addItem(self.imageItem)
        #segResult is of class pyqtgraph.GraphicsView
        self.segResult.setCentralItem(self.view)

        #get file pathes with buttons
        self.RGBimgpathButton.clicked.connect(self.getFileRGB)
        self.smoothedpathButton.clicked.connect(self.getFilesmoothed)
        self.saveClassificationButton.clicked.connect(self.saveFileClassified)

        #temporary data of segmented image
        self.segmentedout = "data/app_segmented.tif"
        self.RGBimgpath = "data/test_image_cubic_resample.tif" 
        self.smoothedpath = "data/smoothed.tif"
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def test_ImageItem_axisorder():
    # All image tests pass again using the opposite axis order
    origMode = pg.getConfigOption('imageAxisOrder')
    altMode = 'row-major' if origMode == 'col-major' else 'col-major'
    pg.setConfigOptions(imageAxisOrder=altMode)
    try:
        test_ImageItem(transpose=True)
    finally:
        pg.setConfigOptions(imageAxisOrder=origMode)
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def test_ImageItem_axisorder():
    # All image tests pass again using the opposite axis order
    origMode = pg.getConfigOption('imageAxisOrder')
    altMode = 'row-major' if origMode == 'col-major' else 'col-major'
    pg.setConfigOptions(imageAxisOrder=altMode)
    try:
        test_ImageItem(transpose=True)
    finally:
        pg.setConfigOptions(imageAxisOrder=origMode)
项目:qudi    作者:Ulm-IQO    | 项目源码 | 文件源码
def exit(exitcode=0):
    """
    Causes python to exit without garbage-collecting any objects, and thus
    avoids calling object destructor methods. This is a sledgehammer
    workaround for a variety of bugs in PyQt and Pyside that cause crashes
    on exit.

    This function does the following in an attempt to 'safely' terminate
    the process:

    * Invoke atexit callbacks
    * Close all open file handles
    * os._exit()

    Note: there is some potential for causing damage with this function if you
    are using objects that _require_ their destructors to be called (for
    example, to properly terminate log files, disconnect from devices, etc).
    Situations like this are probably quite rare, but use at your own risk.

    @param int exitcode: system exit code
    """

    if has_pyqtgraph:
        # first disable our pyqtgraph's cleanup function; won't be needing it.
        pyqtgraph.setConfigOptions(exitCleanup=False)

    # invoke atexit callbacks
    atexit._run_exitfuncs()

    # close file handles
    if sys.platform == 'darwin':
        for fd in range(3, 4096):
            # trying to close 7 produces an illegal instruction on the Mac.
            if fd not in [7]:
                os.close(fd)
    else:
        # just guessing on the maximum descriptor count..
        os.closerange(3, 4096)

    os._exit(exitcode)
项目:GUI-for-EWBF    作者:K4P11    | 项目源码 | 文件源码
def __init__(self, parent=None):

        super(Second, self).__init__(parent)
        self.T=[]
        self.P=[]
        self.sp=[]
        self.dt=[]
        self.eff=[]
        url=setter.url

        try:
            url=setter.url
            l= requests.get(url).json()
            for i in range(0,len(l['result'])):
                self.T.append([])
                self.P.append([])
                self.sp.append([])
                self.eff.append([])
        except requests.exceptions.RequestException as e:
                i=0

        self.resize(1000,800)
        self.setWindowTitle('Performance monitor')
        pg.setConfigOptions(antialias=True)

        self.p1 = self.addPlot(title="GPUs speed", axisItems={'bottom': TimeAxisItem(orientation='bottom')})
        self.curve = []
        #self.p1.addLegend()
        vb = self.addViewBox()#
        vb.setMaximumWidth(100)
        legend = pg.LegendItem()
        legend.setParentItem(vb)
        legend.anchor((0,0), (0,0))#

        self.nextRow()
        self.p2= self.addPlot(title="Temperature", axisItems={'bottom': TimeAxisItem(orientation='bottom')})
        #self.p2.addLegend()
        self.curve1=[]
        self.nextRow()
        self.p3= self.addPlot(title="Power", axisItems={'bottom': TimeAxisItem(orientation='bottom')})
        #self.p3.addLegend()
        self.curve2=[]
        self.nextRow()
        self.p4= self.addPlot(title="Effiency", axisItems={'bottom': TimeAxisItem(orientation='bottom')})
        #self.p4.addLegend()
        self.curve3=[]
        colors=[[255,0,0],[0,255,0],[0,0,255],[0,255,255],[255,0,255],[255,255,0],[125,125,0],[125,0,125],[0,125,125],[255,150,50],[255,50,150]]
        for i in range(0,len(self.T)):
            self.curve.append(self.p1.plot(pen='y',symbolBrush=(colors[i][0],colors[i][1],colors[i][2]), symbolPen='w',name='n GPU '+str(i)))                    
            self.curve1.append(self.p2.plot(pen='y',symbolBrush=(colors[i][0],colors[i][1],colors[i][2]), symbolPen='w',name='GPU '+str(i)))
            self.curve2.append(self.p3.plot(pen='y',symbolBrush=(colors[i][0],colors[i][1],colors[i][2]), symbolPen='w',name='GPU '+str(i)))
            self.curve3.append(self.p4.plot(pen='y',symbolBrush=(colors[i][0],colors[i][1],colors[i][2]), symbolPen='w',name='GPU '+str(i)))
            legend.addItem(self.curve[i],name=self.curve[i].name())        
        self.update()