当前位置: 首页>>代码示例>>Python>>正文


Python QVBoxLayout.addSpacerItem方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QVBoxLayout.addSpacerItem方法的典型用法代码示例。如果您正苦于以下问题:Python QVBoxLayout.addSpacerItem方法的具体用法?Python QVBoxLayout.addSpacerItem怎么用?Python QVBoxLayout.addSpacerItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets.QVBoxLayout的用法示例。


在下文中一共展示了QVBoxLayout.addSpacerItem方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: initAppletDrawerUi

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addSpacerItem [as 别名]
 def initAppletDrawerUi(self):
     training_controls = EdgeTrainingGui.createDrawerControls(self)
     training_controls.layout().setContentsMargins(5,0,5,0)
     training_layout = QVBoxLayout()
     training_layout.addWidget( training_controls )
     training_layout.setContentsMargins(0,15,0,0)
     training_box = QGroupBox( "Training", parent=self )
     training_box.setLayout(training_layout)
     training_box.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
     
     multicut_controls = MulticutGuiMixin.createDrawerControls(self)
     multicut_controls.layout().setContentsMargins(5,0,5,0)
     multicut_layout = QVBoxLayout()
     multicut_layout.addWidget( multicut_controls )
     multicut_layout.setContentsMargins(0,15,0,0)
     multicut_box = QGroupBox( "Multicut", parent=self )
     multicut_box.setLayout(multicut_layout)
     multicut_box.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
     
     drawer_layout = QVBoxLayout()
     drawer_layout.addWidget(training_box)
     drawer_layout.addWidget(multicut_box)
     drawer_layout.setSpacing(2)
     drawer_layout.setContentsMargins(5,5,5,5)
     drawer_layout.addSpacerItem( QSpacerItem(0, 10, QSizePolicy.Minimum, QSizePolicy.Expanding) )
     
     self._drawer = QWidget(parent=self)
     self._drawer.setLayout(drawer_layout)        
开发者ID:DerThorsten,项目名称:ilastik,代码行数:30,代码来源:edgeTrainingWithMulticutGui.py

示例2: initAppletDrawerUi

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addSpacerItem [as 别名]
    def initAppletDrawerUi(self):
        localDir = os.path.split(__file__)[0]
        self._drawer = self._cropControlUi

        data_has_z_axis = True
        if self.topLevelOperatorView.InputImage.ready():
            tShape = self.topLevelOperatorView.InputImage.meta.getTaggedShape()
            if not 'z' in tShape or tShape['z']==1:
                data_has_z_axis = False

        self._cropControlUi._minSliderZ.setVisible(data_has_z_axis)
        self._cropControlUi._minSliderZ.setVisible(data_has_z_axis)
        self._cropControlUi._maxSliderZ.setVisible(data_has_z_axis)
        self._cropControlUi._minSpinZ.setVisible(data_has_z_axis)
        self._cropControlUi._maxSpinZ.setVisible(data_has_z_axis)
        self._cropControlUi.labelMinZ.setVisible(data_has_z_axis)
        self._cropControlUi.labelMaxZ.setVisible(data_has_z_axis)

        self._cropControlUi.AddCropButton.clicked.connect( bind (self.newCrop) )
        self._cropControlUi.SetCropButton.setVisible(False)
        self.editor.cropModel.mouseRelease.connect(bind(self.setCrop))

        self.topLevelOperatorView.MinValueT.notifyDirty(self.apply_operator_settings_to_gui)
        self.topLevelOperatorView.MaxValueT.notifyDirty(self.apply_operator_settings_to_gui)
        self.topLevelOperatorView.MinValueX.notifyDirty(self.apply_operator_settings_to_gui)
        self.topLevelOperatorView.MaxValueX.notifyDirty(self.apply_operator_settings_to_gui)
        self.topLevelOperatorView.MinValueY.notifyDirty(self.apply_operator_settings_to_gui)
        self.topLevelOperatorView.MaxValueY.notifyDirty(self.apply_operator_settings_to_gui)
        self.topLevelOperatorView.MinValueZ.notifyDirty(self.apply_operator_settings_to_gui)
        self.topLevelOperatorView.MaxValueZ.notifyDirty(self.apply_operator_settings_to_gui)

        self.topLevelOperatorView.InputImage.notifyDirty(self.setDefaultValues)
        self.topLevelOperatorView.PredictionImage.notifyDirty(self.setDefaultValues)

        layout = QVBoxLayout()
        layout.setSpacing(0)
        layout.addWidget( self._cropControlUi )
        layout.addSpacerItem( QSpacerItem(0,0,vPolicy=QSizePolicy.Expanding) )

        self.setDefaultValues()
        self.apply_operator_settings_to_gui()

        self.editor.showCropLines(True)
        self.editor.cropModel.setEditable (True)
        self.editor.cropModel.changed.connect(self.onCropModelChanged)
        self.editor.posModel.timeChanged.connect(self.updateTime)
        self._cropControlUi._minSliderT.valueChanged.connect(self._onMinSliderTMoved)
        self._cropControlUi._maxSliderT.valueChanged.connect(self._onMaxSliderTMoved)
        self._cropControlUi._minSliderX.valueChanged.connect(self._onMinSliderXMoved)
        self._cropControlUi._maxSliderX.valueChanged.connect(self._onMaxSliderXMoved)
        self._cropControlUi._minSliderY.valueChanged.connect(self._onMinSliderYMoved)
        self._cropControlUi._maxSliderY.valueChanged.connect(self._onMaxSliderYMoved)
        self._cropControlUi._minSliderZ.valueChanged.connect(self._onMinSliderZMoved)
        self._cropControlUi._maxSliderZ.valueChanged.connect(self._onMaxSliderZMoved)

        self._cropControlUi.cropListView.deleteCrop.connect(self.onDeleteCrop)
        self._cropControlUi.cropListView.colorsChanged.connect(self.onColorsChanged)

        self._initCropListView()
开发者ID:DerThorsten,项目名称:ilastik,代码行数:61,代码来源:cropSelectionGui.py

示例3: createDrawerControls

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addSpacerItem [as 别名]
    def createDrawerControls(self):
        op = self.topLevelOperatorView

        def configure_update_handlers( qt_signal, op_slot ):
            qt_signal.connect( self.configure_operator_from_gui )
            cleanup_fn = op_slot.notifyDirty( self.configure_gui_from_operator, defer=True )
            self.__cleanup_fns.append( cleanup_fn )

        # Controls
        feature_selection_button = QPushButton(text="Select Features",
                                               icon=QIcon(ilastikIcons.AddSel),
                                               toolTip="Select edge/superpixel features to use for classification.",
                                               clicked=self._open_feature_selection_dlg)
        self.train_from_gt_button = QPushButton(text="Auto-label",
                                                icon=QIcon(ilastikIcons.Segment),
                                                toolTip="Automatically label all edges according to your pre-loaded groundtruth volume.",
                                                clicked=self._handle_label_from_gt_clicked)
        self.clear_labels_button = QPushButton(text="Clear Labels",
                                               icon=QIcon(ilastikIcons.Clear),
                                               toolTip="Remove all edge labels. (Start over on this image.)",
                                               clicked=self._handle_clear_labels_clicked)
        self.live_update_button = QPushButton(text="Live Predict",
                                              checkable=True,
                                              icon=QIcon(ilastikIcons.Play),
                                              toolTip="Update the edge classifier predictions",
                                              clicked=self._handle_live_update_clicked)
        configure_update_handlers( self.live_update_button.toggled, op.FreezeCache )
        
        # Layout
        label_layout = QHBoxLayout()
        label_layout.addWidget(self.clear_labels_button)
        label_layout.addWidget(self.train_from_gt_button)
        label_layout.setSpacing(1)
        
        layout = QVBoxLayout()
        layout.addWidget(feature_selection_button)
        layout.setSpacing(1)
        layout.addLayout(label_layout)
        layout.addWidget(self.live_update_button)
        layout.addSpacerItem( QSpacerItem(0, 10, QSizePolicy.Minimum, QSizePolicy.Expanding) )
        
        # Finally, the whole drawer widget
        drawer = QWidget(parent=self)
        drawer.setLayout(layout)

        # Widget Shortcuts
        mgr = ShortcutManager()
        ActionInfo = ShortcutManager.ActionInfo
        shortcut_group = "Edge Training"
        mgr.register( "l", ActionInfo( shortcut_group,
                                       "Live Predict",
                                       "Toggle live edge classifier update mode",
                                       self.live_update_button.toggle,
                                       self.live_update_button,
                                       self.live_update_button ) )

        
        return drawer
