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


Python QCheckBox.isChecked方法代码示例

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


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

示例1: _PhotonSpectrumResultOptionsToolItem

# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import isChecked [as 别名]
class _PhotonSpectrumResultOptionsToolItem(_ResultToolItem):
    def _initUI(self):
        # Widgets
        self._chk_total = QCheckBox("Show total intensity")
        self._chk_total.setChecked(True)

        self._chk_background = QCheckBox("Show background intensity")
        self._chk_background.setChecked(False)

        self._chk_errorbar = QCheckBox("Show error bars")
        self._chk_errorbar.setChecked(True)

        # Layouts
        layout = _ResultToolItem._initUI(self)
        layout.addRow(self._chk_total)
        layout.addRow(self._chk_background)
        layout.addRow(self._chk_errorbar)

        # Signals
        self._chk_total.stateChanged.connect(self.stateChanged)
        self._chk_background.stateChanged.connect(self.stateChanged)
        self._chk_errorbar.stateChanged.connect(self.stateChanged)

        return layout

    def isTotal(self):
        return self._chk_total.isChecked()

    def isBackground(self):
        return self._chk_background.isChecked()

    def isErrorbar(self):
        return self._chk_errorbar.isChecked()
开发者ID:pymontecarlo,项目名称:pymontecarlo-gui,代码行数:35,代码来源:result.py

示例2: CheckinConfirmation

# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import isChecked [as 别名]
class CheckinConfirmation(QDialog):
    def __init__(self, parent, venue):
        super(CheckinConfirmation, self).__init__(parent)
        self.setWindowTitle("Checkin")
        self.centralWidget = QWidget()

        #Main Layout
        layout = QGridLayout()
        #layout.setSpacing(0)
        self.setLayout(layout)


        text = "You're checking in @<b>" + venue['name'] + "</b>"
        if 'address' in venue['location']:
            text += ", " + venue['location']['address']
        text += "."
        textLabel = QLabel(text, self)
        textLabel.setWordWrap(True)

        okButton = QPushButton("Ok")
        self.connect(okButton, SIGNAL("clicked()"), self.accept)
        cancelButton = QPushButton("Cancel")
        self.connect(cancelButton, SIGNAL("clicked()"), self.reject)

        # TODO: make this a separate widget
        #----
        self.tw = QCheckBox("Twitter")
        self.fb = QCheckBox("Facebook")

        broadcast = foursquare.config_get("broadcast")
        if broadcast:
            if not ", " in broadcast:
                self.tw.setChecked("twitter" in broadcast)
                self.fb.setChecked("facebook" in broadcast)
        #----

        layout.addWidget(textLabel, 0, 0, 1, 3)
        layout.addWidget(self.tw, 1, 0)
        layout.addWidget(self.fb, 1, 1)
        layout.addWidget(okButton, 1, 2)
        #layout.addWidget(cancelButton, 1, 1)

    def broadcast(self):
        broadcast = "public"
        if self.tw.isChecked():
            broadcast += ",twitter"
        if self.fb.isChecked():
            broadcast += ",facebook"
开发者ID:Mad-Halfling,项目名称:ubersquare,代码行数:50,代码来源:checkins.py

示例3: IncludeRow

# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import isChecked [as 别名]
class IncludeRow():
	def __init__(self,result):
		self.result			= result
		self.resultLabel	= QLabel(result)
		self.included		= QCheckBox()
	def isIncluded(self):
		return self.included.isChecked()
开发者ID:mcvmcv,项目名称:cherry,代码行数:9,代码来源:cherryIncludeDialog.py

示例4: qLabeledCheck

# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import isChecked [as 别名]
class qLabeledCheck(QWidget): 
    def __init__(self, name, arg_dict, pos = "side", max_size = 200):
        QWidget.__init__(self)
        self.setContentsMargins(1, 1, 1, 1)
        if pos == "side":
            self.layout1=QHBoxLayout()
        else:
            self.layout1 = QVBoxLayout()
        self.layout1.setContentsMargins(1, 1, 1, 1)
        self.layout1.setSpacing(1)
        self.setLayout(self.layout1)
        self.cbox = QCheckBox()
        # self.efield.setMaximumWidth(max_size)
        self.cbox.setFont(QFont('SansSerif', 12))
        self.label = QLabel(name)
        # self.label.setAlignment(Qt.AlignLeft)
        self.label.setFont(QFont('SansSerif', 12))
        self.layout1.addWidget(self.label)
        self.layout1.addWidget(self.cbox)
        self.arg_dict = arg_dict
        self.name = name
        self.mytype = type(self.arg_dict[name])
        if self.mytype != bool:
            self.cbox.setChecked(bool(self.arg_dict[name]))
        else:
            self.cbox.setChecked(self.arg_dict[name])
        self.cbox.toggled.connect(self.when_modified)
        self.when_modified()
        
    def when_modified(self):
        self.arg_dict[self.name]  = self.cbox.isChecked()
        
    def hide(self):
        QWidget.hide(self)
开发者ID:bsherin,项目名称:shared_tools,代码行数:36,代码来源:mywidgets.py

示例5: EditPreferencesDlg

# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import isChecked [as 别名]
class EditPreferencesDlg(QDialog):
	
	def __init__(self, parent=None):
		super(EditPreferencesDlg, self).__init__(parent)
		self.setWindowTitle("Preferences")
		# define widgets
		pref_list = QListWidget()
		pref_list.addItem("General")
		pref_list.addItem("Display")
		pref_list.setMaximumWidth(150)
		pref_list.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding)
		
		button_box = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
		
		general_page = QWidget()
		general_layout = QGridLayout()
		general_layout.setAlignment(Qt.AlignTop)
		general_layout.addWidget(QLabel("<b>General</b>"), 0, 0)
		general_page.setLayout(general_layout)
		
		display_page = QWidget()
		display_layout = QGridLayout()
		display_layout.setAlignment(Qt.AlignTop)
		display_layout.addWidget(QLabel("<b>Display Options</b>"), 0, 0)
		self.multitabs_checkbox = QCheckBox("Limit the display of tabs to one relief device (and the device's scenarios) at a time")
		if parent.limit_tabs is True:
			self.multitabs_checkbox.setChecked(True)
		display_layout.addWidget(self.multitabs_checkbox, 1, 0)
		display_page.setLayout(display_layout)

		stacked_widget = QStackedWidget()
		for page in general_page, display_page:
			stacked_widget.addWidget(page)
		
		main_layout = QVBoxLayout()
		widgets_layout = QHBoxLayout()
		widgets_layout.addWidget(pref_list)
		widgets_layout.addWidget(stacked_widget)
		buttons_layout = QHBoxLayout()
		buttons_layout.addStretch()
		buttons_layout.addWidget(button_box)
		main_layout.addLayout(widgets_layout)
		main_layout.addLayout(buttons_layout)
		self.setLayout(main_layout)
		
		pref_list.currentRowChanged.connect(stacked_widget.setCurrentIndex)
		
		button_box.accepted.connect(self.accept)
		button_box.rejected.connect(self.reject)
		
	def sizeHint(self):
		return QSize(400, 400)
		
	def returnVals(self):
		return self.multitabs_checkbox.isChecked()
开发者ID:nb1987,项目名称:rvac,代码行数:57,代码来源:dlg_classes.py

示例6: CreateUser

# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import isChecked [as 别名]
class CreateUser(QDialog):
    def __init__(self, window = None):
        super(CreateUser, self).__init__(window)
        layout = QFormLayout(self)

        self.email = QLineEdit(self)
        fm = self.email.fontMetrics()
        self.email.setMaximumWidth(30 * fm.maxWidth() + 11)
        layout.addRow("&User ID:", self.email)

        self.pwd = QLineEdit(self)
        self.pwd.setEchoMode(QLineEdit.Password)
        fm = self.pwd.fontMetrics()
        self.pwd.setMaximumWidth(30 * fm.width('*') + 11)
        layout.addRow("&Password:", self.pwd)

        self.pwd_again = QLineEdit(self)
        self.pwd_again.setEchoMode(QLineEdit.Password)
        fm = self.pwd_again.fontMetrics()
        self.pwd_again.setMaximumWidth(30 * fm.width('*') + 11)
        validator = RepeatPasswordValidator(self.pwd)
        self.pwd_again.setValidator(validator)
        layout.addRow("Password (&again):", self.pwd_again)

        self.display_name = QLineEdit(self)
        fm = self.display_name.fontMetrics()
        self.display_name.setMaximumWidth(50 * fm.maxWidth() + 11)
        layout.addRow("&Name", self.display_name)

        self.savecreds = QCheckBox("&Save Credentials (unsafe)")
        layout.addRow(self.savecreds)

        self.buttonbox = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self)
        self.buttonbox.accepted.connect(self.create)
        self.buttonbox.rejected.connect(self.reject)
        layout.addRow(self.buttonbox)
        self.setLayout(layout)

    def create(self):
        password = self.pwd.text()
        if password != self.pwd_again.text():
            QMessageBox.critical(self, "Passwords don't match",
                "The passwords entered are different")
            self.reject()
        try:
            QCoreApplication.instance().add_user(self.email.text(),
                                                 password,
                                                 self.display_name.text(),
                                                 self.savecreds.isChecked())
            self.accept()
        except Exception as e:
            logger.exception("Exception creating user")
            QMessageBox.critical(self, "Error", str(e))
            self.reject()
开发者ID:JanDeVisser,项目名称:Grumble,代码行数:57,代码来源:mainwindow.py

示例7: _ChannelsResultOptionsToolItem

# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import isChecked [as 别名]
class _ChannelsResultOptionsToolItem(_ResultToolItem):
    def _initUI(self):
        # Widgets
        self._chk_errorbar = QCheckBox("Show error bars")
        self._chk_errorbar.setChecked(True)

        # Layouts
        layout = _ResultToolItem._initUI(self)
        layout.addRow(self._chk_errorbar)

        # Signals
        self._chk_errorbar.stateChanged.connect(self.stateChanged)

        return layout

    def showErrorbar(self):
        return self._chk_errorbar.isChecked()
开发者ID:pymontecarlo,项目名称:pymontecarlo-gui,代码行数:19,代码来源:result.py

示例8: TrajectoryDetectorWidget

# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import isChecked [as 别名]
class TrajectoryDetectorWidget(_DetectorWidget):

    def __init__(self, parent=None):
        _DetectorWidget.__init__(self, parent)
        self.setAccessibleName("Trajectory")

    def _initUI(self):
        # Widgets
        self._chk_secondary = QCheckBox("Simulation secondary electrons")
        self._chk_secondary.setChecked(True)

        # Layouts
        layout = _DetectorWidget._initUI(self)
        layout.addRow(self._chk_secondary)

        return layout

    def value(self):
        secondary = self._chk_secondary.isChecked()
        return TrajectoryDetector(secondary)

    def setValue(self, value):
        self._chk_secondary.setChecked(value.secondary)
开发者ID:pymontecarlo,项目名称:pymontecarlo-gui,代码行数:25,代码来源:detector.py

示例9: SelectUser

# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import isChecked [as 别名]
class SelectUser(QDialog):
    def __init__(self, window = None):
        super(SelectUser, self).__init__(window)
        layout = QFormLayout(self)
        self.email = QLineEdit(self)
        fm = self.email.fontMetrics()
        self.email.setMaximumWidth(30 * fm.maxWidth() + 11)
        layout.addRow("&User ID:", self.email)
        self.pwd = QLineEdit(self)
        self.pwd.setEchoMode(QLineEdit.Password)
        fm = self.pwd.fontMetrics()
        self.pwd.setMaximumWidth(30 * fm.width('*') + 11)
        layout.addRow("&Password:", self.pwd)
        self.savecreds = QCheckBox("&Save Credentials (unsafe)")
        layout.addRow(self.savecreds)
        self.buttonbox = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
            Qt.Horizontal, self)
        self.buttonbox.accepted.connect(self.authenticate)
        self.buttonbox.rejected.connect(self.reject)
        layout.addRow(self.buttonbox)
        self.setLayout(layout)

    def select(self):
        if not QCoreApplication.instance().is_authenticated():
            self.exec_()

    def authenticate(self):
        password = self.pwd.text()
        uid = self.email.text()
        savecreds = self.savecreds.isChecked()
        if QCoreApplication.instance().authenticate(uid, password, savecreds):
            self.accept()
        else:
            QMessageBox.critical(self, "Wrong Password",
                "The user ID and password entered do not match.")
开发者ID:JanDeVisser,项目名称:Grumble,代码行数:38,代码来源:mainwindow.py

示例10: NewMarkerDialog

# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import isChecked [as 别名]
class NewMarkerDialog(QDialog):
	def __init__(self):
		super(NewMarkerDialog, self).__init__()
		self.setWindowTitle('Add new marker...')
		newMarkerLabel		= QLabel('Marker:')
		self.newMarker		= QLineEdit()
		includeLabel		= QLabel('Include all samples:')
		self.includeAll		= QCheckBox()
		controlsLabel		= QLabel('Control wells:')
		self.controls		= QSpinBox()
		self.controls.setRange(0,8)
		self.controls.setValue(2)
		layout				= QGridLayout()
		layout.addWidget(newMarkerLabel,0,0)
		layout.addWidget(self.newMarker,0,1)
		layout.addWidget(includeLabel,1,0)
		layout.addWidget(self.includeAll,1,1)
		layout.addWidget(controlsLabel,2,0)
		layout.addWidget(self.controls,2,1)
		self.buttons		= QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)	
		self.buttons.accepted.connect(self.accept)
		self.buttons.rejected.connect(self.reject)
		layout.addWidget(self.buttons,100,0,1,2)
		self.setLayout(layout)
	def getMarker(self):		return self.newMarker.text()
	def getIncludeAll(self):	return self.includeAll.isChecked()
	def getControls(self):		return self.controls.value()
 
	@staticmethod
	def run(parent = None):
		dialog				= NewMarkerDialog()
		result				= dialog.exec_()
		newMarker			= dialog.getMarker()
		includeAll			= dialog.getIncludeAll()
		controls			= dialog.getControls()
		return (newMarker,includeAll,controls,result == QDialog.Accepted)
开发者ID:mcvmcv,项目名称:cherry,代码行数:38,代码来源:cherryNewMarkerDialog.py

示例11: LoginView

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

#.........这里部分代码省略.........
        fieldsLayout.addStretch(30)
        
        buttonLayout.addStretch(50)
        buttonLayout.addWidget(self.loginButton, 50, Qt.AlignRight)
        
        fieldsLayout.addLayout(buttonLayout)
        fieldsLayout.addStretch(20)
        
        mainLayout.addLayout(fieldsLayout, 30)
        mainLayout.addStretch(20)
        
        self.setLayout(mainLayout)
        
    def createWidgets(self):
        """Create children widgets needed by this view"""

        fieldsWidth = 200
        labelsFont = View.labelsFont()
        editsFont = View.editsFont()
        self.setLogo()
        
        self.hostLabel = QLabel(self)
        self.hostEdit = QLineEdit(self)
        self.sslLabel = QLabel(self)
        self.sslCheck = QCheckBox(self)     
        self.hostLabel.setText('FTP Location')
        self.hostLabel.setFont(labelsFont)
        self.hostEdit.setFixedWidth(fieldsWidth)
        self.hostEdit.setFont(editsFont)
        self.sslLabel.setText('SSL')
        self.sslLabel.setFont(labelsFont)
        
        self.usernameLabel = QLabel(self)
        self.usernameEdit = QLineEdit(self)
        self.usernameLabel.setText('Username')
        self.usernameLabel.setFont(labelsFont)
        self.usernameEdit.setFixedWidth(fieldsWidth)
        self.usernameEdit.setFont(editsFont)
        
        self.passwdLabel = QLabel(self)
        self.passwdEdit = QLineEdit(self)
        self.passwdLabel.setText('Password')
        self.passwdLabel.setFont(labelsFont)
        self.passwdEdit.setFixedWidth(fieldsWidth)
        self.passwdEdit.setEchoMode(QLineEdit.Password)
        self.passwdEdit.setFont(editsFont)
        self.passwdEdit.returnPressed.connect(self.onLoginClicked)
        
        self.loginButton = QPushButton(self)
        self.loginButton.setText('Login')
        self.loginButton.setFont(labelsFont)
        self.loginButton.setFixedWidth(fieldsWidth / 2)
        self.loginButton.clicked.connect(self.onLoginClicked)
        
        # Sets previously stored values into the fields, if any
        settings = get_settings()
        
        self.hostEdit.setText(settings.value(SettingsKeys['host'], ''))
        self.usernameEdit.setText(settings.value(SettingsKeys['username'], ''))
        self.passwdEdit.setText(crypt.decrypt(settings.value(SettingsKeys['passwd'], '')))
        
        # Unicode to boolean conversion
        ssl = settings.value(SettingsKeys['ssl'], u'true') 
        ssl = True if ssl == u'true' else False
        self.sslCheck.setChecked(ssl)
        
    @Slot() 
    def onLoginClicked(self):
        """
        Slot. Called on the user clicks on the `loginButton` button
        """
        # Takes out the user input from the fields
        host = self.hostEdit.text()
        username = self.usernameEdit.text()
        passwd = self.passwdEdit.text()
        ssl = self.sslCheck.isChecked()
        
        print 'Logging in: %s, %s, %s' % (host, username, '*' * len(passwd))
        
        if len(host) > 0:
            # If the fields are valid, store them using a `QSettings` object
            # and triggers a log in request
            settings = get_settings()
            
            settings.setValue(SettingsKeys['host'], host)
            settings.setValue(SettingsKeys['username'], username)
            settings.setValue(SettingsKeys['passwd'], crypt.encrypt(passwd))
            settings.setValue(SettingsKeys['ssl'], ssl)
            
            self.setEnabled(False)
            self.login.emit(host.strip(), username, passwd, ssl)
            
    @Slot()
    def onFailedLogIn(self):
        """
        Slot. Called when the log in request fails
        """
        
        # Enables the fields again for user input
        self.setEnabled(True)
开发者ID:ShareByLink,项目名称:iqbox-ftp,代码行数:104,代码来源:views.py

示例12: MainWindow

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

#.........这里部分代码省略.........
        self.digits_checkbox.setChecked(True)
        self.digits_checkbox.stateChanged.connect(self.reset_iterations)
        self.layout.addWidget(self.digits_checkbox)
        # Length slider
        self.length_label = QLabel("&Länge:")
        self.length_display = QLabel()
        self.length_label_layout = QBoxLayout(QBoxLayout.LeftToRight)
        self.length_label_layout.addWidget(self.length_label)
        self.length_label_layout.addWidget(self.length_display)
        self.length_label_layout.addStretch()
        self.length_slider = QSlider(Qt.Horizontal)
        self.length_slider.setMinimum(4)
        self.length_slider.setMaximum(20)
        self.length_slider.setPageStep(1)
        self.length_slider.setValue(10)
        self.length_display.setText(str(self.length_slider.sliderPosition()))
        self.length_slider.valueChanged.connect(self.length_slider_changed)
        self.length_label.setBuddy(self.length_slider)
        self.layout.addLayout(self.length_label_layout)
        self.layout.addWidget(self.length_slider)
        # Button
        self.generate_button = QPushButton("Erzeugen")
        self.generate_button.clicked.connect(self.generate_password)
        self.generate_button.setAutoDefault(True)
        self.layout.addWidget(self.generate_button)
        # Password
        self.password_label = QLabel("&Passwort:")
        self.password = QLabel()
        self.password.setTextFormat(Qt.PlainText)
        self.password.setAlignment(Qt.AlignCenter)
        self.password.setFont(QFont("Helvetica", 18, QFont.Bold))
        self.password_label.setBuddy(self.password)
        self.layout.addWidget(self.password_label)
        self.layout.addWidget(self.password)
        # Iteration display
        self.message_label = QLabel()
        self.message_label.setTextFormat(Qt.RichText)
        self.message_label.setVisible(False)
        self.layout.addWidget(self.message_label)
        # Window layout
        self.layout.addStretch()
        self.setGeometry(0, 30, 300, 400)
        self.setWindowTitle("c't SESAM")
        self.maser_password_edit.setFocus()
        self.show()

    def length_slider_changed(self):
        self.length_display.setText(str(self.length_slider.sliderPosition()))
        self.reset_iterations()

    def reset_iterations(self):
        self.iterations = 4096
        self.message_label.setVisible(False)
        self.password.setText('')
        self.clipboard.setText('')

    def move_focus(self):
        line_edits = [self.maser_password_edit, self.domain_edit, self.username_edit]
        for i, edit in enumerate(line_edits):
            if edit.hasFocus() and i + 1 < len(line_edits):
                line_edits[i + 1].setFocus()
                return True
        self.generate_button.setFocus()

    def generate_password(self):
        if len(self.domain_edit.text()) <= 0:
            self.reset_iterations()
            self.message_label.setText(
                '<span style="font-size: 10px; color: #aa0000;">Bitte geben Sie eine Domain an.</span>')
            self.message_label.setVisible(True)
            return False
        if self.letters_checkbox.isChecked() or \
           self.digits_checkbox.isChecked() or \
           self.special_characters_checkbox.isChecked():
            self.generator.set_password_characters(
                use_letters=self.letters_checkbox.isChecked(),
                use_digits=self.digits_checkbox.isChecked(),
                use_special_characters=self.special_characters_checkbox.isChecked())
        else:
            self.reset_iterations()
            self.message_label.setText(
                '<span style="font-size: 10px; color: #aa0000;">Bei den aktuellen Einstellungen ' +
                'kann kein Passwort berechnet werden.</span>')
            self.message_label.setVisible(True)
            return False
        password = self.generator.generate(
            master_password=self.maser_password_edit.text(),
            domain=self.domain_edit.text(),
            username=self.username_edit.text(),
            length=self.length_slider.sliderPosition(),
            iterations=self.iterations
        )
        self.password.setText(password)
        self.password.setTextInteractionFlags(Qt.TextSelectableByMouse | Qt.TextSelectableByKeyboard)
        self.clipboard.setText(password)
        self.message_label.setText(
            '<span style="font-size: 10px; color: #888888;">Das Passwort wurde ' + str(self.iterations) +
            ' mal gehasht <br />und in die Zwischenablage kopiert.</span>')
        self.message_label.setVisible(True)
        self.iterations += 1
