本文整理汇总了Python中qtpy.QtWidgets.QLineEdit.show方法的典型用法代码示例。如果您正苦于以下问题:Python QLineEdit.show方法的具体用法?Python QLineEdit.show怎么用?Python QLineEdit.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtWidgets.QLineEdit
的用法示例。
在下文中一共展示了QLineEdit.show方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Help
# 需要导入模块: from qtpy.QtWidgets import QLineEdit [as 别名]
# 或者: from qtpy.QtWidgets.QLineEdit import show [as 别名]
class Help(SpyderPluginWidget):
"""
Docstrings viewer widget
"""
CONF_SECTION = 'help'
CONFIGWIDGET_CLASS = HelpConfigPage
LOG_PATH = get_conf_path(CONF_SECTION)
FONT_SIZE_DELTA = DEFAULT_SMALL_DELTA
# Signals
focus_changed = Signal()
def __init__(self, parent):
if PYQT5:
SpyderPluginWidget.__init__(self, parent, main = parent)
else:
SpyderPluginWidget.__init__(self, parent)
self.internal_shell = None
# Initialize plugin
self.initialize_plugin()
self.no_doc_string = _("No further documentation available")
self._last_console_cb = None
self._last_editor_cb = None
self.plain_text = PlainText(self)
self.rich_text = RichText(self)
color_scheme = self.get_color_scheme()
self.set_plain_text_font(self.get_plugin_font(), color_scheme)
self.plain_text.editor.toggle_wrap_mode(self.get_option('wrap'))
# Add entries to read-only editor context-menu
self.wrap_action = create_action(self, _("Wrap lines"),
toggled=self.toggle_wrap_mode)
self.wrap_action.setChecked(self.get_option('wrap'))
self.plain_text.editor.readonly_menu.addSeparator()
add_actions(self.plain_text.editor.readonly_menu, (self.wrap_action,))
self.set_rich_text_font(self.get_plugin_font('rich_text'))
self.shell = None
self.external_console = None
# locked = disable link with Console
self.locked = False
self._last_texts = [None, None]
self._last_editor_doc = None
# Object name
layout_edit = QHBoxLayout()
layout_edit.setContentsMargins(0, 0, 0, 0)
txt = _("Source")
if sys.platform == 'darwin':
source_label = QLabel(" " + txt)
else:
source_label = QLabel(txt)
layout_edit.addWidget(source_label)
self.source_combo = QComboBox(self)
self.source_combo.addItems([_("Console"), _("Editor")])
self.source_combo.currentIndexChanged.connect(self.source_changed)
if (not programs.is_module_installed('rope') and
not programs.is_module_installed('jedi', '>=0.8.1')):
self.source_combo.hide()
source_label.hide()
layout_edit.addWidget(self.source_combo)
layout_edit.addSpacing(10)
layout_edit.addWidget(QLabel(_("Object")))
self.combo = ObjectComboBox(self)
layout_edit.addWidget(self.combo)
self.object_edit = QLineEdit(self)
self.object_edit.setReadOnly(True)
layout_edit.addWidget(self.object_edit)
self.combo.setMaxCount(self.get_option('max_history_entries'))
self.combo.addItems( self.load_history() )
self.combo.setItemText(0, '')
self.combo.valid.connect(lambda valid: self.force_refresh())
# Plain text docstring option
self.docstring = True
self.rich_help = self.get_option('rich_mode', True)
self.plain_text_action = create_action(self, _("Plain Text"),
toggled=self.toggle_plain_text)
# Source code option
self.show_source_action = create_action(self, _("Show Source"),
toggled=self.toggle_show_source)
# Rich text option
self.rich_text_action = create_action(self, _("Rich Text"),
toggled=self.toggle_rich_text)
# Add the help actions to an exclusive QActionGroup
help_actions = QActionGroup(self)
help_actions.setExclusive(True)
help_actions.addAction(self.plain_text_action)
#.........这里部分代码省略.........
示例2: ColorbarWidget
# 需要导入模块: from qtpy.QtWidgets import QLineEdit [as 别名]
# 或者: from qtpy.QtWidgets.QLineEdit import show [as 别名]
class ColorbarWidget(QWidget):
colorbarChanged = Signal() # The parent should simply redraw their canvas
def __init__(self, parent=None):
super(ColorbarWidget, self).__init__(parent)
self.setWindowTitle("Colorbar")
self.setMaximumWidth(200)
self.dval = QDoubleValidator()
self.cmin = QLineEdit()
self.cmin_value = 0
self.cmin.setMaximumWidth(100)
self.cmin.editingFinished.connect(self.clim_changed)
self.cmin_layout = QHBoxLayout()
self.cmin_layout.addStretch()
self.cmin_layout.addWidget(self.cmin)
self.cmin_layout.addStretch()
self.cmax = QLineEdit()
self.cmax_value = 1
self.cmax.setMaximumWidth(100)
self.cmax.editingFinished.connect(self.clim_changed)
self.cmin.setValidator(self.dval)
self.cmax.setValidator(self.dval)
self.cmax_layout = QHBoxLayout()
self.cmax_layout.addStretch()
self.cmax_layout.addWidget(self.cmax)
self.cmax_layout.addStretch()
self.norm_layout = QHBoxLayout()
self.norm = QComboBox()
self.norm.addItems(NORM_OPTS)
self.norm.currentIndexChanged.connect(self.norm_changed)
self.powerscale = QLineEdit()
self.powerscale_value = 2
self.powerscale.setText("2")
self.powerscale.setValidator(QDoubleValidator(0.001,100,3))
self.powerscale.setMaximumWidth(50)
self.powerscale.editingFinished.connect(self.norm_changed)
self.powerscale.hide()
self.powerscale_label = QLabel("n=")
self.powerscale_label.hide()
self.norm_layout.addStretch()
self.norm_layout.addWidget(self.norm)
self.norm_layout.addStretch()
self.norm_layout.addWidget(self.powerscale_label)
self.norm_layout.addWidget(self.powerscale)
self.autoscale = QCheckBox("Autoscaling")
self.autoscale.setChecked(True)
self.autoscale.stateChanged.connect(self.update_clim)
self.canvas = FigureCanvas(Figure())
if parent:
# Set facecolor to match parent
self.canvas.figure.set_facecolor(parent.palette().window().color().getRgbF())
self.ax = self.canvas.figure.add_axes([0.4,0.05,0.2,0.9])
# layout
self.layout = QVBoxLayout(self)
self.layout.addLayout(self.cmax_layout)
self.layout.addWidget(self.canvas, stretch=1)
self.layout.addLayout(self.cmin_layout)
self.layout.addLayout(self.norm_layout)
self.layout.addWidget(self.autoscale)
def set_mappable(self, mappable):
"""
When a new plot is created this method should be called with the new mappable
"""
self.ax.clear()
self.colorbar = Colorbar(ax=self.ax, mappable=mappable)
self.cmin_value, self.cmax_value = self.colorbar.get_clim()
self.update_clim_text()
self.redraw()
def norm_changed(self):
"""
Called when a different normalization is selected
"""
idx = self.norm.currentIndex()
if NORM_OPTS[idx] == 'Power':
self.powerscale.show()
self.powerscale_label.show()
else:
self.powerscale.hide()
self.powerscale_label.hide()
self.colorbar.mappable.set_norm(self.get_norm())
self.colorbarChanged.emit()
def get_norm(self):
"""
This will create a matplotlib.colors.Normalize from selected idx, limits and powerscale
"""
idx = self.norm.currentIndex()
if self.autoscale.isChecked():
#.........这里部分代码省略.........
示例3: SlitSelectionUI
# 需要导入模块: from qtpy.QtWidgets import QLineEdit [as 别名]
# 或者: from qtpy.QtWidgets.QLineEdit import show [as 别名]
class SlitSelectionUI(QDialog):
"""
Custom slit selection UI and editor.
Right now it only applies slits temporarly,
ie. if the current target is changed, slit settings
will be lost.
"""
def __init__(self, mosviz_viewer, parent=None):
super(SlitSelectionUI, self).__init__(parent=parent)
self.mosviz_viewer = mosviz_viewer
self._slit_dict = {}
self._mosviz_table_option_text = 'Slit from MOSViz Table'
self._init_ui()
def _init_ui(self):
self.slit_type_label = QLabel('Slit Type')
self.slit_type_combo = QComboBox()
self.slit_type_combo.currentIndexChanged.connect(self.update_info)
hbl1 = QHBoxLayout()
hbl1.addWidget(self.slit_type_label)
hbl1.addWidget(self.slit_type_combo)
self.slit_width_label = QLabel('Slit Width')
self.slit_width_input = QLineEdit()
self.slit_width_combo = QComboBox()
self.slit_width_units = QLabel('arcsec')
hbl2 = QHBoxLayout()
hbl2.addWidget(self.slit_width_label)
hbl2.addWidget(self.slit_width_input)
hbl2.addWidget(self.slit_width_combo)
hbl2.addWidget(self.slit_width_units)
self.slit_length_label = QLabel('Slit Length')
self.slit_length_input = QLineEdit()
self.slit_length_combo = QComboBox()
self.slit_length_units = QLabel('arcsec')
hbl3 = QHBoxLayout()
hbl3.addWidget(self.slit_length_label)
hbl3.addWidget(self.slit_length_input)
hbl3.addWidget(self.slit_length_combo)
hbl3.addWidget(self.slit_length_units)
self.okButton = QPushButton('Apply')
self.okButton.clicked.connect(self.apply)
self.okButton.setDefault(True)
self.cancelButton = QPushButton('Cancel')
self.cancelButton.clicked.connect(self.cancel)
hbl4 = QHBoxLayout()
hbl4.addWidget(self.cancelButton)
hbl4.addWidget(self.okButton)
vbl = QVBoxLayout()
vbl.addLayout(hbl1)
vbl.addLayout(hbl2)
vbl.addLayout(hbl3)
vbl.addLayout(hbl4)
self.setLayout(vbl)
self.vbl = vbl
self._load_selections()
self._populate_combo()
self.update_info(0)
self.show()
def _load_selections(self):
"""Load preconfigured slit shapes from yaml file"""
file_path = os.path.join(os.path.dirname(__file__), 'saved_slits.yaml')
with open(file_path) as f:
self.slit_dict = yaml.load(f)
def _populate_combo(self, default_index=0):
"""Populate combo box with slit types"""
name_list = [self._mosviz_table_option_text] + \
[self.slit_dict[s]['name'] for s in sorted(self.slit_dict)] + \
['Custom']
key_list = ['default'] + [s for s in sorted(self.slit_dict)] + ['custom']
combo_input = [(name, key) for name, key in zip(name_list, key_list)]
update_combobox(self.slit_type_combo, combo_input, default_index=default_index)
@property
def width(self):
if self.slit_width_combo.isVisible():
width = self.slit_width_combo.currentData()
else:
width = self.slit_width_input.text()
return u.Quantity(width)
@property
def length(self):
#.........这里部分代码省略.........