eric6/Network/IRC/IrcIdentitiesEditDialog.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
66 if index == -1: 66 if index == -1:
67 index = 0 67 index = 0
68 identityName = self.identitiesCombo.itemText(0) 68 identityName = self.identitiesCombo.itemText(0)
69 self.identitiesCombo.setCurrentIndex(index) 69 self.identitiesCombo.setCurrentIndex(index)
70 70
71 self.on_identitiesCombo_currentIndexChanged(identityName) 71 self.on_identitiesCombo_currentIndexChanged(index)
72 72
73 self.nicknameEdit.installEventFilter(self) 73 self.nicknameEdit.installEventFilter(self)
74 74
75 def eventFilter(self, obj, evt): 75 def eventFilter(self, obj, evt):
76 """ 76 """
78 78
79 @param obj reference to the object (QObject) 79 @param obj reference to the object (QObject)
80 @param evt reference to the event (QEvent) 80 @param evt reference to the event (QEvent)
81 @return flag indicating that the event should be filtered out (boolean) 81 @return flag indicating that the event should be filtered out (boolean)
82 """ 82 """
83 if obj == self.nicknameEdit and evt.type() == QEvent.KeyPress: 83 if obj == self.nicknameEdit and evt.type() == QEvent.Type.KeyPress:
84 if evt.key() in [Qt.Key_Enter, Qt.Key_Return]: 84 if evt.key() in [Qt.Key.Key_Enter, Qt.Key.Key_Return]:
85 self.on_nicknameAddButton_clicked() 85 self.on_nicknameAddButton_clicked()
86 return True 86 return True
87 87
88 return super(IrcIdentitiesEditDialog, self).eventFilter(obj, evt) 88 return super(IrcIdentitiesEditDialog, self).eventFilter(obj, evt)
89 89
94 enable = (self.identitiesCombo.currentText() != 94 enable = (self.identitiesCombo.currentText() !=
95 IrcIdentity.DefaultIdentityDisplay) 95 IrcIdentity.DefaultIdentityDisplay)
96 self.renameButton.setEnabled(enable) 96 self.renameButton.setEnabled(enable)
97 self.deleteButton.setEnabled(enable) 97 self.deleteButton.setEnabled(enable)
98 98
99 @pyqtSlot(str) 99 @pyqtSlot(int)
100 def on_identitiesCombo_currentIndexChanged(self, identity): 100 def on_identitiesCombo_currentIndexChanged(self, index):
101 """ 101 """
102 Private slot to handle the selection of an identity. 102 Private slot to handle the selection of an identity.
103 103
104 @param identity selected identity (string) 104 @param index index of the selected entry
105 """ 105 @type int
106 """
107 identity = self.identitiesCombo.itemText(index)
106 if identity == IrcIdentity.DefaultIdentityDisplay: 108 if identity == IrcIdentity.DefaultIdentityDisplay:
107 identity = IrcIdentity.DefaultIdentityName 109 identity = IrcIdentity.DefaultIdentityName
108 self.__updateIdentitiesButtons() 110 self.__updateIdentitiesButtons()
109 111
110 if self.__currentIdentity and not self.__checkCurrentIdentity(): 112 if self.__currentIdentity and not self.__checkCurrentIdentity():
210 """ 212 """
211 name, ok = QInputDialog.getText( 213 name, ok = QInputDialog.getText(
212 self, 214 self,
213 self.tr("Add Identity"), 215 self.tr("Add Identity"),
214 self.tr("Identity Name:"), 216 self.tr("Identity Name:"),
215 QLineEdit.Normal) 217 QLineEdit.EchoMode.Normal)
216 218
217 if ok: 219 if ok:
218 if name: 220 if name:
219 if name in self.__identities: 221 if name in self.__identities:
220 E5MessageBox.critical( 222 E5MessageBox.critical(
248 currentIdentity = self.identitiesCombo.currentText() 250 currentIdentity = self.identitiesCombo.currentText()
249 name, ok = QInputDialog.getText( 251 name, ok = QInputDialog.getText(
250 self, 252 self,
251 self.tr("Copy Identity"), 253 self.tr("Copy Identity"),
252 self.tr("Identity Name:"), 254 self.tr("Identity Name:"),
253 QLineEdit.Normal, 255 QLineEdit.EchoMode.Normal,
254 currentIdentity) 256 currentIdentity)
255 257
256 if ok: 258 if ok:
257 if name: 259 if name:
258 if name in self.__identities: 260 if name in self.__identities:
286 currentIdentity = self.identitiesCombo.currentText() 288 currentIdentity = self.identitiesCombo.currentText()
287 name, ok = QInputDialog.getText( 289 name, ok = QInputDialog.getText(
288 self, 290 self,
289 self.tr("Rename Identity"), 291 self.tr("Rename Identity"),
290 self.tr("Identity Name:"), 292 self.tr("Identity Name:"),
291 QLineEdit.Normal, 293 QLineEdit.EchoMode.Normal,
292 currentIdentity) 294 currentIdentity)
293 295
294 if ok and name != currentIdentity: 296 if ok and name != currentIdentity:
295 if name: 297 if name:
296 if name in self.__identities: 298 if name in self.__identities:
417 """ 419 """
418 nick = self.nicknameEdit.text() 420 nick = self.nicknameEdit.text()
419 if nick not in [self.nicknamesList.item(row).text() 421 if nick not in [self.nicknamesList.item(row).text()
420 for row in range(self.nicknamesList.count())]: 422 for row in range(self.nicknamesList.count())]:
421 self.nicknamesList.insertItem(0, nick) 423 self.nicknamesList.insertItem(0, nick)
422 self.nicknamesList.setCurrentRow(0, QItemSelectionModel.Clear) 424 self.nicknamesList.setCurrentRow(
425 0, QItemSelectionModel.SelectionFlag.Clear)
423 self.nicknameEdit.clear() 426 self.nicknameEdit.clear()
424 self.__updateNicknameButtons() 427 self.__updateNicknameButtons()
425 428
426 @pyqtSlot() 429 @pyqtSlot()
427 def on_nicknameDeleteButton_clicked(self): 430 def on_nicknameDeleteButton_clicked(self):
463 466
464 @param checked state of the button 467 @param checked state of the button
465 @type bool 468 @type bool
466 """ 469 """
467 if checked: 470 if checked:
468 self.passwordEdit.setEchoMode(QLineEdit.Normal) 471 self.passwordEdit.setEchoMode(QLineEdit.EchoMode.Normal)
469 self.showPasswordButton.setIcon( 472 self.showPasswordButton.setIcon(
470 UI.PixmapCache.getIcon("hidePassword")) 473 UI.PixmapCache.getIcon("hidePassword"))
471 self.showPasswordButton.setToolTip( 474 self.showPasswordButton.setToolTip(
472 self.tr("Press to hide the password")) 475 self.tr("Press to hide the password"))
473 else: 476 else:
474 self.passwordEdit.setEchoMode(QLineEdit.Password) 477 self.passwordEdit.setEchoMode(QLineEdit.EchoMode.Password)
475 self.showPasswordButton.setIcon( 478 self.showPasswordButton.setIcon(
476 UI.PixmapCache.getIcon("showPassword")) 479 UI.PixmapCache.getIcon("showPassword"))
477 self.showPasswordButton.setToolTip( 480 self.showPasswordButton.setToolTip(
478 self.tr("Press to show the password")) 481 self.tr("Press to show the password"))
479 482

eric ide

mercurial