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


Python QCheckBox.setCheckState方法代码示例

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


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

示例1: createVulnOptions

# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import setCheckState [as 别名]
    def createVulnOptions(self):
        """
        Vulnerability Discovery related
        """
        groupBox = QtGui.QGroupBox('Vulnerability Discovery')

        # Elements
        cbv_deep_dang = QCheckBox('Deep search for dangerous functions')
        # xxx = QCheckBox('blah')

        # Default states are read from the Options
        # class and reflected in the GUI
        cbv_deep_dang.setCheckState(self.get_state(self.config.deep_dangerous_functions))

        # Connect elements and signals
        cbv_deep_dang.stateChanged.connect(self.deep_dangerous)

        vbox = QtGui.QVBoxLayout()
        vbox.addWidget(cbv_deep_dang)
        # vbox.addWidget(xxx)
        vbox.addStretch(1)

        groupBox.setLayout(vbox)

        return groupBox
开发者ID:0xr0ot,项目名称:JARVIS,代码行数:27,代码来源:OptionsWidget.py

示例2: createBinaryOptions

# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import setCheckState [as 别名]
    def createBinaryOptions(self):
        """
        Binary Analysis Options
        """
        groupBox = QtGui.QGroupBox('Binary Analysis')

        # Elements
        cbs_unique_str = QCheckBox('Show unique strings', self)
        cbs_unique_com = QCheckBox('Show unique comments', self)
        cbs_unique_calls = QCheckBox('Show unique calls', self)
        cbs_entropy = QCheckBox('Calculate entropy', self)
        cutoff_label = QLabel('Connect BB cutoff')
        sb_cutoff = QSpinBox()
        sb_cutoff.setRange(1, 40)
        cutoff_func_label = QLabel('Connect functions cutoff')
        sbf_cutoff = QSpinBox()
        sbf_cutoff.setRange(1, 40)

        # Default states are read from the Config
        # class and reflected in the GUI
        cbs_unique_str.setCheckState(
            self.get_state(self.config.display_unique_strings))
        cbs_unique_com.setCheckState(
            self.get_state(self.config.display_unique_comments))
        cbs_unique_calls.setCheckState(
            self.get_state(self.config.display_unique_calls))
        cbs_entropy.setCheckState(
            self.get_state(self.config.calculate_entropy))
        sb_cutoff.setValue(self.config.connect_bb_cutoff)
        sbf_cutoff.setValue(self.config.connect_func_cutoff)

        # Connect elements and signals
        cbs_unique_str.stateChanged.connect(self.string_unique)
        cbs_unique_com.stateChanged.connect(self.comment_unique)
        cbs_unique_calls.stateChanged.connect(self.calls_unique)
        cbs_entropy.stateChanged.connect(self.string_entropy)
        sb_cutoff.valueChanged[int].connect(self.set_cutoff)
        sb_cutoff.valueChanged[int].connect(self.set_func_cutoff)

        vbox = QtGui.QVBoxLayout()
        vbox.addWidget(cbs_unique_str)
        vbox.addWidget(cbs_unique_com)
        vbox.addWidget(cbs_unique_calls)
        vbox.addWidget(cbs_entropy)
        vbox.addWidget(cutoff_label)
        vbox.addWidget(sb_cutoff)
        vbox.addWidget(cutoff_func_label)
        vbox.addWidget(sbf_cutoff)
        vbox.addStretch(1)

        groupBox.setLayout(vbox)

        return groupBox
开发者ID:chubbymaggie,项目名称:JARVIS,代码行数:55,代码来源:OptionsWidget.py

示例3: __init__

# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import setCheckState [as 别名]
 def __init__(self, name, tendril, parent=None):
     super(TendrilWidget,self).__init__(parent)
     hlayout = QHBoxLayout(self)
     label = QLabel("&" + name)
     hlayout.addWidget(label)
     self.thunker = TendrilThunker(tendril)
     if tendril.val == True or tendril.val == False:
         spacer = QSpacerItem(0, 0, hPolicy=QSizePolicy.Expanding, vPolicy=QSizePolicy.Minimum)
         hlayout.addItem(spacer)
         checkbox = QCheckBox(self)
         checkbox.setCheckState(Qt.Checked if tendril.val else Qt.Unchecked)
         checkbox.stateChanged.connect(self.thunker.update)
         label.setBuddy(checkbox)
         hlayout.addWidget(checkbox)
     else:
         edit = QLineEdit(str(tendril.val), self)
         edit.textChanged.connect(self.thunker.update)
         label.setBuddy(edit)
         hlayout.addWidget(edit)
     self.setLayout(hlayout)
     self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