开发者ID:DerThorsten,项目名称:ilastik,代码行数:60,代码来源:edgeTrainingGui.py

示例4: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addSpacerItem [as 别名]
    def __init__(self, parent):
        super(FindInFilesWidget, self).__init__(parent)
        self._main_container = IDE.get_service('main_container')
        self._explorer_container = IDE.get_service('explorer')
        self._result_widget = FindInFilesResult()
        self._open_find_button = QPushButton(translations.TR_FIND + "!")
        self._stop_button = QPushButton(translations.TR_STOP + "!")
        self._clear_button = QPushButton(translations.TR_CLEAR + "!")
        self._replace_button = QPushButton(translations.TR_REPLACE)
        self._find_widget = FindInFilesDialog(self._result_widget, self)
        self._error_label = QLabel(translations.TR_NO_RESULTS)
        self._error_label.setVisible(False)
        #Replace Area
        self.replace_widget = QWidget()
        hbox_replace = QHBoxLayout(self.replace_widget)
        hbox_replace.setContentsMargins(0, 0, 0, 0)
        self.lbl_replace = QLabel(translations.TR_REPLACE_RESULTS_WITH)
        self.lbl_replace.setTextFormat(Qt.PlainText)
        self.replace_edit = QLineEdit()
        hbox_replace.addWidget(self.lbl_replace)
        hbox_replace.addWidget(self.replace_edit)
        self.replace_widget.setVisible(False)
        #Main Layout
        main_hbox = QHBoxLayout(self)
        #Result Layout
        tree_vbox = QVBoxLayout()
        tree_vbox.addWidget(self._result_widget)
        tree_vbox.addWidget(self._error_label)
        tree_vbox.addWidget(self.replace_widget)

        main_hbox.addLayout(tree_vbox)
        #Buttons Layout
        vbox = QVBoxLayout()
        vbox.addWidget(self._open_find_button)
        vbox.addWidget(self._stop_button)
        vbox.addWidget(self._clear_button)
        vbox.addSpacerItem(QSpacerItem(0, 50,
            QSizePolicy.Fixed, QSizePolicy.Expanding))
        vbox.addWidget(self._replace_button)
        main_hbox.addLayout(vbox)

        self._open_find_button.setFocus()
        #signals
        self._open_find_button.clicked['bool'].connect(self.open)
        self._stop_button.clicked['bool'].connect(self._find_stop)
        self._clear_button.clicked['bool'].connect(self._clear_results)
        self._result_widget.itemActivated['QTreeWidgetItem*', int].connect(self._go_to)
        self._result_widget.itemClicked['QTreeWidgetItem*', int].connect(self._go_to)
        self._find_widget.finished.connect(self._find_finished)
        self._find_widget.findStarted.connect(self._find_started)
        self._replace_button.clicked['bool'].connect(self._replace_results)
开发者ID:Salmista-94,项目名称:Ninja_3.0_PyQt5,代码行数:53,代码来源:find_in_files.py

示例5: SettingsPage

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addSpacerItem [as 别名]
class SettingsPage(QWidget):
    """Settings page for OpenTerm plugin
    """

    def __init__(self, parent, autodetectedCommand):
        QWidget.__init__(self, parent)

        text = "<html>Terminal emulator command.<br/>" + \
               "Leave empty to autodetect.<br/>" + \
               "Autodetected value is <i>{}</i></html>".format(autodetectedCommand)
        self._label = QLabel(text, self)
        self.edit = QLineEdit(self)

        self._vLayout = QVBoxLayout(self)
        self._vLayout.addWidget(self._label)
        self._vLayout.addWidget(self.edit)
        self._vLayout.addSpacerItem(QSpacerItem(0, 0, QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding))
开发者ID:gpa14,项目名称:enki,代码行数:19,代码来源:openterm.py

