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


Python QComboBox.insertItems方法代码示例

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


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

示例1: createEditor

# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import insertItems [as 别名]
 def createEditor(self, parent, option, index):
     """ Should return a combo box with Income or Expense """
     self.accounts = Accounts.all()
     self.accountNames = [account.name for account in self.accounts]
     comboBox = QComboBox(parent)
     comboBox.insertItems(0, self.accountNames)
     return comboBox
开发者ID:cloew,项目名称:PersonalAccountingSoftware,代码行数:9,代码来源:transaction_account_delegate.py

示例2: AbstractContext

# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import insertItems [as 别名]
class AbstractContext(QWidget):
    def __init__(self, parent, labels):
        super(AbstractContext, self).__init__(parent)

        self.add = QAction(QIcon(":/img/add.png"), self.tr("Add"), self)

        self.delete = QAction(QIcon(":/img/delete.png"),
                              self.tr("Delete"),
                              self)

        self.edit = QAction(QIcon(":/img/edit.png"), self.tr("Edit"), self)

        self.print_ = QAction(QIcon(":/img/print.png"), self.tr("Print"), self)

        self.toolbar = QToolBar(self.tr("Controls"), self)

        self.toolbar.addAction(self.add)
        self.toolbar.addAction(self.delete)
        self.toolbar.addAction(self.edit)
        self.toolbar.addAction(self.print_)

        self.entries = QTreeWidget(self)
        self.entries.setHeaderLabels(labels)

        self.search = QLineEdit(self)

        self.search_by = QComboBox(self)
        self.search_by.insertItems(len(labels), labels)

        layout = QGridLayout(self)

        layout.addWidget(self.toolbar,                         0, 0)
        layout.addWidget(self.entries,                         1, 0, 1, 8)
        layout.addWidget(QLabel(self.tr("Search for:"), self), 2, 0)
        layout.addWidget(self.search,                          2, 1)
        layout.addWidget(QLabel(self.tr("by"), self),          2, 2)
        layout.addWidget(self.search_by,                       2, 3)

    def add_entry(self, entry):
        pass

    def delete_entry(self, entry):
        index = self.entries.indexOfTopLevelItem(entry)
        self.entries.takeTopLevelItem(index)

    def edit_entry(self, entry, new_data):
        for column, data in new_data:
            entry.setText(column, data)

    def confirm_deletion(self, what):
        return True
开发者ID:xiphffff,项目名称:Caerus,代码行数:53,代码来源:caerus.py

示例3: AbstractEntry

# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import insertItems [as 别名]
class AbstractEntry(QWizardPage):
    def __init__(self, parent, title, sub_title):
        super(AbstractEntry, self).__init__(parent)

        self.setTitle(title)
        self.setSubTitle(sub_title)

        self.score = QComboBox(self)

        self.score.insertItems(5,
                               ["1 - Poor",
                                "2 - Fair",
                                "3 - Good",
                                "4 - Great",
                                "5 - Outstanding"])

        self.comments = QPlainTextEdit(self)
        self.comments.textChanged.connect(self.comments_changed)

        field = "%s.comments*" % title

        self.registerField(field,
                           self.comments,
                           "plainText",
                           SIGNAL("textChanged()"))

        layout = QGridLayout(self)

        layout.addWidget(QLabel(self.tr("Score:"), self),    0, 0)
        layout.addWidget(self.score,                         0, 1)
        layout.addWidget(QLabel(self.tr("Comments:"), self), 1, 0)
        layout.addWidget(self.comments,                      1, 1)

    def comments_changed(self):
        if len(self.comments.toPlainText()) >= 257:
            self.comments.textCursor().deletePreviousChar()
开发者ID:xiphffff,项目名称:Caerus,代码行数:38,代码来源:evaluate.py

示例4: MainWindow

# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import insertItems [as 别名]

