def __init__(self, x=None, y1=None, y2=None, set_range=None): super(MyPW, self).__init__() self.plotItem.autoBtn = ButtonItem.ButtonItem( pixmaps.getPixmap('default'), 14, self.plotItem) self._rescale = lambda: None # self.plotItem.autoBtn.clicked.connect(self._rescale) self.plotItem.vb.menu.clear() self.vmenu = QtGui.QMenu() defaultview = QtGui.QAction("Default View", self.vmenu) defaultview.triggered.connect(set_range) self.vmenu.addAction(defaultview) self.plotItem.ctrlMenu = [defaultview] # mouse tracking label self.x = x self.y1 = y1 self.y2 = y2 # delete default view, get rid of Export self.plotItem.hideButtons() self.plotItem.scene().contextMenu = None # get rid of 'Export' self.proxy = pg.SignalProxy(self.plotItem.scene().sigMouseMoved, rateLimit=60, slot=self.mouseMoved)
def __init__(self): super(MyPW, self).__init__() self.plotItem.autoBtn = ButtonItem.ButtonItem( pixmaps.getPixmap('default'), 14, self.plotItem) self._rescale = lambda: None self.plotItem.autoBtn.clicked.connect(self._rescale) self.plotItem.vb.menu.clear() self.plotItem.ctrlMenu = None # delete default view, get rid of Export self.plotItem.hideButtons() self.plotItem.scene().contextMenu = None # get rid of 'Export'
def __init__(self, param, depth): ParameterItem.__init__(self, param, depth) self.hideWidget = True # hide edit widget, replace with label when not selected # set this to False to keep the editor widget always visible # build widget into column 1 with a display label and default button. w = self.makeWidget() self.widget = w self.eventProxy = EventProxy(w, self.widgetEventFilter) opts = self.param.opts if 'tip' in opts: w.setToolTip(opts['tip']) self.defaultBtn = QtWidgets.QPushButton() self.defaultBtn.setFixedWidth(20) self.defaultBtn.setFixedHeight(20) modDir = os.path.dirname(__file__) self.defaultBtn.setIcon(QtGui.QIcon(pixmaps.getPixmap('default'))) self.defaultBtn.clicked.connect(self.defaultClicked) # hide defaults-button if param is readonly: if opts.get('readonly', False): self.defaultBtn.hide() self.displayLabel = QtWidgets.QLabel() layout = QtWidgets.QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(2) layout.addWidget(w) layout.addWidget(self.displayLabel) layout.addWidget(self.defaultBtn) self.layoutWidget = QtWidgets.QWidget() self.layoutWidget.setLayout(layout) if w.sigChanged is not None: w.sigChanged.connect(self.widgetValueChanged) if hasattr(w, 'sigChanging'): w.sigChanging.connect(self.widgetValueChanging) # update value shown in widget. if opts.get('value', None) is not None: self.valueChanged(self, opts['value'], force=True) else: # no starting value was given; use whatever the widget has self.widgetValueChanged()
def __init__(self, x=None, y1=None, y2=None, set_range=None, num=None, set_range_byspbox=None): super(MyPW, self).__init__() self.plotItem.autoBtn = ButtonItem.ButtonItem( pixmaps.getPixmap('default'), 14, self.plotItem) self._rescale = lambda: None # self.plotItem.autoBtn.clicked.connect(self._rescale) self.plotItem.vb.menu.clear() # to use clear_points in main.py self.num = num self.vmenu = QtGui.QMenu() defaultview = QtGui.QAction("Default View", self.vmenu) defaultview.triggered.connect(set_range) self.vmenu.addAction(defaultview) self.set_range_byspbox = set_range_byspbox view_range = QtGui.QAction("View Range", self.vmenu) view_range.triggered.connect(self.view_range) self.vmenu.addAction(view_range) self.rwindow = QtGui.QMainWindow() self.rwindow.setWindowIcon(QtGui.QIcon(logo)) self.rwindow.setWindowTitle("View Range") boxeswidget = QtGui.QWidget(self.rwindow) spinbox_layout = QtGui.QGridLayout(boxeswidget) # change the name based on nums self.xrange = QtGui.QDoubleSpinBox() self.yrange = QtGui.QDoubleSpinBox() self.xrange_end = QtGui.QDoubleSpinBox() self.yrange_end = QtGui.QDoubleSpinBox() self.xrange.setDecimals(4) self.xrange_end.setDecimals(4) self.yrange.setDecimals(4) self.yrange_end.setDecimals(4) self.font = QtGui.QFont("", 13) self.label_x = QtGui.QLabel() self.label_x.setAlignment(QtCore.Qt.AlignCenter) self.label_x.setFont(self.font) self.label_y = QtGui.QLabel() self.label_y.setAlignment(QtCore.Qt.AlignCenter) self.label_y.setFont(self.font) self.xrange.setButtonSymbols(QtGui.QDoubleSpinBox.NoButtons) self.xrange_end.setButtonSymbols(QtGui.QDoubleSpinBox.NoButtons) self.yrange.setButtonSymbols(QtGui.QDoubleSpinBox.NoButtons) self.yrange_end.setButtonSymbols(QtGui.QDoubleSpinBox.NoButtons) self.xrange.valueChanged.connect(self.range_handler_x) self.xrange_end.valueChanged.connect(self.range_handler_x_end) self.yrange.valueChanged.connect(self.range_handler_y) self.yrange_end.valueChanged.connect(self.range_handler_y_end) self.label_x.setText(x) self.label_y.setText(y1) if y2: self.y2range = QtGui.QDoubleSpinBox() self.y2range_end = QtGui.QDoubleSpinBox() self.label_y2 = QtGui.QLabel() self.label_y2.setAlignment(QtCore.Qt.AlignCenter) self.label_y2.setFont(self.font) self.label_y2.setText(y2) self.y2range.setButtonSymbols(QtGui.QDoubleSpinBox.NoButtons) self.y2range_end.setButtonSymbols(QtGui.QDoubleSpinBox.NoButtons) self.y2range.valueChanged.connect(self.range_handler_y2) self.y2range_end.valueChanged.connect(self.range_handler_y2_end) self.y2range.setDecimals(4) self.y2range_end.setDecimals(4) spinbox_layout.addWidget(self.label_x, 0, 0, 1, 1) spinbox_layout.addWidget(self.label_y, 1, 0, 1, 1) spinbox_layout.addWidget(self.label_y2, 2, 0, 1, 1) spinbox_layout.addWidget(self.xrange, 0, 1, 1, 1) spinbox_layout.addWidget(self.yrange, 1, 1, 1, 1) spinbox_layout.addWidget(self.y2range, 2, 1, 1, 1) spinbox_layout.addWidget(self.xrange_end, 0, 2, 1, 1) spinbox_layout.addWidget(self.yrange_end, 1, 2, 1, 1) spinbox_layout.addWidget(self.y2range_end, 2, 2, 1, 1) else: spinbox_layout.addWidget(self.label_x, 0, 0, 1, 1) spinbox_layout.addWidget(self.label_y, 1, 0, 1, 1) spinbox_layout.addWidget(self.xrange, 0, 1, 1, 1) spinbox_layout.addWidget(self.yrange, 1, 1, 1, 1) spinbox_layout.addWidget(self.xrange_end, 0, 2, 1, 1) spinbox_layout.addWidget(self.yrange_end, 1, 2, 1, 1) self.rwindow.setCentralWidget(boxeswidget) self.plotItem.ctrlMenu = [defaultview, view_range] self.main = main # mouse tracking label self.x = x self.y1 = y1 self.y2 = y2 # delete default view, get rid of Export self.plotItem.hideButtons() self.plotItem.scene().contextMenu = None # get rid of 'Export' # print(dir(self.plotItem)) # print(dir(self.plotItem.scene())) # print(dir(self.plotItem.scene())) self.proxy = pg.SignalProxy(self.plotItem.scene().sigMouseMoved, rateLimit=60, slot=self.mouseMoved)