开发者ID:caomw,项目名称:ecto,代码行数:23,代码来源:gui.py

示例4: UI

# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import setCheckState [as 别名]
class UI(gobject.GObject):
	__gsignals__ = {
		'command' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_STRING,))
	}

	def __init__(self,args,continuous):
		self.continuous = continuous
		gobject.GObject.__init__(self)
		#start by making our app
		self.app = QApplication(args)
		#make a window
		self.window = QMainWindow()
		#give the window a name
		self.window.setWindowTitle("BlatherQt")
		self.window.setMaximumSize(400,200)
		center = QWidget()
		self.window.setCentralWidget(center)

		layout = QVBoxLayout()
		center.setLayout(layout)
		#make a listen/stop button
		self.lsbutton = QPushButton("Listen")
		layout.addWidget(self.lsbutton)
		#make a continuous button
		self.ccheckbox = QCheckBox("Continuous Listen")
		layout.addWidget(self.ccheckbox)

		#connect the buttons
		self.lsbutton.clicked.connect(self.lsbutton_clicked)
		self.ccheckbox.clicked.connect(self.ccheckbox_clicked)

		#add a label to the UI to display the last command
		self.label = QLabel()
		layout.addWidget(self.label)

		#add the actions for quiting
		quit_action = QAction(self.window)
		quit_action.setShortcut('Ctrl+Q')
		quit_action.triggered.connect(self.accel_quit)
		self.window.addAction(quit_action)

	def accel_quit(self):
		#emit the quit
		self.emit("command", "quit")
	
	#function for managing the continuou listening check box being clicked. When it is clicked it 
	#emits an event for blather to let blather know that the state of things has changed. This is
	#caught by blather's process_command function.
	def ccheckbox_clicked(self):
		checked = self.ccheckbox.isChecked()
		if checked:
			#disable lsbutton
			self.lsbutton.setEnabled(False)
			self.lsbutton_stopped()
			self.emit('command', "continuous_listen")
			self.set_icon_active()
		else:
			self.lsbutton.setEnabled(True)
			self.emit('command', "continuous_stop")
			self.set_icon_inactive()


	#functions related to the listen button. lsbutton_stopped is a quasi place holder for if I
	#want to expand the end of listening to do other things as well.
	def lsbutton_stopped(self):
		self.lsbutton.setText("Listen")

	def lsbutton_clicked(self):
		val = self.lsbutton.text()
		if val == "Listen":
			self.emit("command", "listen")
			self.lsbutton.setText("Stop")
			#clear the label
			self.label.setText("")
			self.set_icon_active()
		else:
			self.lsbutton_stopped()
			self.emit("command", "stop")
			self.set_icon_inactive()

	#called by blather right before the main loop is started. Mainloop is handled by gst. 
	def run(self):
		self.set_icon_inactive()
		self.window.show()
		if self.continuous:
			self.set_icon_active()
			self.ccheckbox.setCheckState(Qt.Checked)
			self.ccheckbox_clicked()
		self.app.exec_()
		self.emit("command", "quit")

	#This function is called when it hears a pause in the audio. 
	#This is called after the command has been sent of to the commander.
	def finished(self, text):
		#if the continuous isn't pressed
		if not self.ccheckbox.isChecked():
			self.lsbutton_stopped()
		self.label.setText(text)


#.........这里部分代码省略.........
开发者ID:Narcolapser,项目名称:blather,代码行数:103,代码来源:QtUI.py

示例5: ColorMapWidget

# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import setCheckState [as 别名]
class ColorMapWidget(QWidget):
    """Interface for changing ColorMap information. It shows the current
       color map selection, a selector for other colormaps, and the option
       to cycle the color map by any number of ordinal values.

       This widget was designed for use with the tab dialog. It can be used by
       itself or it can be used as part of a bigger color tab.

       Changes to this widget are emitted via a changeSignal as a ColorMap
       object and this widget's tag.
    """

    changeSignal = Signal(ColorMap, str)

    def __init__(self, parent, initial_map, tag):
        """Creates a ColorMap widget.

           parent
               The Qt parent of this widget.

           initial_map
               The colormap set on creation.

           tag
               A name for this widget, will be emitted on change.
        """
        super(ColorMapWidget, self).__init__(parent)
        self.color_map = initial_map.color_map
        self.color_map_name = initial_map.color_map_name
        self.color_step = initial_map.color_step
        self.step_size = initial_map.step_size
        self.tag = tag

        self.color_map_label = "Color Map"
        self.color_step_label = "Cycle Color Map"
        self.number_steps_label = "Colors"

        self.color_step_tooltip = "Use the given number of evenly spaced " \
            + " colors from the map and assign to discrete values in cycled " \
            + " sequence."

        layout = QVBoxLayout()

        layout.addWidget(self.buildColorBarControl())
        layout.addItem(QSpacerItem(5,5))
        layout.addWidget(self.buildColorStepsControl())

        self.setLayout(layout)

    def buildColorBarControl(self):
        """Builds the portion of this widget for color map selection."""
        widget = QWidget()
        layout = QHBoxLayout()

        label = QLabel(self.color_map_label)
        self.colorbar = QLabel(self)
        self.colorbar.setPixmap(QPixmap.fromImage(ColorBarImage(
            self.color_map, 180, 15)))

        self.mapCombo = QComboBox(self)
        self.mapCombo.addItems(map_names)
        self.mapCombo.setCurrentIndex(map_names.index(self.color_map_name))
        self.mapCombo.currentIndexChanged.connect(self.colorbarChange)

        layout.addWidget(label)
        layout.addItem(QSpacerItem(5,5))
        layout.addWidget(self.mapCombo)
        layout.addItem(QSpacerItem(5,5))
        layout.addWidget(self.colorbar)

        widget.setLayout(layout)
        return widget

    @Slot(int)
    def colorbarChange(self, ind):
        """Handles a selection of a different colormap."""
        indx = self.mapCombo.currentIndex()
        self.color_map_name = map_names[indx]
        self.color_map = getMap(self.color_map_name)
        self.colorbar.setPixmap(QPixmap.fromImage(ColorBarImage(
            self.color_map, 180, 12)))
        self.changeSignal.emit(ColorMap(self.color_map_name, self.color_step,
            self.step_size), self.tag)

    def buildColorStepsControl(self):
        """Builds the portion of this widget for color cycling options."""
        widget = QWidget()
        layout = QHBoxLayout()

        self.stepBox = QCheckBox(self.color_step_label)
        self.stepBox.stateChanged.connect(self.colorstepsChange)

        self.stepEdit = QLineEdit("8", self)
        # Setting max to sys.maxint in the validator causes an overflow! D:
        self.stepEdit.setValidator(QIntValidator(1, 65536, self.stepEdit))
        self.stepEdit.setEnabled(False)
        self.stepEdit.editingFinished.connect(self.colorstepsChange)

        if self.color_step > 0:
            self.stepBox.setCheckState(Qt.Checked)
#.........这里部分代码省略.........
开发者ID:Schizo,项目名称:boxfish,代码行数:103,代码来源:ColorMaps.py

示例6: ToolBox

# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import setCheckState [as 别名]