示例6: initAppletDrawerUi

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addSpacerItem [as 别名]
    def initAppletDrawerUi(self):
        # Load the ui file (find it in our own directory)
        localDir = os.path.split(__file__)[0]
        self._drawer = uic.loadUi(localDir+"/drawer.ui")

        # Init threshold widget        
        self.thresholdWidget = ThresholdingWidget(self)
        self.thresholdWidget.valueChanged.connect( self.apply_gui_settings_to_operator )

        # Add widget to a layout
        layout = QVBoxLayout()
        layout.setSpacing(0)
        layout.addWidget( self.thresholdWidget )
        layout.addSpacerItem( QSpacerItem(0,0,vPolicy=QSizePolicy.Expanding) )

        # Apply layout to the drawer
        self._drawer.setLayout( layout )

        # Initialize the gui with the operator's current values
        self.apply_operator_settings_to_gui()
开发者ID:DerThorsten,项目名称:ilastik,代码行数:22,代码来源:thresholdMaskingGui.py

示例7: initAppletDrawerUi

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addSpacerItem [as 别名]
    def initAppletDrawerUi(self):
        training_controls = EdgeTrainingGui.createDrawerControls(self)
        training_controls.layout().setContentsMargins(5,0,5,0)
        training_layout = QVBoxLayout()
        training_layout.addWidget( training_controls )
        training_layout.setContentsMargins(0,15,0,0)
        training_box = QGroupBox( "Training", parent=self )
        training_box.setLayout(training_layout)
        training_box.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        
        multicut_controls = MulticutGuiMixin.createDrawerControls(self)
        multicut_controls.layout().setContentsMargins(5,0,5,0)
        multicut_layout = QVBoxLayout()
        multicut_layout.addWidget( multicut_controls )
        multicut_layout.setContentsMargins(0,15,0,0)
        multicut_box = QGroupBox( "Multicut", parent=self )
        multicut_box.setLayout(multicut_layout)
        multicut_box.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        multicut_box.setEnabled(False)

        op = self.topLevelOperatorView
        multicut_required_slots = (
            op.Superpixels,
            op.Rag,
            op.EdgeProbabilities,
            op.EdgeProbabilitiesDict,
        )
        self.__cleanup_fns.append(guiutil.enable_when_ready(multicut_box, multicut_required_slots))

        drawer_layout = QVBoxLayout()
        drawer_layout.addWidget(training_box)
        drawer_layout.addWidget(multicut_box)
        drawer_layout.setSpacing(2)
        drawer_layout.setContentsMargins(5,5,5,5)
        drawer_layout.addSpacerItem( QSpacerItem(0, 10, QSizePolicy.Minimum, QSizePolicy.Expanding) )
        
        self._drawer = QWidget(parent=self)
        self._drawer.setLayout(drawer_layout)        
开发者ID:ilastik,项目名称:ilastik,代码行数:40,代码来源:edgeTrainingWithMulticutGui.py

示例8: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addSpacerItem [as 别名]
    def __init__(self, parent):
        super(ManualInstallWidget, self).__init__()
        self._parent = parent
        vbox = QVBoxLayout(self)
        form = QFormLayout()
        self._txtName = QLineEdit()
        self._txtName.setPlaceholderText('my_plugin')
        self._txtVersion = QLineEdit()
        self._txtVersion.setPlaceholderText('0.1')
        form.addRow(translations.TR_PROJECT_NAME, self._txtName)
        form.addRow(translations.TR_VERSION, self._txtVersion)
        vbox.addLayout(form)
        hPath = QHBoxLayout()
        self._txtFilePath = QLineEdit()
        self._txtFilePath.setPlaceholderText(os.path.join(
            os.path.expanduser('~'), 'full', 'path', 'to', 'plugin.zip'))
        self._btnFilePath = QPushButton(QIcon(":img/open"), '')
        self.completer, self.dirs = QCompleter(self), QDirModel(self)
        self.dirs.setFilter(QDir.AllEntries | QDir.NoDotAndDotDot)
        self.completer.setModel(self.dirs)
        self._txtFilePath.setCompleter(self.completer)
        hPath.addWidget(QLabel(translations.TR_FILENAME))
        hPath.addWidget(self._txtFilePath)
        hPath.addWidget(self._btnFilePath)
        vbox.addLayout(hPath)
        vbox.addSpacerItem(QSpacerItem(0, 1, QSizePolicy.Expanding,
            QSizePolicy.Expanding))

        hbox = QHBoxLayout()
        hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding))
        self._btnInstall = QPushButton(translations.TR_INSTALL)
        hbox.addWidget(self._btnInstall)
        vbox.addLayout(hbox)

        #Signals
        self._btnFilePath.clicked['bool'].connect(self._load_plugin_path)
        self._btnInstall.clicked['bool'].connect(self.install_plugin)
