本文整理汇总了Python中PySide.QtGui.QComboBox.setEditText方法的典型用法代码示例。如果您正苦于以下问题:Python QComboBox.setEditText方法的具体用法?Python QComboBox.setEditText怎么用?Python QComboBox.setEditText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QComboBox
的用法示例。
在下文中一共展示了QComboBox.setEditText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import setEditText [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)