本文整理汇总了Python中spyderlib.qt.QtGui.QRadioButton.isChecked方法的典型用法代码示例。如果您正苦于以下问题:Python QRadioButton.isChecked方法的具体用法?Python QRadioButton.isChecked怎么用?Python QRadioButton.isChecked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spyderlib.qt.QtGui.QRadioButton
的用法示例。
在下文中一共展示了QRadioButton.isChecked方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RunConfigOptions
# 需要导入模块: from spyderlib.qt.QtGui import QRadioButton [as 别名]
# 或者: from spyderlib.qt.QtGui.QRadioButton import isChecked [as 别名]
#.........这里部分代码省略.........
interpreter_layout.addWidget(self.dedicated_radio)
self.systerm_radio = QRadioButton(SYSTERM_INTERPRETER)
interpreter_layout.addWidget(self.systerm_radio)
# --- Dedicated interpreter ---
new_group = QGroupBox(_("Dedicated Python console"))
self.connect(self.current_radio, SIGNAL("toggled(bool)"),
new_group.setDisabled)
new_layout = QGridLayout()
new_group.setLayout(new_layout)
self.interact_cb = QCheckBox(_("Interact with the Python "
"console after execution"))
new_layout.addWidget(self.interact_cb, 1, 0, 1, -1)
self.show_kill_warning_cb = QCheckBox(_("Show warning when killing"
" running process"))
new_layout.addWidget(self.show_kill_warning_cb, 2, 0, 1, -1)
self.pclo_cb = QCheckBox(_("Command line options:"))
new_layout.addWidget(self.pclo_cb, 3, 0)
self.pclo_edit = QLineEdit()
self.connect(self.pclo_cb, SIGNAL("toggled(bool)"),
self.pclo_edit.setEnabled)
self.pclo_edit.setEnabled(False)
self.pclo_edit.setToolTip(_("<b>-u</b> is added to the "
"other options you set here"))
new_layout.addWidget(self.pclo_edit, 3, 1)
#TODO: Add option for "Post-mortem debugging"
# Checkbox to preserve the old behavior, i.e. always open the dialog
# on first run
hline = QFrame()
hline.setFrameShape(QFrame.HLine)
hline.setFrameShadow(QFrame.Sunken)
self.firstrun_cb = QCheckBox(ALWAYS_OPEN_FIRST_RUN % _("this dialog"))
self.connect(self.firstrun_cb, SIGNAL("clicked(bool)"),
self.set_firstrun_o)
self.firstrun_cb.setChecked(firstrun_o)
layout = QVBoxLayout()
layout.addWidget(interpreter_group)
layout.addWidget(common_group)
layout.addWidget(new_group)
layout.addWidget(hline)
layout.addWidget(self.firstrun_cb)
self.setLayout(layout)
def select_directory(self):
"""Select directory"""
basedir = to_text_string(self.wd_edit.text())
if not osp.isdir(basedir):
basedir = getcwd()
directory = getexistingdirectory(self, _("Select directory"), basedir)
if directory:
self.wd_edit.setText(directory)
self.wd_cb.setChecked(True)
def set(self, options):
self.runconf.set(options)
self.clo_cb.setChecked(self.runconf.args_enabled)
self.clo_edit.setText(self.runconf.args)
self.wd_cb.setChecked(self.runconf.wdir_enabled)
self.wd_edit.setText(self.runconf.wdir)
if self.runconf.current:
self.current_radio.setChecked(True)
elif self.runconf.systerm:
self.systerm_radio.setChecked(True)
else:
self.dedicated_radio.setChecked(True)
self.interact_cb.setChecked(self.runconf.interact)
self.show_kill_warning_cb.setChecked(self.runconf.show_kill_warning)
self.pclo_cb.setChecked(self.runconf.python_args_enabled)
self.pclo_edit.setText(self.runconf.python_args)
def get(self):
self.runconf.args_enabled = self.clo_cb.isChecked()
self.runconf.args = to_text_string(self.clo_edit.text())
self.runconf.wdir_enabled = self.wd_cb.isChecked()
self.runconf.wdir = to_text_string(self.wd_edit.text())
self.runconf.current = self.current_radio.isChecked()
self.runconf.systerm = self.systerm_radio.isChecked()
self.runconf.interact = self.interact_cb.isChecked()
self.runconf.show_kill_warning = self.show_kill_warning_cb.isChecked()
self.runconf.python_args_enabled = self.pclo_cb.isChecked()
self.runconf.python_args = to_text_string(self.pclo_edit.text())
return self.runconf.get()
def is_valid(self):
wdir = to_text_string(self.wd_edit.text())
if not self.wd_cb.isChecked() or osp.isdir(wdir):
return True
else:
QMessageBox.critical(self, _("Run configuration"),
_("The following working directory is "
"not valid:<br><b>%s</b>") % wdir)
return False
def set_firstrun_o(self):
CONF.set('run', ALWAYS_OPEN_FIRST_RUN_OPTION,
self.firstrun_cb.isChecked())
示例2: ContentsWidget
# 需要导入模块: from spyderlib.qt.QtGui import QRadioButton [as 别名]
# 或者: from spyderlib.qt.QtGui.QRadioButton import isChecked [as 别名]
#.........这里部分代码省略.........
row_btn_layout = QHBoxLayout()
self.eol_btn = QRadioButton(_("EOL"))
self.eol_btn.setChecked(True)
row_btn_layout.addWidget(self.eol_btn)
other_btn_row = QRadioButton(_("other"))
row_btn_layout.addWidget(other_btn_row)
row_w.setLayout(row_btn_layout)
grid_layout.addWidget(row_w, 1, 1)
self.line_edt_row = QLineEdit(";")
self.line_edt_row.setMaximumWidth(30)
self.line_edt_row.setEnabled(False)
other_btn_row.toggled.connect(self.line_edt_row.setEnabled)
grid_layout.addWidget(self.line_edt_row, 1, 2)
grid_layout.setRowMinimumHeight(2, 15)
other_group = QGroupBox(_("Additional options"))
other_layout = QGridLayout()
other_group.setLayout(other_layout)
skiprows_label = QLabel(_("Skip rows:"))
other_layout.addWidget(skiprows_label, 0, 0)
self.skiprows_edt = QLineEdit("0")
self.skiprows_edt.setMaximumWidth(30)
intvalid = QIntValidator(0, len(to_text_string(text).splitlines()), self.skiprows_edt)
self.skiprows_edt.setValidator(intvalid)
other_layout.addWidget(self.skiprows_edt, 0, 1)
other_layout.setColumnMinimumWidth(2, 5)
comments_label = QLabel(_("Comments:"))
other_layout.addWidget(comments_label, 0, 3)
self.comments_edt = QLineEdit("#")
self.comments_edt.setMaximumWidth(30)
other_layout.addWidget(self.comments_edt, 0, 4)
self.trnsp_box = QCheckBox(_("Transpose"))
# self.trnsp_box.setEnabled(False)
other_layout.addWidget(self.trnsp_box, 1, 0, 2, 0)
grid_layout.addWidget(other_group, 3, 0, 2, 0)
opts_frame = QFrame()
opts_frame.setLayout(grid_layout)
data_btn.toggled.connect(opts_frame.setEnabled)
data_btn.toggled.connect(self.set_as_data)
code_btn.toggled.connect(self.set_as_code)
# self.connect(txt_btn, SIGNAL("toggled(bool)"),
# self, SLOT("is_text(bool)"))
# Final layout
layout = QVBoxLayout()
layout.addWidget(type_frame)
layout.addWidget(self.text_editor)
layout.addWidget(opts_frame)
self.setLayout(layout)
def get_as_data(self):
"""Return if data type conversion"""
return self._as_data
def get_as_code(self):
"""Return if code type conversion"""
return self._as_code
def get_as_num(self):
"""Return if numeric type conversion"""
return self._as_num
def get_col_sep(self):
"""Return the column separator"""
if self.tab_btn.isChecked():
return u"\t"
return to_text_string(self.line_edt.text())
def get_row_sep(self):
"""Return the row separator"""
if self.eol_btn.isChecked():
return u"\n"
return to_text_string(self.line_edt_row.text())
def get_skiprows(self):
"""Return number of lines to be skipped"""
return int(to_text_string(self.skiprows_edt.text()))
def get_comments(self):
"""Return comment string"""
return to_text_string(self.comments_edt.text())
@Slot(bool)
def set_as_data(self, as_data):
"""Set if data type conversion"""
self._as_data = as_data
self.asDataChanged.emit(as_data)
@Slot(bool)
def set_as_code(self, as_code):
"""Set if code type conversion"""
self._as_code = as_code
示例3: FindOptions
# 需要导入模块: from spyderlib.qt.QtGui import QRadioButton [as 别名]
# 或者: from spyderlib.qt.QtGui.QRadioButton import isChecked [as 别名]
#.........这里部分代码省略.........
vlayout.addLayout(hlayout2)
vlayout.addLayout(hlayout3)
self.more_widgets = (hlayout2, hlayout3)
self.toggle_more_options(more_options)
self.setLayout(vlayout)
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
@Slot(bool)
def toggle_more_options(self, state):
for layout in self.more_widgets:
for index in range(layout.count()):
if state and self.isVisible() or not state:
layout.itemAt(index).widget().setVisible(state)
if state:
icon = ima.icon('options_less')
tip = _('Hide advanced options')
else:
icon = ima.icon('options_more')
tip = _('Show advanced options')
self.more_options.setIcon(icon)
self.more_options.setToolTip(tip)
def update_combos(self):
self.search_text.lineEdit().returnPressed.emit()
self.include_pattern.lineEdit().returnPressed.emit()
self.exclude_pattern.lineEdit().returnPressed.emit()
def detect_hg_repository(self, path=None):
if path is None:
path = getcwd()
hg_repository = is_hg_installed() and get_vcs_root(path) is not None
self.hg_manifest.setEnabled(hg_repository)
if not hg_repository and self.hg_manifest.isChecked():
self.custom_dir.setChecked(True)
def set_search_text(self, text):
if text:
self.search_text.add_text(text)
self.search_text.lineEdit().selectAll()
self.search_text.setFocus()
def get_options(self, all=False):
# Getting options
utext = to_text_string(self.search_text.currentText())
if not utext:
return
try:
texts = [(utext.encode('ascii'), 'ascii')]
except UnicodeEncodeError:
texts = []
for enc in self.supported_encodings:
try:
texts.append((utext.encode(enc), enc))
except UnicodeDecodeError:
pass
text_re = self.edit_regexp.isChecked()
include = to_text_string(self.include_pattern.currentText())
include_re = self.include_regexp.isChecked()
exclude = to_text_string(self.exclude_pattern.currentText())
exclude_re = self.exclude_regexp.isChecked()
python_path = self.python_path.isChecked()
hg_manifest = self.hg_manifest.isChecked()
path = osp.abspath( to_text_string( self.dir_combo.currentText() ) )
# Finding text occurrences
示例4: RunConfigOptions
# 需要导入模块: from spyderlib.qt.QtGui import QRadioButton [as 别名]
# 或者: from spyderlib.qt.QtGui.QRadioButton import isChecked [as 别名]
class RunConfigOptions(QWidget):
"""Run configuration options"""
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.runconf = RunConfiguration()
common_group = QGroupBox(_("General settings"))
common_layout = QGridLayout()
common_group.setLayout(common_layout)
self.clo_cb = QCheckBox(_("Command line options:"))
common_layout.addWidget(self.clo_cb, 0, 0)
self.clo_edit = QLineEdit()
self.connect(self.clo_cb, SIGNAL("toggled(bool)"), self.clo_edit.setEnabled)
self.clo_edit.setEnabled(False)
common_layout.addWidget(self.clo_edit, 0, 1)
self.wd_cb = QCheckBox(_("Working directory:"))
common_layout.addWidget(self.wd_cb, 1, 0)
wd_layout = QHBoxLayout()
self.wd_edit = QLineEdit()
self.connect(self.wd_cb, SIGNAL("toggled(bool)"), self.wd_edit.setEnabled)
self.wd_edit.setEnabled(False)
wd_layout.addWidget(self.wd_edit)
browse_btn = QPushButton(get_std_icon("DirOpenIcon"), "", self)
browse_btn.setToolTip(_("Select directory"))
self.connect(browse_btn, SIGNAL("clicked()"), self.select_directory)
wd_layout.addWidget(browse_btn)
common_layout.addLayout(wd_layout, 1, 1)
radio_group = QGroupBox(_("Interpreter"))
radio_layout = QVBoxLayout()
radio_group.setLayout(radio_layout)
self.current_radio = QRadioButton(_("Execute in current Python " "or IPython interpreter"))
radio_layout.addWidget(self.current_radio)
self.new_radio = QRadioButton(_("Execute in a new dedicated " "Python interpreter"))
radio_layout.addWidget(self.new_radio)
self.systerm_radio = QRadioButton(_("Execute in an external " "system terminal"))
radio_layout.addWidget(self.systerm_radio)
new_group = QGroupBox(_("Dedicated Python interpreter"))
self.connect(self.current_radio, SIGNAL("toggled(bool)"), new_group.setDisabled)
new_layout = QGridLayout()
new_group.setLayout(new_layout)
self.interact_cb = QCheckBox(_("Interact with the Python " "interpreter after execution"))
new_layout.addWidget(self.interact_cb, 1, 0, 1, -1)
self.pclo_cb = QCheckBox(_("Command line options:"))
new_layout.addWidget(self.pclo_cb, 2, 0)
self.pclo_edit = QLineEdit()
self.connect(self.pclo_cb, SIGNAL("toggled(bool)"), self.pclo_edit.setEnabled)
self.pclo_edit.setEnabled(False)
new_layout.addWidget(self.pclo_edit, 2, 1)
pclo_label = QLabel(_("The <b>-u</b> option is " "added to these commands"))
pclo_label.setWordWrap(True)
new_layout.addWidget(pclo_label, 3, 1)
# TODO: Add option for "Post-mortem debugging"
layout = QVBoxLayout()
layout.addWidget(common_group)
layout.addWidget(radio_group)
layout.addWidget(new_group)
self.setLayout(layout)
def select_directory(self):
"""Select directory"""
basedir = unicode(self.wd_edit.text())
if not osp.isdir(basedir):
basedir = os.getcwdu()
directory = getexistingdirectory(self, _("Select directory"), basedir)
if directory:
self.wd_edit.setText(directory)
self.wd_cb.setChecked(True)
def set(self, options):
self.runconf.set(options)
self.clo_cb.setChecked(self.runconf.args_enabled)
self.clo_edit.setText(self.runconf.args)
self.wd_cb.setChecked(self.runconf.wdir_enabled)
self.wd_edit.setText(self.runconf.wdir)
if self.runconf.current:
self.current_radio.setChecked(True)
elif self.runconf.systerm:
self.systerm_radio.setChecked(True)
else:
self.new_radio.setChecked(True)
self.interact_cb.setChecked(self.runconf.interact)
self.pclo_cb.setChecked(self.runconf.python_args_enabled)
self.pclo_edit.setText(self.runconf.python_args)
def get(self):
self.runconf.args_enabled = self.clo_cb.isChecked()
self.runconf.args = unicode(self.clo_edit.text())
self.runconf.wdir_enabled = self.wd_cb.isChecked()
self.runconf.wdir = unicode(self.wd_edit.text())
self.runconf.current = self.current_radio.isChecked()
self.runconf.systerm = self.systerm_radio.isChecked()
self.runconf.interact = self.interact_cb.isChecked()
self.runconf.python_args_enabled = self.pclo_cb.isChecked()
self.runconf.python_args = unicode(self.pclo_edit.text())
return self.runconf.get()
#.........这里部分代码省略.........