开发者ID:LK-Studios,项目名称:ctSESAM-pyside,代码行数:104,代码来源:ctSESAM.py

示例13: _PhotonDistributionResultOptionsToolItem

# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import isChecked [as 别名]
class _PhotonDistributionResultOptionsToolItem(_ResultToolItem):
    def _initUI(self):
        # Variables
        result = self.result()
        transitions = sorted(result.iter_transitions())
        transition0 = transitions[0]
        model = _TransitionListModel(transitions)

        # Widgets
        self._chk_errorbar = QCheckBox("Show error bars")
        self._chk_errorbar.setChecked(True)

        self._cb_transition = QComboBox()
        self._cb_transition.setModel(model)
        self._cb_transition.setCurrentIndex(0)

        self._chk_pg = QCheckBox("No absorption, no fluorescence")
        state = result.exists(transition0, True, False, False, False)
        self._chk_pg.setEnabled(state)
        self._chk_pg.setChecked(state)

        self._chk_eg = QCheckBox("With absorption, no fluorescence")
        state = result.exists(transition0, True, True, False, False)
        self._chk_eg.setEnabled(state)
        self._chk_eg.setChecked(state)

        self._chk_pt = QCheckBox("No absorption, with fluorescence")
        state = result.exists(transition0, True, False, True, True)
        self._chk_pt.setEnabled(state)
        self._chk_pt.setChecked(state)

        self._chk_et = QCheckBox("With absorption, with fluorescence")
        state = result.exists(transition0, True, True, True, True)
        self._chk_et.setEnabled(state)
        self._chk_et.setChecked(state)

        # Layouts
        layout = _ResultToolItem._initUI(self)
        layout.addRow(self._chk_errorbar)
        layout.addRow("Transition", self._cb_transition)

        boxlayout = QVBoxLayout()
        boxlayout.addWidget(self._chk_pg)
        boxlayout.addWidget(self._chk_eg)
        boxlayout.addWidget(self._chk_pt)
        boxlayout.addWidget(self._chk_et)

        box_generated = QGroupBox("Curves")
        box_generated.setLayout(boxlayout)
        layout.addRow(box_generated)

        # Signals
        self._cb_transition.currentIndexChanged.connect(self._onTransitionChanged)
        self._chk_pg.stateChanged.connect(self.stateChanged)
        self._chk_eg.stateChanged.connect(self.stateChanged)
        self._chk_pt.stateChanged.connect(self.stateChanged)
        self._chk_et.stateChanged.connect(self.stateChanged)
        self._chk_errorbar.stateChanged.connect(self.stateChanged)

        return layout

    def _onTransitionChanged(self):
        result = self.result()

        index = self._cb_transition.currentIndex()
        transition = self._cb_transition.model().transition(index)

        self._chk_pg.setEnabled(result.exists(transition, True, False, False, False))
        self._chk_eg.setEnabled(result.exists(transition, True, True, False, False))
        self._chk_pt.setEnabled(result.exists(transition, True, False, True, True))
        self._chk_et.setEnabled(result.exists(transition, True, True, True, True))

        self.stateChanged.emit()

    def transition(self):
        index = self._cb_transition.currentIndex()
        return self._cb_transition.model().transition(index)

    def showConditions(self):
        return (
            self._chk_pg.isChecked() and self._chk_pg.isEnabled(),
            self._chk_eg.isChecked() and self._chk_eg.isEnabled(),
            self._chk_pt.isChecked() and self._chk_pt.isEnabled(),
            self._chk_et.isChecked() and self._chk_et.isEnabled(),
        )

    def showErrorbar(self):
        return self._chk_errorbar.isChecked()
