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


Python QGroupBox.setChecked方法代码示例

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


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

示例1: __init__

# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setChecked [as 别名]
    def __init__(self, *args, **kwargs):
        # Initialize the base class...
        super(DvidDataSelectionBrowser, self).__init__(*args, **kwargs)

        self._subvol_widget = SubregionRoiWidget(parent=self)

        subvol_layout = QVBoxLayout()
        subvol_layout.addWidget(self._subvol_widget)
        group_title = (
            "Restrict to subvolume (Right-click a volume name above to auto-initialize these subvolume parameters.)"
        )
        subvol_groupbox = QGroupBox(group_title, parent=self)
        subvol_groupbox.setCheckable(True)
        subvol_groupbox.setChecked(False)
        subvol_groupbox.setEnabled(False)
        subvol_groupbox.toggled.connect(self._update_status)
        subvol_groupbox.setLayout(subvol_layout)
        subvol_groupbox.setFixedHeight(200)
        subvol_groupbox.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Minimum)
        self._subvol_groupbox = subvol_groupbox

        # Add to the layout
        layout = self.layout()
        layout.insertWidget(3, subvol_groupbox)

        # Special right-click behavior.
        self._repo_treewidget.viewport().installEventFilter(self)
开发者ID:CVML,项目名称:ilastik,代码行数:29,代码来源:dvidDataSelectionBrowser.py

示例2: buildPostProcessorForm

# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setChecked [as 别名]
    def buildPostProcessorForm(self, theParams):
        """Build Post Processor Tab

        Args:
           * theParams - dictionary containing element of form
        Returns:
           not applicable
        """

        # create postprocessors tab
        myTab = QWidget()
        myFormLayout = QFormLayout(myTab)
        myFormLayout.setLabelAlignment(Qt.AlignLeft)
        self.tabWidget.addTab(myTab, self.tr('Postprocessors'))
        self.tabWidget.tabBar().setVisible(True)

        # create element for the tab
        myValues = {}
        for myLabel, myOptions in theParams.items():
            myInputValues = {}

            # NOTE (gigih) : 'params' is assumed as dictionary
            if 'params' in myOptions:
                myGroupBox = QGroupBox()
                myGroupBox.setCheckable(True)
                myGroupBox.setTitle(get_postprocessor_human_name(myLabel))

                # NOTE (gigih): is 'on' always exist??
                myGroupBox.setChecked(myOptions.get('on'))
                myInputValues['on'] = self.bind(myGroupBox, 'checked', bool)

                myLayout = QFormLayout(myGroupBox)
                myGroupBox.setLayout(myLayout)

                # create widget element from 'params'
                myInputValues['params'] = {}
                for myKey, myValue in myOptions['params'].items():
                    myHumanName = get_postprocessor_human_name(myKey)
                    myInputValues['params'][myKey] = self.buildWidget(
                        myLayout, myHumanName, myValue)

                myFormLayout.addRow(myGroupBox, None)

            elif 'on' in myOptions:
                myCheckBox = QCheckBox()
                myCheckBox.setText(get_postprocessor_human_name(myLabel))
                myCheckBox.setChecked(myOptions['on'])

                myInputValues['on'] = self.bind(myCheckBox, 'checked', bool)
                myFormLayout.addRow(myCheckBox, None)
            else:
                raise NotImplementedError('This case is not handled for now')

            myValues[myLabel] = myInputValues

        self.values['postprocessors'] = myValues
开发者ID:zzpwelkin,项目名称:inasafe,代码行数:58,代码来源:function_options_dialog.py

示例3: build_post_processor_form

# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setChecked [as 别名]
    def build_post_processor_form(self, parameters):
        """Build Post Processor Tab.

        :param parameters: A Dictionary containing element of form
        :type parameters: dict
        """
        # create postprocessors tab
        tab = QWidget()
        form_layout = QFormLayout(tab)
        form_layout.setLabelAlignment(Qt.AlignLeft)
        self.tabWidget.addTab(tab, self.tr('Postprocessors'))
        self.tabWidget.tabBar().setVisible(True)

        # create element for the tab
        values = OrderedDict()
        for label, options in parameters.items():
            input_values = OrderedDict()

            # NOTE (gigih) : 'params' is assumed as dictionary
            if 'params' in options:
                group_box = QGroupBox()
                group_box.setCheckable(True)
                group_box.setTitle(get_postprocessor_human_name(label))

                # NOTE (gigih): is 'on' always exist??
                # (MB) should always be there
                group_box.setChecked(options.get('on'))
                input_values['on'] = self.bind(group_box, 'checked', bool)

                layout = QFormLayout(group_box)
                group_box.setLayout(layout)

                # create widget element from 'params'
                input_values['params'] = OrderedDict()
                for key, value in options['params'].items():
                    input_values['params'][key] = self.build_widget(
                        layout, key, value)

                form_layout.addRow(group_box, None)

            elif 'on' in options:
                checkbox = QCheckBox()
                checkbox.setText(get_postprocessor_human_name(label))
                checkbox.setChecked(options['on'])

                input_values['on'] = self.bind(checkbox, 'checked', bool)
                form_layout.addRow(checkbox, None)
            else:
                raise NotImplementedError('This case is not handled for now')

            values[label] = input_values

        self.values['postprocessors'] = values
