當前位置: 首頁>>代碼示例>>Python>>正文


Python QLineEdit.setToolTip方法代碼示例

本文整理匯總了Python中PyQt5.QtWidgets.QLineEdit.setToolTip方法的典型用法代碼示例。如果您正苦於以下問題:Python QLineEdit.setToolTip方法的具體用法?Python QLineEdit.setToolTip怎麽用?Python QLineEdit.setToolTip使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt5.QtWidgets.QLineEdit的用法示例。


在下文中一共展示了QLineEdit.setToolTip方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setToolTip [as 別名]
    def __init__(self, settings):
        super(QWidget, self).__init__()
        self._layout = QBoxLayout(QBoxLayout.TopToBottom)
        self.setLayout(self._layout)
        self.settings = settings

        # eq directory
        widget = QWidget()
        layout = QBoxLayout(QBoxLayout.LeftToRight)
        widget.setLayout(layout)
        label = QLabel("Everquest Directory: ")
        layout.addWidget(label)
        text = QLineEdit()
        text.setText(self.settings.get_value("general", "eq_directory"))
        text.setToolTip(self.settings.get_value("general", "eq_directory"))
        text.setDisabled(True)
        self._text_eq_directory = text
        layout.addWidget(text, 1)
        button = QPushButton("Browse...")
        button.clicked.connect(self._get_eq_directory)
        layout.addWidget(button)
        self._layout.addWidget(widget, 0, Qt.AlignTop)

        # eq directory info
        frame = QFrame()
        frame.setFrameShadow(QFrame.Sunken)
        frame.setFrameShape(QFrame.Box)
        frame_layout = QBoxLayout(QBoxLayout.LeftToRight)
        frame.setLayout(frame_layout)
        widget = QWidget()
        layout = QBoxLayout(QBoxLayout.LeftToRight)
        widget.setLayout(layout)
        self._label_eq_directory = QLabel()
        layout.addWidget(self._label_eq_directory, 1)
        frame_layout.addWidget(widget, 1, Qt.AlignCenter)
        self._layout.addWidget(frame, 1)

        # parse interval
        widget = QWidget()
        layout = QBoxLayout(QBoxLayout.LeftToRight)
        widget.setLayout(layout)
        label = QLabel("Seconds between parse checks: ")
        layout.addWidget(label, 0, Qt.AlignLeft)
        text = QLineEdit()
        text.setText(str(self.settings.get_value("general", "parse_interval")))
        text.editingFinished.connect(self._parse_interval_editing_finished)
        text.setMaxLength(3)
        self._text_parse_interval = text
        metrics = QFontMetrics(QApplication.font())
        text.setFixedWidth(metrics.width("888888"))
        layout.addWidget(text, 0, Qt.AlignLeft)
        self._layout.addWidget(widget, 0, Qt.AlignTop | Qt.AlignLeft)

        # spacing at bottom of window
        widget = QWidget()
        self._layout.addWidget(widget, 1)

        # setup
        if settings.get_value("general", "eq_directory") is not None:
            self._check_directory_stats()
開發者ID:nomns,項目名稱:Parse99,代碼行數:62,代碼來源:generaltab.py

示例2: manage_properties

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setToolTip [as 別名]
    def manage_properties(self):
        self.update()
        self.setWindowTitle('Properties:')
        layout = QGridLayout()

        button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        button_box.button(QDialogButtonBox.Ok).setDefault(True)

        for idx, prop in enumerate(sorted(self.flume_object.properties.keys())):
            label = QLabel(prop + ':')
            editor = QLineEdit(self.flume_object.properties[prop]["value"])
            if prop == "type":
                editor.setReadOnly(True)
            if self.flume_object.properties[prop]["required"]:
                label.setText(prop + ":*")
                pass  # label.setFont(QFont) TODO
            editor.setToolTip(self.flume_object.properties[prop]["description"])
            editor.setToolTipDuration(-1)

            self.new_properties[prop] = editor

            label.setBuddy(self.new_properties[prop])
            layout.addWidget(label, idx, 0)
            layout.addWidget(self.new_properties[prop], idx, 1)

        layout.addWidget(button_box)
        self.setLayout(layout)

        button_box.accepted.connect(self.accept_prop)
        button_box.rejected.connect(self.reject)
