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


Python KPushButton.setEnabled方法代碼示例

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


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

示例1: Ui_Form

# 需要導入模塊: from PyKDE4.kdeui import KPushButton [as 別名]
# 或者: from PyKDE4.kdeui.KPushButton import setEnabled [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: Ui_Form

# 需要導入模塊: from PyKDE4.kdeui import KPushButton [as 別名]
# 或者: from PyKDE4.kdeui.KPushButton import setEnabled [as 別名]
class Ui_Form(object):
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(632, 411)
        self.tableWidget = QtGui.QTableWidget(Form)
        self.tableWidget.setGeometry(QtCore.QRect(30, 20, 591, 301))
        self.tableWidget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
        self.tableWidget.setColumnCount(4)
        self.tableWidget.setObjectName("tableWidget")
        self.tableWidget.setColumnCount(4)
        self.tableWidget.setRowCount(0)
        item = QtGui.QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(0, item)
        item = QtGui.QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(1, item)
        item = QtGui.QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(2, item)
        item = QtGui.QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(3, item)
        self.tableWidget.horizontalHeader().setStretchLastSection(True)
        self.horizontalLayoutWidget = QtGui.QWidget(Form)
        self.horizontalLayoutWidget.setGeometry(QtCore.QRect(29, 320, 591, 31))
        self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget")
        self.horizontalLayout = QtGui.QHBoxLayout(self.horizontalLayoutWidget)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.add_button = KPushButton(self.horizontalLayoutWidget)
        self.add_button.setObjectName("add_button")
        self.horizontalLayout.addWidget(self.add_button)
        self.remove_button = KPushButton(self.horizontalLayoutWidget)
        self.remove_button.setEnabled(False)
        self.remove_button.setObjectName("remove_button")
        self.horizontalLayout.addWidget(self.remove_button)
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.move_up_button = KPushButton(self.horizontalLayoutWidget)
        self.move_up_button.setEnabled(False)
        self.move_up_button.setObjectName("move_up_button")
        self.horizontalLayout.addWidget(self.move_up_button)
        self.move_down_button = KPushButton(self.horizontalLayoutWidget)
        self.move_down_button.setEnabled(False)
        self.move_down_button.setObjectName("move_down_button")
        self.horizontalLayout.addWidget(self.move_down_button)
        self.export_button = KPushButton(Form)
        self.export_button.setGeometry(QtCore.QRect(30, 370, 111, 26))
        self.export_button.setObjectName("export_button")

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

    def retranslateUi(self, Form):
        Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8))
        self.tableWidget.horizontalHeaderItem(0).setText(QtGui.QApplication.translate("Form", "Icon", None, QtGui.QApplication.UnicodeUTF8))
        self.tableWidget.horizontalHeaderItem(1).setText(QtGui.QApplication.translate("Form", "Button Text", None, QtGui.QApplication.UnicodeUTF8))
        self.tableWidget.horizontalHeaderItem(2).setText(QtGui.QApplication.translate("Form", "Media URL", None, QtGui.QApplication.UnicodeUTF8))
        self.tableWidget.horizontalHeaderItem(3).setText(QtGui.QApplication.translate("Form", "ToolTip Comment", None, QtGui.QApplication.UnicodeUTF8))
        self.add_button.setText(QtGui.QApplication.translate("Form", "add", None, QtGui.QApplication.UnicodeUTF8))
        self.remove_button.setText(QtGui.QApplication.translate("Form", "remove", None, QtGui.QApplication.UnicodeUTF8))
        self.move_up_button.setText(QtGui.QApplication.translate("Form", "Move Up", None, QtGui.QApplication.UnicodeUTF8))
        self.move_down_button.setText(QtGui.QApplication.translate("Form", "Move Down", None, QtGui.QApplication.UnicodeUTF8))
        self.export_button.setText(QtGui.QApplication.translate("Form", "Export to file", None, QtGui.QApplication.UnicodeUTF8))
開發者ID:alandmoore,項目名稱:kliqtune-plasmoid,代碼行數:62,代碼來源:launcher_config_ui.py

示例3: Ui_Form