开发者ID:mahardika,项目名称:inasafe,代码行数:55,代码来源:function_options_dialog.py

示例4: __init__

# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setChecked [as 别名]
    def __init__(self, *args, **kwargs):
        # Initialize the base class...
        super( DvidDataSelectionBrowser, self ).__init__(*args, **kwargs)

        self._roi_widget = SubregionRoiWidget( parent=self )

        roi_layout = QVBoxLayout()
        roi_layout.addWidget( self._roi_widget )
        roi_groupbox = QGroupBox("Specify Region of Interest", parent=self)
        roi_groupbox.setCheckable(True)
        roi_groupbox.setChecked(False)
        roi_groupbox.setEnabled(False)
        roi_groupbox.toggled.connect( self._update_display )
        roi_groupbox.setLayout( roi_layout )
        roi_groupbox.setFixedHeight( 200 )
        roi_groupbox.setSizePolicy( QSizePolicy.Preferred, QSizePolicy.Minimum )
        self._roi_groupbox = roi_groupbox

        # Add to the layout
        layout = self.layout()
        layout.insertWidget( 3, roi_groupbox )
开发者ID:kushal124,项目名称:ilastik,代码行数:23,代码来源:dvidDataSelectionBrowser.py

示例5: SphereWidget

# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setChecked [as 别名]
class SphereWidget(QWidget):
    """
    Widget for editing sphere's parameters
    """

    signalObjetChanged = pyqtSignal(SphereParam, name='signal_objet_changed')

    def __init__(self, parent=None, param=None):
        super(SphereWidget, self).__init__(parent)

        if param is None:
            self.param = SphereParam()
        else:
            self.param = param

        gbC_lay = QVBoxLayout()

        l_cmap = QLabel("Cmap ")
        self.cmap = list(get_colormaps().keys())
        self.combo = QComboBox(self)
        self.combo.addItems(self.cmap)
        self.combo.currentIndexChanged.connect(self.updateParam)
        self.param.dict["colormap"] = self.cmap[0]
        hbox = QHBoxLayout()
        hbox.addWidget(l_cmap)
        hbox.addWidget(self.combo)
        gbC_lay.addLayout(hbox)

        self.sp = []
        # subdiv
        lL = QLabel("subdiv")
        self.sp.append(QSpinBox())
        self.sp[-1].setMinimum(0)
        self.sp[-1].setMaximum(6)
        self.sp[-1].setValue(self.param.dict["subdiv"])
        # Layout
        hbox = QHBoxLayout()
        hbox.addWidget(lL)
        hbox.addWidget(self.sp[-1])
        gbC_lay.addLayout(hbox)
        # signal's
        self.sp[-1].valueChanged.connect(self.updateParam)
        # Banded
        self.gbBand = QGroupBox(u"Banded")
        self.gbBand.setCheckable(True)
        hbox = QGridLayout()
        lL = QLabel("nbr band", self.gbBand)
        self.sp.append(QSpinBox(self.gbBand))
        self.sp[-1].setMinimum(0)
        self.sp[-1].setMaximum(100)
        # Layout
        hbox = QHBoxLayout()
        hbox.addWidget(lL)
        hbox.addWidget(self.sp[-1])
        self.gbBand.setLayout(hbox)
        gbC_lay.addWidget(self.gbBand)
        # signal's
        self.sp[-1].valueChanged.connect(self.updateParam)
        self.gbBand.toggled.connect(self.updateParam)

        gbC_lay.addStretch(1.0)

        hbox = QHBoxLayout()
        hbox.addLayout(gbC_lay)

        self.setLayout(hbox)
        self.updateMenu()

    def updateParam(self, option):
        """
        update param and emit a signal
        """

        tab = ["subdiv", "nbr_band"]
        for pos, name in enumerate(tab):
            self.param.dict[name] = self.sp[pos].value()
        self.param.dict["banded"] = self.gbBand.isChecked()
        self.param.dict["colormap"] = self.combo.currentText()
        # emit signal
        self.signalObjetChanged.emit(self.param)

    def updateMenu(self, param=None):
        """
        Update menus
        """
        if param is not None:
            self.param = param
        # Lock signals
        self.blockSignals(True)
        for wid in self.sp:
            wid.blockSignals(True)
        tab = ["subdiv", "nbr_band"]
        for pos, name in enumerate(tab):
            self.sp[pos].setValue(self.param.dict[name])
        self.gbBand.setChecked(self.param.dict["banded"])
        # unlock signals
        self.blockSignals(False)
        for wid in self.sp:
            wid.blockSignals(False)
        self.signalObjetChanged.emit(self.param)