开发者ID:pymontecarlo,项目名称:pymontecarlo-gui,代码行数:90,代码来源:result.py

示例14: RepresentationPane

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

#.........这里部分代码省略.........
        envWidget.setLayout(envLayout)
        repLayout.addWidget(envWidget)

        mfccLayout = QFormLayout()
        self.numCCEdit = QLineEdit()
        mfccLayout.addRow(QLabel('Number of coefficents:'),self.numCCEdit)
        self.numFiltersEdit = QLineEdit()
        mfccLayout.addRow(QLabel('Number of filters:'),self.numFiltersEdit)
        self.powerCheck = QCheckBox()
        mfccLayout.addRow(QLabel('Use power (first coefficient):'),self.powerCheck)

        mfccWidget = QGroupBox('MFCC')
        mfccWidget.setLayout(mfccLayout)

        repLayout.addWidget(mfccWidget)

        self.setLayout(repLayout)

        self.winLenEdit.setText(str(setting_dict['win_len']))
        self.timeStepEdit.setText(str(setting_dict['time_step']))
        freq_lims = setting_dict['freq_lims']
        self.minFreqEdit.setText(str(freq_lims[0]))
        self.maxFreqEdit.setText(str(freq_lims[1]))
        self.numCoresEdit.setText(str(setting_dict['num_cores']))

        rep = setting_dict['rep']
        if rep == 'mfcc':
            self.mfccRadio.setChecked(True)
        elif rep == 'mhec':
            self.mhecRadio.setChecked(True)
        elif rep == 'prosody':
            self.prosodyRadio.setChecked(True)
        elif rep == 'formant':
            self.formantRadio.setChecked(True)
        elif rep == 'envelopes':
            self.envelopeRadio.setChecked(True)

        self.bandEdit.setText(str(setting_dict['envelope_bands']))

        if setting_dict['use_gammatone']:
            self.gammatoneCheck.setChecked(True)
        if setting_dict['use_window']:
            self.windowCheck.setChecked(True)

        self.numFiltersEdit.setText(str(setting_dict['mfcc_filters']))
        self.numCCEdit.setText(str(setting_dict['num_coeffs']))
        if setting_dict['use_power']:
            self.powerCheck.setChecked(True)

        self.prev_state = setting_dict

    def get_current_state(self):
        setting_dict = {}

        if self.mfccRadio.isChecked():
            setting_dict['rep'] = 'mfcc'
        elif self.mhecRadio.isChecked():
            setting_dict['rep'] = 'mhec'
        elif self.prosodyRadio.isChecked():
            setting_dict['rep'] = 'prosody'
        elif self.formantRadio.isChecked():
            setting_dict['rep'] = 'formant'
        elif self.envelopeRadio.isChecked():
            setting_dict['rep'] = 'envelopes'

        setting_dict['win_len'] = float(self.winLenEdit.text())
        setting_dict['time_step'] = float(self.timeStepEdit.text())
        setting_dict['freq_lims'] = (int(self.minFreqEdit.text()),
                                    int(self.maxFreqEdit.text()))
        setting_dict['num_cores'] = int(self.numCoresEdit.text())

        setting_dict['envelope_bands'] = int(self.bandEdit.text())
        setting_dict['use_gammatone'] = int(self.gammatoneCheck.isChecked())
        setting_dict['use_window'] = int(self.windowCheck.isChecked())

        setting_dict['num_coeffs'] = int(self.numCCEdit.text())
        setting_dict['mfcc_filters'] = int(self.numFiltersEdit.text())
        setting_dict['use_power'] = int(self.powerCheck.isChecked())

        return setting_dict

    def is_changed(self):
        cur_state = self.get_current_state()
        if self.prev_state['rep'] != cur_state['rep']:
            return True
        if cur_state['rep'] == 'mfcc':
            for k in ['win_len','time_step','freq_lims',
                    'num_coeffs','mfcc_filters','use_power']:
                if cur_state[k] != self.prev_state[k]:
                    return True
        elif cur_state['rep'] == 'envelopes':
            for k in ['freq_lims','envelope_bands',
                        'use_gammatone', 'use_window']:
                if cur_state[k] != self.prev_state[k]:
                    return True
            if cur_state['use_window']:
                for k in ['win_len','time_step']:
                    if cur_state[k] != self.prev_state[k]:
                        return True
        return False
