本文整理匯總了Python中PyQt5.QtWidgets.QLineEdit.setWhatsThis方法的典型用法代碼示例。如果您正苦於以下問題:Python QLineEdit.setWhatsThis方法的具體用法?Python QLineEdit.setWhatsThis怎麽用?Python QLineEdit.setWhatsThis使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.QtWidgets.QLineEdit
的用法示例。
在下文中一共展示了QLineEdit.setWhatsThis方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: DebugViewer
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setWhatsThis [as 別名]
class DebugViewer(QWidget):
"""
Class implementing a widget conatining various debug related views.
The individual tabs contain the interpreter shell (optional),
the filesystem browser (optional), the two variables viewers
(global and local), a breakpoint viewer, a watch expression viewer and
the exception logger. Additionally a list of all threads is shown.
@signal sourceFile(string, int) emitted to open a source file at a line
"""
sourceFile = pyqtSignal(str, int)
def __init__(self, debugServer, docked, vm, parent=None,
embeddedShell=True, embeddedBrowser=True):
"""
Constructor
@param debugServer reference to the debug server object
@param docked flag indicating a dock window
@param vm reference to the viewmanager object
@param parent parent widget (QWidget)
@param embeddedShell flag indicating whether the shell should be
included. This flag is set to False by those layouts, that have
the interpreter shell in a separate window.
@param embeddedBrowser flag indicating whether the file browser should
be included. This flag is set to False by those layouts, that
have the file browser in a separate window or embedded
in the project browser instead.
"""
super(DebugViewer, self).__init__(parent)
self.debugServer = debugServer
self.debugUI = None
self.setWindowIcon(UI.PixmapCache.getIcon("eric.png"))
self.__mainLayout = QVBoxLayout()
self.__mainLayout.setContentsMargins(0, 0, 0, 0)
self.setLayout(self.__mainLayout)
self.__tabWidget = E5TabWidget()
self.__mainLayout.addWidget(self.__tabWidget)
self.embeddedShell = embeddedShell
if embeddedShell:
from QScintilla.Shell import ShellAssembly
# add the interpreter shell
self.shellAssembly = ShellAssembly(debugServer, vm, False)
self.shell = self.shellAssembly.shell()
index = self.__tabWidget.addTab(
self.shellAssembly,
UI.PixmapCache.getIcon("shell.png"), '')
self.__tabWidget.setTabToolTip(index, self.shell.windowTitle())
self.embeddedBrowser = embeddedBrowser
if embeddedBrowser:
from UI.Browser import Browser
# add the browser
self.browser = Browser()
index = self.__tabWidget.addTab(
self.browser,
UI.PixmapCache.getIcon("browser.png"), '')
self.__tabWidget.setTabToolTip(index, self.browser.windowTitle())
from .VariablesViewer import VariablesViewer
# add the global variables viewer
self.glvWidget = QWidget()
self.glvWidgetVLayout = QVBoxLayout(self.glvWidget)
self.glvWidgetVLayout.setContentsMargins(0, 0, 0, 0)
self.glvWidgetVLayout.setSpacing(3)
self.glvWidget.setLayout(self.glvWidgetVLayout)
self.globalsViewer = VariablesViewer(self.glvWidget, True)
self.glvWidgetVLayout.addWidget(self.globalsViewer)
self.glvWidgetHLayout = QHBoxLayout()
self.glvWidgetHLayout.setContentsMargins(3, 3, 3, 3)
self.globalsFilterEdit = QLineEdit(self.glvWidget)
self.globalsFilterEdit.setSizePolicy(
QSizePolicy.Expanding, QSizePolicy.Fixed)
self.glvWidgetHLayout.addWidget(self.globalsFilterEdit)
self.globalsFilterEdit.setToolTip(
self.tr("Enter regular expression patterns separated by ';'"
" to define variable filters. "))
self.globalsFilterEdit.setWhatsThis(
self.tr("Enter regular expression patterns separated by ';'"
" to define variable filters. All variables and"
" class attributes matched by one of the expressions"
" are not shown in the list above."))
self.setGlobalsFilterButton = QPushButton(
self.tr('Set'), self.glvWidget)
self.glvWidgetHLayout.addWidget(self.setGlobalsFilterButton)
self.glvWidgetVLayout.addLayout(self.glvWidgetHLayout)
index = self.__tabWidget.addTab(
self.glvWidget,
UI.PixmapCache.getIcon("globalVariables.png"), '')
#.........這裏部分代碼省略.........
示例2: NewProjectForm
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setWhatsThis [as 別名]
class NewProjectForm(QDialog):
"""a popup widget to create a new Typeloader Project
"""
project_changed = pyqtSignal(str)
refresh_projects = pyqtSignal()
def __init__(self, log, mydb, settings, parent=None):
try:
super().__init__(parent)
self.settings = settings
log.debug("Opening 'New Project' Dialog...")
self.log = log
self.mydb = mydb
self.init_UI()
self.setWindowTitle("Create a new project")
self.setWindowIcon(QIcon(general.favicon))
if self.settings["modus"] == "debugging":
self.fill_with_test_values()
self.get_existing_projects()
self.user = ""
self.gene = ""
self.pool = ""
self.project_name = None
self.success = False
self.show()
ok, msg = settings_ok("ENA", self.settings, self.log)
if not ok:
QMessageBox.warning(self, "Missing ENA settings", msg)
self.close()
except Exception as E:
QMessageBox.warning(self, "Problem with NewProjectForm", "Could not open NewProjectForm:\n\n" + repr(E))
log.error(E)
log.exception(E)
def init_UI(self):
"""establish the widgets
"""
layout = QFormLayout()
self.setLayout(layout)
self.user_entry = QLineEdit(self.settings["user_name"], self)
self.user_entry.setWhatsThis("Your name")
layout.addRow("User:", self.user_entry)
self.user_entry.setText(self.settings["user_name"])
self.gene_entry = QLineEdit(self)
self.gene_entry.setFocus()
self.gene_entry.setFixedWidth(175)
layout.addRow("Gene:", self.gene_entry)
self.gene_entry.setWhatsThis("The gene analyzed in this project. Use 'mixed' for multiple genes.")
self.pool_entry = QLineEdit(self)
layout.addRow("Pool:", self.pool_entry)
self.pool_entry.setWhatsThis("Name for the sample pool, required by ENA.")
self.pool_entry.textChanged.connect(self.check_ready_project)
self.title_entry = QLineEdit(self)
layout.addRow("Title:", self.title_entry)
self.title_entry.setPlaceholderText("(optional)")
self.title_entry.setWhatsThis("An optional short project title. If you set none, a default text is generated for ENA.")
self.desc_entry = QLineEdit(self)
layout.addRow("Description:", self.desc_entry)
self.desc_entry.setPlaceholderText("(optional)")
self.desc_entry.setWhatsThis("An optional project description. Useful for later filtering.")
self.project_btn = QPushButton("Click to generate", self)
layout.addRow("Project Name:", self.project_btn)
self.project_btn.setEnabled(False)
self.project_btn.clicked.connect(self.on_projectBtn_clicked)
self.project_btn.setWhatsThis("Click here to generate the project name. Can only be clicked after all necessary fields above have been filled.")
self.submit_btn = QPushButton("Start new project", self)
layout.addRow(self.submit_btn)
self.submit_btn.setEnabled(False)
self.submit_btn.clicked.connect(self.on_submitBtn_clicked)
self.submit_btn.setWhatsThis("Click here to submit the project to ENA, receive a project accession number, and save the project. Can only be clicked after a project name has been generated.")
self.acc_entry = QLineEdit(self)
layout.addRow("ENA Project Nr.:", self.acc_entry)
self.acc_entry.setWhatsThis("Project accession number received from ENA.")
self.close_btn = QPushButton("Done", self)
layout.addRow(self.close_btn)
self.close_btn.clicked.connect(self.close_me)
self.close_btn.setWhatsThis("Click to leave this dialog.")
@pyqtSlot()
def check_ready_project(self):
"""check whether all required fields have content;
if yes, enable project_btn
"""
self.user = self.user_entry.text()
self.gene = self.gene_entry.text()
self.pool = self.pool_entry.text()
if self.user and self.gene and self.pool:
self.project_btn.ready = True
self.project_btn.setEnabled(True)
self.project_btn.setStyleSheet(general.btn_style_ready)
#.........這裏部分代碼省略.........
示例3: AlleleSection
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setWhatsThis [as 別名]
class AlleleSection(QGroupBox):
"""lists details about one allele, derived from input file & editable by user
"""
selection_changed = pyqtSignal()
def __init__(self, lbl, parent=None):
super().__init__(parent)
if parent:
self.settings = parent.settings
else:
import GUI_login
self.settings = GUI_login.get_settings("admin", self.log)
self.lbl = lbl
self.init_UI()
self.unselect()
self.checkbox.toggled.connect(self.toggle_selection)
def init_UI(self):
"""setup the UI
"""
self.fields = []
layout = QGridLayout()
self.setLayout(layout)
self.lbl1 = QLabel(self.lbl)
self.lbl1.setStyleSheet(general.label_style_main)
self.checkbox = QCheckBox(self)
layout.addWidget(self.lbl1,0,0,1,2)
layout.addWidget(self.checkbox, 0,2)
lbl2 = QLabel("Allele details:")
lbl2.setStyleSheet(general.label_style_2nd)
layout.addWidget(lbl2,1,0,1,3)
self.gene_field = QLineEdit(" ",self)
self.gene_field
self.gene_field.setWhatsThis("Gene of this allele")
self.fields.append(self.gene_field)
layout.addWidget(QLabel("\tGene:"),2,0)
layout.addWidget(self.gene_field, 2,1,1,2)
self.name_field = QLineEdit(self)
self.fields.append(self.name_field)
self.name_field.setWhatsThis("Suggested internal name for this allele")
layout.addWidget(QLabel("\tAllele name:"),3,0)
layout.addWidget(self.name_field, 3,1,1,2)
self.product_field = QLineEdit(self)
self.fields.append(self.product_field)
self.product_field.setWhatsThis("Protein made by this allele, required for ENA")
layout.addWidget(QLabel("\tProduct:"),5,0)
layout.addWidget(self.product_field, 5,1,1,2)
lbl3 = QLabel("Choose exon subset: (optional)")
lbl3.setStyleSheet(general.label_style_2nd)
layout.addWidget(lbl3, 6,0,1,3)
self.exon1_field = QLineEdit(self, text="0")
self.exon1_field.setWhatsThis("Ignore everything before this exon")
self.fields.append(self.exon1_field)
layout.addWidget(QLabel("\tFrom exon:"),7,0)
layout.addWidget(self.exon1_field, 7,1,1,2)
self.exon2_field = QLineEdit(self, text="0")
self.fields.append(self.exon2_field)
self.exon2_field.setWhatsThis("Ignore everything after this exon")
layout.addWidget(QLabel("\tTo exon:"),8,0)
layout.addWidget(self.exon2_field, 8,1,1,2)
def select(self):
"""select the whole section of this allele
"""
if self.sender != self.checkbox:
self.checkbox.setChecked(True)
self.isSelected = True
self.setStyleSheet(general.groupbox_style_normal)
for field in self.fields:
field.setDisabled(False)
self.selection_changed.emit()
def unselect(self):
"""unselect the whole section of this allele
"""
if self.sender != self.checkbox:
self.checkbox.setChecked(False)
self.isSelected = False
self.setStyleSheet(general.groupbox_style_inactive)
for field in self.fields:
field.setDisabled(True)
self.selection_changed.emit()
def toggle_selection(self):
"""toggle between selected and unselected state
"""
if self.isSelected:
self.unselect()
else:
self.select()
示例4: EditView
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setWhatsThis [as 別名]
#.........這裏部分代碼省略.........
# Make a valid cursor based on position and anchor values possibly
# input by the user.
def make_cursor(self, position, anchor):
mx = self.document.characterCount()
tc = QTextCursor(self.Editor.textCursor())
anchor = min( max(0,anchor), mx )
position = min ( max(0,position), mx )
tc.setPosition(anchor)
tc.setPosition(position,QTextCursor.KeepAnchor)
return tc
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# INITIALIZE UI
#
# First we built the Edit panel using Qt Creator which produced a large
# and somewhat opaque block of code that had to be mixed in by
# multiple inheritance. This had several drawbacks, so the following
# is a "manual" UI setup using code drawn from the generated code.
#
def _uic(self):
# First set up the properties of "self", a QWidget.
self.setObjectName("EditViewWidget")
sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(1)
sizePolicy.setVerticalStretch(1)
sizePolicy.setHeightForWidth(False) # don't care to bind height to width
self.setSizePolicy(sizePolicy)
self.setMinimumSize(QSize(250, 250))
self.setFocusPolicy(Qt.StrongFocus)
self.setContextMenuPolicy(Qt.CustomContextMenu)
self.setWindowTitle("")
self.setToolTip("")
self.setStatusTip("")
self.setWhatsThis("")
# Set up our primary widget, the editor
self.Editor = PTEditor(self,self.my_book)
self.Editor.setObjectName("Editor")
sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(2) # Edit deserves all available space
sizePolicy.setVerticalStretch(2)
sizePolicy.setHeightForWidth(False)
self.Editor.setSizePolicy(sizePolicy)
self.Editor.setFocusPolicy(Qt.StrongFocus)
self.Editor.setContextMenuPolicy(Qt.NoContextMenu)
self.Editor.setAcceptDrops(True)
self.Editor.setLineWidth(2)
self.Editor.setDocumentTitle("")
self.Editor.setLineWrapMode(QPlainTextEdit.NoWrap)
# Set up the frame that will contain the bottom row of widgets
# It doesn't need a parent and doesn't need to be a class member
# because it will be added to a layout, which parents it.
bot_frame = QFrame()
sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(False)
bot_frame.setSizePolicy(sizePolicy)
bot_frame.setMinimumSize(QSize(0, 24))
bot_frame.setContextMenuPolicy(Qt.NoContextMenu)
bot_frame.setFrameShape(QFrame.Panel)
bot_frame.setFrameShadow(QFrame.Sunken)
bot_frame.setLineWidth(3)
# Set up the horizontal layout that will contain the following
# objects. Its parent is the frame, which gives it a look?
示例5: EditView
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setWhatsThis [as 別名]
#.........這裏部分代碼省略.........
# Make a valid cursor based on position and anchor values possibly
# input by the user.
def make_cursor(self, position, anchor):
mx = self.document.characterCount()
tc = QTextCursor(self.Editor.textCursor())
anchor = min( max(0,anchor), mx )
position = min ( max(0,position), mx )
tc.setPosition(anchor)
tc.setPosition(position,QTextCursor.KeepAnchor)
return tc
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# INITIALIZE UI
#
# First we built the Edit panel using Qt Creator which produced a large
# and somewhat opaque block of code that had to be mixed in by
# multiple inheritance. This had several drawbacks, so the following
# is a "manual" UI setup using code drawn from the generated code.
#
def _uic(self):
# First set up the properties of "self", a QWidget.
self.setObjectName("EditViewWidget")
sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(1)
sizePolicy.setVerticalStretch(1)
sizePolicy.setHeightForWidth(False) # don't care to bind height to width
self.setSizePolicy(sizePolicy)
self.setMinimumSize(QSize(250, 250))
self.setFocusPolicy(Qt.StrongFocus)
self.setContextMenuPolicy(Qt.CustomContextMenu)
self.setWindowTitle("")
self.setToolTip("")
self.setStatusTip("")
self.setWhatsThis("")
# Set up our primary widget, the editor
self.Editor = PTEditor(self,self.my_book)
self.Editor.setObjectName("Editor")
sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(2) # Edit deserves all available space
sizePolicy.setVerticalStretch(2)
sizePolicy.setHeightForWidth(False)
self.Editor.setSizePolicy(sizePolicy)
self.Editor.setFocusPolicy(Qt.StrongFocus)
self.Editor.setContextMenuPolicy(Qt.NoContextMenu)
self.Editor.setAcceptDrops(True)
self.Editor.setLineWidth(2)
self.Editor.setDocumentTitle("")
self.Editor.setLineWrapMode(QPlainTextEdit.NoWrap)
# Set up the frame that will contain the bottom row of widgets
# It doesn't need a parent and doesn't need to be a class member
# because it will be added to a layout, which parents it.
bot_frame = QFrame()
sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(False)
bot_frame.setSizePolicy(sizePolicy)
bot_frame.setMinimumSize(QSize(0, 24))
bot_frame.setContextMenuPolicy(Qt.NoContextMenu)
bot_frame.setFrameShape(QFrame.Panel)
bot_frame.setFrameShadow(QFrame.Sunken)
bot_frame.setLineWidth(3)
# Set up the horizontal layout that will contain the following
# objects. Its parent is the frame, which gives it a look?