开发者ID:Salmista-94,项目名称:Ninja_3.0_PyQt5,代码行数:39,代码来源:plugins_manager.py

示例9: display_content

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addSpacerItem [as 别名]
    def display_content(self):
        #
        layout_main = QVBoxLayout()
        layout_main.setAlignment(Qt.AlignCenter)
        self.setLayout(layout_main)
        self.layouts.append(layout_main)

        #
        fonts = QFontDatabase()
        fonts.addApplicationFont('Fonts/Raleway/Raleway-ExtraLight.ttf')
        fonts.addApplicationFont('Fonts/OpenSans/OpenSans-Light.ttf')

        #
        title = QLabel("Eight Puzzle")
        title.setStyleSheet('font-size: 52px; color: #CECFD4;')
        title.setFont(QFont('Raleway'))
        layout_main.addWidget(title)
        layout_main.addSpacerItem(QSpacerItem(0, 12))

        #
        layout_tiles = QGridLayout()
        layout_tiles.setAlignment(Qt.AlignCenter)
        layout_main.addLayout(layout_tiles)
        for index in range(9):
            tile = QPushButton(str(self.puzzle.state[index]))
            tile.setStyleSheet('background-color: #879AA4;'
                               'color: #CECFD4; font-size: 32px;')
            tile.setFont(QFont('Open Sans'))
            tile.setFixedSize(75, 75)
            tile.setEnabled(False)
            tile.setFocusPolicy(Qt.NoFocus)
            layout_tiles.addWidget(tile, index / 3, index % 3)
            if self.puzzle.state[index] is '0':
                tile.setVisible(False)
            self.tiles.append(tile)
        self.layouts.append(layout_tiles)
        layout_main.addSpacerItem(QSpacerItem(0, 25))

        #
        layout_buttons = QGridLayout()
        layout_buttons.setAlignment(Qt.AlignCenter)
        layout_main.addLayout(layout_buttons)
        for index in range(3):
            button = QPushButton(['Shuffle', 'Solve', 'Quit'][index])
            button.setStyleSheet('background-color: #CECFD4;'
                                 'color: #363B57; font-size: 18px;')
            button.setFont(QFont('Raleway'))
            button.setFixedSize(90, 40)
            button.setFocusPolicy(Qt.NoFocus)
            layout_buttons.addWidget(button, 0, index)
            self.buttons.append(button)
        self.layouts.append(layout_buttons)
        layout_main.addSpacerItem(QSpacerItem(0, 10))
开发者ID:nsteely,项目名称:Eight-Puzzle,代码行数:55,代码来源:eight_puzzle_qt.py

