示例#1
0
 def create_spinbox(self, prefix, suffix, option, default=NoDefault,
                    min_=None, max_=None, step=None, tip=None):
     if prefix:
         plabel = QLabel(prefix)
     else:
         plabel = None
     if suffix:
         slabel = QLabel(suffix)
     else:
         slabel = None
     spinbox = QSpinBox()
     if min_ is not None:
         spinbox.setMinimum(min_)
     if max_ is not None:
         spinbox.setMaximum(max_)
     if step is not None:
         spinbox.setSingleStep(step)
     if tip is not None:
         spinbox.setToolTip(tip)
     self.spinboxes[option] = spinbox
     layout = QHBoxLayout()
     for subwidget in (plabel, spinbox, slabel):
         if subwidget is not None:
             layout.addWidget(subwidget)
     layout.addStretch(1)
     layout.setContentsMargins(0, 0, 0, 0)
     widget = QWidget(self)
     widget.setLayout(layout)
     return widget
示例#2
0
class Panel(QToolBar):

    def __init__(self, state, parent=None, *, editableFontSize=False):
        super().__init__(parent)
        self.appState = state
        self.state = FormatState(self.appState, self)
        self.fontSizeSpinBox = None
        if editableFontSize:
            self.fontSizeSpinBox = QSpinBox()
            self.fontSizeSpinBox.setAlignment(Qt.AlignRight)
            self.fontSizeSpinBox.setFocusPolicy(Qt.NoFocus)
            self.fontSizeSpinBox.setRange(MIN_FONT_SIZE, MAX_FONT_SIZE)
            self.fontSizeSpinBox.setSuffix(" pt")
            self.fontSizeSpinBox.setValue(self.appState.stdFontSize)
            self.fontSizeSpinBox.setToolTip("""<p><b>Font Size</b></p>
<p>Set the font size in points.</p>""")
        self.formatActions = Actions.Format.Actions(
            self, self.fontSizeSpinBox)
        for action in self.formatActions.forToolbar():
            if action is not None:
                self.addAction(action)
            else:
                self.addSeparator()
        if editableFontSize:
            self.addWidget(self.fontSizeSpinBox)
class DoFPCompound(QGroupBox):
  def __init__(self, parent=None):
    super(DoFPCompound, self).__init__(parent)
    self.setTitle("doFP")
    self.button_execute = QPushButton("Execute ...")
    self.spinbox_iterations = QSpinBox()
    self.spinbox_iterations.setMaximum(9999)
    self.spinbox_iterations.setValue(200)
    self.spinbox_iterations.setToolTip("No. iterations")
    layout = QHBoxLayout()
    layout.addWidget(self.spinbox_iterations)
    layout.addWidget(self.button_execute)
    self.setLayout(layout)
示例#4
0
 def create_spinbox(self,
                    prefix,
                    suffix,
                    option,
                    default=NoDefault,
                    min_=None,
                    max_=None,
                    step=None,
                    tip=None):
     if prefix:
         plabel = QLabel(prefix)
     else:
         plabel = None
     if suffix:
         slabel = QLabel(suffix)
     else:
         slabel = None
     spinbox = QSpinBox()
     if min_ is not None:
         spinbox.setMinimum(min_)
     if max_ is not None:
         spinbox.setMaximum(max_)
     if step is not None:
         spinbox.setSingleStep(step)
     if tip is not None:
         spinbox.setToolTip(tip)
     self.spinboxes[option] = spinbox
     layout = QHBoxLayout()
     for subwidget in (plabel, spinbox, slabel):
         if subwidget is not None:
             layout.addWidget(subwidget)
     layout.addStretch(1)
     layout.setContentsMargins(0, 0, 0, 0)
     widget = QWidget(self)
     widget.setLayout(layout)
     return widget