本文整理汇总了Python中qtpy.QtWidgets.QPushButton.hide方法的典型用法代码示例。如果您正苦于以下问题:Python QPushButton.hide方法的具体用法?Python QPushButton.hide怎么用?Python QPushButton.hide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtWidgets.QPushButton
的用法示例。
在下文中一共展示了QPushButton.hide方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SummaryWidget
# 需要导入模块: from qtpy.QtWidgets import QPushButton [as 别名]
# 或者: from qtpy.QtWidgets.QPushButton import hide [as 别名]
class SummaryWidget(QWidget):
open = Signal([str, list])
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.uid_label = QLabel()
self.open_individually_button = QPushButton('Open individually')
self.open_individually_button.hide()
self.open_individually_button.clicked.connect(self._open_individually)
self.open_overplotted_button = QPushButton('Open over-plotted')
self.open_overplotted_button.hide()
self.open_overplotted_button.clicked.connect(self._open_overplotted)
self.open_overplotted_on_button = QPushButton('Add to tab...')
self.open_overplotted_on_button.hide()
self.open_overplotted_on_button.setEnabled(False)
self.open_overplotted_on_button.clicked.connect(self._open_overplotted_on)
self.copy_uid_button = QPushButton('Copy UID to Clipboard')
self.copy_uid_button.hide()
self.copy_uid_button.clicked.connect(self._copy_uid)
self.streams = QLabel()
self.entries = []
uid_layout = QHBoxLayout()
uid_layout.addWidget(self.uid_label)
uid_layout.addWidget(self.copy_uid_button)
layout = QVBoxLayout()
layout.addWidget(self.open_individually_button)
layout.addWidget(self.open_overplotted_button)
layout.addWidget(self.open_overplotted_on_button)
layout.addLayout(uid_layout)
layout.addWidget(self.streams)
self.setLayout(layout)
self._tab_titles = ()
def cache_tab_titles(self, titles):
self._tab_titles = titles
self.open_overplotted_on_button.setEnabled(bool(titles))
def _copy_uid(self):
QApplication.clipboard().setText(self.uid)
def _open_individually(self):
for entry in self.entries:
self.open.emit(None, [entry])
def _open_overplotted(self):
self.open.emit(None, self.entries)
def _open_overplotted_on(self):
item, ok = QInputDialog.getItem(
self, "Select Tab", "Tab", self._tab_titles, 0, False)
if not ok:
return
self.open.emit(item, self.entries)
def set_entries(self, entries):
self.entries.clear()
self.entries.extend(entries)
if not entries:
self.uid_label.setText('')
self.streams.setText('')
self.copy_uid_button.hide()
self.open_individually_button.hide()
self.open_overplotted_button.hide()
self.open_overplotted_on_button.hide()
elif len(entries) == 1:
entry, = entries
self.uid = entry.metadata['start']['uid']
self.uid_label.setText(self.uid[:8])
self.copy_uid_button.show()
self.open_individually_button.show()
self.open_individually_button.setText('Open')
self.open_overplotted_on_button.show()
self.open_overplotted_button.hide()
num_events = entry.metadata.get('stop', {}).get('num_events')
if num_events:
self.streams.setText(
'Streams:\n' + ('\n'.join(f'{k} ({v} Events)' for k, v in num_events.items())))
else:
# Either the RunStop document has not been emitted yet or was never
# emitted due to critical failure or this is an old document stream
# from before 'num_events' was added to the schema. Get the list of
# stream names another way, and omit the Event count.
self.streams.setText('Streams:\n' + ('\n'.join(list(entry()))))
else:
self.uid_label.setText('(Multiple Selected)')
self.streams.setText('')
self.copy_uid_button.hide()
self.open_individually_button.setText('Open individually')
self.open_individually_button.show()
self.open_overplotted_button.show()
self.open_overplotted_on_button.show()
示例2: SpyderErrorDialog
# 需要导入模块: from qtpy.QtWidgets import QPushButton [as 别名]
# 或者: from qtpy.QtWidgets.QPushButton import hide [as 别名]
class SpyderErrorDialog(QDialog):
"""Custom error dialog for error reporting."""
def __init__(self, parent=None, is_report=False):
QDialog.__init__(self, parent)
self.is_report = is_report
self.setWindowTitle(_("Issue reporter"))
self.setModal(True)
# To save the traceback sent to the internal console
self.error_traceback = ""
# Dialog main label
if self.is_report:
title = _("Please fill the following information")
else:
title = _("Spyder has encountered an internal problem!")
main_label = QLabel(
_("<h3>{title}</h3>"
"Before reporting this problem, <i>please</i> consult our "
"comprehensive "
"<b><a href=\"{trouble_url}\">Troubleshooting Guide</a></b> "
"which should help solve most issues, and search for "
"<b><a href=\"{project_url}\">known bugs</a></b> "
"matching your error message or problem description for a "
"quicker solution."
).format(title=title, trouble_url=__trouble_url__,
project_url=__project_url__))
main_label.setOpenExternalLinks(True)
main_label.setWordWrap(True)
main_label.setAlignment(Qt.AlignJustify)
main_label.setStyleSheet('font-size: 12px;')
# Issue title
self.title = QLineEdit()
self.title.textChanged.connect(self._contents_changed)
self.title_chars_label = QLabel(_("{} more characters "
"to go...").format(TITLE_MIN_CHARS))
form_layout = QFormLayout()
form_layout.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow)
red_asterisk = '<font color="Red">*</font>'
title_label = QLabel(_("<b>Title</b>: {}").format(red_asterisk))
form_layout.setWidget(0, QFormLayout.LabelRole, title_label)
form_layout.setWidget(0, QFormLayout.FieldRole, self.title)
# Description
steps_header = QLabel(
_("<b>Steps to reproduce:</b> {}").format(red_asterisk))
steps_text = QLabel(_("Please enter a detailed step-by-step "
"description (in English) of what led up to "
"the problem below. Issue reports without a "
"clear way to reproduce them will be closed."))
steps_text.setWordWrap(True)
steps_text.setAlignment(Qt.AlignJustify)
steps_text.setStyleSheet('font-size: 12px;')
# Field to input the description of the problem
self.input_description = DescriptionWidget(self)
# Only allow to submit to Github if we have a long enough description
self.input_description.textChanged.connect(self._contents_changed)
# Widget to show errors
self.details = ShowErrorWidget(self)
self.details.set_pythonshell_font(get_font())
self.details.hide()
# Label to show missing chars
self.initial_chars = len(self.input_description.toPlainText())
self.desc_chars_label = QLabel(_("{} more characters "
"to go...").format(DESC_MIN_CHARS))
# Checkbox to dismiss future errors
self.dismiss_box = QCheckBox(_("Hide all future errors during this "
"session"))
if self.is_report:
self.dismiss_box.hide()
# Dialog buttons
gh_icon = ima.icon('github')
self.submit_btn = QPushButton(gh_icon, _('Submit to Github'))
self.submit_btn.setEnabled(False)
self.submit_btn.clicked.connect(self._submit_to_github)
self.details_btn = QPushButton(_('Show details'))
self.details_btn.clicked.connect(self._show_details)
if self.is_report:
self.details_btn.hide()
self.close_btn = QPushButton(_('Close'))
if self.is_report:
self.close_btn.clicked.connect(self.reject)
# Buttons layout
buttons_layout = QHBoxLayout()
buttons_layout.addWidget(self.submit_btn)
buttons_layout.addWidget(self.details_btn)
buttons_layout.addWidget(self.close_btn)
#.........这里部分代码省略.........