eric6/Network/IRC/IrcIdentitiesEditDialog.py

Sat, 27 Feb 2021 12:08:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Feb 2021 12:08:23 +0100
changeset 8138
169e65a6787c
parent 7923
91e843545d9a
child 8143
2c730d5fd177
permissions
-rw-r--r--

Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

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

eric ide

mercurial