Sun, 30 Jun 2024 17:58:31 +0200
Moved some functions to the EricUtilities package for consistency and adapted the code base accordingly.
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
10439
21c28b0f9e41
Updated copyright for 2024.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10428
diff
changeset
|
3 | # Copyright (c) 2012 - 2024 Detlev Offenbach <detlev@die-offenbachs.de> |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing the IRC data structures and their manager. |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
10 | import copy |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
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 QCoreApplication, QObject, pyqtSignal |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | |
10806
2f6df822e3b9
Moved some functions to the EricUtilities package for consistency and adapted the code base accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
14 | from eric7 import EricUtilities, Preferences |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
15 | from eric7.SystemUtilities import OSUtilities |
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
|
16 | from eric7.Utilities.AutoSaver import AutoSaver |
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
|
17 | from eric7.Utilities.crypto import pwConvert |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | |
8207
d359172d11be
Applied some more code simplifications suggested by the new Simplify checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7960
diff
changeset
|
20 | class IrcIdentity: |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
21 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | Class implementing the IRC identity object. |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
23 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
24 | |
2231
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
25 | DefaultIdentityName = "0default" |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
26 | DefaultIdentityDisplay = QCoreApplication.translate( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
27 | "IrcIdentity", "Default Identity" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
28 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
29 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
30 | DefaultAwayMessage = QCoreApplication.translate("IrcIdentity", "Gone away for now.") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
31 | DefaultQuitMessage = QCoreApplication.translate("IrcIdentity", "IRC for eric IDE") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
32 | DefaultPartMessage = QCoreApplication.translate("IrcIdentity", "IRC for eric IDE") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
33 | |
2235
266800cbe7cc
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
34 | def __init__(self, name): |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | Constructor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
37 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
38 | @param name name of the identity |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
39 | @type str |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | """ |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8207
diff
changeset
|
41 | super().__init__() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
42 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
43 | self.__name = name |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
44 | self.__realName = "" |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
45 | self.__nickNames = [] |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
46 | self.__serviceName = "" |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
47 | self.__password = "" |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
48 | self.__ident = OSUtilities.getUserName() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
49 | |
2243
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
50 | self.__rememberPosOnAway = True |
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
51 | self.__awayMessage = IrcIdentity.DefaultAwayMessage |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
52 | |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
53 | self.__quitMessage = IrcIdentity.DefaultQuitMessage |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
54 | self.__partMessage = IrcIdentity.DefaultPartMessage |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
55 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
56 | def save(self, settings): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
57 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
58 | Public method to save the identity data. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
59 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
60 | @param settings reference to the settings object |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
61 | @type QSettings |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
62 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
63 | # no need to save the name because that is the group key |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
64 | settings.setValue("Ident", self.__ident) |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
65 | settings.setValue("RealName", self.__realName) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
66 | settings.setValue("NickNames", self.__nickNames) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
67 | settings.setValue("ServiceName", self.__serviceName) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
68 | settings.setValue("Password", self.__password) |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
69 | settings.setValue("QuitMessage", self.__quitMessage) |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
70 | settings.setValue("PartMessage", self.__partMessage) |
2243
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
71 | settings.setValue("RememberAwayPosition", self.__rememberPosOnAway) |
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
72 | settings.setValue("AwayMessage", self.__awayMessage) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
73 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
74 | def load(self, settings): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
75 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
76 | Public method to load the identity data. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
77 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
78 | @param settings reference to the settings object |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
79 | @type QSettings |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
80 | """ |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
81 | self.__ident = settings.value("Ident", OSUtilities.getUserName()) |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
82 | self.__realName = settings.value("RealName", "") |
10806
2f6df822e3b9
Moved some functions to the EricUtilities package for consistency and adapted the code base accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
83 | self.__nickNames = EricUtilities.toList(settings.value("NickNames", [])) |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
84 | self.__serviceName = settings.value("ServiceName", "") |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | self.__password = settings.value("Password", "") |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
86 | self.__quitMessage = settings.value( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
87 | "QuitMessage", IrcIdentity.DefaultQuitMessage |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
88 | ) |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
89 | self.__partMessage = settings.value( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
90 | "PartMessage", IrcIdentity.DefaultPartMessage |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
91 | ) |
10806
2f6df822e3b9
Moved some functions to the EricUtilities package for consistency and adapted the code base accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
92 | self.__rememberPosOnAway = EricUtilities.toBool( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
93 | settings.value("RememberAwayPosition", True) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
94 | ) |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
95 | self.__awayMessage = settings.value( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
96 | "AwayMessage", IrcIdentity.DefaultAwayMessage |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
97 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
98 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
99 | def setName(self, name): |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
100 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
101 | Public method to set the identity name. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
102 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
103 | @param name identity name |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
104 | @type str |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
105 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
106 | self.__name = name |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
107 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
108 | def getName(self): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
109 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
110 | Public method to get the identity name. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
111 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
112 | @return identity name |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
113 | @rtype str |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
114 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
115 | return self.__name |
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:
2238
diff
changeset
|
117 | def setIdent(self, name): |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
118 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
119 | Public method to set the real identity name. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
120 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
121 | @param name real identity name |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
122 | @type str |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
123 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
124 | self.__ident = name |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
125 | |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
126 | def getIdent(self): |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
127 | """ |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
128 | Public method to get the real identity name. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
129 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
130 | @return real identity name |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
131 | @rtype str |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
132 | """ |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
133 | return self.__ident |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
134 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
135 | def setRealName(self, name): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
136 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
137 | Public method to set the real name of the identity. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
138 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
139 | @param name real name |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
140 | @type str |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
141 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
142 | self.__realName = name |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
143 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
144 | def getRealName(self): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
145 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
146 | Public method to get the real name. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
147 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
148 | @return real name |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
149 | @rtype str |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
150 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
151 | return self.__realName |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
152 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
153 | def setNickNames(self, names): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
154 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
155 | Public method to set the nick names of the identity. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
156 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
157 | @param names nick names |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
158 | @type list of str |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
159 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
160 | self.__nickNames = names[:] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
161 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
162 | def getNickNames(self): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
163 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
164 | Public method to get the nick names. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
165 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
166 | @return nick names |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
167 | @rtype list of str |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
168 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
169 | return self.__nickNames |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
170 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
171 | def setServiceName(self, name): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
172 | """ |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
173 | Public method to set the service name of the identity used for |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
174 | identification. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
175 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
176 | @param name service name |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
177 | @type str |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
178 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
179 | self.__serviceName = name |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
180 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
181 | def getServiceName(self): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
182 | """ |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
183 | Public method to get the service name of the identity used for |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
184 | identification. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
185 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
186 | @return service name |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
187 | @rtype str |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
188 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
189 | return self.__serviceName |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
190 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
191 | def setPassword(self, password): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
192 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
193 | Public method to set a new password. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
194 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
195 | @param password password to set |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
196 | @type str |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
197 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
198 | self.__password = pwConvert(password, encode=True) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
199 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
200 | def getPassword(self): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
201 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
202 | Public method to get the password. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
203 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
204 | @return password |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
205 | @rtype str |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
206 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
207 | return pwConvert(self.__password, encode=False) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
208 | |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
209 | def setQuitMessage(self, message): |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
210 | """ |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
211 | Public method to set the QUIT message. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
212 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
213 | @param message QUIT message |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
214 | @type str |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
215 | """ |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
216 | if message: |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
217 | self.__quitMessage = message |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
218 | else: |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
219 | self.__quitMessage = IrcIdentity.DefaultQuitMessage |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
220 | |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
221 | def getQuitMessage(self): |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
222 | """ |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
223 | Public method to get the QUIT message. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
224 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
225 | @return QUIT message |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
226 | @rtype str |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
227 | """ |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
228 | return self.__quitMessage |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
229 | |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
230 | def setPartMessage(self, message): |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
231 | """ |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
232 | Public method to set the PART message. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
233 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
234 | @param message PART message |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
235 | @type str |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
236 | """ |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
237 | if message: |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
238 | self.__partMessage = message |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
239 | else: |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
240 | self.__partMessage = IrcIdentity.DefaultPartMessage |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
241 | |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
242 | def getPartMessage(self): |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
243 | """ |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
244 | Public method to get the PART message. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
245 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
246 | @return PART message |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
247 | @rtype str |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
248 | """ |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2239
diff
changeset
|
249 | return self.__partMessage |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
250 | |
2243
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
251 | def setRememberAwayPosition(self, remember): |
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
252 | """ |
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
253 | Public method to set to remember the chat position upon AWAY. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
254 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
255 | @param remember flag indicating to remember the chat position |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
256 | @type bool |
2243
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
257 | """ |
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
258 | self.__rememberPosOnAway = remember |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
259 | |
2243
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
260 | def rememberAwayPosition(self): |
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
261 | """ |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
262 | Public method to get a flag indicating to remember the chat position |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
263 | upon AWAY. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
264 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
265 | @return flag indicating to remember the chat position |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
266 | @rtype bool |
2243
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
267 | """ |
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
268 | return self.__rememberPosOnAway |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
269 | |
2243
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
270 | def setAwayMessage(self, message): |
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
271 | """ |
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
272 | Public method to set the AWAY message. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
273 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
274 | @param message AWAY message |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
275 | @type str |
2243
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
276 | """ |
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
277 | if message: |
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
278 | self.__awayMessage = message |
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
279 | else: |
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
280 | self.__awayMessage = IrcIdentity.DefaultAwayMessage |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
281 | |
2243
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
282 | def getAwayMessage(self): |
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
283 | """ |
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
284 | Public method to get the AWAY message. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
285 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
286 | @return AWAY message |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
287 | @rtype str |
2243
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
288 | """ |
c0323a43d966
Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2241
diff
changeset
|
289 | return self.__awayMessage |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
290 | |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
291 | @classmethod |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
292 | def createDefaultIdentity(cls): |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
293 | """ |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
294 | Class method to create the default identity. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
295 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
296 | @return default identity |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
297 | @rtype IrcIdentity |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
298 | """ |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
299 | userName = OSUtilities.getUserName() |
9664
4ae1d1e277c2
Fixed a crash caused by a wrong/forgotten import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
300 | realName = OSUtilities.getRealName() |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
301 | if not realName: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
302 | realName = "eric IDE chat" |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
303 | identity = IrcIdentity(IrcIdentity.DefaultIdentityName) |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
304 | identity.setNickNames([userName, userName + "_", userName + "__"]) |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
305 | identity.setRealName(realName) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
306 | identity.setIdent(userName) |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
307 | return identity |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
308 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
309 | |
8207
d359172d11be
Applied some more code simplifications suggested by the new Simplify checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7960
diff
changeset
|
310 | class IrcServer: |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
311 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
312 | Class implementing the IRC identity object. |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
313 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
314 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
315 | DefaultPort = 6667 |
2241
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
316 | DefaultSslPort = 6697 |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
317 | |
2235
266800cbe7cc
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
318 | def __init__(self, name): |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
319 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
320 | Constructor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
321 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
322 | @param name name of the server |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
323 | @type str |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
324 | """ |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8207
diff
changeset
|
325 | super().__init__() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
326 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
327 | self.__server = name |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
328 | self.__port = IrcServer.DefaultPort |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
329 | self.__ssl = False |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
330 | self.__password = "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
331 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
332 | def save(self, settings): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
333 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
334 | Public method to save the server data. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
335 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
336 | @param settings reference to the settings object |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
337 | @type QSettings |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
338 | """ |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
339 | settings.setValue("Name", self.__server) |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
340 | settings.setValue("Port", self.__port) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
341 | settings.setValue("SSL", self.__ssl) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
342 | settings.setValue("Password", self.__password) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
343 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
344 | def load(self, settings): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
345 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
346 | Public method to load the server data. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
347 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
348 | @param settings reference to the settings object |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
349 | @type QSettings |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
350 | """ |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
351 | self.__server = settings.value("Name", "") |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
352 | self.__port = int(settings.value("Port", IrcServer.DefaultPort)) |
10806
2f6df822e3b9
Moved some functions to the EricUtilities package for consistency and adapted the code base accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
353 | self.__ssl = EricUtilities.toBool(settings.value("SSL", False)) |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
354 | self.__password = settings.value("Password", "") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
355 | |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
356 | def getName(self): |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
357 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
358 | Public method to get the server name. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
359 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
360 | @return server name |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
361 | @rtype str |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
362 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
363 | return self.__server |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
364 | |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
365 | def setName(self, name): |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
366 | """ |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
367 | Public method to set the server name. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
368 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
369 | @param name server name |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
370 | @type str |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
371 | """ |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
372 | self.__server = name |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
373 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
374 | def getPort(self): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
375 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
376 | Public method to get the server port number. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
377 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
378 | @return port number |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
379 | @rtype int |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
380 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
381 | return self.__port |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
382 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
383 | def setPort(self, port): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
384 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
385 | Public method to set the server port number. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
386 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
387 | @param port server port number |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
388 | @type int |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
389 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
390 | self.__port = port |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
391 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
392 | def useSSL(self): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
393 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
394 | Public method to check for SSL usage. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
395 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
396 | @return flag indicating SSL usage |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
397 | @rtype bool |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
398 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
399 | return self.__ssl |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
400 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
401 | def setUseSSL(self, on): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
402 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
403 | Public method to set the SSL usage. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
404 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
405 | @param on flag indicating SSL usage |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
406 | @type bool |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
407 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
408 | self.__ssl = on |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
409 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
410 | def setPassword(self, password): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
411 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
412 | Public method to set a new password. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
413 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
414 | @param password password to set |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
415 | @type str |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
416 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
417 | self.__password = pwConvert(password, encode=True) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
418 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
419 | def getPassword(self): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
420 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
421 | Public method to get the password. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
422 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
423 | @return password |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
424 | @rtype str |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
425 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
426 | return pwConvert(self.__password, encode=False) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
427 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
428 | |
8207
d359172d11be
Applied some more code simplifications suggested by the new Simplify checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7960
diff
changeset
|
429 | class IrcChannel: |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
430 | """ |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
431 | Class implementing the IRC channel object. |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
432 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
433 | |
2235
266800cbe7cc
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
434 | def __init__(self, name): |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
435 | """ |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
436 | Constructor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
437 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
438 | @param name name of the network |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
439 | @type str |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
440 | """ |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8207
diff
changeset
|
441 | super().__init__() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
442 | |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
443 | self.__name = name |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
444 | self.__key = "" |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
445 | self.__autoJoin = False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
446 | |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
447 | def save(self, settings): |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
448 | """ |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
449 | Public method to save the channel data. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
450 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
451 | @param settings reference to the settings object |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
452 | @type QSettings |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
453 | """ |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
454 | # no need to save the channel name because that is the group key |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
455 | settings.setValue("Key", self.__key) |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
456 | settings.setValue("AutoJoin", self.__autoJoin) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
457 | |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
458 | def load(self, settings): |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
459 | """ |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
460 | Public method to load the network data. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
461 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
462 | @param settings reference to the settings object |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
463 | @type QSettings |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
464 | """ |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
465 | self.__key = settings.value("Key", "") |
10806
2f6df822e3b9
Moved some functions to the EricUtilities package for consistency and adapted the code base accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
466 | self.__autoJoin = EricUtilities.toBool(settings.value("AutoJoin", False)) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
467 | |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
468 | def getName(self): |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
469 | """ |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
470 | Public method to get the channel name. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
471 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
472 | @return channel name |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
473 | @rtype str |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
474 | """ |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
475 | return self.__name |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
476 | |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
477 | def setKey(self, key): |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
478 | """ |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
479 | Public method to set a new channel key. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
480 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
481 | @param key channel key to set |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
482 | @type str |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
483 | """ |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
484 | self.__key = pwConvert(key, encode=True) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
485 | |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
486 | def getKey(self): |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
487 | """ |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
488 | Public method to get the channel key. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
489 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
490 | @return channel key |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
491 | @rtype str |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
492 | """ |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
493 | return pwConvert(self.__key, encode=False) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
494 | |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
495 | def autoJoin(self): |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
496 | """ |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
497 | Public method to check the auto join status. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
498 | |
2280
8e85ca3fabe7
Fixed a few PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2279
diff
changeset
|
499 | @return flag indicating if the channel should be |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
500 | joined automatically |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
501 | @rtype bool |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
502 | """ |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
503 | return self.__autoJoin |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
504 | |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
505 | def setAutoJoin(self, enable): |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
506 | """ |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
507 | Public method to set the auto join status of the channel. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
508 | |
2280
8e85ca3fabe7
Fixed a few PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2279
diff
changeset
|
509 | @param enable flag indicating if the channel should be |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
510 | joined automatically |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
511 | @type bool |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
512 | """ |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
513 | self.__autoJoin = enable |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
514 | |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
515 | |
8207
d359172d11be
Applied some more code simplifications suggested by the new Simplify checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7960
diff
changeset
|
516 | class IrcNetwork: |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
517 | """ |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
518 | Class implementing the IRC network object. |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
519 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
520 | |
2235
266800cbe7cc
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
521 | def __init__(self, name): |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
522 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
523 | Constructor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
524 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
525 | @param name name of the network |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
526 | @type str |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
527 | """ |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8207
diff
changeset
|
528 | super().__init__() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
529 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
530 | self.__name = name |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
531 | self.__identity = "" |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
532 | self.__server = None |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
533 | self.__channels = {} |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
534 | self.__autoConnect = False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
535 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
536 | def save(self, settings): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
537 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
538 | Public method to save the network data. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
539 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
540 | @param settings reference to the settings object |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
541 | @type QSettings |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
542 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
543 | # no need to save the network name because that is the group key |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
544 | settings.setValue("Identity", self.__identity) |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
545 | settings.setValue("AutoConnect", self.__autoConnect) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
546 | |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
547 | settings.beginGroup("Server") |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
548 | self.__server.save(settings) |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
549 | settings.endGroup() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
550 | |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
551 | settings.beginGroup("Channels") |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
552 | for key in self.__channels: |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
553 | settings.beginGroup(key) |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
554 | self.__channels[key].save(settings) |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
555 | settings.endGroup() |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
556 | settings.endGroup() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
557 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
558 | def load(self, settings): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
559 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
560 | Public method to load the network data. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
561 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
562 | @param settings reference to the settings object |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
563 | @type QSettings |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
564 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
565 | self.__identity = settings.value("Identity", "") |
10806
2f6df822e3b9
Moved some functions to the EricUtilities package for consistency and adapted the code base accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
566 | self.__autoConnect = EricUtilities.toBool(settings.value("AutoConnect", False)) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
567 | |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
568 | settings.beginGroup("Server") |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
569 | self.__server = IrcServer("") |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
570 | self.__server.load(settings) |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
571 | settings.endGroup() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
572 | |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
573 | settings.beginGroup("Channels") |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
574 | for key in settings.childGroups(): |
2235
266800cbe7cc
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
575 | self.__channels[key] = IrcChannel(key) |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
576 | settings.beginGroup(key) |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
577 | self.__channels[key].load(settings) |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
578 | settings.endGroup() |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
579 | settings.endGroup() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
580 | |
2238
9977d3081ab6
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
581 | def setName(self, name): |
9977d3081ab6
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
582 | """ |
9977d3081ab6
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
583 | Public method to set the network name. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
584 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
585 | @param name network name |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
586 | @type str |
2238
9977d3081ab6
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
587 | """ |
9977d3081ab6
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
588 | self.__name = name |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
589 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
590 | def getName(self): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
591 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
592 | Public method to get the network name. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
593 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
594 | @return network name |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
595 | @rtype str |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
596 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
597 | return self.__name |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
598 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
599 | def setIdentityName(self, name): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
600 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
601 | Public method to set the name of the identity. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
602 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
603 | @param name identity name |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
604 | @type str |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
605 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
606 | self.__identity = name |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
607 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
608 | def getIdentityName(self): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
609 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
610 | Public method to get the name of the identity. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
611 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
612 | @return identity name |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
613 | @rtype str |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
614 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
615 | return self.__identity |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
616 | |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
617 | def getServerName(self): |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
618 | """ |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
619 | Public method to get the server name. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
620 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
621 | @return server name |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
622 | @rtype str |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
623 | """ |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
624 | if self.__server: |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
625 | return self.__server.getName() |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
626 | else: |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
627 | return "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
628 | |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
629 | def getServer(self): |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
630 | """ |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
631 | Public method to get the server object. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
632 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
633 | @return reference to the server |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
634 | @rtype IrcServer |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
635 | """ |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
636 | return self.__server |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
637 | |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
638 | def setServer(self, server): |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
639 | """ |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
640 | Public method to set the server. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
641 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
642 | @param server server object to set |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
643 | @type IrcServer |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
644 | """ |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
645 | self.__server = server |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
646 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
647 | def setChannels(self, channels): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
648 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
649 | Public method to set the list of channels. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
650 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
651 | @param channels list of channels for the network |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
652 | @type list of IrcChannel |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
653 | """ |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
654 | self.__channels = {} |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
655 | for channel in channels: |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
656 | self.__channels[channel.getName()] = channel |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
657 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
658 | def getChannels(self): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
659 | """ |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
660 | Public method to get the channels. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
661 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
662 | @return list of channels for the network |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
663 | @rtype list of IrcChannel |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
664 | """ |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
665 | return list(copy.deepcopy(self.__channels).values()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
666 | |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
667 | def getChannelNames(self): |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
668 | """ |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
669 | Public method to get the list of channels. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
670 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
671 | @return list of channel names |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
672 | @rtype list of str |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
673 | """ |
10373
093dcebe5ecb
Corrected some uses of dict.keys(), dict.values() and dict.items().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9664
diff
changeset
|
674 | return sorted(self.__channels) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
675 | |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
676 | def getChannel(self, channelName): |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
677 | """ |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
678 | Public method to get a channel. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
679 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
680 | @param channelName name of the channel to retrieve |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
681 | @type str |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
682 | @return reference to the channel |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
683 | @rtype IrcChannel |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
684 | """ |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
685 | if channelName in self.__channels: |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
686 | return self.__channels[channelName] |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
687 | else: |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
688 | return None |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
689 | |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
690 | def setChannel(self, channel): |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
691 | """ |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
692 | Public method to set a channel. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
693 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
694 | @param channel channel object to set |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
695 | @type IrcChannel |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
696 | """ |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
697 | channelName = channel.getName() |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
698 | if channelName in self.__channels: |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
699 | self.__channels[channelName] = channel |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
700 | |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
701 | def addChannel(self, channel): |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
702 | """ |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
703 | Public method to add a channel. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
704 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
705 | @param channel channel object to add |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
706 | @type IrcChannel |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
707 | """ |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
708 | channelName = channel.getName() |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
709 | if channelName not in self.__channels: |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
710 | self.__channels[channelName] = channel |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
711 | |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
712 | def deleteChannel(self, channelName): |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
713 | """ |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
714 | Public method to delete the given channel. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
715 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
716 | @param channelName name of the channel to be deleted |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
717 | @type str |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
718 | """ |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
719 | if channelName in self.__channels: |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
720 | del self.__channels[channelName] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
721 | |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
722 | def setAutoConnect(self, enable): |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
723 | """ |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
724 | Public method to set the auto connect flag. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
725 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
726 | @param enable flag indicate to connect to the network at start-up |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
727 | @type bool |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
728 | """ |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
729 | self.__autoConnect = enable |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
730 | |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
731 | def autoConnect(self): |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
732 | """ |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
733 | Public method to check, if the network should be connected to at |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
734 | start-up. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
735 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
736 | @return flag indicating an auto connect |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
737 | @rtype bool |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
738 | """ |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
739 | return self.__autoConnect |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
740 | |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
741 | @classmethod |
2241
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
742 | def createDefaultNetwork(cls, ssl=False): |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
743 | """ |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
744 | Class method to create the default network. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
745 | |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
746 | @param ssl flag indicating to create a SSL network configuration |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
747 | @type bool |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
748 | @return default network object |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
749 | @rtype IrcNetwork |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
750 | """ |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
751 | # network |
8425
63cc81d35ddc
IRC: changed default from freenet to liber.chat.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
752 | networkName = "libera.chat (SSL)" if ssl else "libera.chat" |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
753 | network = IrcNetwork(networkName) |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
754 | network.setIdentityName(IrcIdentity.DefaultIdentityName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
755 | |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
756 | # server |
8425
63cc81d35ddc
IRC: changed default from freenet to liber.chat.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
757 | serverName = "irc.libera.chat" |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
758 | server = IrcServer(serverName) |
2241
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
759 | if ssl: |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
760 | server.setPort(IrcServer.DefaultSslPort) |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
761 | server.setUseSSL(True) |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
762 | else: |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
763 | server.setPort(IrcServer.DefaultPort) |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
764 | network.setServer(server) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
765 | |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
766 | # channel |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
767 | channel = IrcChannel("#eric-ide") |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
768 | channel.setAutoJoin(False) |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
769 | network.addChannel(channel) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
770 | |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
771 | # auto connect |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
772 | network.setAutoConnect(False) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
773 | |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
774 | return network |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
775 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
776 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
777 | class IrcNetworkManager(QObject): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
778 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
779 | Class implementing the IRC identity object. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
780 | |
2232
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2231
diff
changeset
|
781 | @signal dataChanged() emitted after some data has changed |
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2231
diff
changeset
|
782 | @signal networksChanged() emitted after a network object has changed |
2279
cbf90feec16f
Fixed a non-fatal issue in the IRC widget related to changing an identity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
783 | @signal identitiesChanged() emitted after an identity object has changed |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
784 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
785 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
786 | dataChanged = pyqtSignal() |
2232
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2231
diff
changeset
|
787 | networksChanged = pyqtSignal() |
2279
cbf90feec16f
Fixed a non-fatal issue in the IRC widget related to changing an identity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
788 | identitiesChanged = pyqtSignal() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
789 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
790 | def __init__(self, parent=None): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
791 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
792 | Constructor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
793 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
794 | @param parent reference to the parent object |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
795 | @type QObject |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
796 | """ |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8207
diff
changeset
|
797 | super().__init__(parent) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
798 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
799 | self.__loaded = False |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
800 | self.__saveTimer = AutoSaver(self, self.save) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
801 | |
8637
394377638256
Replaced the direct access to 'Preferences.Prefs.settings' with 'Preferences.getSettings()'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8425
diff
changeset
|
802 | self.__settings = Preferences.getSettings() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
803 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
804 | self.__networks = {} |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
805 | self.__identities = {} |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
806 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
807 | self.dataChanged.connect(self.__saveTimer.changeOccurred) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
808 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
809 | def close(self): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
810 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
811 | Public method to close the open search engines manager. |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
812 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
813 | self.__saveTimer.saveIfNeccessary() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
814 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
815 | def save(self): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
816 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
817 | Public slot to save the IRC data. |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
818 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
819 | if not self.__loaded: |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
820 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
821 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
822 | # save IRC data |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
823 | self.__settings.beginGroup("IRC") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
824 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
825 | # identities |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
826 | self.__settings.remove("Identities") |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
827 | self.__settings.beginGroup("Identities") |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
828 | for key in self.__identities: |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
829 | self.__settings.beginGroup(key) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
830 | self.__identities[key].save(self.__settings) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
831 | self.__settings.endGroup() |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
832 | self.__settings.endGroup() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
833 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
834 | # networks |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
835 | self.__settings.remove("Networks") |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
836 | self.__settings.beginGroup("Networks") |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
837 | for key in self.__networks: |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
838 | self.__settings.beginGroup(key) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
839 | self.__networks[key].save(self.__settings) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
840 | self.__settings.endGroup() |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
841 | self.__settings.endGroup() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
842 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
843 | self.__settings.endGroup() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
844 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
845 | def __load(self): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
846 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
847 | Private slot to load the IRC data. |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
848 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
849 | if self.__loaded: |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
850 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
851 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
852 | # load IRC data |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
853 | self.__settings.beginGroup("IRC") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
854 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
855 | # identities |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
856 | self.__settings.beginGroup("Identities") |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
857 | for key in self.__settings.childGroups(): |
2235
266800cbe7cc
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
858 | self.__identities[key] = IrcIdentity(key) |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
859 | self.__settings.beginGroup(key) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
860 | self.__identities[key].load(self.__settings) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
861 | self.__settings.endGroup() |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
862 | self.__settings.endGroup() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
863 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
864 | # networks |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
865 | self.__settings.beginGroup("Networks") |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
866 | for key in self.__settings.childGroups(): |
2235
266800cbe7cc
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
867 | self.__networks[key] = IrcNetwork(key) |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
868 | self.__settings.beginGroup(key) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
869 | self.__networks[key].load(self.__settings) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
870 | self.__settings.endGroup() |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
871 | self.__settings.endGroup() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
872 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
873 | self.__settings.endGroup() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
874 | |
7255
d595f6f9cbf8
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
875 | if not self.__identities or not self.__networks: |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
876 | # data structures got corrupted; load defaults |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
877 | self.__loadDefaults() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
878 | |
2231
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
879 | if IrcIdentity.DefaultIdentityName not in self.__identities: |
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
880 | self.__loadDefaults(identityOnly=True) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
881 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
882 | self.__loaded = True |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
883 | |
2231
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
884 | def __loadDefaults(self, identityOnly=False): |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
885 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
886 | Private method to load default values. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
887 | |
2231
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
888 | @param identityOnly flag indicating to just load the default |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
889 | identity |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
890 | @type bool |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
891 | """ |
2231
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
892 | if not identityOnly: |
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
893 | self.__networks = {} |
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
894 | self.__identities = {} |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
895 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
896 | # identity |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
897 | identity = IrcIdentity.createDefaultIdentity() |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
898 | self.__identities[identity.getName()] = identity |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
899 | |
2231
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
900 | if not identityOnly: |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
901 | network = IrcNetwork.createDefaultNetwork() |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
902 | self.__networks[network.getName()] = network |
2241
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
903 | network = IrcNetwork.createDefaultNetwork(True) |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
904 | self.__networks[network.getName()] = network |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
905 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
906 | self.dataChanged.emit() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
907 | |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
908 | ################################################################## |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
909 | ## Identity related methods below |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
910 | ################################################################## |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
911 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
912 | def getIdentity(self, name, create=False): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
913 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
914 | Public method to get an identity object. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
915 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
916 | @param name name of the identity to get |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
917 | @type str |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
918 | @param create flag indicating to create a new object, |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
919 | if none exists |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
920 | @type bool |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
921 | @return reference to the identity |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
922 | @rtype IrcIdentity |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
923 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
924 | if not name: |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
925 | return None |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
926 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
927 | if not self.__loaded: |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
928 | self.__load() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
929 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
930 | if name in self.__identities: |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
931 | return self.__identities[name] |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
932 | elif create: |
5588
6ba512d9f46a
Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
933 | ircId = IrcIdentity(name) |
6ba512d9f46a
Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
934 | self.__identities[name] = ircId |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
935 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
936 | self.dataChanged.emit() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
937 | |
5588
6ba512d9f46a
Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
938 | return ircId |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
939 | else: |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
940 | return None |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
941 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
942 | def getIdentities(self): |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
943 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
944 | Public method to get a copy of all identities. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
945 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
946 | @return dictionary of all identities |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
947 | @rtype dict of IrcIdentity |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
948 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
949 | return copy.deepcopy(self.__identities) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
950 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
951 | def setIdentities(self, identities): |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
952 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
953 | Public method to set the identities. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
954 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
955 | @param identities dictionary of all identities |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
956 | @type dict of IrcIdentity |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
957 | """ |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
958 | self.__identities = copy.deepcopy(identities) |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
959 | self.identityChanged() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
960 | |
2239
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
961 | # Check all networks, if the identity they use is still available. |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
962 | # If it isn't, change them to use the default identity. |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
963 | for network in self.__networks.values(): |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
964 | if network.getIdentityName() not in self.__identities: |
a47b50e80a20
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2238
diff
changeset
|
965 | network.setIdentityName(IrcIdentity.DefaultIdentityName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
966 | |
2231
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
967 | def getIdentityNames(self): |
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
968 | """ |
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
969 | Public method to get the names of all identities. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
970 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
971 | @return names of all identities |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
972 | @rtype list of string) |
2231
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
973 | """ |
10373
093dcebe5ecb
Corrected some uses of dict.keys(), dict.values() and dict.items().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9664
diff
changeset
|
974 | return list(self.__identities) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
975 | |
2231
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
976 | def addIdentity(self, identity): |
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
977 | """ |
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
978 | Public method to add a new identity. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
979 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
980 | @param identity reference to the identity to add |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
981 | @type IrcIdentity |
2231
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
982 | """ |
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
983 | name = identity.getName() |
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
984 | self.__identities[name] = identity |
2232
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2231
diff
changeset
|
985 | self.identityChanged() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
986 | |
2231
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
987 | def deleteIdentity(self, name): |
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
988 | """ |
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
989 | Public method to delete the given identity. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
990 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
991 | @param name name of the identity to delete |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
992 | @type str |
2231
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
993 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
994 | if name in self.__identities and name != IrcIdentity.DefaultIdentityName: |
2231
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
995 | del self.__identities[name] |
2232
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2231
diff
changeset
|
996 | self.identityChanged() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
997 | |
2231
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
998 | def renameIdentity(self, oldName, newName): |
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
999 | """ |
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
1000 | Public method to rename an identity. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1001 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
1002 | @param oldName old name of the identity |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
1003 | @type str |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
1004 | @param newName new name of the identity |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
1005 | @type str |
2231
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
1006 | """ |
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
1007 | if oldName in self.__identities: |
2280
8e85ca3fabe7
Fixed a few PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2279
diff
changeset
|
1008 | self.__identities[newName] = self.__identities[oldName] |
2231
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
1009 | del self.__identities[oldName] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1010 | |
2231
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
1011 | for network in self.__networks: |
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
1012 | if network.getIdentityName() == oldName: |
241df9311ade
Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
1013 | network.setIdentityName(newName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1014 | |
2232
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2231
diff
changeset
|
1015 | self.identityChanged() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1016 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1017 | def identityChanged(self): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1018 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1019 | Public method to indicate a change of an identity object. |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1020 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1021 | self.dataChanged.emit() |
2279
cbf90feec16f
Fixed a non-fatal issue in the IRC widget related to changing an identity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1022 | self.identitiesChanged.emit() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1023 | |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
1024 | ################################################################## |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
1025 | ## Network related methods below |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
1026 | ################################################################## |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1027 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1028 | def getNetwork(self, name): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1029 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1030 | Public method to get a network object. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1031 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
1032 | @param name name of the network |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
1033 | @type str |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
1034 | @return reference to the network object |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
1035 | @rtype IrcNetwork |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1036 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1037 | if not self.__loaded: |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1038 | self.__load() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1039 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1040 | if name in self.__networks: |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1041 | return self.__networks[name] |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1042 | else: |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1043 | return None |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1044 | |
2238
9977d3081ab6
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
1045 | def setNetwork(self, network, networkName=""): |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1046 | """ |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
1047 | Public method to set a network. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1048 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
1049 | @param network network object to set |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
1050 | @type IrcNetwork |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
1051 | @param networkName name the network was known for |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
1052 | @type str |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
1053 | """ |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
1054 | name = network.getName() |
2238
9977d3081ab6
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
1055 | if networkName and name != networkName: |
9977d3081ab6
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
1056 | # the network name has changed |
9977d3081ab6
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
1057 | self.deleteNetwork(networkName) |
9977d3081ab6
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
1058 | self.addNetwork(network) |
9977d3081ab6
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
1059 | elif name in self.__networks: |
9977d3081ab6
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
1060 | self.__networks[name] = network |
9977d3081ab6
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
1061 | self.networkChanged() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1062 | |
2238
9977d3081ab6
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
1063 | def addNetwork(self, network): |
9977d3081ab6
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
1064 | """ |
9977d3081ab6
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
1065 | Public method to add a network. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1066 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
1067 | @param network network object to add |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
1068 | @type IrcNetwork |
2238
9977d3081ab6
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
1069 | """ |
9977d3081ab6
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
1070 | name = network.getName() |
9977d3081ab6
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
1071 | if name not in self.__networks: |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
1072 | self.__networks[name] = network |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2235
diff
changeset
|
1073 | self.networkChanged() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1074 | |
2232
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2231
diff
changeset
|
1075 | def deleteNetwork(self, name): |
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2231
diff
changeset
|
1076 | """ |
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2231
diff
changeset
|
1077 | Public method to delete the given network. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1078 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
1079 | @param name name of the network to delete |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
1080 | @type str |
2232
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2231
diff
changeset
|
1081 | """ |
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2231
diff
changeset
|
1082 | if name in self.__networks: |
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2231
diff
changeset
|
1083 | del self.__networks[name] |
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2231
diff
changeset
|
1084 | self.networkChanged() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1085 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1086 | def networkChanged(self): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1087 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1088 | Public method to indicate a change of a network object. |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1089 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1090 | self.dataChanged.emit() |
2232
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2231
diff
changeset
|
1091 | self.networksChanged.emit() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1092 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1093 | def getNetworkNames(self): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1094 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1095 | Public method to get a list of all known network names. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1096 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
1097 | @return list of network names |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
1098 | @rtype list of str |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1099 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1100 | if not self.__loaded: |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1101 | self.__load() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1102 | |
10373
093dcebe5ecb
Corrected some uses of dict.keys(), dict.values() and dict.items().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9664
diff
changeset
|
1103 | return sorted(self.__networks) |