開發者ID:ADobrodey,項目名稱:Apache-Flume-Editor,代碼行數:32,代碼來源:_manage_properties.py

示例3: Avance

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setToolTip [as 別名]
class Avance(QWidget):
    def __init__(self, parent):
        QWidget.__init__(self, parent)
        self.parent = parent
        prm = parent.param


        ### Liste des options avancées de la calculatrice ###
        self.pave = QVBoxLayout()

        box = QGroupBox("Post-traitement")
        box_layout = QVBoxLayout()
        box.setLayout(box_layout)
        box_layout.addWidget(QLabel("Traitement automatiquement du résultat :"))
        self.traitement = QLineEdit()
        traitement = self.parent.param("appliquer_au_resultat") or '_'
        self.traitement.setText(traitement)
        self.traitement.setMinimumWidth(100)
        self.traitement.setToolTip("Fonction ou opérations à appliquer automatiquement au résultat (représenté par _). Ex: 'factoriser(_)'.")
        self.traitement.editingFinished.connect(self.EvtAppliquerResultat)
        box_layout.addWidget(self.traitement)
        self.pave.addWidget(box)
        self.setLayout(self.pave)
        self.pave.addStretch()


    def EvtAppliquerResultat(self, event=None):
        val = self.traitement.text().strip()
        if not val:
            self.traitement.setText('_')
            val = None
        elif val == '_':
            val = None
        self.parent.param("appliquer_au_resultat", val)
開發者ID:wxgeo,項目名稱:geophar,代碼行數:36,代碼來源:__init__.py

示例4: JackSinkSettings

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setToolTip [as 別名]
class JackSinkSettings(SettingsSection):

    NAME = "Jack Sink"
    ELEMENT = JackSink

    def __init__(self, size, Id, parent=None):
        super().__init__(size, parent)

        self.id = Id

        self.group = QGroupBox(self)
        self.group.setTitle('Jack')
        self.group.setGeometry(0, 0, self.width(), 100)
        self.group.setLayout(QGridLayout())

        self.client = QLineEdit(self.group)
        self.client.setToolTip('The client name of the Jack instance')
        self.client.setText('Linux Show Player')
        self.group.layout().addWidget(self.client, 0, 0)

        self.clientLabel = QLabel('Client name', self.group)
        self.clientLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.group.layout().addWidget(self.clientLabel, 0, 1)

        self.connection = QComboBox(self.group)
        self.connection.setToolTip('Specify how the output ports will be'
                                   'connected')
        self.connection.addItems([JackSink.CONNECT_NONE,
                                  JackSink.CONNECT_AUTO,
                                  JackSink.CONNECT_AUTO_FORCED])
        self.connection.setCurrentIndex(1)
        self.group.layout().addWidget(self.connection, 1, 0)

        self.connLabel = QLabel('Connection mode', self.group)
        self.connLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.group.layout().addWidget(self.connLabel, 1, 1)

    def sizeHint(self):
        return QSize(450, 100)

    def enable_check(self, enable):
        self.group.setCheckable(enable)
        self.group.setChecked(False)

    def set_configuration(self, conf):
        if self.id in conf:
            if 'client-name' in conf[self.id]:
                self.client.setText(conf[self.id]['client-name'])
            if 'connection' in conf[self.id]:
                self.connection.setCurrentText(conf[self.id]['connection'])

    def get_configuration(self):
        if not (self.group.isCheckable() and not self.group.isChecked()):
            return {self.id: {'client-name': self.client.text(),
                              'connection': self.connection.currentText()}}
        else:
            return {}
開發者ID:tornel,項目名稱:linux-show-player,代碼行數:59,代碼來源:jack_sink.py