# 需要導入模塊: from PyKDE4.kdeui import KPushButton [as 別名]
# 或者: from PyKDE4.kdeui.KPushButton import setEnabled [as 別名]
class Ui_Form(object):
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(544, 313)
        self.verticalLayout = QtGui.QVBoxLayout(Form)
        self.verticalLayout.setObjectName("verticalLayout")
        self.tableWidget = QtGui.QTableWidget(Form)
        self.tableWidget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
        self.tableWidget.setColumnCount(3)
        self.tableWidget.setObjectName("tableWidget")
        self.tableWidget.setColumnCount(3)
        self.tableWidget.setRowCount(0)
        item = QtGui.QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(0, item)
        item = QtGui.QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(1, item)
        item = QtGui.QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(2, item)
        self.tableWidget.horizontalHeader().setStretchLastSection(True)
        self.verticalLayout.addWidget(self.tableWidget)
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.add_button = KPushButton(Form)
        self.add_button.setObjectName("add_button")
        self.horizontalLayout.addWidget(self.add_button)
        self.remove_button = KPushButton(Form)
        self.remove_button.setEnabled(False)
        self.remove_button.setObjectName("remove_button")
        self.horizontalLayout.addWidget(self.remove_button)
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.move_up_button = KPushButton(Form)
        self.move_up_button.setEnabled(False)
        self.move_up_button.setObjectName("move_up_button")
        self.horizontalLayout.addWidget(self.move_up_button)
        self.move_down_button = KPushButton(Form)
        self.move_down_button.setEnabled(False)
        self.move_down_button.setObjectName("move_down_button")
        self.horizontalLayout.addWidget(self.move_down_button)
        self.verticalLayout.addLayout(self.horizontalLayout)

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

    def retranslateUi(self, Form):
        Form.setWindowTitle(kdecore.i18n("Form"))
        self.tableWidget.horizontalHeaderItem(0).setText(kdecore.i18n("Button Title"))
        self.tableWidget.horizontalHeaderItem(1).setText(kdecore.i18n("Command"))
        self.tableWidget.horizontalHeaderItem(2).setText(kdecore.i18n("Comment"))
        self.add_button.setText(kdecore.i18n("add"))
        self.remove_button.setText(kdecore.i18n("remove"))
        self.move_up_button.setText(kdecore.i18n("Move Up"))
        self.move_down_button.setText(kdecore.i18n("Move Down"))
開發者ID:alandmoore,項目名稱:textlaunch-plasmoid,代碼行數:55,代碼來源:launcher_config_ui.py

示例4: ListEdit

# 需要導入模塊: from PyKDE4.kdeui import KPushButton [as 別名]
# 或者: from PyKDE4.kdeui.KPushButton import setEnabled [as 別名]
class ListEdit(QWidget):
    """A widget to edit a list of items (e.g. a list of directories)."""
    
    # emitted when anything changed in the listbox.
    changed = Signal()
    
    def __init__(self, *args, **kwargs):
        QWidget.__init__(self, *args, **kwargs)
        layout = QGridLayout(self)
        self.setLayout(layout)
        
        self.addButton = KPushButton(KStandardGuiItem.add())
        self.editButton = KPushButton(KStandardGuiItem.configure())
        self.removeButton = KPushButton(KStandardGuiItem.remove())
        self.listBox = QListWidget()
        
        layout.setContentsMargins(1, 1, 1, 1)
        layout.setSpacing(0)
        layout.addWidget(self.listBox, 0, 0, 4, 1)
        layout.addWidget(self.addButton, 0, 1)
        layout.addWidget(self.editButton, 1, 1)
        layout.addWidget(self.removeButton, 2, 1)
        
        @self.addButton.clicked.connect
        def addClicked():
            item = self.createItem()
            if self.openEditor(item):
                self.addItem(item)
                
        @self.editButton.clicked.connect
        def editClicked():
            item = self.listBox.currentItem()
            item and self.editItem(item)
        
        @self.removeButton.clicked.connect
        def removeClicked():
            item = self.listBox.currentItem()
            if item:
                self.removeItem(item)
        
        @self.listBox.itemDoubleClicked.connect
        def itemDoubleClicked(item):
            item and self.editItem(item)
            
        self.listBox.model().layoutChanged.connect(self.changed)
    
        def updateSelection():
            selected = bool(self.listBox.currentItem())
            self.editButton.setEnabled(selected)
            self.removeButton.setEnabled(selected)
        self.changed.connect(updateSelection)
        self.listBox.itemSelectionChanged.connect(updateSelection)
        updateSelection()
    
    def createItem(self):
        return QListWidgetItem()
        
    def addItem(self, item):
        self.listBox.addItem(item)
        self.itemChanged(item)
        self.changed()
        
    def removeItem(self, item):
        self.listBox.takeItem(self.listBox.row(item))
        self.changed()
        
    def editItem(self, item):
        if self.openEditor(item):
            self.itemChanged(item)
            self.changed()
            
    def setCurrentItem(self, item):
        self.listBox.setCurrentItem(item)
        
    def setCurrentRow(self, row):
        self.listBox.setCurrentRow(row)
        
    def openEditor(self, item):
        """Opens an editor (dialog) for the item.
        
        Returns True if the dialog was accepted and the item edited.
        Returns False if the dialog was cancelled (the item must be left
        unedited).
        """
        pass
    
    def itemChanged(self, item):
        """Called after an item has been added or edited.
        
        Re-implement to do something at this moment if needed, e.g. alter the
        text or display of other items.
        """
        pass
    
    def setValue(self, strings):
        """Sets the listbox to a list of strings."""
        self.listBox.clear()
        self.listBox.addItems(strings)
        self.changed()
        
#.........這裏部分代碼省略.........
開發者ID:Alwnikrotikz,項目名稱:lilykde,代碼行數:103,代碼來源:widgets.py


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