当前位置: 首页>>代码示例>>Python>>正文


Python KPushButton.setToolTip方法代码示例

本文整理汇总了Python中PyKDE4.kdeui.KPushButton.setToolTip方法的典型用法代码示例。如果您正苦于以下问题:Python KPushButton.setToolTip方法的具体用法?Python KPushButton.setToolTip怎么用?Python KPushButton.setToolTip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyKDE4.kdeui.KPushButton的用法示例。


在下文中一共展示了KPushButton.setToolTip方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Ui_Form

# 需要导入模块: from PyKDE4.kdeui import KPushButton [as 别名]
# 或者: from PyKDE4.kdeui.KPushButton import setToolTip [as 别名]
class Ui_Form(object):
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(508, 94)
        self.verticalLayout = QtGui.QVBoxLayout(Form)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.dictionaryCombo = QtGui.QComboBox(Form)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.dictionaryCombo.sizePolicy().hasHeightForWidth())
        self.dictionaryCombo.setSizePolicy(sizePolicy)
        self.dictionaryCombo.setObjectName("dictionaryCombo")
        self.horizontalLayout.addWidget(self.dictionaryCombo)
        self.checkVersionButton = KPushButton(Form)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.checkVersionButton.sizePolicy().hasHeightForWidth())
        self.checkVersionButton.setSizePolicy(sizePolicy)
        self.checkVersionButton.setObjectName("checkVersionButton")
        self.horizontalLayout.addWidget(self.checkVersionButton)
        self.removeButton = KPushButton(Form)
        self.removeButton.setObjectName("removeButton")
        self.horizontalLayout.addWidget(self.removeButton)
        self.installButton = KPushButton(Form)
        self.installButton.setEnabled(False)
        self.installButton.setObjectName("installButton")
        self.horizontalLayout.addWidget(self.installButton)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.statusLabel = KSqueezedTextLabel(Form)
        self.statusLabel.setObjectName("statusLabel")
        self.verticalLayout.addWidget(self.statusLabel)
        self.progressBar = QtGui.QProgressBar(Form)
        self.progressBar.setProperty("value", QtCore.QVariant(24))
        self.progressBar.setInvertedAppearance(False)
        self.progressBar.setObjectName("progressBar")
        self.verticalLayout.addWidget(self.progressBar)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)

    def retranslateUi(self, Form):
        Form.setWindowTitle(kdecore.i18n("Form"))
        self.checkVersionButton.setToolTip(kdecore.i18n("Check the online resource for a newer version."))
        self.checkVersionButton.setWhatsThis(kdecore.i18n("Check the online resource for a newer version."))
        self.checkVersionButton.setText(kdecore.i18n("&Check for newer"))
        self.removeButton.setText(kdecore.i18n("&Remove"))
        self.installButton.setToolTip(kdecore.i18n("Download and install the selected dictionary."))
        self.installButton.setWhatsThis(kdecore.i18n("Download and install the selected dictionary."))
        self.installButton.setText(kdecore.i18n("&Install"))
开发者ID:cburgmer,项目名称:eclectus,代码行数:55,代码来源:UpdateUI.py

示例2: PylouApplet