示例5: Kalkulator

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setToolTip [as 別名]
class Kalkulator(QWidget):

    def __init__(self, parent=None):
        super().__init__(parent)

        self.interfejs()

    def interfejs(self):

        # etykiety
        etykieta1 = QLabel("Liczba 1:", self)
        etykieta2 = QLabel("Liczba 2:", self)
        etykieta3 = QLabel("Wynik:", self)

        # przypisanie widgetów do układu tabelarycznego
        ukladT = QGridLayout()
        ukladT.addWidget(etykieta1, 0, 0)
        ukladT.addWidget(etykieta2, 0, 1)
        ukladT.addWidget(etykieta3, 0, 2)

        # 1-liniowe pola edycyjne
        self.liczba1Edt = QLineEdit()
        self.liczba2Edt = QLineEdit()
        self.wynikEdt = QLineEdit()

        self.wynikEdt.readonly = True
        self.wynikEdt.setToolTip('Wpisz <b>liczby</b> i wybierz działanie...')

        ukladT.addWidget(self.liczba1Edt, 1, 0)
        ukladT.addWidget(self.liczba2Edt, 1, 1)
        ukladT.addWidget(self.wynikEdt, 1, 2)

        # przyciski
        dodajBtn = QPushButton("&Dodaj", self)
        odejmijBtn = QPushButton("&Odejmij", self)
        dzielBtn = QPushButton("&Mnóż", self)
        mnozBtn = QPushButton("D&ziel", self)
        koniecBtn = QPushButton("&Koniec", self)
        koniecBtn.resize(koniecBtn.sizeHint())

        ukladH = QHBoxLayout()
        ukladH.addWidget(dodajBtn)
        ukladH.addWidget(odejmijBtn)
        ukladH.addWidget(dzielBtn)
        ukladH.addWidget(mnozBtn)

        ukladT.addLayout(ukladH, 2, 0, 1, 3)
        ukladT.addWidget(koniecBtn, 3, 0, 1, 3)

        # przypisanie utworzonego układu do okna
        self.setLayout(ukladT)

        self.setGeometry(20, 20, 300, 100)
        self.setWindowIcon(QIcon('kalkulator.png'))
        self.setWindowTitle("Prosty kalkulator")
        self.show()
開發者ID:koduj-z-klasa,項目名稱:python101,代碼行數:58,代碼來源:kalkulator03.py

示例6: box

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setToolTip [as 別名]
 def box(text, tool_tip):
     w = QLineEdit(self)
     w.setReadOnly(True)
     w.setFont(get_monospace_font())
     w.setText(str(text))
     w.setToolTip(tool_tip)
     fm = QFontMetrics(w.font())
     magic_number = 10
     text_size = fm.size(0, w.text())
     w.setMinimumWidth(text_size.width() + magic_number)
     return w
開發者ID:learningendless,項目名稱:gui_tool,代碼行數:13,代碼來源:value_extractor_views.py

示例7: Resolution

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setToolTip [as 別名]
class Resolution(QWidget):
    """
    Widget for setting the resolution
    """
    def __init__(self):
        super(Resolution, self).__init__()
        self.width = 0
        self.height = 0
        self.fullscreen = True
        self.initUI()
        self.hide()
    def initUI(self):
        vbox = QVBoxLayout(self)
        self.width_line = QLineEdit("0", self)
        self.width_line.setToolTip("Width (0 is your screen resolution)")
        self.height_line = QLineEdit("0", self)
        self.height_line.setToolTip("Height (0 is your screen resolution)")
        self.fullscreen_box = QCheckBox("Fullscreen", self)
        self.fullscreen_box.setTristate(False)
        self.fullscreen_box.setChecked(True)
        vbox.addWidget(self.width_line)
        vbox.addWidget(self.height_line)
        vbox.addWidget(self.fullscreen_box)
    def validate_lines(self):
        states = []
        for line in [self.width_line, self.height_line]:
            text = line.text()
            if text.isdigit():
                if int(text) >= 0:
                    line.setStyleSheet("QLineEdit {background: rgb(210, 255, 210)}")
                    states.append(0)
                else:
                    states.append(1)
                    line.setStyleSheet("QLineEdit {background: rgb(255, 210, 210)}")
            else:
                states.append(2)
                line.setStyleSheet("QLineEdit {background: rgb(255, 210, 210)}")
        if states.count(0) == len(states):
            return True
        else:
            return False

    def set_values(self):
        self.width = int(self.width_line.text())
        self.height = int(self.height_line.text())
        self.fullscreen = self.fullscreen_box.isChecked()
    def __call__(self):
        if self.isVisible():
            if self.validate_lines():
                self.set_values()
                self.hide()
        else:
            self.show()
