def __init__(self, parent): QAbstractSpinBox.__init__(self, parent) self.fName = "" self.fMinimum = 0.0 self.fMaximum = 1.0 self.fDefault = 0.0 self.fValue = None self.fStep = 0.01 self.fStepSmall = 0.0001 self.fStepLarge = 0.1 self.fIsReadOnly = False self.fScalePoints = None self.fUseScalePoints = False self.fBar = ParamProgressBar(self) self.fBar.setContextMenuPolicy(Qt.NoContextMenu) #self.fBar.show() self.fBox = None self.lineEdit().hide() self.customContextMenuRequested.connect(self.slot_showCustomMenu) self.fBar.valueChanged.connect(self.slot_progressBarValueChanged) QTimer.singleShot(0, self.slot_updateProgressBarGeometry)
def _add_data_option_menu(self): """add data option submenu to Plot Options menu Data option menu contains actions to to clear present data; set the clear-on-startup option; and enable data autosave option """ # Clear data clear_data = QtGui.QAction( "Clear Data", self.data_options ) clear_data.triggered.connect(self.tpg.clear_all_data) self.data_options.addAction(clear_data) self.data_options.clear_data = clear_data # Automatic clear data automatic_clear = QtGui.QWidgetAction(self.data_options) automatic_clear_checkbox = QtGui.QCheckBox("Clear Old Data on Start") automatic_clear.setDefaultWidget(automatic_clear_checkbox) automatic_clear_checkbox.stateChanged.connect(self.tpg.save_data_settings) self.data_options.addAction(automatic_clear) self.data_options.automatic_clear = automatic_clear self.data_options.automatic_clear_checkbox = automatic_clear_checkbox # autosave autosave = QtGui.QWidgetAction(self.data_options) autosave_widget = QWidget() autosave_layout = QHBoxLayout() autosave_layout.setContentsMargins(0,0,0,0) autosave_checkbox = QtGui.QCheckBox("Automatically Save Data") autosave_checkbox.stateChanged.connect(self.tpg.set_all_autosave) autosave_checkbox.setChecked(self.tpg.settings['do_autosave']) autosave_nr = QSpinBox() autosave_nr.setButtonSymbols(QAbstractSpinBox().NoButtons) autosave_nr.setRange(10, 1000) autosave_nr.setValue(self.tpg.settings['autosave_nr']) autosave_nr.valueChanged.connect(self.tpg.set_all_autosave_nr) autosave_layout.addWidget(autosave_checkbox) autosave_layout.addWidget(autosave_nr) autosave_widget.setLayout(autosave_layout) autosave.setDefaultWidget(autosave_widget) self.data_options.addAction(autosave) # self.data_options.autosave = autosave setattr(self.data_options, 'autosave', autosave) setattr(self.data_options, 'autosave_checkbox', autosave_checkbox) setattr(self.data_options, 'autosave_nr', autosave_nr)
def resizeEvent(self, event): QAbstractSpinBox.resizeEvent(self, event) self.slot_updateProgressBarGeometry()
def setEnabled(self, yesNo): self.fBar.setEnabled(yesNo) QAbstractSpinBox.setEnabled(self, yesNo)
def setReadOnly(self, yesNo): self.fIsReadOnly = yesNo self.setButtonSymbols(QAbstractSpinBox.UpDownArrows if yesNo else QAbstractSpinBox.NoButtons) QAbstractSpinBox.setReadOnly(self, yesNo)
def __init__(self, *args): QAbstractSpinBox.__init__(self, *args) regexp = QtCore.QRegExp("^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$") self.validator = QtGui.QRegExpValidator(regexp) self._value = None
def setToolTip(self, text): self.fBar.setToolTip(text) QAbstractSpinBox.setToolTip(self, text)
def __init__(self, *args): QAbstractSpinBox.__init__(self, *args) regexp = QtCore.QRegExp('^0x[0-9A-Fa-f]{1,10}$') self.validator = QtGui.QRegExpValidator(regexp) self._value = 0