开发者ID:sylm21,项目名称:vispy,代码行数:102,代码来源:mesh_banded_qt.py

示例6: NetWorkSettingWidget

# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setChecked [as 别名]

#.........这里部分代码省略.........
        else:
            typeList[1] = DNSStatus
        return typeList

    def getNetStatic(self):
        netList = ["0.0.0.0","255.255.255.0","1.1.1.1"]
        networkInfo = self.getCmdExecValueT("../lib/ccr_jytcapi network")
        for item in networkInfo:
            if len(item.split(":")) == 2:
                if item.split(":")[0] == "ip":
                    netList[0] = item.split(":")[1] 
                elif item.split(":")[0] == "mask":
                    netList[1] = item.split(":")[1] 
                elif item.split(":")[0] == "gateway":
                    netList[2] = item.split(":")[1] 
        return netList

    def getDnsStatic(self):
        dnsList = ["0.0.0.0","2.5.5.0"]
        networkInfo = self.getCmdExecValueT("../lib/ccr_jytcapi network")
        for item in networkInfo:
            if len(item.split(":")) == 2:
                if item.split(":")[0] == "dns1":
                    dnsList[0] = item.split(":")[1] 
                elif item.split(":")[0] == "dns2":
                    dnsList[1] = item.split(":")[1] 
        return dnsList


    def initCheckBoxStatus(self):
        """读取网络配置文件,初始化相应的checkbox的状态"""
        [netType, DNSType] = self.getNetDnsType()
        if netType == "dhcp":
            self.autoGetIpCheckbox.setChecked(True)
            self.staticIpGroupbox.setChecked(False)
            self.autoGetDNSCheckBox.setEnabled(False)
            self.dnsServerAddressGroupbox.setEnabled(False)
        else:
            self.autoGetIpCheckbox.setChecked(False)
            self.staticIpGroupbox.setChecked(True)
            self.autoGetDNSCheckBox.setEnabled(True)
            self.dnsServerAddressGroupbox.setEnabled(True)
            [ip, netmask, gateway] = self.getNetStatic()
            if ip:
                self.ip.setText(ip)

            if netmask:
                self.netmast.setText(netmask)

            if gateway:
                self.defaultGateway.setText(gateway)


        if DNSType == "dhcp":
            self.autoGetDNSCheckBox.setChecked(True)
            self.dnsServerAddressGroupbox.setChecked(False)
        else:
            self.autoGetDNSCheckBox.setChecked(False)
            self.dnsServerAddressGroupbox.setChecked(True)
            [DNS_first, DNS_second] = self.getDnsStatic()
            if DNS_first:
                self.dns.setText(DNS_first)

            if DNS_second:
                self.backupDns.setText(DNS_second)
开发者ID:siwenhu,项目名称:test_client_broadcast,代码行数:69,代码来源:networkingubuntu.py

示例7: EthernetEditor

# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setChecked [as 别名]
class EthernetEditor(QFrame):
    def __init__(self, ethernet, parent=None):
        QFrame.__init__(self, parent)

        self.ethernet = ethernet

        self.buildGUI()
        self.fillValues()

    def buildGUI(self):
        #general setup
        form = QFormLayout(self)

        self.label = OptionnalLine(hint="Optional interface name")
        form.addRow(self.tr("Interface name"), self.label)

        self.speed_group = QButtonGroup()
        self.speed_box = QGroupBox(tr("Force an ethernet speed"))
        speed_layout = QVBoxLayout(self.speed_box)

        self.speed_GFull = QRadioButton(tr("Gigabit full duplex"))
        self.speed_GHalf = QRadioButton(tr("Gigabit half duplex"))
        self.speed_100Full = QRadioButton(tr("100 Mb Full duplex"))
        self.speed_100Half = QRadioButton(tr("100 Mb Half duplex"))
        self.speed_10Full = QRadioButton(tr("10 Mb Full duplex"))
        self.speed_10Half = QRadioButton(tr("10 Mb Half duplex"))

        def toggle(value):
            if value:
                self.speed_GFull.click()

        self.speed_box.setCheckable(True)
        self.speed_box.setChecked(Qt.Unchecked)
        self.connect(self.speed_box, SIGNAL('toggled(bool)'), toggle)

        for item in (
            self.speed_GFull,
            self.speed_GHalf,
            self.speed_100Full,
            self.speed_100Half,
            self.speed_10Full,
            self.speed_10Half,
            ):
            self.speed_group.addButton(item)
            speed_layout.addWidget(item)

        form.addRow(self.speed_box)

    def fillValues(self):
        name = self.ethernet.user_label
        if name != "":
            self.label.setText(name)
            self.label.checkEmpty()
            self.label.setStyleSheet('')

        if self.ethernet.eth_auto:
            self.speed_box.setChecked(Qt.Unchecked)
            return

        self.speed_box.setChecked(Qt.Checked)
        if self.ethernet.eth_duplex == Ethernet.FULL:
            if self.ethernet.eth_speed == 10:
                button = self.speed_10Full
            elif self.ethernet.eth_speed == 100:
                button = self.speed_100Full
            else:
                button = self.speed_GFull
        else:
            if self.ethernet.eth_speed == 10:
                button = self.speed_10Half
            elif self.ethernet.eth_speed == 100:
                button = self.speed_100Half
            else:
                button = self.speed_GHalf


        button.setChecked(Qt.Checked)

    def getConfig(self):
        auto = not self.speed_box.isChecked()
        if auto:
            return True, None, None
        selection = self.speed_group.checkedButton()
        if selection is self.speed_GFull:
            return False, 1000, Ethernet.FULL
        elif self.speed_GHalf:
            return False, 1000, Ethernet.HALF
        elif self.speed_100Full:
            return False, 100, Ethernet.FULL
        elif self.speed_100Half:
            return False, 100, Ethernet.HALF
        elif self.speed_10Full:
            return False, 10, Ethernet.FULL
        elif self.speed_10Half:
            return False, 10, Ethernet.HALF

        assert False, "this selection is unknown"

    def setName(self):
        new_name = self.label.value()
#.........这里部分代码省略.........
开发者ID:maximerobin,项目名称:Ufwi,代码行数:103,代码来源:ethernet_editor.py

示例8: NetWorkSettingWidget

# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setChecked [as 别名]

#.........这里部分代码省略.........

        if globalvariable.PROGRAM_RUNNING_TYPE == common.OPERATION_ENV_TYPE:#running
            globalfunc.umountFile(self.originalNetConfigFile)
            globalfunc.umountFile(self.originalBridgerNetConfigFile)


        if self.autoGetIpCheckbox.isChecked():
            if not self.setDynamicNetwork():
                if globalvariable.PROGRAM_RUNNING_TYPE == common.OPERATION_ENV_TYPE:
                    globalfunc.mountFile(self.originalNetConfigFile)
                    globalfunc.mountFile(self.originalBridgerNetConfigFile)
                return
        elif self.staticIpGroupbox.isChecked():
            if not self.setStaticNetwork():
                if globalvariable.PROGRAM_RUNNING_TYPE == common.OPERATION_ENV_TYPE:
                    globalfunc.mountFile(self.originalNetConfigFile)
                    globalfunc.mountFile(self.originalBridgerNetConfigFile)
                return


        if globalvariable.PROGRAM_RUNNING_TYPE == common.OPERATION_ENV_TYPE:
            globalfunc.mountFile(self.originalNetConfigFile)
            globalfunc.mountFile(self.originalBridgerNetConfigFile)

        #重新启动网络
        self.restartNetworkTD.start()
        
        return
            
    def initCheckBoxStatus(self):
        """读取网络配置文件,初始化相应的checkbox的状态"""
        [netType, DNSType] = self.getNetworkType()
        if netType == "dhcp":
            self.autoGetIpCheckbox.setChecked(True)
            self.staticIpGroupbox.setChecked(False)
        else:
            self.autoGetIpCheckbox.setChecked(False)
            self.staticIpGroupbox.setChecked(True)
            [ip, netmask, gateway] = self.getStaticNetworkInfo()
            if ip:
                self.ip.setText(ip)
                
            if netmask:
                self.netmast.setText(netmask)
                
            if gateway:
                self.defaultGateway.setText(gateway)
                
            
        if DNSType == "AUTODNS":
            self.autoGetDNSCheckBox.setChecked(True)
            self.dnsServerAddressGroupbox.setChecked(False)
        else:
            self.autoGetDNSCheckBox.setChecked(False)
            self.dnsServerAddressGroupbox.setChecked(True)
            [DNS_first, DNS_second] = self.getCustomDNSInfo()
            if DNS_first:
                self.dns.setText(DNS_first)
            
            if DNS_second:
                self.backupDns.setText(DNS_second)
            
            
    def getCustomDNSInfo(self):
        """得到自定义DNS的内容"""
        DNS_first = None
