Sun, 18 Dec 2022 19:33:46 +0100
Refactored the Utilities and Globals modules in order to enhance the maintainability.
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 | |
8881
54e42bc2437a
Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8761
diff
changeset
|
3 | # Copyright (c) 2012 - 2022 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 | |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
12 | from PyQt6.QtCore import QEvent, QItemSelectionModel, Qt, pyqtSlot |
8318
962bce857696
Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8312
diff
changeset
|
13 | from PyQt6.QtWidgets import QDialog, QInputDialog, QLineEdit |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
14 | |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
15 | from eric7 import Utilities |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
16 | from eric7.EricGui import EricPixmapCache |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
17 | from eric7.EricWidgets import EricMessageBox |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
18 | from eric7.SystemUtilities import OSUtilities |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
19 | |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
20 | from .IrcNetworkManager import IrcIdentity |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
21 | from .Ui_IrcIdentitiesEditDialog import Ui_IrcIdentitiesEditDialog |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | |
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 | class IrcIdentitiesEditDialog(QDialog, Ui_IrcIdentitiesEditDialog): |
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 implementing the identities management dialog. |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
28 | |
2239
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 |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
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 | """ |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
38 | super().__init__(parent) |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
39 | self.setupUi(self) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
40 | |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
41 | self.addButton.setIcon(EricPixmapCache.getIcon("plus")) |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
42 | self.copyButton.setIcon(EricPixmapCache.getIcon("editCopy")) |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
43 | self.renameButton.setIcon(EricPixmapCache.getIcon("editRename")) |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
44 | self.deleteButton.setIcon(EricPixmapCache.getIcon("minus")) |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
45 | self.nicknameAddButton.setIcon(EricPixmapCache.getIcon("plus")) |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
46 | self.nicknameDeleteButton.setIcon(EricPixmapCache.getIcon("minus")) |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
47 | self.nicknameUpButton.setIcon(EricPixmapCache.getIcon("1uparrow")) |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
48 | self.nicknameDownButton.setIcon(EricPixmapCache.getIcon("1downarrow")) |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
49 | self.showPasswordButton.setIcon(EricPixmapCache.getIcon("showPassword")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
50 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | self.__manager = manager |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
52 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
53 | self.__identities = self.__manager.getIdentities() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
54 | self.__currentIdentity = None |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
55 | |
8761
f05818ae6431
Corrected some code style issues detected by the enhanced comprehensions check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
56 | identities = sorted(self.__manager.getIdentityNames()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
57 | identities[ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
58 | identities.index(IrcIdentity.DefaultIdentityName) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
59 | ] = IrcIdentity.DefaultIdentityDisplay |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
60 | self.identitiesCombo.addItems(identities) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
61 | if identityName == IrcIdentity.DefaultIdentityName: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
62 | identityName = IrcIdentity.DefaultIdentityDisplay |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
63 | index = self.identitiesCombo.findText(identityName) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
64 | if index == -1: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
65 | index = 0 |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
66 | identityName = self.identitiesCombo.itemText(0) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
67 | self.identitiesCombo.setCurrentIndex(index) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
68 | |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
69 | self.on_identitiesCombo_currentIndexChanged(index) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
70 | |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
71 | self.nicknameEdit.installEventFilter(self) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
72 | |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
73 | def eventFilter(self, obj, evt): |
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 | Public method to handle events for other objects. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
76 | |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
77 | @param obj reference to the object (QObject) |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
78 | @param evt reference to the event (QEvent) |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
79 | @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
|
80 | """ |
8222
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
81 | if ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
82 | obj == self.nicknameEdit |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
83 | and evt.type() == QEvent.Type.KeyPress |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
84 | and evt.key() in [Qt.Key.Key_Enter, Qt.Key.Key_Return] |
8222
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
85 | ): |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
86 | self.on_nicknameAddButton_clicked() |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
87 | return True |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
88 | |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
89 | return super().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 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
95 | enable = ( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
96 | self.identitiesCombo.currentText() != IrcIdentity.DefaultIdentityDisplay |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
97 | ) |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
98 | self.renameButton.setEnabled(enable) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
99 | self.deleteButton.setEnabled(enable) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
100 | |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
101 | @pyqtSlot(int) |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
102 | def on_identitiesCombo_currentIndexChanged(self, index): |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
103 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
104 | Private slot to handle the selection of an identity. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
105 | |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
106 | @param index index of the selected entry |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
107 | @type int |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
108 | """ |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
109 | identity = self.identitiesCombo.itemText(index) |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
110 | if identity == IrcIdentity.DefaultIdentityDisplay: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
111 | identity = IrcIdentity.DefaultIdentityName |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
112 | self.__updateIdentitiesButtons() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
113 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
114 | if self.__currentIdentity and not self.__checkCurrentIdentity(): |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
115 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
116 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
117 | self.__refreshCurrentIdentity() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
118 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
119 | self.__currentIdentity = self.__identities[identity] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
120 | |
2243
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
121 | # General Tab |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
122 | self.realnameEdit.setText(self.__currentIdentity.getRealName()) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
123 | self.nicknamesList.clear() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
124 | self.nicknamesList.addItems(self.__currentIdentity.getNickNames()) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
125 | self.serviceEdit.setText(self.__currentIdentity.getServiceName()) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
126 | self.passwordEdit.setText(self.__currentIdentity.getPassword()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
127 | |
2243
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
128 | # Away Tab |
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
129 | self.rememberPosOnAwayCheckBox.setChecked( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
130 | self.__currentIdentity.rememberAwayPosition() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
131 | ) |
2243
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
132 | self.awayEdit.setText(self.__currentIdentity.getAwayMessage()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
133 | |
2243
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
134 | # Advanced Tab |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
135 | self.identEdit.setText(self.__currentIdentity.getIdent()) |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
136 | self.quitEdit.setText(self.__currentIdentity.getQuitMessage()) |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
137 | self.partEdit.setText(self.__currentIdentity.getPartMessage()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
138 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
139 | self.__updateIdentitiesButtons() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
140 | self.__updateNicknameUpDownButtons() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
141 | self.__updateNicknameButtons() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
142 | |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
143 | self.identityTabWidget.setCurrentIndex(0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
144 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
145 | def __refreshCurrentIdentity(self): |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
146 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
147 | 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
|
148 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
149 | if self.__currentIdentity is None: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
150 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
151 | |
2243
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
152 | # General Tab |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
153 | 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
|
154 | self.__currentIdentity.setNickNames( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
155 | [ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
156 | self.nicknamesList.item(row).text() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
157 | for row in range(self.nicknamesList.count()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
158 | ] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
159 | ) |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
160 | self.__currentIdentity.setServiceName(self.serviceEdit.text()) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
161 | self.__currentIdentity.setPassword(self.passwordEdit.text()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
162 | |
2243
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
163 | # Away Tab |
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
164 | self.__currentIdentity.setRememberAwayPosition( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
165 | self.rememberPosOnAwayCheckBox.isChecked() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
166 | ) |
2243
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
167 | self.__currentIdentity.setAwayMessage(self.awayEdit.text()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
168 | |
2243
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
169 | # Advanced Tab |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
170 | self.__currentIdentity.setIdent(self.identEdit.text()) |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
171 | self.__currentIdentity.setQuitMessage(self.quitEdit.text()) |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
172 | self.__currentIdentity.setPartMessage(self.partEdit.text()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
173 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
174 | def __checkCurrentIdentity(self): |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
175 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
176 | Private method to check the data for the current identity. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
177 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
178 | @return flag indicating a successful check (boolean) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
179 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
180 | if self.nicknamesList.count() == 0: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
181 | EricMessageBox.critical( |
3020
542e97d4ecb3
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2992
diff
changeset
|
182 | self, |
3190
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
183 | self.tr("Edit Identity"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
184 | self.tr("""The identity must contain at least one nick name."""), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
185 | ) |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
186 | block = self.identitiesCombo.blockSignals(True) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
187 | identity = self.__currentIdentity.getName() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
188 | if identity == IrcIdentity.DefaultIdentityName: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
189 | 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
|
190 | self.identitiesCombo.setCurrentIndex( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
191 | self.identitiesCombo.findText(identity) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
192 | ) |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
193 | self.identitiesCombo.blockSignals(block) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
194 | self.identityTabWidget.setCurrentIndex(0) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
195 | self.nicknameEdit.setFocus() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
196 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
197 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
198 | if not self.realnameEdit.text(): |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
199 | EricMessageBox.critical( |
3020
542e97d4ecb3
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2992
diff
changeset
|
200 | self, |
3190
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
201 | self.tr("Edit Identity"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
202 | self.tr("""The identity must have a real name."""), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
203 | ) |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
204 | block = self.identitiesCombo.blockSignals(True) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
205 | identity = self.__currentIdentity.getName() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
206 | if identity == IrcIdentity.DefaultIdentityName: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
207 | 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
|
208 | self.identitiesCombo.setCurrentIndex( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
209 | self.identitiesCombo.findText(identity) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
210 | ) |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
211 | self.identitiesCombo.blockSignals(block) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
212 | self.identityTabWidget.setCurrentIndex(0) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
213 | self.realnameEdit.setFocus() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
214 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
215 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
216 | return True |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
217 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
218 | @pyqtSlot() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
219 | def on_addButton_clicked(self): |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
220 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
221 | Private slot to add a new idntity. |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
222 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
223 | name, ok = QInputDialog.getText( |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
224 | self, |
3190
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
225 | 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
|
226 | self.tr("Identity Name:"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
227 | QLineEdit.EchoMode.Normal, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
228 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
229 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
230 | if ok: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
231 | if name: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
232 | if name in self.__identities: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
233 | EricMessageBox.critical( |
3020
542e97d4ecb3
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2992
diff
changeset
|
234 | self, |
3190
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
235 | 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
|
236 | self.tr( |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
237 | """An identity named <b>{0}</b> already exists.""" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
238 | """ You must provide a different name.""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
239 | ).format(name), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
240 | ) |
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 | else: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
243 | identity = IrcIdentity(name) |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
244 | identity.setIdent(OSUtilities.getUserName()) |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
245 | identity.setRealName(Utilities.getRealName()) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
246 | self.__identities[name] = identity |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
247 | 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
|
248 | self.identitiesCombo.setCurrentIndex( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
249 | self.identitiesCombo.count() - 1 |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
250 | ) |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
251 | else: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
252 | EricMessageBox.critical( |
3020
542e97d4ecb3
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2992
diff
changeset
|
253 | self, |
3190
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
254 | self.tr("Add Identity"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
255 | self.tr("""The identity has to have a name."""), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
256 | ) |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
257 | self.on_addButton_clicked() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
258 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
259 | @pyqtSlot() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
260 | def on_copyButton_clicked(self): |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
261 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
262 | Private slot to copy the selected identity. |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
263 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
264 | currentIdentity = self.identitiesCombo.currentText() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
265 | name, ok = QInputDialog.getText( |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
266 | self, |
3190
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
267 | 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
|
268 | self.tr("Identity Name:"), |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
269 | QLineEdit.EchoMode.Normal, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
270 | currentIdentity, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
271 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
272 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
273 | if ok: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
274 | if name: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
275 | if name in self.__identities: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
276 | EricMessageBox.critical( |
3020
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( |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
280 | """An identity named <b>{0}</b> already exists.""" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
281 | """ You must provide a different name.""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
282 | ).format(name), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
283 | ) |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
284 | self.on_copyButton_clicked() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
285 | else: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
286 | identity = copy.deepcopy(self.__currentIdentity) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
287 | identity.setName(name) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
288 | self.__identities[name] = identity |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
289 | 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
|
290 | self.identitiesCombo.setCurrentIndex( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
291 | self.identitiesCombo.count() - 1 |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
292 | ) |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
293 | else: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
294 | EricMessageBox.critical( |
3020
542e97d4ecb3
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2992
diff
changeset
|
295 | self, |
3190
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
296 | self.tr("Copy Identity"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
297 | self.tr("""The identity has to have a name."""), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
298 | ) |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
299 | self.on_copyButton_clicked() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
300 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
301 | @pyqtSlot() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
302 | def on_renameButton_clicked(self): |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
303 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
304 | Private slot to rename the selected identity. |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
305 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
306 | currentIdentity = self.identitiesCombo.currentText() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
307 | name, ok = QInputDialog.getText( |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
308 | self, |
3190
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
309 | 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
|
310 | self.tr("Identity Name:"), |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
311 | QLineEdit.EchoMode.Normal, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
312 | currentIdentity, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
313 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
314 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
315 | if ok and name != currentIdentity: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
316 | if name: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
317 | if name in self.__identities: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
318 | EricMessageBox.critical( |
3020
542e97d4ecb3
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2992
diff
changeset
|
319 | self, |
3190
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
320 | 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
|
321 | self.tr( |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
322 | """An identity named <b>{0}</b> already exists.""" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
323 | """ You must provide a different name.""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
324 | ).format(name), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
325 | ) |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
326 | self.on_renameButton_clicked() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
327 | else: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
328 | del self.__identities[currentIdentity] |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
329 | self.__currentIdentity.setName(name) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
330 | self.__identities[name] = self.__currentIdentity |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
331 | self.identitiesCombo.setItemText( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
332 | self.identitiesCombo.currentIndex(), name |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
333 | ) |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
334 | else: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
335 | EricMessageBox.critical( |
3020
542e97d4ecb3
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2992
diff
changeset
|
336 | self, |
3190
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
337 | self.tr("Copy Identity"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
338 | self.tr("""The identity has to have a name."""), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
339 | ) |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
340 | self.on_renameButton_clicked() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
341 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
342 | @pyqtSlot() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
343 | def on_deleteButton_clicked(self): |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
344 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
345 | Private slot to rename the selected identity. |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
346 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
347 | currentIdentity = self.identitiesCombo.currentText() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
348 | if currentIdentity == IrcIdentity.DefaultIdentityDisplay: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
349 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
350 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
351 | inUse = False |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
352 | for networkName in self.__manager.getNetworkNames(): |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
353 | inUse = ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
354 | self.__manager.getNetwork(networkName).getIdentityName() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
355 | == currentIdentity |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
356 | ) |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
357 | if inUse: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
358 | break |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
359 | |
8259
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8222
diff
changeset
|
360 | msg = ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
361 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
362 | "This identity is in use. If you remove it, the network" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
363 | " settings using it will fall back to the default" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
364 | " identity. Should it be deleted anyway?" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
365 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
366 | if inUse |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
367 | else self.tr( |
9576
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
368 | "Do you really want to delete all information for this identity?" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
369 | ) |
8259
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8222
diff
changeset
|
370 | ) |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
371 | res = EricMessageBox.yesNo( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
372 | self, self.tr("Delete Identity"), msg, icon=EricMessageBox.Warning |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
373 | ) |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
374 | if res: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
375 | del self.__identities[currentIdentity] |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
376 | self.identitiesCombo.removeItem( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
377 | self.identitiesCombo.findText(currentIdentity) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
378 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
379 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
380 | def __updateNicknameUpDownButtons(self): |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
381 | """ |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
382 | 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
|
383 | down buttons. |
2239
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 | if len(self.nicknamesList.selectedItems()) == 0: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
386 | self.nicknameUpButton.setEnabled(False) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
387 | self.nicknameDownButton.setEnabled(False) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
388 | else: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
389 | if self.nicknamesList.currentRow() == 0: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
390 | self.nicknameUpButton.setEnabled(False) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
391 | self.nicknameDownButton.setEnabled(True) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
392 | elif self.nicknamesList.currentRow() == self.nicknamesList.count() - 1: |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
393 | self.nicknameUpButton.setEnabled(True) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
394 | self.nicknameDownButton.setEnabled(False) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
395 | else: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
396 | self.nicknameUpButton.setEnabled(True) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
397 | self.nicknameDownButton.setEnabled(True) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
398 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
399 | def __updateNicknameButtons(self): |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
400 | """ |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
401 | 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
|
402 | down buttons. |
2239
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 | self.nicknameDeleteButton.setEnabled( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
405 | len(self.nicknamesList.selectedItems()) != 0 |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
406 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
407 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
408 | self.nicknameAddButton.setEnabled(self.nicknameEdit.text() != "") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
409 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
410 | @pyqtSlot(str) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
411 | def on_nicknameEdit_textEdited(self, nick): |
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 | Private slot handling a change of the nick name. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
414 | |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
415 | @param nick new nick name (string) |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
416 | """ |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
417 | sel = self.nicknamesList.selectedItems() |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
418 | if sel: |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
419 | sel[0].setText(nick) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
420 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
421 | self.__updateNicknameButtons() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
422 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
423 | @pyqtSlot() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
424 | def on_nicknamesList_itemSelectionChanged(self): |
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 | Private slot handling the selection of a nick name. |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
427 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
428 | items = self.nicknamesList.selectedItems() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
429 | if items: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
430 | self.nicknameEdit.setText(items[0].text()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
431 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
432 | self.__updateNicknameUpDownButtons() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
433 | self.__updateNicknameButtons() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
434 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
435 | self.nicknameEdit.setFocus() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
436 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
437 | @pyqtSlot() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
438 | def on_nicknameAddButton_clicked(self): |
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 | Private slot to add a new nickname. |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
441 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
442 | nick = self.nicknameEdit.text() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
443 | if nick not in [ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
444 | self.nicknamesList.item(row).text() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
445 | for row in range(self.nicknamesList.count()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
446 | ]: |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
447 | self.nicknamesList.insertItem(0, nick) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
448 | self.nicknamesList.setCurrentRow(0, QItemSelectionModel.SelectionFlag.Clear) |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
449 | self.nicknameEdit.clear() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
450 | self.__updateNicknameButtons() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
451 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
452 | @pyqtSlot() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
453 | def on_nicknameDeleteButton_clicked(self): |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
454 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
455 | Private slot to delete a nick name. |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
456 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
457 | itm = self.nicknamesList.takeItem(self.nicknamesList.currentRow()) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
458 | del itm |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
459 | self.__updateNicknameButtons() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
460 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
461 | @pyqtSlot() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
462 | def on_nicknameUpButton_clicked(self): |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
463 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
464 | 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
|
465 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
466 | row = self.nicknamesList.currentRow() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
467 | if row > 0: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
468 | itm = self.nicknamesList.takeItem(row) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
469 | row -= 1 |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
470 | self.nicknamesList.insertItem(row, itm) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
471 | self.nicknamesList.setCurrentItem(itm) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
472 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
473 | @pyqtSlot() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
474 | def on_nicknameDownButton_clicked(self): |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
475 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
476 | 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
|
477 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
478 | row = self.nicknamesList.currentRow() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
479 | if row < self.nicknamesList.count() - 1: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
480 | itm = self.nicknamesList.takeItem(row) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
481 | row += 1 |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
482 | self.nicknamesList.insertItem(row, itm) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
483 | self.nicknamesList.setCurrentItem(itm) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
484 | |
6471
ecfcfc58385c
IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
485 | @pyqtSlot(bool) |
ecfcfc58385c
IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
486 | 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
|
487 | """ |
ecfcfc58385c
IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
488 | Private slot to show or hide the password. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
489 | |
6471
ecfcfc58385c
IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
490 | @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
|
491 | @type bool |
ecfcfc58385c
IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
492 | """ |
ecfcfc58385c
IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
493 | if checked: |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
494 | self.passwordEdit.setEchoMode(QLineEdit.EchoMode.Normal) |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
495 | self.showPasswordButton.setIcon(EricPixmapCache.getIcon("hidePassword")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
496 | self.showPasswordButton.setToolTip(self.tr("Press to hide the password")) |
6471
ecfcfc58385c
IrcIdentitiesEditDialog: added a button to show the password as clear text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
497 | else: |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
498 | self.passwordEdit.setEchoMode(QLineEdit.EchoMode.Password) |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
499 | self.showPasswordButton.setIcon(EricPixmapCache.getIcon("showPassword")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
500 | self.showPasswordButton.setToolTip(self.tr("Press to show the password")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
501 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
502 | def accept(self): |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
503 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
504 | Public slot handling the acceptance of the dialog. |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
505 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
506 | if not self.__checkCurrentIdentity(): |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
507 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
508 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
509 | self.__refreshCurrentIdentity() |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
510 | self.__manager.setIdentities(self.__identities) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
511 | |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
512 | super().accept() |