eric6/Network/IRC/IrcIdentitiesEditDialog.py

Sat, 11 Apr 2020 14:13:25 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 11 Apr 2020 14:13:25 +0200
changeset 7522
e0e05a1b576f
parent 7360
9190402e4505
child 7533
88261c96484b
permissions
-rw-r--r--

Styles: added some Qt style sheets and some highlighter styles.

2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7360
9190402e4505 Updated copyright for 2020.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7255
diff changeset
3 # Copyright (c) 2012 - 2020 Detlev Offenbach <detlev@die-offenbachs.de>
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the identities management dialog.
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
10
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 import copy
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
13 from PyQt5.QtCore import pyqtSlot, Qt, QEvent, QItemSelectionModel
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
14 from PyQt5.QtWidgets import QDialog, QInputDialog, QLineEdit
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 from E5Gui import E5MessageBox
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 from .Ui_IrcIdentitiesEditDialog import Ui_IrcIdentitiesEditDialog
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 from .IrcNetworkManager import IrcIdentity
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 import Utilities
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 import UI.PixmapCache
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 class IrcIdentitiesEditDialog(QDialog, Ui_IrcIdentitiesEditDialog):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 Class implementing the identities management dialog.
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 def __init__(self, manager, identityName, parent=None):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 Constructor
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
34 @param manager reference to the IRC network manager object
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
35 (IrcNetworkManager)
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 @param identityName name of the identity to be selected (string)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 @param parent reference to the parent widget (QWidget)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
39 super(IrcIdentitiesEditDialog, self).__init__(parent)
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 self.setupUi(self)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.addButton.setIcon(UI.PixmapCache.getIcon("plus.png"))
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 self.copyButton.setIcon(UI.PixmapCache.getIcon("editCopy.png"))
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 self.renameButton.setIcon(UI.PixmapCache.getIcon("editRename.png"))
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 self.deleteButton.setIcon(UI.PixmapCache.getIcon("minus.png"))
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 self.nicknameAddButton.setIcon(UI.PixmapCache.getIcon("plus.png"))
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 self.nicknameDeleteButton.setIcon(UI.PixmapCache.getIcon("minus.png"))
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 self.nicknameUpButton.setIcon(UI.PixmapCache.getIcon("1uparrow.png"))
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
49 self.nicknameDownButton.setIcon(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
50 UI.PixmapCache.getIcon("1downarrow.png"))
6471
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
51 self.showPasswordButton.setIcon(
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
52 UI.PixmapCache.getIcon("showPassword.png"))
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 self.__manager = manager
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 self.__identities = self.__manager.getIdentities()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 self.__currentIdentity = None
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 identities = list(sorted(self.__manager.getIdentityNames()))
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
60 identities[identities.index(IrcIdentity.DefaultIdentityName)] = (
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 IrcIdentity.DefaultIdentityDisplay
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
62 )
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 self.identitiesCombo.addItems(identities)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 if identityName == IrcIdentity.DefaultIdentityName:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 identityName = IrcIdentity.DefaultIdentityDisplay
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 index = self.identitiesCombo.findText(identityName)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 if index == -1:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 index = 0
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 identityName = self.identitiesCombo.itemText(0)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 self.identitiesCombo.setCurrentIndex(index)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 self.on_identitiesCombo_currentIndexChanged(identityName)
2240
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
73
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
74 self.nicknameEdit.installEventFilter(self)
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
75
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
76 def eventFilter(self, obj, evt):
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
77 """
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
78 Public method to handle events for other objects.
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
79
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
80 @param obj reference to the object (QObject)
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
81 @param evt reference to the event (QEvent)
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
82 @return flag indicating that the event should be filtered out (boolean)
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
83 """
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
84 if obj == self.nicknameEdit and evt.type() == QEvent.KeyPress:
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
85 if evt.key() in [Qt.Key_Enter, Qt.Key_Return]:
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
86 self.on_nicknameAddButton_clicked()
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
87 return True
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
88
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
89 return super(IrcIdentitiesEditDialog, self).eventFilter(obj, evt)
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 def __updateIdentitiesButtons(self):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 Private slot to update the status of the identity related buttons.
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 """
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
95 enable = (self.identitiesCombo.currentText() !=
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
96 IrcIdentity.DefaultIdentityDisplay)
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 self.renameButton.setEnabled(enable)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 self.deleteButton.setEnabled(enable)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 @pyqtSlot(str)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 def on_identitiesCombo_currentIndexChanged(self, identity):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 Private slot to handle the selection of an identity.
2960
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
104
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
105 @param identity selected identity (string)
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 if identity == IrcIdentity.DefaultIdentityDisplay:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 identity = IrcIdentity.DefaultIdentityName
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 self.__updateIdentitiesButtons()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 if self.__currentIdentity and not self.__checkCurrentIdentity():
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 return
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 self.__refreshCurrentIdentity()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 self.__currentIdentity = self.__identities[identity]
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117
2243
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
118 # General Tab
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 self.realnameEdit.setText(self.__currentIdentity.getRealName())
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 self.nicknamesList.clear()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 self.nicknamesList.addItems(self.__currentIdentity.getNickNames())
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 self.serviceEdit.setText(self.__currentIdentity.getServiceName())
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 self.passwordEdit.setText(self.__currentIdentity.getPassword())
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124
2243
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
125 # Away Tab
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
126 self.rememberPosOnAwayCheckBox.setChecked(
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
127 self.__currentIdentity.rememberAwayPosition())
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
128 self.awayEdit.setText(self.__currentIdentity.getAwayMessage())
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
129
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
130 # Advanced Tab
2240
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
131 self.identEdit.setText(self.__currentIdentity.getIdent())
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
132 self.quitEdit.setText(self.__currentIdentity.getQuitMessage())
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
133 self.partEdit.setText(self.__currentIdentity.getPartMessage())
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
134
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 self.__updateIdentitiesButtons()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 self.__updateNicknameUpDownButtons()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 self.__updateNicknameButtons()
2240
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
138
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
139 self.identityTabWidget.setCurrentIndex(0)
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 def __refreshCurrentIdentity(self):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 Private method to read back the data for the current identity.
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 if self.__currentIdentity is None:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 return
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147
2243
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
148 # General Tab
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 self.__currentIdentity.setRealName(self.realnameEdit.text())
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
150 self.__currentIdentity.setNickNames(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
151 [self.nicknamesList.item(row).text()
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
152 for row in range(self.nicknamesList.count())])
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 self.__currentIdentity.setServiceName(self.serviceEdit.text())
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 self.__currentIdentity.setPassword(self.passwordEdit.text())
2240
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
155
2243
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
156 # Away Tab
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
157 self.__currentIdentity.setRememberAwayPosition(
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
158 self.rememberPosOnAwayCheckBox.isChecked())
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
159 self.__currentIdentity.setAwayMessage(self.awayEdit.text())
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
160
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
161 # Advanced Tab
2240
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
162 self.__currentIdentity.setIdent(self.identEdit.text())
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
163 self.__currentIdentity.setQuitMessage(self.quitEdit.text())
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
164 self.__currentIdentity.setPartMessage(self.partEdit.text())
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 def __checkCurrentIdentity(self):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 Private method to check the data for the current identity.
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 @return flag indicating a successful check (boolean)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 if self.nicknamesList.count() == 0:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
173 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
174 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
175 self.tr("Edit Identity"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
176 self.tr(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
177 """The identity must contain at least one nick name."""))
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 block = self.identitiesCombo.blockSignals(True)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 identity = self.__currentIdentity.getName()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 if identity == IrcIdentity.DefaultIdentityName:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 identity = IrcIdentity.DefaultIdentityDisplay
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
182 self.identitiesCombo.setCurrentIndex(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
183 self.identitiesCombo.findText(identity))
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 self.identitiesCombo.blockSignals(block)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 self.identityTabWidget.setCurrentIndex(0)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 self.nicknameEdit.setFocus()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 return False
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 if not self.realnameEdit.text():
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
190 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
191 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
192 self.tr("Edit Identity"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
193 self.tr("""The identity must have a real name."""))
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 block = self.identitiesCombo.blockSignals(True)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 identity = self.__currentIdentity.getName()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 if identity == IrcIdentity.DefaultIdentityName:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197 identity = IrcIdentity.DefaultIdentityDisplay
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
198 self.identitiesCombo.setCurrentIndex(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
199 self.identitiesCombo.findText(identity))
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 self.identitiesCombo.blockSignals(block)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 self.identityTabWidget.setCurrentIndex(0)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 self.realnameEdit.setFocus()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 return False
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 return True
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 @pyqtSlot()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 def on_addButton_clicked(self):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 Private slot to add a new idntity.
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 name, ok = QInputDialog.getText(
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
214 self.tr("Add Identity"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
215 self.tr("Identity Name:"),
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 QLineEdit.Normal)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 if ok:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219 if name:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 if name in self.__identities:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
221 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
222 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
223 self.tr("Add Identity"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
224 self.tr(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
225 """An identity named <b>{0}</b> already exists."""
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
226 """ You must provide a different name.""").format(
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 name))
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228 self.on_addButton_clicked()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229 else:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230 identity = IrcIdentity(name)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231 identity.setIdent(Utilities.getUserName())
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232 identity.setRealName(Utilities.getRealName())
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233 self.__identities[name] = identity
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 self.identitiesCombo.addItem(name)
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
235 self.identitiesCombo.setCurrentIndex(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
236 self.identitiesCombo.count() - 1)
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
238 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
239 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
240 self.tr("Add Identity"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
241 self.tr("""The identity has to have a name."""))
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 self.on_addButton_clicked()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 @pyqtSlot()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245 def on_copyButton_clicked(self):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 Private slot to copy the selected identity.
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 currentIdentity = self.identitiesCombo.currentText()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 name, ok = QInputDialog.getText(
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
252 self.tr("Copy Identity"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
253 self.tr("Identity Name:"),
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 QLineEdit.Normal,
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255 currentIdentity)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 if ok:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 if name:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 if name in self.__identities:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
260 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
261 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
262 self.tr("Copy Identity"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
263 self.tr(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
264 """An identity named <b>{0}</b> already exists."""
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
265 """ You must provide a different name.""").format(
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266 name))
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 self.on_copyButton_clicked()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 else:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 identity = copy.deepcopy(self.__currentIdentity)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 identity.setName(name)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 self.__identities[name] = identity
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272 self.identitiesCombo.addItem(name)
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
273 self.identitiesCombo.setCurrentIndex(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
274 self.identitiesCombo.count() - 1)
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
276 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
277 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
278 self.tr("Copy Identity"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
279 self.tr("""The identity has to have a name."""))
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 self.on_copyButton_clicked()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 @pyqtSlot()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 def on_renameButton_clicked(self):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 Private slot to rename the selected identity.
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 currentIdentity = self.identitiesCombo.currentText()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 name, ok = QInputDialog.getText(
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
290 self.tr("Rename Identity"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
291 self.tr("Identity Name:"),
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 QLineEdit.Normal,
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 currentIdentity)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 if ok and name != currentIdentity:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 if name:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 if name in self.__identities:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
298 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
299 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
300 self.tr("Rename Identity"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
301 self.tr(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
302 """An identity named <b>{0}</b> already exists."""
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
303 """ You must provide a different name.""").format(
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304 name))
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305 self.on_renameButton_clicked()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 else:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 del self.__identities[currentIdentity]
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 self.__currentIdentity.setName(name)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309 self.__identities[name] = self.__currentIdentity
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 self.identitiesCombo.setItemText(
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311 self.identitiesCombo.currentIndex(), name)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
313 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
314 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
315 self.tr("Copy Identity"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
316 self.tr("""The identity has to have a name."""))
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317 self.on_renameButton_clicked()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 @pyqtSlot()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 def on_deleteButton_clicked(self):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322 Private slot to rename the selected identity.
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324 currentIdentity = self.identitiesCombo.currentText()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325 if currentIdentity == IrcIdentity.DefaultIdentityDisplay:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 return
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328 inUse = False
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329 for networkName in self.__manager.getNetworkNames():
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 inUse = (
2280
8e85ca3fabe7 Fixed a few PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
331 self.__manager.getNetwork(networkName).getIdentityName() ==
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
332 currentIdentity)
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333 if inUse:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334 break
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 if inUse:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
337 msg = self.tr(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
338 """This identity is in use. If you remove it, the network"""
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
339 """ settings using it will fall back to the default"""
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
340 """ identity. Should it be deleted anyway?""")
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
342 msg = self.tr(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
343 """Do you really want to delete all information for"""
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
344 """ this identity?""")
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
345 res = E5MessageBox.yesNo(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
346 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
347 self.tr("Delete Identity"),
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348 msg,
2280
8e85ca3fabe7 Fixed a few PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
349 icon=E5MessageBox.Warning)
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
350 if res:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
351 del self.__identities[currentIdentity]
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
352 self.identitiesCombo.removeItem(
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 self.identitiesCombo.findText(currentIdentity))
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
354
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
355 def __updateNicknameUpDownButtons(self):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356 """
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
357 Private method to set the enabled state of the nick name up and
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
358 down buttons.
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
360 if len(self.nicknamesList.selectedItems()) == 0:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361 self.nicknameUpButton.setEnabled(False)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
362 self.nicknameDownButton.setEnabled(False)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
363 else:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
364 if self.nicknamesList.currentRow() == 0:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
365 self.nicknameUpButton.setEnabled(False)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
366 self.nicknameDownButton.setEnabled(True)
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
367 elif (
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
368 self.nicknamesList.currentRow() ==
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
369 self.nicknamesList.count() - 1
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
370 ):
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
371 self.nicknameUpButton.setEnabled(True)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372 self.nicknameDownButton.setEnabled(False)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373 else:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374 self.nicknameUpButton.setEnabled(True)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 self.nicknameDownButton.setEnabled(True)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377 def __updateNicknameButtons(self):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 """
2960
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
379 Private slot to update the nick name buttons except the up and
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
380 down buttons.
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 self.nicknameDeleteButton.setEnabled(
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383 len(self.nicknamesList.selectedItems()) != 0)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385 self.nicknameAddButton.setEnabled(self.nicknameEdit.text() != "")
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387 @pyqtSlot(str)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
388 def on_nicknameEdit_textEdited(self, nick):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
389 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390 Private slot handling a change of the nick name.
2960
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
391
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
392 @param nick new nick name (string)
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 """
2240
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
394 sel = self.nicknamesList.selectedItems()
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
395 if sel:
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
396 sel[0].setText(nick)
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
397
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
398 self.__updateNicknameButtons()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 @pyqtSlot()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401 def on_nicknamesList_itemSelectionChanged(self):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
403 Private slot handling the selection of a nick name.
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
404 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405 items = self.nicknamesList.selectedItems()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406 if items:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407 self.nicknameEdit.setText(items[0].text())
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
408
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409 self.__updateNicknameUpDownButtons()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410 self.__updateNicknameButtons()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
411
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 self.nicknameEdit.setFocus()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414 @pyqtSlot()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415 def on_nicknameAddButton_clicked(self):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417 Private slot to add a new nickname.
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419 nick = self.nicknameEdit.text()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 if nick not in [self.nicknamesList.item(row).text()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
421 for row in range(self.nicknamesList.count())]:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
422 self.nicknamesList.insertItem(0, nick)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
423 self.nicknamesList.setCurrentRow(0, QItemSelectionModel.Clear)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424 self.nicknameEdit.clear()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 self.__updateNicknameButtons()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
426
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
427 @pyqtSlot()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428 def on_nicknameDeleteButton_clicked(self):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
429 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430 Private slot to delete a nick name.
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
431 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
432 itm = self.nicknamesList.takeItem(self.nicknamesList.currentRow())
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
433 del itm
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
434 self.__updateNicknameButtons()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
435
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
436 @pyqtSlot()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
437 def on_nicknameUpButton_clicked(self):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
438 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
439 Private slot to move the selected entry up one row.
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
440 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441 row = self.nicknamesList.currentRow()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
442 if row > 0:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
443 itm = self.nicknamesList.takeItem(row)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
444 row -= 1
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
445 self.nicknamesList.insertItem(row, itm)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
446 self.nicknamesList.setCurrentItem(itm)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
447
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
448 @pyqtSlot()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
449 def on_nicknameDownButton_clicked(self):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
450 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
451 Private slot to move the selected entry down one row.
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
452 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
453 row = self.nicknamesList.currentRow()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
454 if row < self.nicknamesList.count() - 1:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
455 itm = self.nicknamesList.takeItem(row)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
456 row += 1
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
457 self.nicknamesList.insertItem(row, itm)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
458 self.nicknamesList.setCurrentItem(itm)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
459
6471
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
460 @pyqtSlot(bool)
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
461 def on_showPasswordButton_clicked(self, checked):
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
462 """
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
463 Private slot to show or hide the password.
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
464
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
465 @param checked state of the button
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
466 @type bool
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
467 """
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
468 if checked:
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
469 self.passwordEdit.setEchoMode(QLineEdit.Normal)
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
470 self.showPasswordButton.setIcon(
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
471 UI.PixmapCache.getIcon("hidePassword.png"))
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
472 self.showPasswordButton.setToolTip(
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
473 self.tr("Press to hide the password"))
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
474 else:
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
475 self.passwordEdit.setEchoMode(QLineEdit.Password)
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
476 self.showPasswordButton.setIcon(
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
477 UI.PixmapCache.getIcon("showPassword.png"))
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
478 self.showPasswordButton.setToolTip(
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
479 self.tr("Press to show the password"))
ecfcfc58385c IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
480
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
481 def accept(self):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
482 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
483 Public slot handling the acceptance of the dialog.
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
484 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
485 if not self.__checkCurrentIdentity():
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
486 return
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
487
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
488 self.__refreshCurrentIdentity()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
489 self.__manager.setIdentities(self.__identities)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
490
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
491 super(IrcIdentitiesEditDialog, self).accept()

eric ide

mercurial