#.........这里部分代码省略.........
        for idx in range(0,max_arg_num):
            self.tableArgs.setItem(idx,0,QTableWidgetItem())
            self.tableArgs.setItem(idx,1,QTableWidgetItem())
        self.tableArgs.horizontalHeader().setStretchLastSection(True)
        vbox.addWidget(self.tableArgs)

        self.titleArg = QLabel('Return Value List')
        vbox.addWidget(self.titleArg)

        max_ret_num = 4
        self.tableRet = QtGui.QTableWidget(max_ret_num,2)
        self.tableRet.setHorizontalHeaderLabels(['type','value'])
        for idx in range(0,max_ret_num):
            self.tableRet.setItem(idx,0,QTableWidgetItem())
            self.tableRet.setItem(idx,1,QTableWidgetItem())
        self.tableRet.horizontalHeader().setStretchLastSection(True)
        vwidth = self.tableRet.verticalHeader().length()
        hwidth = self.tableRet.horizontalHeader().height()
        fwidth = self.tableRet.frameWidth() * 2
        self.tableRet.setFixedHeight(vwidth + hwidth + fwidth)
        vbox.addWidget(self.tableRet)

        self.buttonSrcView = QPushButton('view code')
        self.buttonSrcView.setFixedWidth(200)
        self.buttonSrcView.clicked.connect(self.openSourceViewer)
        self.buttonHide = QPushButton('Hide')
        self.buttonHide.setFixedWidth(200)
        self.buttonHide.clicked.connect(self.notifyHide)
        self.buttonHideAllMsg = QPushButton('Hide All')
        self.buttonHideAllMsg.setFixedWidth(200)
        self.buttonHideAllMsg.clicked.connect(self.hideAllMsgNamedAsSelected)
        self.groupBoxMessageInfo.setLayout(vbox)
        self.checkHideCircular = QCheckBox('Hide Circular Messages')
        self.checkHideCircular.setCheckState(QtCore.Qt.Unchecked)
        self.checkHideCircular.stateChanged.connect(self.changeHideCircularMessage)
        self.addWidget(self.checkHideCircular)
        self.addWidget(self.groupBoxMessageInfo)
        self.groupBoxMessageInfo.setSizePolicy(self.sizePolicy)

    def reset(self):
        for idx in reversed(range(0,self.listThread.count())):
            self.listThread.takeItem(idx)

    def setMsgInfoMessage(self,msg):
        self.strMessage = msg

    def changeHideCircularMessage(self,state):
        if state == QtCore.Qt.Unchecked:
            self.diagramView.hideCircularChanged(False)
        elif state == QtCore.Qt.Checked:
            self.diagramView.hideCircularChanged(True)
    
    def setMsgInfoModule(self,module):
        self.strModule = module

    def updateSearchStatus(self,curr,number):
        self.searchCursor.setText("%d/%d" % (curr,number))

    def connectSourceViewer(self,viewer):
        self.srcViewer = viewer

    def openSourceViewer(self):
        self.srcViewer.openViewer(self.strModule,self.strMessage)

    def setMessageInfoTime(self,begin,end,duration):
        self.tableTime.item(0,1).setText(begin)
开发者ID:OpenDanbi,项目名称:Sherlock,代码行数:70,代码来源:ToolBox.py

示例7: UiMain

# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import setCheckState [as 别名]