開發者ID:m-nez,項目名稱:tetroll,代碼行數:55,代碼來源:menu.py

示例8: App

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setToolTip [as 別名]
class App(QMainWindow):
 
    def __init__(self):
        super().__init__()
        self.title = 'GSEA'
        self.left = 10
        self.top = 10
        self.width = 400
        self.height = 200
        self.initUI()
 
    def initUI(self):
        self.layout = QVBoxLayout()
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)
 

        self.textbox = QLineEdit(self)
        self.textbox.move(20, 20)
        self.textbox.resize(280,40)
        self.textbox.setToolTip("Please enter GEO id")
        self.textbox.resize(self.textbox.sizeHint())
        
        self.textbox2 = QLineEdit(self)
        self.textbox2.move(20, 90)
        self.textbox2.resize(280,40)
        self.textbox2.setToolTip("Please enter Gene list")
        self.textbox2.resize(self.textbox2.sizeHint())


        self.button = QPushButton('Get p_value', self)
        self.button.move(20,150)
 
        self.button.clicked.connect(self.on_click)
        self.show()
    

    def on_click(self):
        self.geo_ID = self.textbox.text()
        self.gene_list = self.textbox2.text().split()
        QMessageBox.question(self, 'GSEA p_value', "p_value: " + GSEA(self.geo_ID,self.gene_list), QMessageBox.Ok, QMessageBox.Ok)
        self.textbox.setText("")
開發者ID:anton-shikov,項目名稱:HW_6,代碼行數:44,代碼來源:GUI.py

示例9: add_items

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setToolTip [as 別名]
    def add_items(self):
        row1, row2 = 0, 0
        for count, item in enumerate(self.items):
            param_name, param_type = item
            param_name = param_name.decode()
            param_help = self.config.get_parameter_help(param_name).decode()
            param_desc = re.split(':|\(|--', param_help)[0].strip()
            if len(param_desc) > 35 or len(param_name) > len(param_desc):
                param_desc = param_name
            param_help = '[' + param_name + '] ' + param_help
            opts = format_options(param_help)

            if param_type == M64TYPE_STRING:
                row1 += 1
                widget = QLineEdit()
                widget.setToolTip(param_help)
                self.gridLayout.addWidget(
                    QLabel(format_label(param_desc)), row1, 1, Qt.AlignRight)
                self.gridLayout.addWidget(widget, row1, 2, Qt.AlignLeft)
                self.widgets[param_name] = (widget, widget.__class__, opts)
            elif param_type == M64TYPE_INT:
                row1 += 1
                if not opts:
                    widget = QSpinBox()
                    widget.setMaximum(32767)
                    widget.setMinimum(-32767)
                    if param_help: widget.setToolTip(param_help)
                else:
                    widget = QComboBox()
                    widget.setToolTip(param_help)
                    widget.setMinimumContentsLength(14)
                    widget.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLength)
                    for idx, key in enumerate(sorted(opts.keys())):
                        value = opts[key]
                        opts[key] = (idx, value)
                        data = (idx, key, value)
                        widget.addItem(value)
                        widget.setItemData(idx, data)
                self.gridLayout.addWidget(
                    QLabel(format_label(param_desc)), row1, 1, Qt.AlignRight)
                self.gridLayout.addWidget(widget, row1, 2, Qt.AlignLeft)
                self.widgets[param_name] = (widget, widget.__class__, opts)
            elif param_type == M64TYPE_BOOL:
                row2 += 1
                widget = QCheckBox()
                widget.setText(format_label(param_desc))
                if param_help:
                    widget.setToolTip(param_help)
                self.gridLayout.addWidget(widget, row2, 3)
                self.widgets[param_name] = (widget, widget.__class__, opts)
開發者ID:mupen64plus,項目名稱:mupen64plus-ui-python,代碼行數:52,代碼來源:plugin.py