# 需要导入模块: from PyKDE4.kdeui import KPushButton [as 别名]
# 或者: from PyKDE4.kdeui.KPushButton import setToolTip [as 别名]
class PylouApplet(Applet):

    """Main Applet containing the UI of Pylou."""

    def __init__(self, parent, args=None):
        """Init class."""
        Applet.__init__(self, parent)

    def init(self):
        """Start the Applet."""
        self._widget = None
        self.setHasConfigurationInterface(True)
        self.setAspectRatioMode(Plasma.IgnoreAspectRatio)
        self.configurations = self.config()
        self._widget = PylouWidget(self)
        self._widget.init()
        self.setGraphicsWidget(self._widget)
        self.applet.setPassivePopup(True)
        self.setPopupIcon(QIcon.fromTheme("edit-find"))
        # for some odd reason this has to be called twice?
        self.setGraphicsWidget(self._widget)
        self.prepareConfigDialog()

    def update_db(self):
        """Update the DB."""
        return call("kdesudo --noignorebutton -c updatedb", shell=True)

    def prepareConfigDialog(self):
        """Prepare the Configuration Dialog."""
        self.bcolor, self.dialog = QColor(), KDialog()
        self.dialog.setWindowTitle(__package__ + "Settings")
        self.layBox = QGridLayout(self.dialog.mainWidget())
        self.title = KTitleWidget(self.dialog)
        self.title.setText(__doc__ + " !")
        self.title.setAutoHideTimeout(3000)
        self.FontButton = KFontRequester(self.dialog)
        self.tfont = QFont(QVariant(self.configurations.readEntry("TextFont",
                           QVariant(QFont()))))
        self.FontButton.setFont(self.tfont)
        self.ColorButton = KColorButton(self.dialog)
        self.tcolor = QColor(self.configurations.readEntry("TextColor",
                             QColor("#000").name()))
        self.ColorButton.setColor(self.tcolor)
        self.BColorButton = KColorButton(self.dialog)
        # button to update the DB via sudo updatedb

        self.UpdateDB = KPushButton("Update Database", self.dialog,
                                    clicked=lambda: self.update_db())
        self.UpdateDB.setToolTip("Database is Updated every Reboot and Daily!")
        self.Histor = KPushButton("Delete my History", self.dialog,
                                  clicked=delete_my_history)
        self.Histor.setToolTip("History is Deleted every Reboot !")
        # list of banned words separated by spaces
        self.banned = KTextEdit(self.dialog)
        self.banned.setPlainText(self.configurations.readEntry(
            "Banned", "sex porn drugs suicide decapitate religion").toString())
        # set the colors
        cg = KConfig("kdeglobals")
        color = cg.group("Colors:View").readEntry(
            "BackgroundAlternate").split(",")
        self.bcolor = QColor(int(color[0]), int(color[1]), int(color[2]))
        self.BColorButton.setColor(self.bcolor)
        self.history_file_path_field = KLineEdit(HISTORY_FILE_PATH)
        self.history_file_path_field.setDisabled(True)
        self.python_file_path_field = KLineEdit(__file__)
        self.python_file_path_field.setDisabled(True)
        self.kill_baloo = QCheckBox("Disable Baloo")
        self.kill_baloo.setToolTip("Enable/Disable Desktop Search Indexing")
        self.kill_baloo.stateChanged.connect(lambda: call(
            DISABLE_BALOO_CMD.format(str(
                not self.kill_baloo.isChecked()).lower()), shell=True))
        self.kill_baloo.stateChanged.connect(lambda: QMessageBox.information(
            self.dialog, __doc__, """
            <b>Indexing Disabled, Baloo is Dead !
            """ if self.kill_baloo.isChecked() else """
            <b>Indexing Enabled, Baloo is Running !"""))
        self.updatez = KPushButton("Check for Updates", self.dialog,
                                   clicked=lambda: self.check_for_updates())
        self.updatez.setToolTip("Check for Pylou updates from the internet")
        self.home_sweet_home = QCheckBox("Only Search Home")
        self.home_sweet_home.setToolTip("Only Search on my Home folders")
        self.home_sweet_home.setChecked(
            bool(self.configurations.readEntry("Home", True)))
        # pack all widgets
        self.layBox.addWidget(self.title, 0, 1)
        self.layBox.addWidget(QLabel("Font"), 1, 0)
        self.layBox.addWidget(self.FontButton, 1, 1)
        self.layBox.addWidget(QLabel("Text Color"), 2, 0)
        self.layBox.addWidget(self.ColorButton, 2, 1)
        self.layBox.addWidget(QLabel("Alternate Color"), 3, 0)
        self.layBox.addWidget(self.BColorButton, 3, 1)
        self.layBox.addWidget(QLabel(), 4, 0)
        self.layBox.addWidget(QLabel("Mainteniance"), 5, 0)
        self.layBox.addWidget(self.UpdateDB, 5, 1)
        self.layBox.addWidget(QLabel("Privacy"), 6, 0)
        self.layBox.addWidget(self.Histor, 6, 1)
        self.layBox.addWidget(QLabel("History file"), 7, 0)
        self.layBox.addWidget(self.history_file_path_field, 7, 1)
        self.layBox.addWidget(QLabel(__package__ + "file"), 8, 0)
        self.layBox.addWidget(self.python_file_path_field, 8, 1)
