本文整理汇总了Python中spyderlib.qt.QtGui.QCheckBox类的典型用法代码示例。如果您正苦于以下问题:Python QCheckBox类的具体用法?Python QCheckBox怎么用?Python QCheckBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QCheckBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PreviewWidget
class PreviewWidget(QWidget):
"""Import wizard preview widget"""
def __init__(self, parent):
QWidget.__init__(self, parent)
vert_layout = QVBoxLayout()
hor_layout = QHBoxLayout()
self.array_box = QCheckBox(_("Import as array"))
self.array_box.setEnabled(ndarray is not FakeObject)
self.array_box.setChecked(ndarray is not FakeObject)
hor_layout.addWidget(self.array_box)
h_spacer = QSpacerItem(40, 20,
QSizePolicy.Expanding, QSizePolicy.Minimum)
hor_layout.addItem(h_spacer)
self._table_view = PreviewTable(self)
vert_layout.addLayout(hor_layout)
vert_layout.addWidget(self._table_view)
self.setLayout(vert_layout)
def open_data(self, text, colsep=u"\t", rowsep=u"\n",
transpose=False, skiprows=0, comments='#'):
"""Open clipboard text as table"""
self._table_view.process_data(text, colsep, rowsep, transpose,
skiprows, comments)
def get_data(self):
"""Return table data"""
return self._table_view.get_data()
示例2: create_scedit
def create_scedit(self, text, option, default=NoDefault, tip=None,
without_layout=False):
label = QLabel(text)
clayout = ColorLayout(QColor(Qt.black), self)
clayout.lineedit.setMaximumWidth(80)
if tip is not None:
clayout.setToolTip(tip)
cb_bold = QCheckBox()
cb_bold.setIcon(ima.icon('bold'))
cb_bold.setToolTip(_("Bold"))
cb_italic = QCheckBox()
cb_italic.setIcon(ima.icon('italic'))
cb_italic.setToolTip(_("Italic"))
self.scedits[(clayout, cb_bold, cb_italic)] = (option, default)
if without_layout:
return label, clayout, cb_bold, cb_italic
layout = QHBoxLayout()
layout.addWidget(label)
layout.addLayout(clayout)
layout.addSpacing(10)
layout.addWidget(cb_bold)
layout.addWidget(cb_italic)
layout.addStretch(1)
layout.setContentsMargins(0, 0, 0, 0)
widget = QWidget(self)
widget.setLayout(layout)
return widget
示例3: __init__
def __init__(self, value, parent=None):
QGridLayout.__init__(self)
font = tuple_to_qfont(value)
assert font is not None
# Font family
self.family = QFontComboBox(parent)
self.family.setCurrentFont(font)
self.addWidget(self.family, 0, 0, 1, -1)
# Font size
self.size = QComboBox(parent)
self.size.setEditable(True)
sizelist = list(range(6, 12)) + list(range(12, 30, 2)) + [36, 48, 72]
size = font.pointSize()
if size not in sizelist:
sizelist.append(size)
sizelist.sort()
self.size.addItems([str(s) for s in sizelist])
self.size.setCurrentIndex(sizelist.index(size))
self.addWidget(self.size, 1, 0)
# Italic or not
self.italic = QCheckBox(_("Italic"), parent)
self.italic.setChecked(font.italic())
self.addWidget(self.italic, 1, 1)
# Bold or not
self.bold = QCheckBox(_("Bold"), parent)
self.bold.setChecked(font.bold())
self.addWidget(self.bold, 1, 2)
示例4: __init__
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)
示例5: create_checkbox
def create_checkbox(self, text, option, default=NoDefault,
tip=None, msg_warning=None, msg_info=None,
msg_if_enabled=False):
checkbox = QCheckBox(text)
if tip is not None:
checkbox.setToolTip(tip)
self.checkboxes[checkbox] = (option, default)
if msg_warning is not None or msg_info is not None:
def show_message(is_checked):
if is_checked or not msg_if_enabled:
if msg_warning is not None:
QMessageBox.warning(self, self.get_name(),
msg_warning, QMessageBox.Ok)
if msg_info is not None:
QMessageBox.information(self, self.get_name(),
msg_info, QMessageBox.Ok)
checkbox.clicked.connect(show_message)
return checkbox
示例6: MessageCheckBox
class MessageCheckBox(QMessageBox):
"""
A QMessageBox derived widget that includes a QCheckBox aligned to the right
under the message and on top of the buttons.
"""
def __init__(self, *args, **kwargs):
super(MessageCheckBox, self).__init__(*args, **kwargs)
self._checkbox = QCheckBox()
# Set layout to include checkbox
size = 9
check_layout = QVBoxLayout()
check_layout.addItem(QSpacerItem(size, size))
check_layout.addWidget(self._checkbox, 0, Qt.AlignRight)
check_layout.addItem(QSpacerItem(size, size))
# Access the Layout of the MessageBox to add the Checkbox
layout = self.layout()
layout.addLayout(check_layout, 1, 1)
# --- Public API
# Methods to access the checkbox
def is_checked(self):
return self._checkbox.isChecked()
def set_checked(self, value):
return self._checkbox.setChecked(value)
def set_check_visible(self, value):
self._checkbox.setVisible(value)
def is_check_visible(self):
self._checkbox.isVisible()
def checkbox_text(self):
self._checkbox.text()
def set_checkbox_text(self, text):
self._checkbox.setText(text)
示例7: setup_and_check
def setup_and_check(self, data, title=''):
"""
Setup DataFrameEditor:
return False if data is not supported, True otherwise
"""
self.layout = QGridLayout()
self.setLayout(self.layout)
self.setWindowIcon(ima.icon('arredit'))
if title:
title = to_text_string(title) + " - %s" % data.__class__.__name__
else:
title = _("%s editor") % data.__class__.__name__
if isinstance(data, Series):
self.is_series = True
data = data.to_frame()
self.setWindowTitle(title)
self.resize(600, 500)
self.dataModel = DataFrameModel(data, parent=self)
self.dataTable = DataFrameView(self, self.dataModel)
self.layout.addWidget(self.dataTable)
self.setLayout(self.layout)
self.setMinimumSize(400, 300)
# Make the dialog act as a window
self.setWindowFlags(Qt.Window)
btn_layout = QHBoxLayout()
btn = QPushButton(_("Format"))
# disable format button for int type
btn_layout.addWidget(btn)
btn.clicked.connect(self.change_format)
btn = QPushButton(_('Resize'))
btn_layout.addWidget(btn)
btn.clicked.connect(self.resize_to_contents)
bgcolor = QCheckBox(_('Background color'))
bgcolor.setChecked(self.dataModel.bgcolor_enabled)
bgcolor.setEnabled(self.dataModel.bgcolor_enabled)
bgcolor.stateChanged.connect(self.change_bgcolor_enable)
btn_layout.addWidget(bgcolor)
self.bgcolor_global = QCheckBox(_('Column min/max'))
self.bgcolor_global.setChecked(self.dataModel.colum_avg_enabled)
self.bgcolor_global.setEnabled(not self.is_series and
self.dataModel.bgcolor_enabled)
self.bgcolor_global.stateChanged.connect(self.dataModel.colum_avg)
btn_layout.addWidget(self.bgcolor_global)
btn_layout.addStretch()
bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
bbox.accepted.connect(self.accept)
bbox.rejected.connect(self.reject)
btn_layout.addWidget(bbox)
self.layout.addLayout(btn_layout, 2, 0)
return True
示例8: setup_and_check
def setup_and_check(self, data, title=""):
"""
Setup DataFrameEditor:
return False if data is not supported, True otherwise
"""
self.layout = QGridLayout()
self.setLayout(self.layout)
self.setWindowIcon(get_icon("arredit.png"))
if title:
title = to_text_string(title) # in case title is not a string
else:
title = _("%s editor") % data.__class__.__name__
if isinstance(data, TimeSeries):
self.is_time_series = True
data = data.to_frame()
self.setWindowTitle(title)
self.resize(600, 500)
self.dataModel = DataFrameModel(data, parent=self)
self.dataTable = DataFrameView(self, self.dataModel)
self.layout.addWidget(self.dataTable)
self.setLayout(self.layout)
self.setMinimumSize(400, 300)
# Make the dialog act as a window
self.setWindowFlags(Qt.Window)
btn_layout = QHBoxLayout()
btn = QPushButton(_("Format"))
# disable format button for int type
btn_layout.addWidget(btn)
self.connect(btn, SIGNAL("clicked()"), self.change_format)
btn = QPushButton(_("Resize"))
btn_layout.addWidget(btn)
self.connect(btn, SIGNAL("clicked()"), self.dataTable.resizeColumnsToContents)
bgcolor = QCheckBox(_("Background color"))
bgcolor.setChecked(self.dataModel.bgcolor_enabled)
bgcolor.setEnabled(self.dataModel.bgcolor_enabled)
self.connect(bgcolor, SIGNAL("stateChanged(int)"), self.change_bgcolor_enable)
btn_layout.addWidget(bgcolor)
self.bgcolor_global = QCheckBox(_("Column min/max"))
self.bgcolor_global.setChecked(self.dataModel.colum_avg_enabled)
self.bgcolor_global.setEnabled(not self.is_time_series and self.dataModel.bgcolor_enabled)
self.connect(self.bgcolor_global, SIGNAL("stateChanged(int)"), self.dataModel.colum_avg)
btn_layout.addWidget(self.bgcolor_global)
btn_layout.addStretch()
bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self.connect(bbox, SIGNAL("accepted()"), SLOT("accept()"))
self.connect(bbox, SIGNAL("rejected()"), SLOT("reject()"))
btn_layout.addWidget(bbox)
self.layout.addLayout(btn_layout, 2, 0)
return True
示例9: __init__
def __init__(self, parent, data, readonly=False,
xlabels=None, ylabels=None):
QWidget.__init__(self, parent)
self.data = data
self.old_data_shape = None
if len(self.data.shape) == 1:
self.old_data_shape = self.data.shape
self.data.shape = (self.data.shape[0], 1)
elif len(self.data.shape) == 0:
self.old_data_shape = self.data.shape
self.data.shape = (1, 1)
format = SUPPORTED_FORMATS.get(data.dtype.name, '%s')
self.model = ArrayModel(self.data, format=format, xlabels=xlabels,
ylabels=ylabels, readonly=readonly, parent=self)
self.view = ArrayView(self, self.model, data.dtype, data.shape)
btn_layout = QHBoxLayout()
btn_layout.setAlignment(Qt.AlignLeft)
btn = QPushButton(_( "Format"))
# disable format button for int type
btn.setEnabled(is_float(data.dtype))
btn_layout.addWidget(btn)
btn.clicked.connect(self.change_format)
btn = QPushButton(_( "Resize"))
btn_layout.addWidget(btn)
btn.clicked.connect(self.view.resize_to_contents)
bgcolor = QCheckBox(_( 'Background color'))
bgcolor.setChecked(self.model.bgcolor_enabled)
bgcolor.setEnabled(self.model.bgcolor_enabled)
bgcolor.stateChanged.connect(self.model.bgcolor)
btn_layout.addWidget(bgcolor)
layout = QVBoxLayout()
layout.addWidget(self.view)
layout.addLayout(btn_layout)
self.setLayout(layout)
示例10: __init__
def __init__(self, *args, **kwargs):
super(MessageCheckBox, self).__init__(*args, **kwargs)
self._checkbox = QCheckBox()
# Set layout to include checkbox
size = 9
check_layout = QVBoxLayout()
check_layout.addItem(QSpacerItem(size, size))
check_layout.addWidget(self._checkbox, 0, Qt.AlignRight)
check_layout.addItem(QSpacerItem(size, size))
# Access the Layout of the MessageBox to add the Checkbox
layout = self.layout()
layout.addLayout(check_layout, 1, 1)
示例11: __init__
def __init__(self, parent):
QWidget.__init__(self, parent)
vert_layout = QVBoxLayout()
hor_layout = QHBoxLayout()
self.array_box = QCheckBox(_("Import as array"))
self.array_box.setEnabled(ndarray is not FakeObject)
self.array_box.setChecked(ndarray is not FakeObject)
hor_layout.addWidget(self.array_box)
h_spacer = QSpacerItem(40, 20,
QSizePolicy.Expanding, QSizePolicy.Minimum)
hor_layout.addItem(h_spacer)
self._table_view = PreviewTable(self)
vert_layout.addLayout(hor_layout)
vert_layout.addWidget(self._table_view)
self.setLayout(vert_layout)
示例12: FontLayout
class FontLayout(QGridLayout):
"""Font selection"""
def __init__(self, value, parent=None):
QGridLayout.__init__(self)
font = tuple_to_qfont(value)
assert font is not None
# Font family
self.family = QFontComboBox(parent)
self.family.setCurrentFont(font)
self.addWidget(self.family, 0, 0, 1, -1)
# Font size
self.size = QComboBox(parent)
self.size.setEditable(True)
sizelist = range(6, 12) + range(12, 30, 2) + [36, 48, 72]
size = font.pointSize()
if size not in sizelist:
sizelist.append(size)
sizelist.sort()
self.size.addItems([str(s) for s in sizelist])
self.size.setCurrentIndex(sizelist.index(size))
self.addWidget(self.size, 1, 0)
# Italic or not
self.italic = QCheckBox(_("Italic"), parent)
self.italic.setChecked(font.italic())
self.addWidget(self.italic, 1, 1)
# Bold or not
self.bold = QCheckBox(_("Bold"), parent)
self.bold.setChecked(font.bold())
self.addWidget(self.bold, 1, 2)
def get_font(self):
font = self.family.currentFont()
font.setItalic(self.italic.isChecked())
font.setBold(self.bold.isChecked())
font.setPointSize(int(self.size.currentText()))
return qfont_to_tuple(font)
示例13: KernelConnectionDialog
class KernelConnectionDialog(QDialog):
"""Dialog to connect to existing kernels (either local or remote)"""
def __init__(self, parent=None):
super(KernelConnectionDialog, self).__init__(parent)
self.setWindowTitle(_('Connect to an existing kernel'))
main_label = QLabel(_("Please enter the connection info of the kernel "
"you want to connect to. For that you can "
"either select its JSON connection file using "
"the <tt>Browse</tt> button, or write directly "
"its id, in case it's a local kernel (for "
"example <tt>kernel-3764.json</tt> or just "
"<tt>3764</tt>)."))
main_label.setWordWrap(True)
main_label.setAlignment(Qt.AlignJustify)
# connection file
cf_label = QLabel(_('Connection info:'))
self.cf = QLineEdit()
self.cf.setPlaceholderText(_('Path to connection file or kernel id'))
self.cf.setMinimumWidth(250)
cf_open_btn = QPushButton(_('Browse'))
self.connect(cf_open_btn, SIGNAL('clicked()'),
self.select_connection_file)
cf_layout = QHBoxLayout()
cf_layout.addWidget(cf_label)
cf_layout.addWidget(self.cf)
cf_layout.addWidget(cf_open_btn)
# remote kernel checkbox
self.rm_cb = QCheckBox(_('This is a remote kernel'))
# ssh connection
self.hn = QLineEdit()
self.hn.setPlaceholderText(_('[email protected]:port'))
self.kf = QLineEdit()
self.kf.setPlaceholderText(_('Path to ssh key file'))
kf_open_btn = QPushButton(_('Browse'))
self.connect(kf_open_btn, SIGNAL('clicked()'), self.select_ssh_key)
kf_layout = QHBoxLayout()
kf_layout.addWidget(self.kf)
kf_layout.addWidget(kf_open_btn)
self.pw = QLineEdit()
self.pw.setPlaceholderText(_('Password or ssh key passphrase'))
self.pw.setEchoMode(QLineEdit.Password)
ssh_form = QFormLayout()
ssh_form.addRow(_('Host name'), self.hn)
ssh_form.addRow(_('Ssh key'), kf_layout)
ssh_form.addRow(_('Password'), self.pw)
# Ok and Cancel buttons
accept_btns = QDialogButtonBox(
QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
Qt.Horizontal, self)
self.connect(accept_btns, SIGNAL('accepted()'), self.accept)
self.connect(accept_btns, SIGNAL('rejected()'), self.reject)
# Dialog layout
layout = QVBoxLayout(self)
layout.addWidget(main_label)
layout.addLayout(cf_layout)
layout.addWidget(self.rm_cb)
layout.addLayout(ssh_form)
layout.addWidget(accept_btns)
# remote kernel checkbox enables the ssh_connection_form
def ssh_set_enabled(state):
for wid in [self.hn, self.kf, kf_open_btn, self.pw]:
wid.setEnabled(state)
for i in range(ssh_form.rowCount()):
ssh_form.itemAt(2 * i).widget().setEnabled(state)
ssh_set_enabled(self.rm_cb.checkState())
self.connect(self.rm_cb, SIGNAL('stateChanged(int)'), ssh_set_enabled)
def select_connection_file(self):
cf = getopenfilename(self, _('Open IPython connection file'),
osp.join(get_ipython_dir(), 'profile_default', 'security'),
'*.json;;*.*')[0]
self.cf.setText(cf)
def select_ssh_key(self):
kf = getopenfilename(self, _('Select ssh key'),
get_ipython_dir(), '*.pem;;*.*')[0]
self.kf.setText(kf)
@staticmethod
def get_connection_parameters(parent=None):
dialog = KernelConnectionDialog(parent)
result = dialog.exec_()
is_remote = bool(dialog.rm_cb.checkState())
accepted = result == QDialog.Accepted
if is_remote:
#.........这里部分代码省略.........
示例14: RunConfigOptions
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()
#.........这里部分代码省略.........
示例15: __init__
def __init__(self, parent, enable_replace=False):
QWidget.__init__(self, parent)
self.enable_replace = enable_replace
self.editor = None
self.is_code_editor = None
glayout = QGridLayout()
glayout.setContentsMargins(0, 0, 0, 0)
self.setLayout(glayout)
self.close_button = create_toolbutton(self, triggered=self.hide,
icon=ima.icon('DialogCloseButton'))
glayout.addWidget(self.close_button, 0, 0)
# Find layout
self.search_text = PatternComboBox(self, tip=_("Search string"),
adjust_to_minimum=False)
self.search_text.valid.connect(
lambda state:
self.find(changed=False, forward=True, rehighlight=False))
self.search_text.lineEdit().textEdited.connect(
self.text_has_been_edited)
self.previous_button = create_toolbutton(self,
triggered=self.find_previous,
icon=ima.icon('ArrowUp'))
self.next_button = create_toolbutton(self,
triggered=self.find_next,
icon=ima.icon('ArrowDown'))
self.next_button.clicked.connect(self.update_search_combo)
self.previous_button.clicked.connect(self.update_search_combo)
self.re_button = create_toolbutton(self, icon=ima.icon('advanced'),
tip=_("Regular expression"))
self.re_button.setCheckable(True)
self.re_button.toggled.connect(lambda state: self.find())
self.case_button = create_toolbutton(self,
icon=get_icon("upper_lower.png"),
tip=_("Case Sensitive"))
self.case_button.setCheckable(True)
self.case_button.toggled.connect(lambda state: self.find())
self.words_button = create_toolbutton(self,
icon=get_icon("whole_words.png"),
tip=_("Whole words"))
self.words_button.setCheckable(True)
self.words_button.toggled.connect(lambda state: self.find())
self.highlight_button = create_toolbutton(self,
icon=get_icon("highlight.png"),
tip=_("Highlight matches"))
self.highlight_button.setCheckable(True)
self.highlight_button.toggled.connect(self.toggle_highlighting)
hlayout = QHBoxLayout()
self.widgets = [self.close_button, self.search_text,
self.previous_button, self.next_button,
self.re_button, self.case_button, self.words_button,
self.highlight_button]
for widget in self.widgets[1:]:
hlayout.addWidget(widget)
glayout.addLayout(hlayout, 0, 1)
# Replace layout
replace_with = QLabel(_("Replace with:"))
self.replace_text = PatternComboBox(self, adjust_to_minimum=False,
tip=_('Replace string'))
self.replace_button = create_toolbutton(self,
text=_('Replace/find'),
icon=ima.icon('DialogApplyButton'),
triggered=self.replace_find,
text_beside_icon=True)
self.replace_button.clicked.connect(self.update_replace_combo)
self.replace_button.clicked.connect(self.update_search_combo)
self.all_check = QCheckBox(_("Replace all"))
self.replace_layout = QHBoxLayout()
widgets = [replace_with, self.replace_text, self.replace_button,
self.all_check]
for widget in widgets:
self.replace_layout.addWidget(widget)
glayout.addLayout(self.replace_layout, 1, 1)
self.widgets.extend(widgets)
self.replace_widgets = widgets
self.hide_replace()
self.search_text.setTabOrder(self.search_text, self.replace_text)
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.shortcuts = self.create_shortcuts(parent)
self.highlight_timer = QTimer(self)
self.highlight_timer.setSingleShot(True)
self.highlight_timer.setInterval(1000)
self.highlight_timer.timeout.connect(self.highlight_matches)