示例10: SheetDockWidget

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setToolTip [as 別名]
class SheetDockWidget(QDockWidget):
    def __init__(self):
        super().__init__("Sheets")

        # Create main widget for content and layout of Dockwidget
        self.mainWidget = QWidget()
        self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        self.mainWidgetLayout = QGridLayout(self.mainWidget)
        self.mainWidgetLayout.setSizeConstraint(QGridLayout.SetDefaultConstraint)

        # - Create frame for button and entry
        self.newSheetWidget = QWidget(self.mainWidget)
        self.newSheetWidget.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        self.newSheetWidgetLayout = QFormLayout(self.newSheetWidget)
        self.newSheetWidgetLayout.setContentsMargins(0, 0, 0, 0)

        self.newSheetButton = QPushButton(self.newSheetWidget)
        self.newSheetButton.setText("Create")
        self.newSheetButton.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        self.newSheetWidgetLayout.setWidget(0, QFormLayout.LabelRole, self.newSheetButton)

        self.newSheetLineedit = QLineEdit(self.newSheetWidget)
        #self.newSheetLineedit.setEditable(True)
        self.newSheetLineedit.setToolTip("Enter name for new sheet")
        self.newSheetLineedit.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        self.newSheetWidgetLayout.setWidget(0, QFormLayout.FieldRole, self.newSheetLineedit)

        self.mainWidgetLayout.addWidget(self.newSheetWidget, 0, 0, 1, 1)

        # - Add worker treeview to content
        self.sheetTree = QTreeWidget(self.mainWidget)
        self.sheetTree.setColumnCount(1)

        self.sheetTree.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.mainWidgetLayout.addWidget(self.sheetTree, 1, 0, 1, 1)

        # Set dockwidget content to main widget
        self.setWidget(self.mainWidget)
開發者ID:DrLuke,項目名稱:gpnshader,代碼行數:40,代碼來源:dockwidgets.py