开发者ID:siwenhu,项目名称:test_client_broadcast,代码行数:70,代码来源:networksettingcentos70.py

示例9: buildUp

# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import setChecked [as 别名]
 def buildUp(self):
     for sect in list(self.backend.shared.settings.keys()):
         scroll = QScrollArea(self.tabWidget)
         widget = QWidget(self.tabWidget)
         layout = QVBoxLayout(widget)
         for key, value in list(self.backend.shared.settings[sect].items()):
             if not type(key) is str:
                 continue
             groupbox = QGroupBox(widget)
             loadUi('GUI' + sep + 'settings_element.ui', groupbox)
             if type(value) is str:
                 groupbox.comboBox.lineEdit().setText(value)
                 if key.endswith('directory'):
                     groupbox.toolButton.clicked.connect(
                         lambda y, x=groupbox.comboBox.lineEdit(): x.setText(
                             QFileDialog.getExistingDirectory(
                                 self,
                                 self.tr('Select path'),
                                 options=QFileDialog.DontUseNativeDialog |
                                 QFileDialog.ShowDirsOnly
                                 )
                             )
                         )
                 elif key.endswith('file'):
                     groupbox.toolButton.clicked.connect(
                         lambda y, x=groupbox.comboBox.lineEdit(): x.setText(
                             QFileDialog.getOpenFileName(
                                 self,
                                 self.tr('Select file'),
                                 filter=self.tr('All files(*)'),
                                 options=QFileDialog.DontUseNativeDialog
                                 )
                             )
                         )
                 else:
                     groupbox.toolButton.setShown(False)
                 self.saveButton.clicked.connect(
                     lambda x, y=key, z=groupbox.comboBox, s=sect:
                         self.backend.shared.settings[s].update({y:
                         z.lineEdit().text()}
                         )
                     )
             elif type(value) is int:
                 groupbox.toolButton.setShown(False)
                 groupbox.comboBox.lineEdit().setValidator(
                     QIntValidator(groupbox))
                 groupbox.comboBox.lineEdit().setText(str(value))
                 self.saveButton.clicked.connect(
                     lambda x, y=key, z=groupbox.comboBox.lineEdit(), s=sect:
                         self.backend.shared.settings[s].update(
                             {y: int(z.text())}
                         )
                     )
             elif type(value) is bool:
                 groupbox.comboBox.setShown(False)
                 groupbox.toolButton.setShown(False)
                 groupbox.setCheckable(True)
                 groupbox.setChecked(value)
                 self.saveButton.clicked.connect(
                     lambda x, y=key, z=groupbox.isChecked, s=sect:
                         self.backend.shared.settings[s].update({y:
                         z()}
                         )
                     )
             elif type(value) is list:
                 groupbox.toolButton.setShown(False)
                 for item in self.backend.shared.settings[sect][tuple(key)]:
                     groupbox.comboBox.addItem(str(item))
                 groupbox.comboBox.lineEdit().setText(value[0])
                 self.saveButton.clicked.connect(
                     lambda x, y=key, z=groupbox.comboBox, s=sect:
                         self.backend.shared.settings[s].update({y:
                         [z.lineEdit().text()]}
                         )
                     )
             else:
                 groupbox.toolButton.setShown(False)
                 groupbox.lineEdit.setText(self.tr('Incorrect value'))
                 groupbox.lineEdit.Enable(False)
             groupbox.setTitle(self.tr(key))
             layout.addWidget(groupbox)
         if sect == 'Main':
             self.tabWidget.insertTab(0, scroll, self.tr(sect))
         else:
             self.tabWidget.addTab(scroll, self.tr(sect))
         scroll.setWidget(widget)
     self.tabWidget.setCurrentIndex(0)
     self.saveButton.clicked.connect(
                     lambda: self.backend.shared.save() or
                     self.backend.shared.load()
                     )
开发者ID:Nikiforius,项目名称:O4erednik,代码行数:93,代码来源:gui_qt4.py


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