src/eric7/Network/IRC/IrcNetworkWidget.py

Wed, 20 Dec 2023 14:58:58 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 20 Dec 2023 14:58:58 +0100
branch
eric7
changeset 10428
a071d4065202
parent 9653
e67609152c5e
child 10439
21c28b0f9e41
permissions
-rw-r--r--

Converted some source code documentation to the new style.

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
9653
e67609152c5e Updated copyright for 2023.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9624
diff changeset
3 # Copyright (c) 2012 - 2023 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 network part of the IRC widget.
b7aceb255831 First 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
9152
8a68afaf1ba2 Started replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
10 import pathlib
8a68afaf1ba2 Started replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
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 QPoint, QThread, QUrl, pyqtSignal, pyqtSlot
8318
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
13 from PyQt6.QtGui import QDesktopServices
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
14 from PyQt6.QtWidgets import QApplication, QMenu, QWidget
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
15
9624
b47dfa7a137d Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
16 from eric7 import Preferences
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
17 from eric7.EricGui import EricPixmapCache
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
18 from eric7.EricWidgets import EricFileDialog, EricMessageBox
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
19 from eric7.EricWidgets.EricApplication import ericApp
9624
b47dfa7a137d Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
20 from eric7.SystemUtilities import OSUtilities
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
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
22 from .IrcUtilities import ircFilter, ircTimestamp
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
23 from .Ui_IrcNetworkWidget import Ui_IrcNetworkWidget
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 class IrcNetworkWidget(QWidget, Ui_IrcNetworkWidget):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 Class implementing the network part of the IRC widget.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
29
4630
7b0e38956b5c Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
30 @signal connectNetwork(str,bool,bool) emitted to connect or disconnect from
2960
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2758
diff changeset
31 a 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
32 @signal editNetwork(str) emitted to edit a network configuration
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 @signal joinChannel(str) emitted to join a channel
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 @signal nickChanged(str) emitted to change the nick name
2245
cbddacb4bc2e Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2244
diff changeset
35 @signal sendData(str) emitted to send a message to the channel
2246
fdf22a29fbf4 Removed the "Auto Away" stuff because there is no universal way to check the computer for user inactivity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2245
diff changeset
36 @signal away(bool) emitted to indicate the away status
2258
9ca42fd3ecc0 Added a signal to the IRC widget fired after the autoconnect was initiated. This will make the IRC pane the current one on the right side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2253
diff changeset
37 @signal autoConnected() emitted after an automatic connection was initiated
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
38 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
39
4630
7b0e38956b5c Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
40 connectNetwork = pyqtSignal(str, bool, 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
41 editNetwork = pyqtSignal(str)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 joinChannel = pyqtSignal(str)
b7aceb255831 First 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 nickChanged = pyqtSignal(str)
2245
cbddacb4bc2e Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2244
diff changeset
44 sendData = pyqtSignal(str)
2246
fdf22a29fbf4 Removed the "Auto Away" stuff because there is no universal way to check the computer for user inactivity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2245
diff changeset
45 away = pyqtSignal(bool)
2258
9ca42fd3ecc0 Added a signal to the IRC widget fired after the autoconnect was initiated. This will make the IRC pane the current one on the right side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2253
diff changeset
46 autoConnected = pyqtSignal()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
47
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
48 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
49 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 Constructor
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
51
10428
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
52 @param parent reference to the parent widget
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
53 @type QWidget
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
54 """
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
55 super().__init__(parent)
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 self.setupUi(self)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
57
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
58 self.connectButton.setIcon(EricPixmapCache.getIcon("ircConnect"))
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
59 self.editButton.setIcon(EricPixmapCache.getIcon("ircConfigure"))
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
60 self.joinButton.setIcon(EricPixmapCache.getIcon("ircJoinChannel"))
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
61 self.awayButton.setIcon(EricPixmapCache.getIcon("ircUserPresent"))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
62
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
63 self.joinButton.setEnabled(False)
2244
654aaddbc2b9 Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2242
diff changeset
64 self.nickCombo.setEnabled(False)
2245
cbddacb4bc2e Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2244
diff changeset
65 self.awayButton.setEnabled(False)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
66
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
67 self.channelCombo.lineEdit().returnPressed.connect(self.on_joinButton_clicked)
2253
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
68 self.nickCombo.lineEdit().returnPressed.connect(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
69 self.on_nickCombo_currentIndexChanged
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
70 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
71
2758
eacdcc89b74d Fixed a little (cosmetic) issue in the IRC network widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2528
diff changeset
72 self.setConnected(False)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
73
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
74 self.__initMessagesMenu()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
75
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
76 self.__manager = 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
77 self.__connected = False
2244
654aaddbc2b9 Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2242
diff changeset
78 self.__registered = False
2245
cbddacb4bc2e Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2244
diff changeset
79 self.__away = False
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
80
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
81 def initialize(self, 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
82 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 Public method to initialize the widget.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
84
10428
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
85 @param manager reference to the network manager
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
86 @type IrcNetworkManager
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
87 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 self.__manager = manager
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
89
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
90 self.networkCombo.addItems(self.__manager.getNetworkNames())
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
91
2232
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
92 self.__manager.networksChanged.connect(self.__refreshNetworks)
2279
cbf90feec16f Fixed a non-fatal issue in the IRC widget related to changing an identity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2258
diff changeset
93 self.__manager.identitiesChanged.connect(self.__refreshNetworks)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
94
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
95 def autoConnect(self):
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
96 """
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
97 Public method to perform the IRC auto connection.
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
98 """
8580
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8358
diff changeset
99 userInterface = ericApp().getObject("UserInterface")
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8358
diff changeset
100 online = userInterface.isOnline()
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8358
diff changeset
101 self.connectButton.setEnabled(online)
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8358
diff changeset
102 userInterface.onlineStateChanged.connect(self.__onlineStateChanged)
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8358
diff changeset
103 if online:
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8358
diff changeset
104 self.__autoConnect()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
105
4630
7b0e38956b5c Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
106 def __autoConnect(self):
7b0e38956b5c Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
107 """
4649
bbc8b2de9173 Fixed a code style issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
108 Private method to perform the IRC auto connection.
4630
7b0e38956b5c Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
109 """
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
110 for networkName in self.__manager.getNetworkNames():
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
111 if self.__manager.getNetwork(networkName).autoConnect():
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
112 row = self.networkCombo.findText(networkName)
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
113 self.networkCombo.setCurrentIndex(row)
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
114 self.on_connectButton_clicked()
2258
9ca42fd3ecc0 Added a signal to the IRC widget fired after the autoconnect was initiated. This will make the IRC pane the current one on the right side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2253
diff changeset
115 self.autoConnected.emit()
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
116 break
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
117
4630
7b0e38956b5c Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
118 @pyqtSlot(bool)
7b0e38956b5c Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
119 def __onlineStateChanged(self, online):
7b0e38956b5c Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
120 """
7b0e38956b5c Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
121 Private slot handling online state changes.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
122
4630
7b0e38956b5c Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
123 @param online online state
7b0e38956b5c Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
124 @type bool
7b0e38956b5c Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
125 """
7b0e38956b5c Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
126 self.connectButton.setEnabled(online)
7b0e38956b5c Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
127 if online:
7b0e38956b5c Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
128 # delay a bit because the signal seems to be sent before the
7b0e38956b5c Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
129 # network interface is fully up
7b0e38956b5c Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
130 QThread.msleep(200)
7b0e38956b5c Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
131 self.__autoConnect()
7b0e38956b5c Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
132 else:
7b0e38956b5c Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
133 network = self.networkCombo.currentText()
7b0e38956b5c Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
134 self.connectNetwork.emit(network, online, True)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
135
2232
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
136 @pyqtSlot()
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
137 def __refreshNetworks(self):
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
138 """
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
139 Private slot to refresh all network related widgets.
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
140 """
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
141 currentNetwork = self.networkCombo.currentText()
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
142 currentNick = self.nickCombo.currentText()
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
143 currentChannel = self.channelCombo.currentText()
2279
cbf90feec16f Fixed a non-fatal issue in the IRC widget related to changing an identity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2258
diff changeset
144 blocked = self.networkCombo.blockSignals(True)
2232
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
145 self.networkCombo.clear()
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
146 self.networkCombo.addItems(self.__manager.getNetworkNames())
2279
cbf90feec16f Fixed a non-fatal issue in the IRC widget related to changing an identity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2258
diff changeset
147 self.networkCombo.blockSignals(blocked)
2232
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
148 row = self.networkCombo.findText(currentNetwork)
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
149 if row == -1:
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
150 row = 0
2279
cbf90feec16f Fixed a non-fatal issue in the IRC widget related to changing an identity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2258
diff changeset
151 blocked = self.nickCombo.blockSignals(True)
2232
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
152 self.networkCombo.setCurrentIndex(row)
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
153 self.nickCombo.setEditText(currentNick)
2279
cbf90feec16f Fixed a non-fatal issue in the IRC widget related to changing an identity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2258
diff changeset
154 self.nickCombo.blockSignals(blocked)
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
155 self.channelCombo.setEditText(currentChannel)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
156
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
157 @pyqtSlot()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 def on_connectButton_clicked(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
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 Private slot to connect to a network.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 """
b7aceb255831 First 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 network = self.networkCombo.currentText()
4630
7b0e38956b5c Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
163 self.connectNetwork.emit(network, not self.__connected, False)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
164
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
165 @pyqtSlot()
2245
cbddacb4bc2e Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2244
diff changeset
166 def on_awayButton_clicked(self):
cbddacb4bc2e Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2244
diff changeset
167 """
cbddacb4bc2e Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2244
diff changeset
168 Private slot to toggle the away status.
cbddacb4bc2e Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2244
diff changeset
169 """
cbddacb4bc2e Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2244
diff changeset
170 if self.__away:
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
171 self.handleAwayCommand("")
2245
cbddacb4bc2e Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2244
diff changeset
172 else:
cbddacb4bc2e Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2244
diff changeset
173 networkName = self.networkCombo.currentText()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
174 identityName = self.__manager.getNetwork(networkName).getIdentityName()
6587
a04952159050 IrcWidget, IrcNetworkWidget: fixed an issue related to a non-existing identity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
175 identity = self.__manager.getIdentity(identityName)
a04952159050 IrcWidget, IrcNetworkWidget: fixed an issue related to a non-existing identity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
176 if identity:
a04952159050 IrcWidget, IrcNetworkWidget: fixed an issue related to a non-existing identity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
177 awayMessage = identity.getAwayMessage()
a04952159050 IrcWidget, IrcNetworkWidget: fixed an issue related to a non-existing identity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
178 else:
a04952159050 IrcWidget, IrcNetworkWidget: fixed an issue related to a non-existing identity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
179 awayMessage = ""
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
180 self.handleAwayCommand(awayMessage)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
181
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
182 @pyqtSlot(str)
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
183 def handleAwayCommand(self, awayMessage):
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
184 """
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
185 Public slot to process an away command.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
186
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
187 @param awayMessage message to be set for being away
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
188 @type str
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
189 """
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
190 if awayMessage and not self.__away:
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
191 # set being away
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
192 # don't send away, if the status is already set
2245
cbddacb4bc2e Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2244
diff changeset
193 self.sendData.emit("AWAY :" + awayMessage)
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
194 self.awayButton.setIcon(EricPixmapCache.getIcon("ircUserAway"))
2245
cbddacb4bc2e Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2244
diff changeset
195 self.__away = True
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
196 self.away.emit(self.__away)
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
197 elif not awayMessage and self.__away:
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
198 # cancel being away
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
199 self.sendData.emit("AWAY")
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
200 self.awayButton.setIcon(EricPixmapCache.getIcon("ircUserPresent"))
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
201 self.__away = False
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
202 self.away.emit(self.__away)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
203
2245
cbddacb4bc2e Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2244
diff changeset
204 @pyqtSlot()
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
205 def on_editButton_clicked(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
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 Private slot to edit a network.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 network = self.networkCombo.currentText()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 self.editNetwork.emit(network)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
211
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
212 @pyqtSlot(str)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 def on_channelCombo_editTextChanged(self, txt):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215 Private slot to react upon changes of the channel.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
216
10428
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
217 @param txt current text of the channel combo
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
218 @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
219 """
2244
654aaddbc2b9 Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2242
diff changeset
220 on = bool(txt) and self.__registered
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
221 self.joinButton.setEnabled(on)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
222
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
223 @pyqtSlot()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 def on_joinButton_clicked(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
225 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 Private slot to join a channel.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228 channel = self.channelCombo.currentText()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229 self.joinChannel.emit(channel)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
230
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7946
diff changeset
231 @pyqtSlot(int)
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7946
diff changeset
232 def on_networkCombo_currentIndexChanged(self, index):
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
233 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 Private slot to handle selections of a network.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
235
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7946
diff changeset
236 @param index index of the selected entry
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7946
diff changeset
237 @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
238 """
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7946
diff changeset
239 networkName = self.networkCombo.itemText(index)
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
240 network = self.__manager.getNetwork(networkName)
2232
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
241 self.nickCombo.clear()
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
242 self.channelCombo.clear()
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
243 if network:
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
244 channels = network.getChannelNames()
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
245 self.channelCombo.addItems(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
246 self.channelCombo.setEnabled(True)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
247 identity = self.__manager.getIdentity(network.getIdentityName())
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
248 if identity:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 self.nickCombo.addItems(identity.getNickNames())
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 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
251 self.channelCombo.setEnabled(False)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
252
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
253 def getNetworkChannels(self):
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
254 """
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
255 Public method to get the list of channels associated with the
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
256 selected network.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
257
10428
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
258 @return associated channels
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
259 @rtype list of IrcChannel
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
260 """
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
261 networkName = self.networkCombo.currentText()
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
262 network = self.__manager.getNetwork(networkName)
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
263 return network.getChannels()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
264
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7946
diff changeset
265 @pyqtSlot(int)
4887
e10234bb547c Fixed an issue in the IRC widget
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4649
diff changeset
266 @pyqtSlot()
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7946
diff changeset
267 def on_nickCombo_currentIndexChanged(self, nick=0):
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
268 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 Private slot to use another nick name.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
270
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7946
diff changeset
271 @param nick index of the selected nick name (unused)
10428
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
272 @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
273 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 if self.__connected:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 self.nickChanged.emit(self.nickCombo.currentText())
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
276
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
277 def getNickname(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
278 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 Public method to get the currently selected nick name.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
280
10428
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
281 @return selected nick name
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
282 @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
283 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 return self.nickCombo.currentText()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
285
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
286 def setNickName(self, nick):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 Public slot to set the nick name in use.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
289
10428
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
290 @param nick nick name in use
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
291 @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
292 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 self.nickCombo.blockSignals(True)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 self.nickCombo.setEditText(nick)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 self.nickCombo.blockSignals(False)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
296
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
297 def addMessage(self, msg):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299 Public method to add a message.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
300
10428
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
301 @param msg message to be added
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
302 @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
303 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304 s = '<font color="{0}">{1} {2}</font>'.format(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
305 Preferences.getIrc("NetworkMessageColour"), ircTimestamp(), msg
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
306 )
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 self.messages.append(s)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
308
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
309 def addServerMessage(self, msgType, msg, filterMsg=True):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 """
b7aceb255831 First 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 Public method to add a server message.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
312
10428
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
313 @param msgType txpe of the message
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
314 @type str
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
315 @param msg message to be added
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
316 @type str
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
317 @param filterMsg flag indicating to filter the message
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
318 @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
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 if filterMsg:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321 msg = ircFilter(msg)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322 s = '<font color="{0}">{1} <b>[</b>{2}<b>]</b> {3}</font>'.format(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
323 Preferences.getIrc("ServerMessageColour"), ircTimestamp(), msgType, msg
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 )
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325 self.messages.append(s)
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 def addErrorMessage(self, msgType, msg):
b7aceb255831 First 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 """
b7aceb255831 First 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 Public method to add an error message.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
330
10428
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
331 @param msgType txpe of the message
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
332 @type str
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
333 @param msg message to be added
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
334 @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
335 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 s = '<font color="{0}">{1} <b>[</b>{2}<b>]</b> {3}</font>'.format(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
337 Preferences.getIrc("ErrorMessageColour"), ircTimestamp(), msgType, msg
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 )
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339 self.messages.append(s)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
340
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
341 def setConnected(self, connected):
b7aceb255831 First 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 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
343 Public slot to set the connection state.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
344
10428
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
345 @param connected flag indicating the connection state
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
346 @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
347 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348 self.__connected = connected
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
349 if self.__connected:
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
350 self.connectButton.setIcon(EricPixmapCache.getIcon("ircDisconnect"))
2758
eacdcc89b74d Fixed a little (cosmetic) issue in the IRC network widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2528
diff changeset
351 self.connectButton.setToolTip(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
352 self.tr("Press to disconnect from the network")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
353 )
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 else:
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
355 self.connectButton.setIcon(EricPixmapCache.getIcon("ircConnect"))
2758
eacdcc89b74d Fixed a little (cosmetic) issue in the IRC network widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2528
diff changeset
356 self.connectButton.setToolTip(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
357 self.tr("Press to connect to the selected network")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
358 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
359
2528
688c7ef0a5b0 Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2446
diff changeset
360 def isConnected(self):
688c7ef0a5b0 Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2446
diff changeset
361 """
688c7ef0a5b0 Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2446
diff changeset
362 Public method to check, if the network is connected.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
363
10428
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
364 @return flag indicating a connected network
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
365 @rtype bool
2528
688c7ef0a5b0 Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2446
diff changeset
366 """
688c7ef0a5b0 Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2446
diff changeset
367 return self.__connected
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
368
2244
654aaddbc2b9 Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2242
diff changeset
369 def setRegistered(self, registered):
654aaddbc2b9 Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2242
diff changeset
370 """
654aaddbc2b9 Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2242
diff changeset
371 Public slot to set the registered state.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
372
10428
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
373 @param registered flag indicating the registration state
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
374 @type bool
2244
654aaddbc2b9 Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2242
diff changeset
375 """
654aaddbc2b9 Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2242
diff changeset
376 self.__registered = registered
654aaddbc2b9 Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2242
diff changeset
377 on = bool(self.channelCombo.currentText()) and self.__registered
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
378 self.joinButton.setEnabled(on)
2244
654aaddbc2b9 Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2242
diff changeset
379 self.nickCombo.setEnabled(registered)
2245
cbddacb4bc2e Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2244
diff changeset
380 self.awayButton.setEnabled(registered)
cbddacb4bc2e Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2244
diff changeset
381 if registered:
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
382 self.awayButton.setIcon(EricPixmapCache.getIcon("ircUserPresent"))
2245
cbddacb4bc2e Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2244
diff changeset
383 self.__away = False
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
384
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
385 def __clearMessages(self):
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
386 """
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
387 Private slot to clear the contents of the messages display.
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
388 """
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
389 self.messages.clear()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
390
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
391 def __copyMessages(self):
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
392 """
2960
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2758
diff changeset
393 Private slot to copy the selection of the messages display to
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2758
diff changeset
394 the clipboard.
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
395 """
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
396 self.messages.copy()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
397
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
398 def __copyAllMessages(self):
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
399 """
2960
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2758
diff changeset
400 Private slot to copy the contents of the messages display to
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2758
diff changeset
401 the clipboard.
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
402 """
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
403 txt = self.messages.toPlainText()
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
404 if txt:
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
405 cb = QApplication.clipboard()
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
406 cb.setText(txt)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
407
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
408 def __cutAllMessages(self):
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
409 """
2960
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2758
diff changeset
410 Private slot to cut the contents of the messages display to
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2758
diff changeset
411 the clipboard.
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
412 """
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
413 txt = self.messages.toPlainText()
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
414 if txt:
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
415 cb = QApplication.clipboard()
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
416 cb.setText(txt)
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
417 self.messages.clear()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
418
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
419 def __saveMessages(self):
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
420 """
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
421 Private slot to save the contents of the messages display.
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
422 """
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
423 hasText = not self.messages.document().isEmpty()
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
424 if hasText:
9624
b47dfa7a137d Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
425 if OSUtilities.isWindowsPlatform():
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
426 htmlExtension = "htm"
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
427 else:
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
428 htmlExtension = "html"
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8322
diff changeset
429 fname, selectedFilter = EricFileDialog.getSaveFileNameAndFilter(
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
430 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
431 self.tr("Save Messages"),
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
432 "",
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
433 self.tr("HTML Files (*.{0});;Text Files (*.txt);;All Files (*)").format(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
434 htmlExtension
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
435 ),
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
436 None,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
437 EricFileDialog.DontConfirmOverwrite,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
438 )
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
439 if fname:
9152
8a68afaf1ba2 Started replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
440 fpath = pathlib.Path(fname)
8a68afaf1ba2 Started replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
441 if not fpath.suffix:
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
442 ex = selectedFilter.split("(*")[1].split(")")[0]
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
443 if ex:
9152
8a68afaf1ba2 Started replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
444 fpath = fpath.with_suffix(ex)
8a68afaf1ba2 Started replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
445 if fpath.exists():
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8322
diff changeset
446 res = EricMessageBox.yesNo(
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
447 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
448 self.tr("Save Messages"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
449 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
450 "<p>The file <b>{0}</b> already exists."
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
451 " Overwrite it?</p>"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
452 ).format(fpath),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
453 icon=EricMessageBox.Warning,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
454 )
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
455 if not res:
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
456 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
457
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
458 try:
8259
2bbec88047dd Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
459 txt = (
2bbec88047dd Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
460 self.messages.toHtml()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
461 if fpath.suffix.lower() in [".htm", ".html"]
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
462 else self.messages.toPlainText()
8259
2bbec88047dd Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
463 )
9152
8a68afaf1ba2 Started replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
464 with fpath.open("w", encoding="utf-8") as f:
7785
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
465 f.write(txt)
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7785
diff changeset
466 except OSError as err:
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8322
diff changeset
467 EricMessageBox.critical(
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
468 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
469 self.tr("Error saving Messages"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
470 self.tr(
2960
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2758
diff changeset
471 """<p>The messages contents could not be written"""
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
472 """ to <b>{0}</b></p><p>Reason: {1}</p>"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
473 ).format(fpath, str(err)),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
474 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
475
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
476 def __initMessagesMenu(self):
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
477 """
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
478 Private slot to initialize the context menu of the messages pane.
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
479 """
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
480 self.__messagesMenu = QMenu(self)
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
481 self.__copyMessagesAct = self.__messagesMenu.addAction(
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
482 EricPixmapCache.getIcon("editCopy"), self.tr("Copy"), self.__copyMessages
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
483 )
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
484 self.__messagesMenu.addSeparator()
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
485 self.__cutAllMessagesAct = self.__messagesMenu.addAction(
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
486 EricPixmapCache.getIcon("editCut"),
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
487 self.tr("Cut all"),
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
488 self.__cutAllMessages,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
489 )
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
490 self.__copyAllMessagesAct = self.__messagesMenu.addAction(
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
491 EricPixmapCache.getIcon("editCopy"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
492 self.tr("Copy all"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
493 self.__copyAllMessages,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
494 )
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
495 self.__messagesMenu.addSeparator()
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
496 self.__clearMessagesAct = self.__messagesMenu.addAction(
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
497 EricPixmapCache.getIcon("editDelete"),
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
498 self.tr("Clear"),
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
499 self.__clearMessages,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
500 )
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
501 self.__messagesMenu.addSeparator()
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
502 self.__saveMessagesAct = self.__messagesMenu.addAction(
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
503 EricPixmapCache.getIcon("fileSave"), self.tr("Save"), self.__saveMessages
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
504 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
505
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
506 self.on_messages_copyAvailable(False)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
507
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
508 @pyqtSlot(bool)
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
509 def on_messages_copyAvailable(self, yes):
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
510 """
2960
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2758
diff changeset
511 Private slot to react to text selection/deselection of the
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2758
diff changeset
512 messages edit.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
513
10428
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
514 @param yes flag signaling the availability of selected text
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
515 @type bool
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
516 """
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
517 self.__copyMessagesAct.setEnabled(yes)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
518
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
519 @pyqtSlot(QPoint)
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
520 def on_messages_customContextMenuRequested(self, pos):
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
521 """
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
522 Private slot to show the context menu of the messages pane.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
523
10428
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
524 @param pos position the menu should be opened at
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
525 @type QPoint
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
526 """
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
527 enable = not self.messages.document().isEmpty()
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
528 self.__cutAllMessagesAct.setEnabled(enable)
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
529 self.__copyAllMessagesAct.setEnabled(enable)
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
530 self.__saveMessagesAct.setEnabled(enable)
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
531 self.__messagesMenu.popup(self.messages.mapToGlobal(pos))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
532
2442
1dcfd570fa12 Fixed an issue in the IRC widget opening hyperlinks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
533 @pyqtSlot(QUrl)
1dcfd570fa12 Fixed an issue in the IRC widget opening hyperlinks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
534 def on_messages_anchorClicked(self, url):
1dcfd570fa12 Fixed an issue in the IRC widget opening hyperlinks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
535 """
1dcfd570fa12 Fixed an issue in the IRC widget opening hyperlinks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
536 Private slot to open links in the default browser.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
537
10428
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
538 @param url URL to be opened
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
539 @type QUrl
2442
1dcfd570fa12 Fixed an issue in the IRC widget opening hyperlinks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
540 """
1dcfd570fa12 Fixed an issue in the IRC widget opening hyperlinks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
541 QDesktopServices.openUrl(url)

eric ide

mercurial