#.........这里部分代码省略.........
开发者ID:juancarlospaco,项目名称:pylou,代码行数:103,代码来源:main.py

示例3: __init__

# 需要导入模块: from PyKDE4.kdeui import KPushButton [as 别名]
# 或者: from PyKDE4.kdeui.KPushButton import setToolTip [as 别名]
    def __init__(self, parent):
        QSplitter.__init__(self, parent)
        parent.addPage(self, i18n("Parts"))

        # The part types overview widget.
        v = KVBox()
        self.addWidget(v)
        QLabel('<b>{0}</b>'.format(i18n("Available parts:")), v)
        allParts = QTreeWidget(v)
        addButton = KPushButton(KStandardGuiItem.add(), v)
        addButton.setToolTip(i18n("Add selected part to your score."))

        # The listbox with selected parts
        v = KVBox()
        self.addWidget(v)
        QLabel('<b>{0}</b>'.format(i18n("Score:")), v)
        score = QListWidget(v)
        self.score = score  # so the partList method can find us
        h = KHBox(v)
        removeButton = KPushButton(KStandardGuiItem.remove(), h)
        upButton = QToolButton(h)
        upButton.setIcon(KIcon("go-up"))
        downButton = QToolButton(h)
        downButton.setIcon(KIcon("go-down"))

        # The StackedWidget with settings
        partSettings = QStackedWidget()
        self.addWidget(partSettings)
        
        self.setStretchFactor(0, 1)
        self.setStretchFactor(1, 1)
        self.setStretchFactor(2, 1)
        self.setSizes((100, 100, 100))

        allParts.setSelectionMode(QTreeWidget.ExtendedSelection)
        allParts.setRootIsDecorated(False)
        allParts.headerItem().setHidden(True)
        score.setSelectionMode(QListWidget.ExtendedSelection)
        score.setDragDropMode(QListWidget.InternalMove)

        class PartItem(QListWidgetItem):
            """
            A part from the score, instantiating a config widget as well.
            """
            def __init__(self, partClass):
                name = partClass.name() # partClass.name is a ki18n object
                QListWidgetItem.__init__(self, name, score)
                self.w = QGroupBox(name)
                partSettings.addWidget(self.w)
                self.part = partClass()
                layout = QVBoxLayout(self.w)
                self.part.widgets(layout)
                layout.addStretch(1)
                if score.count() == 1:
                    score.setCurrentRow(0)
                    self.setSelected(True)
                parent.enableButton(KPageDialog.Try, True)

            def showSettingsWidget(self):
                partSettings.setCurrentWidget(self.w)

            def remove(self):
                if score.count() == 1:
                    parent.enableButton(KPageDialog.Try, False)
                sip.delete(self.w)
                sip.delete(self) # TODO: check if necessary
        
        @allParts.itemDoubleClicked.connect
        def addPart(item, col):
            if hasattr(item, "partClass"):
                PartItem(item.partClass)
        
        @allParts.itemClicked.connect
        def toggleExpand(item, col):
            item.setExpanded(not item.isExpanded())

        @addButton.clicked.connect
        def addSelectedParts():
            for item in allParts.selectedItems():
                PartItem(item.partClass)

        @removeButton.clicked.connect
        def removeSelectedParts():
            for item in score.selectedItems():
                item.remove()

        def keepSel(func):
            """
            Restore the selection and current element after reordering parts.
            """
            def decorator():
                selItems = score.selectedItems()
                curItem = score.currentItem()
                func()
                score.setCurrentItem(curItem)
                for i in selItems:
                    i.setSelected(True)
            return decorator
            
        @upButton.clicked.connect
#.........这里部分代码省略.........
开发者ID:Alwnikrotikz,项目名称:lilykde,代码行数:103,代码来源:__init__.py


注:本文中的PyKDE4.kdeui.KPushButton.setToolTip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。