#.........这里部分代码省略.........
    def generate_password(self):
        if not self.kgk_manager.has_kgk():
            self.kgk_manager.create_new_kgk()
            self.kgk_manager.create_and_save_new_kgk_block()
        if not self.kgk_manager.kgk_crypter or not self.kgk_manager.salt:
            self.kgk_manager.get_kgk_crypter(self.master_password_edit.text().encode('utf-8'),
                                             self.kgk_manager.get_kgk_crypter_salt())
        if self.setting_dirty:
            self.setting.new_salt()
            self.setting.calculate_template()
        self.settings_manager.set_setting(self.setting)
        if not self.setting.get_legacy_password():
            generator = CtSesam(self.setting.get_domain(),
                                self.setting.get_username(),
                                self.kgk_manager.get_kgk(),
                                self.setting.get_salt(),
                                self.setting.get_iterations())
            password = generator.generate(self.setting)
        else:
            password = self.setting.get_legacy_password()
        self.password.setText(password)
        self.password.setTextInteractionFlags(Qt.TextSelectableByMouse | Qt.TextSelectableByKeyboard)
        self.clipboard_button.setVisible(True)
        self.settings_manager.store_local_settings(self.kgk_manager)
        self.setting_dirty = False

    def copy_to_clipboard(self):
        QApplication.clipboard().setText(self.password.text())

    def username_changed(self):
        if self.setting:
            if self.setting.get_username() != self.username_edit.text():
                self.setting.set_username(self.username_edit.text())
                self.setting_dirty = True
            self.generate_password()

    def strength_changed(self, complexity, length):
        if self.setting:
            if self.setting.get_length() != length:
                self.setting.set_length(length)
                self.setting_dirty = True
            if self.setting.get_complexity() != complexity:
                self.setting.set_complexity(complexity)
                self.setting_dirty = True
            self.generate_password()

    def migrate_local_domains(self, new_kgk_manager):
        for domain in self.settings_manager.get_domain_list():
            setting = self.settings_manager.get_setting(domain)
            generator = CtSesam(setting.get_domain(),
                                setting.get_username(),
                                self.kgk_manager.get_kgk(),
                                setting.get_salt(),
                                setting.get_iterations())
            setting.set_legacy_password(generator.generate(setting))
            self.settings_manager.set_setting(setting)
        self.kgk_manager = new_kgk_manager
        self.settings_manager.store_local_settings(self.kgk_manager)

    # noinspection PyUnresolvedReferences
    def sync_clicked(self):
        self.masterpassword_entered()
        if not self.settings_manager.sync_manager.has_settings():
            self.show_sync_settings()
        else:
            pull_successful, data = self.settings_manager.sync_manager.pull()
            if pull_successful and len(data) > 0:
                remote_kgk_manager = KgkManager()
                remote_kgk_manager.update_from_blob(self.master_password_edit.text().encode('utf-8'), b64decode(data))
                if len(self.preference_manager.get_kgk_block()) == 112 and \
                   remote_kgk_manager.has_kgk() and self.kgk_manager.has_kgk() and \
                   self.kgk_manager.get_kgk() != remote_kgk_manager.get_kgk():
                    if len(self.settings_manager.get_domain_list()) > 0:
                        print("Lokal und auf dem Server gibt es unterschiedliche KGKs. Das ist ein Problem!")
                    self.migrate_local_domains(remote_kgk_manager)
                else:
                    if len(self.preference_manager.get_kgk_block()) != 112:
                        self.kgk_manager = remote_kgk_manager
                        self.kgk_manager.set_preference_manager(self.preference_manager)
                        self.kgk_manager.store_local_kgk_block()
                    self.settings_manager.update_from_export_data(remote_kgk_manager, b64decode(data))
                    self.domain_edit.blockSignals(True)
                    current_domain = self.domain_edit.lineEdit().text()
                    for i in reversed(range(self.domain_edit.count())):
                        self.domain_edit.removeItem(i)
                    self.domain_edit.insertItems(0, self.settings_manager.get_domain_list())
                    self.domain_edit.blockSignals(False)
                    self.domain_edit.setEditText(current_domain)
            self.settings_manager.store_settings(self.kgk_manager)

    # noinspection PyUnresolvedReferences
    def show_sync_settings(self, url=None, username=None, password=None):
        self.settings_window = SettingsWindow(
            self.settings_manager.sync_manager,
            self.nam,
            url=self.settings_manager.sync_manager.server_address,
            username=self.settings_manager.sync_manager.username,
            password=self.settings_manager.sync_manager.password,
            certificate=self.settings_manager.sync_manager.certificate)
        self.settings_window.finished.connect(self.sync_clicked)
开发者ID:pinae,项目名称:ctSESAM-pyside,代码行数:104,代码来源:ctSESAM.py

示例5: createEditor

# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import insertItems [as 别名]
 def createEditor(self, parent, option, index):
     """ Should return a combo box with Income or Expense """
     comboBox = QComboBox(parent)
     comboBox.insertItems(0, self.__type_strings__)
     return comboBox
开发者ID:cloew,项目名称:PersonalAccountingSoftware,代码行数:7,代码来源:transaction_type_delegate.py


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