示例10: createDrawerControls

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addSpacerItem [as 别名]
    def createDrawerControls(self):
        """
        This is a separate function from initAppletDrawer() so that it can be
        called and used within another applet (this class is a mixin).
        """
        op = self.__topLevelOperatorView

        def configure_update_handlers( qt_signal, op_slot ):
            qt_signal.connect( self.configure_operator_from_gui )
            op_slot.notifyDirty( self.configure_gui_from_operator )
            self.__cleanup_fns.append( partial( op_slot.unregisterDirty, self.configure_gui_from_operator ) )

        def control_layout( label_text, widget ):
            row_layout = QHBoxLayout()
            row_layout.addWidget( QLabel(label_text) )
            row_layout.addSpacerItem( QSpacerItem(10, 0, QSizePolicy.Expanding) )
            row_layout.addWidget(widget)
            return row_layout

        drawer_layout = QVBoxLayout()
        drawer_layout.setSpacing(1)

        # Beta
        beta_box = QDoubleSpinBox(decimals=2, minimum=0.01, maximum=0.99, singleStep=0.1,
                                  toolTip="Bias parameter for the multicut optimization.")
        configure_update_handlers( beta_box.valueChanged, op.Beta )
        beta_layout = control_layout("Beta", beta_box)
        drawer_layout.addLayout(beta_layout)
        self.beta_box = beta_box

        # Solver
        solver_name_combo = QComboBox(
            toolTip="Multicut optimization technique. Available solvers depend on which optimizer library you have installed.")
        for solver_name in AVAILABLE_SOLVER_NAMES:
            solver_name_combo.addItem(solver_name)
        configure_update_handlers( solver_name_combo.currentIndexChanged, op.SolverName )
        drawer_layout.addLayout( control_layout( "Solver", solver_name_combo ) )
        self.solver_name_combo = solver_name_combo

        button_layout = QHBoxLayout()
        
        # Live Multicut Button
        live_multicut_button = QPushButton(text="Live Multicut",
                                           checkable=True,
                                           icon=QIcon(ilastikIcons.Play))
        configure_update_handlers( live_multicut_button.toggled, op.FreezeCache )
        
        # Extra: Auto-show the multicut edges if necessary.
        def auto_show_multicut_layer(checked):
            if checked:
                self.getLayerByName("Multicut Edges").visible = True            
        live_multicut_button.toggled.connect( auto_show_multicut_layer )
        
        button_layout.addWidget(live_multicut_button)
        self.live_multicut_button = live_multicut_button
        
        # Update Button
        update_button = QPushButton(text="Update Now",
                                    icon=QIcon(ilastikIcons.Play),
                                    clicked=self._handle_mulicut_update_clicked)
        button_layout.addWidget(update_button)
        self.update_button = update_button
        
        drawer_layout.addLayout(button_layout)

        # Layout
        drawer_layout.addSpacerItem( QSpacerItem(0, 10, QSizePolicy.Minimum, QSizePolicy.Expanding) )
        
        # Finally, the whole drawer widget
        drawer = QWidget(parent=self)
        drawer.setLayout(drawer_layout)

        # Widget Shortcuts
        mgr = ShortcutManager()
        ActionInfo = ShortcutManager.ActionInfo
        shortcut_group = "Multicut"
        mgr.register( "u", ActionInfo( shortcut_group,
                                       "UpdateMulticut",
                                       "Run the multicut optimization using the current edge probabilities",
                                       update_button.click,
                                       update_button,
                                       update_button ) )

        return drawer
开发者ID:DerThorsten,项目名称:ilastik,代码行数:86,代码来源:multicutGui.py