#.........这里部分代码省略.........
        self.inactive_items_list.setGeometry(230, 40, 150, 100)
        # Populate the two boxes with active and inactive items
        for item in Constants.ACTIVEITEMS:
            if item == '__name__' or item == 'active':
                continue
            self.active_items_list.addItem(item)
        for item in Constants.INACTIVEITEMS:
            if item == '__name__' or item == 'active':
                continue
            self.inactive_items_list.addItem(item)

        # The buttons responsible for switching
        # off button
        self.switch_active_item_button_off = QPushButton(self.options)
        self.switch_active_item_button_off.setText('->'.decode('utf-8'))
        # Makes the -> readable and clear
        self.switch_active_item_button_off.setFont(QFont('SansSerif', 17))
        self.switch_active_item_button_off.setGeometry(175, 55, 40, 30)
        # on button
        self.switch_active_item_button_on = QPushButton(self.options)
        self.switch_active_item_button_on.setText('<-'.decode('utf-8'))
        # makes <- readable and clear
        self.switch_active_item_button_on.setFont(QFont('SansSerif', 17))
        self.switch_active_item_button_on.setGeometry(175, 90, 40, 30)

        QObject.connect(self.switch_active_item_button_on, SIGNAL
                       ("clicked()"), self.switch_item_on)
        QObject.connect(self.switch_active_item_button_off, SIGNAL
                       ("clicked()"), self.switch_item_off)

        # A button to toggle the split output in half option. It's a temporary
        # fix for the Foobar double output problem.
        self.switch_output_split_btn = QCheckBox(self.options)
        self.switch_output_split_btn.setCheckState(Qt.CheckState.Unchecked)
        self.switch_output_split_btn.setGeometry(10, 140, 40, 30)
        self.switch_output_split_btn.stateChanged.connect(self.toggle_split)

        # The label for the split toggle
        self.switch_output_split_lbl = QLabel(self.options)
        self.switch_output_split_lbl.setText(
            "Split the output text in half (don't use this if you don't need it)")
        self.switch_output_split_lbl.setGeometry(30, 140, 300, 30)

    def switch_item_on(self):
        """ Switches items (musicapps) on """
        try:
            # If an item from the active box is selected
            # Remove it and place it inside the inactive box
            item_taken = self.inactive_items_list.takeItem(
                self.inactive_items_list.currentRow())
            self.active_items_list.addItem(item_taken)
            active_items = {}
            inactive_items = {}
            for i in range(self.active_items_list.count()):
                active_items[self.active_items_list.item(i).text()] =\
                    ITEMS[self.active_items_list.item(i).text()
                          .encode('utf-8')]
            for i in range(self.inactive_items_list.count()):
                inactive_items[self.inactive_items_list.item(i).text()] =\
                    ITEMS[self.inactive_items_list.item(i).text()
                          .encode('utf-8')]
            Constants.ACTIVE_ITEMS = active_items
            Constants.INACTIVE_ITEMS = inactive_items
            # clear the selection combobox
            self.app_select_box.clear()
            # Repopulate the combobox
开发者ID:dylziez,项目名称:SMG,代码行数:70,代码来源:guiv2.py

示例8: UI

# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import setCheckState [as 别名]
class UI(gobject.GObject):
	__gsignals__ = {
		'command' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_STRING,))
	}
	
	def __init__(self,args,continuous):
		self.continuous = continuous
		gobject.GObject.__init__(self)
		#start by making our app
		self.app = QApplication(args)
		#make a window
		self.window = QMainWindow()
		#give the window a name
		self.window.setWindowTitle("BlatherQt")
		self.window.setMaximumSize(400,200)
		center = QWidget()
		self.window.setCentralWidget(center)
		
		layout = QVBoxLayout()
		center.setLayout(layout)
		#make a listen/stop button
		self.lsbutton = QPushButton("Listen")
		layout.addWidget(self.lsbutton)
		#make a continuous button
		self.ccheckbox = QCheckBox("Continuous Listen")
		layout.addWidget(self.ccheckbox)
		
		#connect the buttonsc
		self.lsbutton.clicked.connect(self.lsbutton_clicked)
		self.ccheckbox.clicked.connect(self.ccheckbox_clicked)
		
		#add a label to the UI to display the last command
		self.label = QLabel()
		layout.addWidget(self.label)
	
	def ccheckbox_clicked(self):
		checked = self.ccheckbox.isChecked()
		if checked:
			#disable lsbutton
			self.lsbutton.setEnabled(False)
			self.lsbutton_stopped()
			self.emit('command', "continuous_listen")
		else:
			self.lsbutton.setEnabled(True)
			self.emit('command', "continuous_stop")
	
	def lsbutton_stopped(self):
		self.lsbutton.setText("Listen")
		
	def lsbutton_clicked(self):
		val = self.lsbutton.text()
		if val == "Listen":
			self.emit("command", "listen")
			self.lsbutton.setText("Stop")
			#clear the label
			self.label.setText("")
		else:
			self.lsbutton_stopped()
			self.emit("command", "stop")
			
	def run(self):
		self.window.show()
		if self.continuous:
			self.ccheckbox.setCheckState(Qt.Checked)
			self.ccheckbox_clicked()
		self.app.exec_()
		self.emit("command", "quit")
	
	def quit(self):
		pass
		
	def finished(self, text):
		print text
		#if the continuous isn't pressed
		if not self.ccheckbox.isChecked():
			self.lsbutton_stopped()
		self.label.setText(text)
		
	def quit(self):
		#sys.exit()
		pass
开发者ID:beerhof,项目名称:waski,代码行数:83,代码来源:QtUI.py


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