Merge branch 'Refactor' of https://github.com/Billy4195/pyqtgraph into Billy4195-Refactor
This commit is contained in:
commit
7358664414
@ -358,14 +358,6 @@ class PlotItem(GraphicsWidget):
|
|||||||
v = np.clip(alpha, 0, 1)*self.ctrl.gridAlphaSlider.maximum()
|
v = np.clip(alpha, 0, 1)*self.ctrl.gridAlphaSlider.maximum()
|
||||||
self.ctrl.gridAlphaSlider.setValue(v)
|
self.ctrl.gridAlphaSlider.setValue(v)
|
||||||
|
|
||||||
#def paint(self, *args):
|
|
||||||
#prof = debug.Profiler()
|
|
||||||
#QtGui.QGraphicsWidget.paint(self, *args)
|
|
||||||
|
|
||||||
## bad idea.
|
|
||||||
#def __getattr__(self, attr): ## wrap ms
|
|
||||||
#return getattr(self.vb, attr)
|
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
#print "delete", self
|
#print "delete", self
|
||||||
## Most of this crap is needed to avoid PySide trouble.
|
## Most of this crap is needed to avoid PySide trouble.
|
||||||
@ -704,16 +696,9 @@ class PlotItem(GraphicsWidget):
|
|||||||
## Qt's SVG-writing capabilities are pretty terrible.
|
## Qt's SVG-writing capabilities are pretty terrible.
|
||||||
def writeSvgCurves(self, fileName=None):
|
def writeSvgCurves(self, fileName=None):
|
||||||
if fileName is None:
|
if fileName is None:
|
||||||
self.fileDialog = FileDialog()
|
self._choose_filename_dialog(handler=self.writeSvg)
|
||||||
if PlotItem.lastFileDir is not None:
|
|
||||||
self.fileDialog.setDirectory(PlotItem.lastFileDir)
|
|
||||||
self.fileDialog.setFileMode(QtGui.QFileDialog.AnyFile)
|
|
||||||
self.fileDialog.setAcceptMode(QtGui.QFileDialog.AcceptSave)
|
|
||||||
self.fileDialog.show()
|
|
||||||
self.fileDialog.fileSelected.connect(self.writeSvg)
|
|
||||||
return
|
return
|
||||||
#if fileName is None:
|
|
||||||
#fileName = QtGui.QFileDialog.getSaveFileName()
|
|
||||||
if isinstance(fileName, tuple):
|
if isinstance(fileName, tuple):
|
||||||
raise Exception("Not implemented yet..")
|
raise Exception("Not implemented yet..")
|
||||||
fileName = str(fileName)
|
fileName = str(fileName)
|
||||||
@ -790,7 +775,9 @@ class PlotItem(GraphicsWidget):
|
|||||||
|
|
||||||
def writeSvg(self, fileName=None):
|
def writeSvg(self, fileName=None):
|
||||||
if fileName is None:
|
if fileName is None:
|
||||||
fileName = QtGui.QFileDialog.getSaveFileName()
|
self._choose_filename_dialog(handler=self.writeSvg)
|
||||||
|
return
|
||||||
|
|
||||||
fileName = str(fileName)
|
fileName = str(fileName)
|
||||||
PlotItem.lastFileDir = os.path.dirname(fileName)
|
PlotItem.lastFileDir = os.path.dirname(fileName)
|
||||||
|
|
||||||
@ -800,16 +787,9 @@ class PlotItem(GraphicsWidget):
|
|||||||
|
|
||||||
def writeImage(self, fileName=None):
|
def writeImage(self, fileName=None):
|
||||||
if fileName is None:
|
if fileName is None:
|
||||||
self.fileDialog = FileDialog()
|
self._choose_filename_dialog(handler=self.writeImage)
|
||||||
if PlotItem.lastFileDir is not None:
|
|
||||||
self.fileDialog.setDirectory(PlotItem.lastFileDir)
|
|
||||||
self.fileDialog.setFileMode(QtGui.QFileDialog.AnyFile)
|
|
||||||
self.fileDialog.setAcceptMode(QtGui.QFileDialog.AcceptSave)
|
|
||||||
self.fileDialog.show()
|
|
||||||
self.fileDialog.fileSelected.connect(self.writeImage)
|
|
||||||
return
|
return
|
||||||
#if fileName is None:
|
|
||||||
#fileName = QtGui.QFileDialog.getSaveFileName()
|
|
||||||
if isinstance(fileName, tuple):
|
if isinstance(fileName, tuple):
|
||||||
raise Exception("Not implemented yet..")
|
raise Exception("Not implemented yet..")
|
||||||
fileName = str(fileName)
|
fileName = str(fileName)
|
||||||
@ -823,16 +803,9 @@ class PlotItem(GraphicsWidget):
|
|||||||
|
|
||||||
def writeCsv(self, fileName=None):
|
def writeCsv(self, fileName=None):
|
||||||
if fileName is None:
|
if fileName is None:
|
||||||
self.fileDialog = FileDialog()
|
self._choose_filename_dialog(handler=self.writeCsv)
|
||||||
if PlotItem.lastFileDir is not None:
|
|
||||||
self.fileDialog.setDirectory(PlotItem.lastFileDir)
|
|
||||||
self.fileDialog.setFileMode(QtGui.QFileDialog.AnyFile)
|
|
||||||
self.fileDialog.setAcceptMode(QtGui.QFileDialog.AcceptSave)
|
|
||||||
self.fileDialog.show()
|
|
||||||
self.fileDialog.fileSelected.connect(self.writeCsv)
|
|
||||||
return
|
return
|
||||||
#if fileName is None:
|
|
||||||
#fileName = QtGui.QFileDialog.getSaveFileName()
|
|
||||||
fileName = str(fileName)
|
fileName = str(fileName)
|
||||||
PlotItem.lastFileDir = os.path.dirname(fileName)
|
PlotItem.lastFileDir = os.path.dirname(fileName)
|
||||||
|
|
||||||
@ -1237,3 +1210,11 @@ class PlotItem(GraphicsWidget):
|
|||||||
#else:
|
#else:
|
||||||
#self.autoBtn.show()
|
#self.autoBtn.show()
|
||||||
|
|
||||||
|
def _choose_filename_dialog(self, handler):
|
||||||
|
self.fileDialog = FileDialog()
|
||||||
|
if PlotItem.lastFileDir is not None:
|
||||||
|
self.fileDialog.setDirectory(PlotItem.lastFileDir)
|
||||||
|
self.fileDialog.setFileMode(QtGui.QFileDialog.AnyFile)
|
||||||
|
self.fileDialog.setAcceptMode(QtGui.QFileDialog.AcceptSave)
|
||||||
|
self.fileDialog.show()
|
||||||
|
self.fileDialog.fileSelected.connect(handler)
|
||||||
|
@ -34,14 +34,3 @@ def test_getViewWidget_deleted():
|
|||||||
|
|
||||||
assert not pg.Qt.isQObjectAlive(view)
|
assert not pg.Qt.isQObjectAlive(view)
|
||||||
assert item.getViewWidget() is None
|
assert item.getViewWidget() is None
|
||||||
|
|
||||||
|
|
||||||
#if __name__ == '__main__':
|
|
||||||
#view = pg.PlotItem()
|
|
||||||
#vref = weakref.ref(view)
|
|
||||||
#item = pg.InfiniteLine()
|
|
||||||
#view.addItem(item)
|
|
||||||
#del view
|
|
||||||
#gc.collect()
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user