开发者ID:mmcauliffe,项目名称:exemplar-network-explorer,代码行数:104,代码来源:config.py

示例15: PushupForm

# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import isChecked [as 别名]
class PushupForm(QDialog):
    '''
    classdocs
    '''
    pushupCreated = Signal(Pushup_Model)
    
    def __init__(self, athlete):
        '''
        Constructor
        '''
        QDialog.__init__(self)
        
        self.setWindowTitle("Pushup form")
        self.athlete = athlete
        self.pushupForm = QFormLayout()
        self.createGUI()
        
    def createGUI(self):
        self.series = QSpinBox()
        self.series.setMinimum(1)
        
        self.repetitions = QSpinBox()
        self.repetitions.setMaximum(512)
        
        self.avgHeartRateToggle = QCheckBox()
        self.avgHeartRateToggle.toggled.connect(self._toggleHeartRateSpinBox)
        
        self.avgHeartRate = QSpinBox()
        self.avgHeartRate.setMinimum(30)
        self.avgHeartRate.setMaximum(250)
        self.avgHeartRate.setValue(120)
        self.avgHeartRate.setDisabled(True)
        
        self.dateSelector_widget = QCalendarWidget()
        self.dateSelector_widget.setMaximumDate(QDate.currentDate())
        
        self.addButton = QPushButton("Add pushup")
        self.addButton.setMaximumWidth(90)
        self.addButton.clicked.connect(self._createPushup)
        
        self.cancelButton = QPushButton("Cancel")
        self.cancelButton.setMaximumWidth(90)
        self.cancelButton.clicked.connect(self.reject)
        
        self.pushupForm.addRow("Series", self.series)
        self.pushupForm.addRow("Repetitions", self.repetitions)
        self.pushupForm.addRow("Store average heart rate ? ", self.avgHeartRateToggle)
        self.pushupForm.addRow("Average Heart Rate", self.avgHeartRate)
        self.pushupForm.addRow("Exercise Date", self.dateSelector_widget)
        
        btnsLayout = QVBoxLayout()
        btnsLayout.addWidget(self.addButton)
        btnsLayout.addWidget(self.cancelButton)        
        btnsLayout.setAlignment(Qt.AlignRight)
        
        layoutWrapper = QVBoxLayout()
        layoutWrapper.addLayout(self.pushupForm)
        layoutWrapper.addLayout(btnsLayout)
        
        self.setLayout(layoutWrapper)        
        
    def _createPushup(self):        
        exerciseDate = self.dateSelector_widget.selectedDate()
        exerciseDate = self.qDate_to_date(exerciseDate)
        
        if self.avgHeartRateToggle.isChecked():
            heartRate = self.avgHeartRate.value()
        else:
            heartRate = None
            
        pushup = Pushup_Model(self.athlete._name, 
                              exerciseDate, 
                              heartRate, 
                              self.series.value(),
                              self.repetitions.value())

        self.pushupCreated.emit(pushup)
        self.accept()       
    
    def _toggleHeartRateSpinBox(self):
        if self.avgHeartRateToggle.isChecked():
            self.avgHeartRate.setDisabled(False)
        else:
            self.avgHeartRate.setDisabled(True)
        
    def qDate_to_date(self, qDate):        
        return date(qDate.year(), qDate.month(),qDate.day())
        
开发者ID:davcri,项目名称:Pushup-app,代码行数:89,代码来源:PushupForm.py


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