def initObjectsAndCompanions(self, creators, objColl, dependents, depLinks): DataView.initObjectsAndCompanions(self, creators, objColl, dependents, depLinks) for ctrlName in objColl.propertiesByName.keys(): for prop in objColl.propertiesByName[ctrlName]: if prop.prop_setter == 'SetSizer': compn, ctrl = self.controllerView.objects[ctrlName][:2] sizer = self.objects[Utils.ctrlNameFromSrcRef(prop.params[0])][1] compn.SetSizer(sizer) self.sizerConnectList.append(prop)
def __init__(self, callback): gtk.HPaned.__init__(self) self.company_view = CompanyView(callback) self.company_view.show() self.pack1(self.company_view, shrink=False) self.data_view = DataView() self.data_view.show() self.pack2(self.data_view, shrink=False) self.set_position(300)
def __init__(self, dataEngine, dataFormat, parent = None): DataView.__init__(self, dataEngine, dataFormat, parent) self.updateCount = 0 self.setMinimumHeight(200) self.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) l = QtGui.QVBoxLayout(self) self.glWidget = MyGLViewWidget(self) l.addWidget(self.glWidget) hlayout = QtGui.QHBoxLayout() hlayout.addWidget(QtGui.QLabel('Depth Threshold:')) self.spanSlider = QxtSpanSlider() self.spanSlider.floatLowerPositionChanged.connect(self.updateLowerLevel) self.spanSlider.floatUpperPositionChanged.connect(self.updateUpperLevel) hlayout.addWidget(self.spanSlider) l.addLayout(hlayout) self.glWidget.opts['distance'] = 20 self.gridItem = gl.GLGridItem(size = QtGui.QVector3D(10,10,1)) self.glWidget.addItem(self.gridItem) self.axisItem = gl.GLAxisItem() self.axisItem.setSize(3,3,3) self.glWidget.addItem(self.axisItem) pos = np.array([[0., 0., 0.]]) color = np.array([[0., 0., 0., 0.]]) self.scatterItem = gl.GLScatterPlotItem(pxMode = True, size = 2, pos = pos, color = color) self.glWidget.addItem(self.scatterItem) self.glWidget.resetCamera() self.glWidget.export.connect(self.exportImage) DataView.communicator.setCurrentPoint2D.connect(self.setCenter, QtCore.Qt.QueuedConnection) DataView.communicator.thresholdsChanged.connect(self.setThresholds, QtCore.Qt.QueuedConnection) self.currentPCF = None self.dataEngine.getDepthCameraController().started.connect(self.streamStarted) self.setSpanKeyModifier(QtCore.Qt.ControlModifier)
def deleteCtrl(self, name, parentRef=None): DataView.deleteCtrl(self, name, parentRef) srName = Utils.srcRefFromCtrlName(name) for prop in self.sizerConnectList[:]: if prop.params[0] == srName: compn, ctrl = self.controllerView.objects[prop.comp_name][:2] ctrl.SetSizer(None) ctrl.Refresh() self.sizerConnectList.remove(prop) wx.CallAfter(self.recreateSizers) wx.CallAfter(self.controllerView.OnRelayoutDesigner, None) #Refresh()
def deleteCtrl(self, name, parentRef = None): DataView.deleteCtrl(self, name, parentRef) srName = Utils.srcRefFromCtrlName(name) for prop in self.sizerConnectList[:]: if prop.params[0] == srName: compn, ctrl = self.controllerView.objects[prop.comp_name][:2] ctrl.SetSizer(None) ctrl.Refresh() self.sizerConnectList.remove(prop) wx.CallAfter(self.recreateSizers) wx.CallAfter(self.controllerView.OnRelayoutDesigner, None)#Refresh()
def setDataFormat(self, dataFormatName): if not self.dataEngine.dataFormats.has_key(dataFormatName): QtGui.QMessageBox( 'DataView failed', 'Failed to show data of format "' + dataFormatName + '"') self.dataFormat = self.dataEngine.dataFormats[dataFormatName] self.setTitle(self.dataFormat.title) if hasattr( self, 'dataView' ) and self.dataView.dataFormat.dataType == self.dataFormat.dataType: #self.dataView.unlink() #QtGui.QWidget().setLayout(self.layout) #print 'Linking new data...' self.dataView.setDataFormat(self.dataFormat) else: if hasattr(self, 'dataView'): self.dataView.cleanup() QtGui.QWidget().setLayout(self.layout) self.layout = QtGui.QVBoxLayout() self.dataView = DataView.getDataView(self.dataFormat, self.dataEngine) if self.statusBar: self.dataView.setStatusBar(self.statusBar) self.layout.addWidget(self.dataView) self.setLayout(self.layout) if self.dataFormat.dataType == DataFormat.DATA_2D and self.shouldLinkViewBox: self.dataView.linkViewBox()
class MainView(gtk.HPaned): def __init__(self, callback): gtk.HPaned.__init__(self) self.company_view = CompanyView(callback) self.company_view.show() self.pack1(self.company_view, shrink=False) self.data_view = DataView() self.data_view.show() self.pack2(self.data_view, shrink=False) self.set_position(300) def clear(self): self.data_view.clear() def load(self, symbols, dates=None): self.data_view.load(symbols, dates)
def __init__(self, dataEngine, dataFormat, sizeRect=None, parent=None): DataView.__init__(self, dataEngine, dataFormat, parent) self.updateCount = 0 self.graphicsWidget = pyqtgraph.GraphicsLayoutWidget() hlayout = QtGui.QHBoxLayout() self.viewBox = CustomViewBox() self.graphicsWidget.addItem(self.viewBox) self.viewBox.sigRangeChanged.connect(self.computeChangedRange) self.imageItem = pyqtgraph.ImageItem() self.viewBox.addItem(self.imageItem) if sizeRect: self.viewBox.setRange(sizeRect) hlayout.addWidget(self.graphicsWidget) self.histogramLUTWidget = CustomHistogramLUTWidget() hlayout.addWidget(self.histogramLUTWidget) self.histogramLUTWidget.setImageItem(self.imageItem) self.viewBox.resetView.connect(self.resetView) self.histogramLUTWidget.resetView.connect(self.resetView) self.viewBox.autoHistogram.connect(self.autoLevels) self.histogramLUTWidget.autoHistogram.connect(self.autoLevels) self.viewBox.histogramToggle.connect(self.toggleHistogramView) self.histogramLUTWidget.histogramToggle.connect( self.toggleHistogramView) self.viewBox.export.connect(self.exportImage) self.histogramLUTWidget.export.connect(self.exportImage) self.layout = QtGui.QVBoxLayout() self.layout.addLayout(hlayout) hlayout = QtGui.QHBoxLayout() self.spanLabel = QtGui.QLabel('Threshold:') hlayout.addWidget(self.spanLabel) self.spanSlider = QxtSpanSlider() self.spanSlider.lowerPositionChanged.connect(self.updateLowerLevel) self.spanSlider.upperPositionChanged.connect(self.updateUpperLevel) hlayout.addWidget(self.spanSlider) self.layout.addLayout(hlayout) self.setLayout(self.layout) self.setFocusProxy(self.graphicsWidget) self.setDataFormat(dataFormat) self.graphicsWidget.scene().sigMouseMoved.connect( self.getMousePosition) self.graphicsWidget.scene().sigMouseClicked.connect( self.sendClickPosition) self.depthCameraController = dataEngine.getDepthCameraController() self.depthCameraController.started.connect(self.streamStarted) self.histogramVisible = True self.toggleHistogramView() m1 = DataView2DMenu(self) m2 = DataView2DMenu(self) self.viewBox.setMenu(m1) self.histogramLUTWidget.setMenu(m2) m1.histogramAction.toggled.connect(m2.histogramAction.setChecked) m2.histogramAction.toggled.connect(m1.histogramAction.setChecked) self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
def saveCtrls(self, definedCtrls, module=None): collDeps = [] self.writeSizerConnectProps(collDeps) DataView.saveCtrls(self, definedCtrls, module, collDeps=collDeps)
def __init__(self, parent, inspector, model, compPal, designer): DataView.__init__(self, parent, inspector, model, compPal) designer.initSizers(self) self.sizerConnectList = []