示例11: DebugViewer

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setToolTip [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"), '')
#.........這裏部分代碼省略.........
開發者ID:Darriall,項目名稱:eric,代碼行數:103,代碼來源:DebugViewer.py

示例12: Controls

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setToolTip [as 別名]
class Controls(QWidget):
    """
    Widget for setting the controlls
    """
    def __init__(self):
        super(Controls, self).__init__()
        # 0 - key action
        # 1 - bool setting
        self.boards = [1, 2]
        self.next_setting = True
        self.settings = [
                ["ml", 0],
                ["mr", 0],
                ["rl", 0],
                ["rr", 0],
                ["at", 0],
                ["ab", 0],
                ["guide_on", 1],
                ]
        self.actions = []
        self.conversion = {
                65509:301,
                65505:304,
                65507:306,
                65513:308,
                65027:313,
                65508:305,
                65506:303,
                65293:13,
                65288:8,
                65361:276,
                65363:275,
                65362:273,
                65364:274,
                }
        self.current_board = 0
        self.current_setting = 0
        self.initUI()

    def initUI(self):
        vbox = QVBoxLayout(self)
        self.line = QLineEdit("HUQ", self)
        self.line.setToolTip("Press a key to assign to an action\nor (y/n) in case of a boolean.")
        self.one_more = QPushButton("ONE MORE", self)
        self.one_more.setToolTip("Set the current setting once again.")
        self.one_more.clicked.connect(self.stop_settings)
        self.input_prompt()
        self.line.keyPressEvent = self.keyPressEvent
        vbox.addWidget(self.line)
        vbox.addWidget(self.one_more)
        self.hide()


    def __call__(self):
        self.hide() if self.isVisible() else self.show()

    def keyPressEvent(self, e):
        key = e.nativeVirtualKey()
        if key in self.conversion:
            key = self.conversion[key]
        self.actions.append([
            self.boards[self.current_board],
            self.settings[self.current_setting][0],
            self.settings[self.current_setting][1],
            key])

        if self.next_setting:
            self.current_setting += 1
            if self.current_setting >= len(self.settings):
                self.current_setting = 0
                self.current_board += 1
                if self.current_board >= len(self.boards):
                    self.current_board = 0
                    self.finalize()
            self.input_prompt()
        else:
            self.restart_settings()

    def finalize(self):
        f = open("config/tmp_config.conf", "w")
        for board, action, t, key in self.actions:
            if t == 0:
                f.write("".join([str(key), ":", str(board), ":", action, "\n"]))
            elif key == 121:
                f.write("".join([str(board), ":", action, "\n"]))
        f.close()
        self.actions = []
        self.hide()

    def input_prompt(self):
        hint = "key"
        if self.settings[self.current_setting][1] == 1:
            hint = "y/n"
        self.line.setText("Board %i %s (%s)" % (
                self.boards[self.current_board],
                self.settings[self.current_setting][0],
                hint))

    def stop_settings(self):
        self.next_setting = False
#.........這裏部分代碼省略.........
開發者ID:m-nez,項目名稱:tetroll,代碼行數:103,代碼來源:menu.py

示例13: View

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setToolTip [as 別名]
class View(QMainWindow) :
	signalAdd = pyqtSignal(QMainWindow)
	signalButton = pyqtSignal()
	signalWidget = pyqtSignal(QMainWindow)
	signalDelete = pyqtSignal(QListWidget,QMainWindow)
	signalDisplay = pyqtSignal(QMainWindow)
	signalSearch = pyqtSignal(QMainWindow)
	signalModify = pyqtSignal(QMainWindow)
	signalUnlock = pyqtSignal()

	def __init__(self):
		
		QMainWindow.__init__(self)	
		self.setWindowOpacity(0.98)
		self.setWindowIcon(QIcon("Pictures/telephone.png"))	
		self.resize(700,500)
		self.setWindowTitle("Annuaire")
		self.setStyleSheet("background-color:pink")
		self.activeLayout = 0
		self.activeButtonAdd = 0
		self.activeButtonEdit = 0
		self.activeButtonSave = 0
		self.alreadyClicked = 0
		
		self.createWidgets()
		self.connectWidgets()
		
	def createWidgets(self):
		"""Cette fonction permet la création de tous les widgets de la
		mainWindow"""
		
		#Création toolbar
		toolBar = self.addToolBar("Tools")
		
		#Création bar recherche
		self.lineEditSearch = QLineEdit()
		self.lineEditSearch.setPlaceholderText("Recherche")
		self.lineEditSearch.setStyleSheet("background-color:white")
		toolBar.addWidget(self.lineEditSearch)
		self.lineEditSearch.setMaximumWidth(300)
		
		#Création séparateur
		toolBar.addSeparator()
		
		#Création icon add contact
		self.actionAdd = QAction("Ajouter (Ctrl+P)",self)
		toolBar.addAction(self.actionAdd)
		self.actionAdd.setShortcut("Ctrl+P")
		self.actionAdd.setIcon(QIcon("Pictures/sign.png"))
		
		#Création icon delete contact
		self.actionDelete = QAction("supprimer (Ctrl+D)",self)
		toolBar.addAction(self.actionDelete)	
		self.actionDelete.setShortcut("Ctrl+D")
		self.actionDelete.setIcon(QIcon("Pictures/contacts.png"))
		
		#Création icon quit
		self.actionQuitter = QAction("Quitter (Ctrl+Q)",self)
		toolBar.addAction(self.actionQuitter)
		self.actionQuitter.setShortcut("Ctrl+Q")
		self.actionQuitter.setIcon(QIcon("Pictures/arrows.png"))
		
		#Création widget central
		self.centralWidget = QWidget()
		self.centralWidget.setStyleSheet("background-color:white")
		self.setCentralWidget(self.centralWidget)
		
		
		#Création dockWidget left
		dockDisplay = QDockWidget("Répertoire")
		dockDisplay.setStyleSheet("background-color:white")
		dockDisplay.setFeatures(QDockWidget.DockWidgetFloatable)
		dockDisplay.setAllowedAreas(Qt.LeftDockWidgetArea | 
			Qt.RightDockWidgetArea)
		self.addDockWidget(Qt.LeftDockWidgetArea,dockDisplay)
		containDock = QWidget(dockDisplay)
		dockDisplay.setWidget(containDock)
		dockLayout = QVBoxLayout()
		displayWidget = QScrollArea()
		displayWidget.setWidgetResizable(1)
		dockLayout.addWidget(displayWidget)
		containDock.setLayout(dockLayout)
		
		#Ajouter la list au dockwidget
		self.listContact = QListWidget()
		displayWidget.setWidget(self.listContact)
	
	def widgetFormulaire(self) :
		"""Fonction donner à la QAction "Ajouter" de la toolbar"""
		
		self.deleteWidget()
			
		#Label prénom/nom
		self.labelPictureContact = QLabel("*")	
		pictureContact = QPixmap("Pictures/avatar.png")
		self.labelPictureContact.setPixmap(pictureContact)
		
		#Ajouter prénom
		self.nameEdit = QLineEdit()
		self.nameEdit.setToolTip("Entrez un prénom sans espace")
#.........這裏部分代碼省略.........
開發者ID:gloups01,項目名稱:Annuaire_PyQt,代碼行數:103,代碼來源:View.py

示例14: Menu

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setToolTip [as 別名]
class Menu(QWidget):
    """
    Tetroll Menu
    """
    def __init__(self):
        super(Menu, self).__init__()

        self.joy = 1
        self.mod = "20levels.mods"
        self.ai = "0"

        self.initUI()

    def initUI(self):
        QToolTip.setFont(QFont("SansSerif", 10))
        vbox = QVBoxLayout(self)
        self.configbox = QComboBox(self)
        self.configbox.setToolTip("Configuration file")

        for f in listdir("./config"):
            if f[-4:] == "conf":
                self.configbox.addItem(f)
        self.ai_delay = QComboBox(self)
        for i in range(1,4):
            self.ai_delay.addItem(str(i))
        self.ai_delay.setToolTip("AI Delay")


        btn_pl_vs_pl = QPushButton("PL VS PL", self)
        btn_pl_vs_pl.clicked.connect(self.pl_vs_pl)
        btn_pl_vs_pl.setToolTip("-get 21 levels\n-don't fill up 3 times\n-speed raises when you clear a level")

        btn_pl_vs_pl_mod = QPushButton("PL VS PL MOD", self)
        btn_pl_vs_pl_mod.clicked.connect(self.pl_vs_pl_mod)
        btn_pl_vs_pl_mod.setToolTip("-don't fill up 3 times\n-enemy speed raises when you clear a level")

        btn_vs_ai = QPushButton("PL VS AI", self)
        btn_vs_ai.clicked.connect(self.vs_ai)
        btn_vs_ai.setToolTip("-play against an AI\n-get 21 levels\n-don't fill up 3 times\n-speed raises when you clear a level")

        btn_vs_ai_mod = QPushButton("PL VS AI MOD", self)
        btn_vs_ai_mod.clicked.connect(self.vs_ai)
        btn_vs_ai_mod.setToolTip("-play against an AI\n-get 21 levels\n-don't fill up 3 times\n-speed raises when enemy clears a level")

        btn_ai_vs_ai = QPushButton("AI VS AI", self)
        btn_ai_vs_ai.clicked.connect(self.ai_vs_ai)
        btn_ai_vs_ai.setToolTip("-watch an AI vs AI match\n-get 21 levels\n-don't fill up 3 times")


        controls = Controls()
        btn_toggle_controls = QPushButton("SET CONTROLS", self)
        btn_toggle_controls.setToolTip("-fill all settings\n-new config is available at tmp_config.conf")
        btn_toggle_controls.clicked.connect(controls)

        self.resolution = Resolution()
        btn_toggle_resolution = QPushButton("SET RESOLUTION", self)
        btn_toggle_resolution.setToolTip("-set the game resolution")
        btn_toggle_resolution.clicked.connect(self.resolution)

        self.multiplayer_ip = QLineEdit("", self)
        self.multiplayer_ip.setToolTip("IP address of your opponent(Leave blank for singleplayer)\nIf you are hosting enter LAN or INET")


        self.multiplayer_initiate_box = QCheckBox("Host", self)
        self.multiplayer_initiate_box.setTristate(False)
        self.multiplayer_initiate_box.setChecked(True)

        vbox.addWidget(btn_pl_vs_pl)
        vbox.addWidget(btn_pl_vs_pl_mod)
        vbox.addWidget(btn_vs_ai)
        vbox.addWidget(btn_vs_ai_mod)
        vbox.addWidget(btn_ai_vs_ai)
        vbox.addWidget(btn_toggle_controls)
        vbox.addWidget(controls)
        vbox.addWidget(self.configbox)
        vbox.addWidget(self.ai_delay)
        vbox.addWidget(btn_toggle_resolution)
        vbox.addWidget(self.resolution)
        vbox.addWidget(self.multiplayer_ip)
        vbox.addWidget(self.multiplayer_initiate_box)

        self.setGeometry(300, 300, 300, 100)
        self.setWindowTitle("Menu")
        self.setWindowIcon(QIcon("green_block.png"))

        self.show()
    def vs_ai_mod(self):
        self.mod = "20levels_trolltime.mods"
        self.ai = "1"
        system("./tetroll.py" + self.option_str())
    def vs_ai(self):
        self.mod = "20levels.mods"
        self.ai = "1"
        system("./tetroll.py" + self.option_str())
    def ai_vs_ai(self):
        self.mod = "20levels.mods"
        self.ai = "2"
        system("./tetroll.py" + self.option_str())
    def pl_vs_pl(self):
        self.mod = "20levels.mods"
#.........這裏部分代碼省略.........
開發者ID:m-nez,項目名稱:tetroll,代碼行數:103,代碼來源:menu.py

示例15: ExtractorWidget

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setToolTip [as 別名]
class ExtractorWidget(QWidget):
    def __init__(self, parent, model):
        super(ExtractorWidget, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose)              # This is required to stop background timers!

        self.on_remove = lambda: None

        self._model = model

        self._update_timer = QTimer(self)
        self._update_timer.setSingleShot(False)
        self._update_timer.timeout.connect(self._update)
        self._update_timer.start(200)

        self._delete_button = make_icon_button('trash-o', 'Remove this extractor', self, on_clicked=self._do_remove)

        self._color_button = make_icon_button('paint-brush', 'Change plot color', self, on_clicked=self._change_color)
        self._color_button.setFlat(True)
        _set_color(self._color_button, QPalette.Button, model.color)

        self._extraction_expression_box = QLineEdit(self)
        self._extraction_expression_box.setToolTip('Extraction expression')
        self._extraction_expression_box.setFont(get_monospace_font())
        self._extraction_expression_box.setText(model.extraction_expression.source)
        self._extraction_expression_box.textChanged.connect(self._on_extraction_expression_changed)
        self._extraction_expression_box.setCompleter(
            _make_expression_completer(self._extraction_expression_box, model.data_type_name))

        self._error_label = make_icon_button('warning', 'Extraction error count; click to reset', self,
                                             on_clicked=self._reset_errors)
        self._reset_errors()

        def box(text, tool_tip):
            w = QLineEdit(self)
            w.setReadOnly(True)
            w.setFont(get_monospace_font())
            w.setText(str(text))
            w.setToolTip(tool_tip)
            fm = QFontMetrics(w.font())
            magic_number = 10
            text_size = fm.size(0, w.text())
            w.setMinimumWidth(text_size.width() + magic_number)
            return w

        layout = QHBoxLayout(self)
        layout.addWidget(self._delete_button)
        layout.addWidget(self._color_button)
        layout.addWidget(box(model.data_type_name, 'Message type name'))
        layout.addWidget(box(' AND '.join([x.source for x in model.filter_expressions]), 'Filter expressions'))
        layout.addWidget(self._extraction_expression_box, 1)
        layout.addWidget(self._error_label)
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)

    def _on_extraction_expression_changed(self):
        text = self._extraction_expression_box.text()
        try:
            expr = Expression(text)
            self._extraction_expression_box.setPalette(QApplication.palette())
        except Exception:
            _set_color(self._extraction_expression_box, QPalette.Base, Qt.red)
            return

        self._model.extraction_expression = expr

    def _change_color(self):
        col = _show_color_dialog(self._model.color, self)
        if col:
            self._model.color = col
            _set_color(self._color_button, QPalette.Button, self._model.color)

    def _update(self):
        self._error_label.setText(str(self._model.error_count))

    def _reset_errors(self):
        self._model.reset_error_count()
        self._update()

    def _do_remove(self):
        self.on_remove()
        self._update_timer.stop()
        self.setParent(None)
        self.close()
        self.deleteLater()
開發者ID:learningendless,項目名稱:gui_tool,代碼行數:86,代碼來源:value_extractor_views.py


注:本文中的PyQt5.QtWidgets.QLineEdit.setToolTip方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。