示例11: initAppletDrawerUi

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import addSpacerItem [as 别名]
    def initAppletDrawerUi(self):
        """
        Overridden from base class (LayerViewerGui)
        """
        op = self.topLevelOperatorView
        
        def configure_update_handlers( qt_signal, op_slot ):
            qt_signal.connect( self.configure_operator_from_gui )
            op_slot.notifyDirty( self.configure_gui_from_operator )
            self.__cleanup_fns.append( partial( op_slot.unregisterDirty, self.configure_gui_from_operator ) )

        def control_layout( label_text, widget ):
            row_layout = QHBoxLayout()
            row_layout.addWidget( QLabel(label_text) )
            row_layout.addSpacerItem( QSpacerItem(10, 0, QSizePolicy.Expanding) )
            row_layout.addWidget(widget)
            return row_layout

        drawer_layout = QVBoxLayout()

        channel_button = QPushButton()
        self.channel_menu = QMenu(self) # Must retain menus (in self) or else they get deleted.
        channel_button.setMenu(self.channel_menu)
        channel_button.clicked.connect(channel_button.showMenu)
        def populate_channel_menu(*args):
            if sip.isdeleted(channel_button):
                return
            self.channel_menu.clear()
            self.channel_actions = []
            for ch in range(op.Input.meta.getTaggedShape()['c']):
                action = QAction("Channel {}".format(ch), self.channel_menu)
                action.setCheckable(True)
                self.channel_menu.addAction(action)
                self.channel_actions.append(action)
                configure_update_handlers( action.toggled, op.ChannelSelections )
        populate_channel_menu()
        op.Input.notifyMetaChanged( populate_channel_menu )
        self.__cleanup_fns.append( partial( op.Input.unregisterMetaChanged, populate_channel_menu ) )
        channel_button.setToolTip("Boundary channel index in the probability map")
        drawer_layout.addLayout( control_layout( "Input Channel", channel_button ) )
        self.channel_button = channel_button

        threshold_box = QDoubleSpinBox()
        threshold_box.setDecimals(2)
        threshold_box.setMinimum(0.00)
        threshold_box.setMaximum(1.0)
        threshold_box.setSingleStep(0.1)
        configure_update_handlers( threshold_box.valueChanged, op.Pmin )
        threshold_box.setToolTip("Boundary probability threshold")
        drawer_layout.addLayout( control_layout( "Threshold", threshold_box ) )
        self.threshold_box = threshold_box

        membrane_size_box = QSpinBox()
        membrane_size_box.setMinimum(0)
        membrane_size_box.setMaximum(1000000)
        configure_update_handlers( membrane_size_box.valueChanged, op.MinMembraneSize )
        membrane_size_box.setToolTip("Size filter for boundary pieces, in pixels")
        drawer_layout.addLayout( control_layout( "Min Boundary Size", membrane_size_box ) )
        self.membrane_size_box = membrane_size_box

        seed_presmoothing_box = QDoubleSpinBox()
        seed_presmoothing_box.setDecimals(1)
        seed_presmoothing_box.setMinimum(0.0)
        seed_presmoothing_box.setMaximum(10.0)
        seed_presmoothing_box.setSingleStep(0.1)
        configure_update_handlers( seed_presmoothing_box.valueChanged, op.SigmaMinima )
        seed_presmoothing_box.setToolTip("Smooth the distance transform map with this sigma")
        drawer_layout.addLayout( control_layout( "Presmooth before Seeds", seed_presmoothing_box ) )
        self.seed_presmoothing_box = seed_presmoothing_box

        seed_method_combo = QComboBox()
        seed_method_combo.addItem("Connected")
        seed_method_combo.addItem("Clustered")
        configure_update_handlers( seed_method_combo.currentIndexChanged, op.GroupSeeds )
        seed_method_combo.setToolTip("Connected: combine directly adjacent pixels into seeds (more superpixels). Clustered: group pixels into seeds by distance heuristic (less superpixels)")
        drawer_layout.addLayout( control_layout( "Seed Labeling", seed_method_combo ) )
        self.seed_method_combo = seed_method_combo

        superpixel_size_box = QSpinBox()
        superpixel_size_box.setMinimum(0)
        superpixel_size_box.setMaximum(1000000)
        configure_update_handlers( superpixel_size_box.valueChanged, op.MinSegmentSize )
        superpixel_size_box.setToolTip("Minimal size of a superpixel")
        drawer_layout.addLayout( control_layout( "Min Superpixel Size", superpixel_size_box ) )
        self.superpixel_size_box = superpixel_size_box

        preserve_pmaps_box = QCheckBox()
        configure_update_handlers( preserve_pmaps_box.toggled, op.PreserveMembranePmaps )
        preserve_pmaps_box.setToolTip("Preserve thin structures. Use that option when some of your foreground objects have long and thin parts")
        drawer_layout.addLayout( control_layout( "Preserve Thin Structures", preserve_pmaps_box ) )
        self.preserve_pmaps_box = preserve_pmaps_box

        enable_debug_box = QCheckBox()
        configure_update_handlers( enable_debug_box.toggled, op.EnableDebugOutputs )
        drawer_layout.addLayout( control_layout( "Show Debug Layers", enable_debug_box ) )
        self.enable_debug_box = enable_debug_box

        op.Superpixels.notifyReady(self.configure_gui_from_operator)
        op.Superpixels.notifyUnready(self.configure_gui_from_operator)
        self.__cleanup_fns.append( partial( op.Superpixels.unregisterReady, self.configure_gui_from_operator ) )
#.........这里部分代码省略.........
开发者ID:ilastik,项目名称:ilastik,代码行数:103,代码来源:wsdtGui.py


注:本文中的PyQt5.QtWidgets.QVBoxLayout.addSpacerItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。