本文整理汇总了Python中spyderlib.qt.QtGui.QLineEdit.setText方法的典型用法代码示例。如果您正苦于以下问题:Python QLineEdit.setText方法的具体用法?Python QLineEdit.setText怎么用?Python QLineEdit.setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spyderlib.qt.QtGui.QLineEdit
的用法示例。
在下文中一共展示了QLineEdit.setText方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ColorLayout
# 需要导入模块: from spyderlib.qt.QtGui import QLineEdit [as 别名]
# 或者: from spyderlib.qt.QtGui.QLineEdit import setText [as 别名]
class ColorLayout(QHBoxLayout):
"""Color-specialized QLineEdit layout"""
def __init__(self, color, parent=None):
QHBoxLayout.__init__(self)
assert isinstance(color, QColor)
self.lineedit = QLineEdit(color.name(), parent)
self.connect(self.lineedit, SIGNAL("textChanged(QString)"),
self.update_color)
self.addWidget(self.lineedit)
self.colorbtn = ColorButton(parent)
self.colorbtn.color = color
self.connect(self.colorbtn, SIGNAL("colorChanged(QColor)"),
self.update_text)
self.addWidget(self.colorbtn)
def update_color(self, text):
color = text_to_qcolor(text)
if color.isValid():
self.colorbtn.color = color
def update_text(self, color):
self.lineedit.setText(color.name())
def text(self):
return self.lineedit.text()
示例2: Help
# 需要导入模块: from spyderlib.qt.QtGui import QLineEdit [as 别名]
# 或者: from spyderlib.qt.QtGui.QLineEdit import setText [as 别名]
#.........这里部分代码省略.........
if (self.locked and not force_refresh):
return
self.switch_to_console_source()
add_to_combo = True
if text is None:
text = to_text_string(self.combo.currentText())
add_to_combo = False
found = self.show_help(text, ignore_unknown=ignore_unknown)
if ignore_unknown and not found:
return
if add_to_combo:
self.combo.add_text(text)
if found:
self.save_history()
if self.dockwidget is not None:
self.dockwidget.blockSignals(True)
self.__eventually_raise_help(text, force=force_refresh)
if self.dockwidget is not None:
self.dockwidget.blockSignals(False)
def set_editor_doc(self, doc, force_refresh=False):
"""
Use the help plugin to show docstring dictionary computed
with introspection plugin from the Editor plugin
"""
if (self.locked and not force_refresh):
return
self.switch_to_editor_source()
self._last_editor_doc = doc
self.object_edit.setText(doc['obj_text'])
if self.rich_help:
self.render_sphinx_doc(doc)
else:
self.set_plain_text(doc, is_code=False)
if self.dockwidget is not None:
self.dockwidget.blockSignals(True)
self.__eventually_raise_help(doc['docstring'], force=force_refresh)
if self.dockwidget is not None:
self.dockwidget.blockSignals(False)
def __eventually_raise_help(self, text, force=False):
index = self.source_combo.currentIndex()
if hasattr(self.main, 'tabifiedDockWidgets'):
# 'QMainWindow.tabifiedDockWidgets' was introduced in PyQt 4.5
if self.dockwidget and (force or self.dockwidget.isVisible()) \
and not self.ismaximized \
and (force or text != self._last_texts[index]):
dockwidgets = self.main.tabifiedDockWidgets(self.dockwidget)
if self.main.console.dockwidget not in dockwidgets and \
(hasattr(self.main, 'extconsole') and \
self.main.extconsole.dockwidget not in dockwidgets):
self.dockwidget.show()
self.dockwidget.raise_()
self._last_texts[index] = text
def load_history(self, obj=None):
"""Load history from a text file in user home directory"""
if osp.isfile(self.LOG_PATH):
history = [line.replace('\n', '')
for line in open(self.LOG_PATH, 'r').readlines()]
示例3: RunConfigOptions
# 需要导入模块: from spyderlib.qt.QtGui import QLineEdit [as 别名]
# 或者: from spyderlib.qt.QtGui.QLineEdit import setText [as 别名]
class RunConfigOptions(QWidget):
"""Run configuration options"""
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.current_radio = None
self.dedicated_radio = None
self.systerm_radio = None
self.runconf = RunConfiguration()
firstrun_o = CONF.get('run', ALWAYS_OPEN_FIRST_RUN_OPTION, False)
# --- General settings ----
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)
# --- Interpreter ---
interpreter_group = QGroupBox(_("Console"))
interpreter_layout = QVBoxLayout()
interpreter_group.setLayout(interpreter_layout)
self.current_radio = QRadioButton(CURRENT_INTERPRETER)
interpreter_layout.addWidget(self.current_radio)
self.dedicated_radio = QRadioButton(DEDICATED_INTERPRETER)
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)
#.........这里部分代码省略.........
示例4: ImportWizard
# 需要导入模块: from spyderlib.qt.QtGui import QLineEdit [as 别名]
# 或者: from spyderlib.qt.QtGui.QLineEdit import setText [as 别名]
class ImportWizard(QDialog):
"""Text data import wizard"""
def __init__(self, parent, text, title=None, icon=None, contents_title=None, varname=None):
QDialog.__init__(self, parent)
# Destroying the C++ object right after closing the dialog box,
# otherwise it may be garbage-collected in another QThread
# (e.g. the editor's analysis thread in Spyder), thus leading to
# a segmentation fault on UNIX or an application crash on Windows
self.setAttribute(Qt.WA_DeleteOnClose)
if title is None:
title = _("Import wizard")
self.setWindowTitle(title)
if icon is None:
self.setWindowIcon(ima.icon("fileimport"))
if contents_title is None:
contents_title = _("Raw text")
if varname is None:
varname = _("variable_name")
self.var_name, self.clip_data = None, None
# Setting GUI
self.tab_widget = QTabWidget(self)
self.text_widget = ContentsWidget(self, text)
self.table_widget = PreviewWidget(self)
self.tab_widget.addTab(self.text_widget, _("text"))
self.tab_widget.setTabText(0, contents_title)
self.tab_widget.addTab(self.table_widget, _("table"))
self.tab_widget.setTabText(1, _("Preview"))
self.tab_widget.setTabEnabled(1, False)
name_layout = QHBoxLayout()
name_label = QLabel(_("Variable Name"))
name_layout.addWidget(name_label)
self.name_edt = QLineEdit()
self.name_edt.setText(varname)
name_layout.addWidget(self.name_edt)
btns_layout = QHBoxLayout()
cancel_btn = QPushButton(_("Cancel"))
btns_layout.addWidget(cancel_btn)
cancel_btn.clicked.connect(self.reject)
h_spacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
btns_layout.addItem(h_spacer)
self.back_btn = QPushButton(_("Previous"))
self.back_btn.setEnabled(False)
btns_layout.addWidget(self.back_btn)
self.back_btn.clicked.connect(ft_partial(self._set_step, step=-1))
self.fwd_btn = QPushButton(_("Next"))
btns_layout.addWidget(self.fwd_btn)
self.fwd_btn.clicked.connect(ft_partial(self._set_step, step=1))
self.done_btn = QPushButton(_("Done"))
self.done_btn.setEnabled(False)
btns_layout.addWidget(self.done_btn)
self.done_btn.clicked.connect(self.process)
self.text_widget.asDataChanged.connect(self.fwd_btn.setEnabled)
self.text_widget.asDataChanged.connect(self.done_btn.setDisabled)
layout = QVBoxLayout()
layout.addLayout(name_layout)
layout.addWidget(self.tab_widget)
layout.addLayout(btns_layout)
self.setLayout(layout)
def _focus_tab(self, tab_idx):
"""Change tab focus"""
for i in range(self.tab_widget.count()):
self.tab_widget.setTabEnabled(i, False)
self.tab_widget.setTabEnabled(tab_idx, True)
self.tab_widget.setCurrentIndex(tab_idx)
def _set_step(self, step):
"""Proceed to a given step"""
new_tab = self.tab_widget.currentIndex() + step
assert new_tab < self.tab_widget.count() and new_tab >= 0
if new_tab == self.tab_widget.count() - 1:
try:
self.table_widget.open_data(
self._get_plain_text(),
self.text_widget.get_col_sep(),
self.text_widget.get_row_sep(),
self.text_widget.trnsp_box.isChecked(),
self.text_widget.get_skiprows(),
self.text_widget.get_comments(),
)
self.done_btn.setEnabled(True)
self.done_btn.setDefault(True)
self.fwd_btn.setEnabled(False)
self.back_btn.setEnabled(True)
except (SyntaxError, AssertionError) as error:
QMessageBox.critical(
self,
_("Import wizard"),
_(
#.........这里部分代码省略.........
示例5: ImportWizard
# 需要导入模块: from spyderlib.qt.QtGui import QLineEdit [as 别名]
# 或者: from spyderlib.qt.QtGui.QLineEdit import setText [as 别名]
class ImportWizard(QDialog):
"""Text data import wizard"""
def __init__(self, parent, text,
title=None, icon=None, contents_title=None, varname=None):
QDialog.__init__(self, parent)
# Destroying the C++ object right after closing the dialog box,
# otherwise it may be garbage-collected in another QThread
# (e.g. the editor's analysis thread in Spyder), thus leading to
# a segmentation fault on UNIX or an application crash on Windows
self.setAttribute(Qt.WA_DeleteOnClose)
if title is None:
title = _("Import wizard")
self.setWindowTitle(title)
if icon is None:
self.setWindowIcon(get_icon("fileimport.png"))
if contents_title is None:
contents_title = _("Raw text")
if varname is None:
varname = _("variable_name")
self.var_name, self.clip_data = None, None
# Setting GUI
self.tab_widget = QTabWidget(self)
self.text_widget = ContentsWidget(self, text)
self.table_widget = PreviewWidget(self)
self.tab_widget.addTab(self.text_widget, _("text"))
self.tab_widget.setTabText(0, contents_title)
self.tab_widget.addTab(self.table_widget, _("table"))
self.tab_widget.setTabText(1, _("Preview"))
self.tab_widget.setTabEnabled(1, False)
name_layout = QHBoxLayout()
name_h_spacer = QSpacerItem(40, 20,
QSizePolicy.Expanding, QSizePolicy.Minimum)
name_layout.addItem(name_h_spacer)
name_label = QLabel(_("Name"))
name_layout.addWidget(name_label)
self.name_edt = QLineEdit()
self.name_edt.setMaximumWidth(100)
self.name_edt.setText(varname)
name_layout.addWidget(self.name_edt)
btns_layout = QHBoxLayout()
cancel_btn = QPushButton(_("Cancel"))
btns_layout.addWidget(cancel_btn)
self.connect(cancel_btn, SIGNAL("clicked()"), self, SLOT("reject()"))
h_spacer = QSpacerItem(40, 20,
QSizePolicy.Expanding, QSizePolicy.Minimum)
btns_layout.addItem(h_spacer)
self.back_btn = QPushButton(_("Previous"))
self.back_btn.setEnabled(False)
btns_layout.addWidget(self.back_btn)
self.connect(self.back_btn, SIGNAL("clicked()"),
ft_partial(self._set_step, step=-1))
self.fwd_btn = QPushButton(_("Next"))
btns_layout.addWidget(self.fwd_btn)
self.connect(self.fwd_btn, SIGNAL("clicked()"),
ft_partial(self._set_step, step=1))
self.done_btn = QPushButton(_("Done"))
self.done_btn.setEnabled(False)
btns_layout.addWidget(self.done_btn)
self.connect(self.done_btn, SIGNAL("clicked()"),
self, SLOT("process()"))
self.connect(self.text_widget, SIGNAL("asDataChanged(bool)"),
self.fwd_btn, SLOT("setEnabled(bool)"))
self.connect(self.text_widget, SIGNAL("asDataChanged(bool)"),
self.done_btn, SLOT("setDisabled(bool)"))
layout = QVBoxLayout()
layout.addLayout(name_layout)
layout.addWidget(self.tab_widget)
layout.addLayout(btns_layout)
self.setLayout(layout)
def _focus_tab(self, tab_idx):
"""Change tab focus"""
for i in range(self.tab_widget.count()):
self.tab_widget.setTabEnabled(i, False)
self.tab_widget.setTabEnabled(tab_idx, True)
self.tab_widget.setCurrentIndex(tab_idx)
def _set_step(self,step):
"""Proceed to a given step"""
new_tab = self.tab_widget.currentIndex() + step
assert new_tab < self.tab_widget.count() and new_tab >= 0
if new_tab == self.tab_widget.count()-1:
try:
self.table_widget.open_data(self._get_plain_text(),
self.text_widget.get_col_sep(),
self.text_widget.get_row_sep(),
self.text_widget.trnsp_box.isChecked(),
self.text_widget.get_skiprows(),
self.text_widget.get_comments())
self.done_btn.setEnabled(True)
#.........这里部分代码省略.........
示例6: RunConfigOptions
# 需要导入模块: from spyderlib.qt.QtGui import QLineEdit [as 别名]
# 或者: from spyderlib.qt.QtGui.QLineEdit import setText [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()
#.........这里部分代码省略.........
示例7: KernelConnectionDialog
# 需要导入模块: from spyderlib.qt.QtGui import QLineEdit [as 别名]
# 或者: from spyderlib.qt.QtGui.QLineEdit import setText [as 别名]
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:
#.........这里部分代码省略.........
示例8: ObjectInspector
# 需要导入模块: from spyderlib.qt.QtGui import QLineEdit [as 别名]
# 或者: from spyderlib.qt.QtGui.QLineEdit import setText [as 别名]
#.........这里部分代码省略.........
if (self.locked and not force_refresh):
return
self.switch_to_console_source()
add_to_combo = True
if text is None:
text = unicode(self.combo.currentText())
add_to_combo = False
found = self.show_help(text, ignore_unknown=ignore_unknown)
if ignore_unknown and not found:
return
if add_to_combo:
self.combo.add_text(text)
self.save_history()
if self.dockwidget is not None:
self.dockwidget.blockSignals(True)
self.__eventually_raise_inspector(text, force=force_refresh)
if self.dockwidget is not None:
self.dockwidget.blockSignals(False)
def set_rope_doc(self, objtxt, doctxt, force_refresh=False):
"""Use the object inspector to show text computed with rope
from the editor plugin"""
if (self.locked and not force_refresh):
return
self.switch_to_editor_source()
self._last_rope_data = objtxt, doctxt
self.object_edit.setText(objtxt)
if self.rich_help:
self.set_sphinx_text(doctxt)
else:
self.set_plain_text(doctxt, is_code=False)
if self.dockwidget is not None:
self.dockwidget.blockSignals(True)
self.__eventually_raise_inspector(doctxt, force=force_refresh)
if self.dockwidget is not None:
self.dockwidget.blockSignals(False)
def __eventually_raise_inspector(self, text, force=False):
index = self.source_combo.currentIndex()
if hasattr(self.main, 'tabifiedDockWidgets'):
# 'QMainWindow.tabifiedDockWidgets' was introduced in PyQt 4.5
if self.dockwidget and (force or self.dockwidget.isVisible()) \
and not self.ismaximized \
and (force or text != self._last_texts[index]):
dockwidgets = self.main.tabifiedDockWidgets(self.dockwidget)
if self.main.console.dockwidget not in dockwidgets and \
(hasattr(self.main, 'extconsole') and \
self.main.extconsole.dockwidget not in dockwidgets):
self.dockwidget.show()
self.dockwidget.raise_()
self._last_texts[index] = text
def load_history(self, obj=None):
"""Load history from a text file in user home directory"""
if osp.isfile(self.LOG_PATH):
history = [line.replace('\n','')
for line in file(self.LOG_PATH, 'r').readlines()]
else: