Thu, 16 Jun 2022 18:28:59 +0200
Started replacing the use of "QFileInfo()" with Python equivalents.
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 | |
8881
54e42bc2437a
Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8580
diff
changeset
|
3 | # Copyright (c) 2012 - 2022 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 | |
8a68afaf1ba2
Started replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
12 | from PyQt6.QtCore import pyqtSlot, pyqtSignal, QPoint, QUrl, QThread |
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 |
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
|
14 | from PyQt6.QtWidgets import QWidget, QApplication, QMenu |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
15 | |
8358
144a6b854f70
Sorted the eric specific extensions into packages named like the corresponding PyQt packages (i.e. EricCore,EricGui and EricWidgets).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8356
diff
changeset
|
16 | from EricWidgets import EricMessageBox, EricFileDialog |
8580
e91b276e0771
Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
17 | from EricWidgets.EricApplication import ericApp |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | 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
|
20 | |
b7aceb255831
First 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 | from .IrcUtilities import ircFilter, ircTimestamp |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | |
b7aceb255831
First 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 | import UI.PixmapCache |
b7aceb255831
First 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 | import Preferences |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
25 | import Utilities |
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
|
26 | |
b7aceb255831
First 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 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
|
29 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
30 | Class 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
|
31 | |
4630
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
32 | @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
|
33 | 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
|
34 | @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
|
35 | @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
|
36 | @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
|
37 | @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
|
38 | @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
|
39 | @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
|
40 | """ |
4630
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
41 | 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
|
42 | 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
|
43 | 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
|
44 | nickChanged = pyqtSignal(str) |
2245
cbddacb4bc2e
Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2244
diff
changeset
|
45 | 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
|
46 | 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
|
47 | autoConnected = pyqtSignal() |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | |
b7aceb255831
First 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 | 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
|
50 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | Constructor |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
52 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
53 | @param parent reference to the parent widget (QWidget) |
b7aceb255831
First 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) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
57 | |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
58 | self.connectButton.setIcon(UI.PixmapCache.getIcon("ircConnect")) |
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
59 | self.editButton.setIcon(UI.PixmapCache.getIcon("ircConfigure")) |
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
60 | self.joinButton.setIcon(UI.PixmapCache.getIcon("ircJoinChannel")) |
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
61 | self.awayButton.setIcon(UI.PixmapCache.getIcon("ircUserPresent")) |
2244
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2242
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) |
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
|
66 | |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2758
diff
changeset
|
67 | self.channelCombo.lineEdit().returnPressed.connect( |
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2758
diff
changeset
|
68 | 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
|
69 | self.nickCombo.lineEdit().returnPressed.connect( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
70 | self.on_nickCombo_currentIndexChanged) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
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) |
eacdcc89b74d
Fixed a little (cosmetic) issue in the IRC network widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2528
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() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
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 |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
80 | |
b7aceb255831
First 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. |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
84 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | @param manager reference to the network manager (IrcNetworkManager) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
86 | """ |
b7aceb255831
First 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 | self.__manager = 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
|
88 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
89 | self.networkCombo.addItems(self.__manager.getNetworkNames()) |
2232
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
90 | |
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
91 | 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
|
92 | self.__manager.identitiesChanged.connect(self.__refreshNetworks) |
2232
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
93 | |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
94 | def autoConnect(self): |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
95 | """ |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
96 | Public method to perform the IRC auto connection. |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
97 | """ |
8580
e91b276e0771
Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
98 | userInterface = ericApp().getObject("UserInterface") |
e91b276e0771
Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
99 | online = userInterface.isOnline() |
e91b276e0771
Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
100 | self.connectButton.setEnabled(online) |
e91b276e0771
Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
101 | userInterface.onlineStateChanged.connect(self.__onlineStateChanged) |
e91b276e0771
Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
102 | if online: |
e91b276e0771
Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
103 | self.__autoConnect() |
4630
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
104 | |
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
105 | def __autoConnect(self): |
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
106 | """ |
4649
bbc8b2de9173
Fixed a code style issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4631
diff
changeset
|
107 | 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
|
108 | """ |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
109 | for networkName in self.__manager.getNetworkNames(): |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
110 | if self.__manager.getNetwork(networkName).autoConnect(): |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
111 | row = self.networkCombo.findText(networkName) |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
112 | self.networkCombo.setCurrentIndex(row) |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
113 | 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
|
114 | self.autoConnected.emit() |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
115 | break |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
116 | |
4630
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
117 | @pyqtSlot(bool) |
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
118 | def __onlineStateChanged(self, online): |
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
119 | """ |
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
120 | Private slot handling online state changes. |
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
121 | |
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
122 | @param online online state |
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
123 | @type bool |
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
124 | """ |
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
125 | self.connectButton.setEnabled(online) |
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
126 | if online: |
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
127 | # 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
|
128 | # network interface is fully up |
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
129 | QThread.msleep(200) |
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
130 | self.__autoConnect() |
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
131 | else: |
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
132 | network = self.networkCombo.currentText() |
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
133 | self.connectNetwork.emit(network, online, True) |
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
134 | |
2232
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
135 | @pyqtSlot() |
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
136 | def __refreshNetworks(self): |
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
137 | """ |
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
138 | 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
|
139 | """ |
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
140 | currentNetwork = self.networkCombo.currentText() |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
141 | currentNick = self.nickCombo.currentText() |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
142 | 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
|
143 | blocked = self.networkCombo.blockSignals(True) |
2232
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
144 | self.networkCombo.clear() |
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
145 | 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
|
146 | self.networkCombo.blockSignals(blocked) |
2232
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
147 | row = self.networkCombo.findText(currentNetwork) |
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
148 | if row == -1: |
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
149 | 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
|
150 | blocked = self.nickCombo.blockSignals(True) |
2232
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
151 | self.networkCombo.setCurrentIndex(row) |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
152 | 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
|
153 | self.nickCombo.blockSignals(blocked) |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
154 | self.channelCombo.setEditText(currentChannel) |
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
|
155 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
156 | @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
|
157 | 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
|
158 | """ |
b7aceb255831
First 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 | 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
|
160 | """ |
b7aceb255831
First 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 | network = self.networkCombo.currentText() |
4630
7b0e38956b5c
Refined the online state change behaviour.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
162 | self.connectNetwork.emit(network, not self.__connected, False) |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
163 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
164 | @pyqtSlot() |
2245
cbddacb4bc2e
Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2244
diff
changeset
|
165 | def on_awayButton_clicked(self): |
cbddacb4bc2e
Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2244
diff
changeset
|
166 | """ |
cbddacb4bc2e
Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2244
diff
changeset
|
167 | 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
|
168 | """ |
cbddacb4bc2e
Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2244
diff
changeset
|
169 | 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
|
170 | self.handleAwayCommand("") |
2245
cbddacb4bc2e
Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2244
diff
changeset
|
171 | else: |
cbddacb4bc2e
Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2244
diff
changeset
|
172 | networkName = self.networkCombo.currentText() |
7255
d595f6f9cbf8
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
173 | identityName = ( |
d595f6f9cbf8
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
174 | self.__manager.getNetwork(networkName).getIdentityName() |
d595f6f9cbf8
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
175 | ) |
6587
a04952159050
IrcWidget, IrcNetworkWidget: fixed an issue related to a non-existing identity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6514
diff
changeset
|
176 | 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
|
177 | if identity: |
a04952159050
IrcWidget, IrcNetworkWidget: fixed an issue related to a non-existing identity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6514
diff
changeset
|
178 | 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
|
179 | else: |
a04952159050
IrcWidget, IrcNetworkWidget: fixed an issue related to a non-existing identity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6514
diff
changeset
|
180 | 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
|
181 | self.handleAwayCommand(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
|
182 | |
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 | @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
|
184 | 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
|
185 | """ |
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
|
186 | Public slot to process an away command. |
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 | |
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 | @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
|
189 | @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
|
190 | """ |
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 | 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
|
192 | # 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
|
193 | # 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
|
194 | self.sendData.emit("AWAY :" + awayMessage) |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
195 | self.awayButton.setIcon(UI.PixmapCache.getIcon("ircUserAway")) |
2245
cbddacb4bc2e
Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2244
diff
changeset
|
196 | 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
|
197 | 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
|
198 | 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
|
199 | # 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
|
200 | self.sendData.emit("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
|
201 | self.awayButton.setIcon( |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
202 | UI.PixmapCache.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
|
203 | 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
|
204 | self.away.emit(self.__away) |
2245
cbddacb4bc2e
Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2244
diff
changeset
|
205 | |
cbddacb4bc2e
Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2244
diff
changeset
|
206 | @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
|
207 | 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
|
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 | 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
|
210 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
211 | 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
|
212 | self.editNetwork.emit(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
|
213 | |
b7aceb255831
First 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 | @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
|
215 | 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
|
216 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
217 | Private slot to react upon changes of the 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
|
218 | |
b7aceb255831
First 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 | @param txt current text of the channel combo (string) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
220 | """ |
2244
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2242
diff
changeset
|
221 | 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
|
222 | self.joinButton.setEnabled(on) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
223 | |
b7aceb255831
First 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 | @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
|
225 | 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
|
226 | """ |
b7aceb255831
First 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 | 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
|
228 | """ |
b7aceb255831
First 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 | 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
|
230 | self.joinChannel.emit(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
|
231 | |
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
|
232 | @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
|
233 | 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
|
234 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
235 | Private slot to handle selections of 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
|
236 | |
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
|
237 | @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
|
238 | @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
|
239 | """ |
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
|
240 | 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
|
241 | network = self.__manager.getNetwork(networkName) |
2232
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
242 | self.nickCombo.clear() |
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
243 | 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
|
244 | if network: |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
245 | 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
|
246 | 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
|
247 | self.channelCombo.setEnabled(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
|
248 | identity = self.__manager.getIdentity( |
b7aceb255831
First 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 | network.getIdentityName()) |
b7aceb255831
First 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 | 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
|
251 | 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
|
252 | 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
|
253 | self.channelCombo.setEnabled(False) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
254 | |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
255 | def getNetworkChannels(self): |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
256 | """ |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
257 | 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
|
258 | selected network. |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
259 | |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
260 | @return associated channels (list of IrcChannel) |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
261 | """ |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
262 | networkName = self.networkCombo.currentText() |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
263 | network = self.__manager.getNetwork(networkName) |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
264 | return network.getChannels() |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
265 | |
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
|
266 | @pyqtSlot(int) |
4887
e10234bb547c
Fixed an issue in the IRC widget
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4649
diff
changeset
|
267 | @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
|
268 | 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
|
269 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
270 | Private slot to use another nick name. |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
271 | |
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
|
272 | @param nick index of the selected nick name (unused) |
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()) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
276 | |
b7aceb255831
First 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. |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
280 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
281 | @return selected nick name (string) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
282 | """ |
b7aceb255831
First 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 | return self.nickCombo.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
|
284 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
285 | 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
|
286 | """ |
b7aceb255831
First 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 | Public slot to set the nick name in use. |
b7aceb255831
First 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 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
289 | @param nick nick name in use (string) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
290 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
291 | 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
|
292 | 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
|
293 | self.nickCombo.blockSignals(False) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
294 | |
b7aceb255831
First 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 | 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
|
296 | """ |
b7aceb255831
First 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 | Public method to add a message. |
b7aceb255831
First 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 | @param msg message to be added (string) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
300 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
301 | s = '<font color="{0}">{1} {2}</font>'.format( |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
302 | Preferences.getIrc("NetworkMessageColour"), |
b7aceb255831
First 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 | ircTimestamp(), |
b7aceb255831
First 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 | 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
|
305 | ) |
b7aceb255831
First 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 | self.messages.append(s) |
b7aceb255831
First 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 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
308 | 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
|
309 | """ |
b7aceb255831
First 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 | Public method to add a server message. |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
311 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
312 | @param msgType txpe of the message (string) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
313 | @param msg message to be added (string) |
7900
72b88fb20261
Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7836
diff
changeset
|
314 | @param filterMsg flag indicating to filter the message (boolean) |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
315 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
316 | 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
|
317 | 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
|
318 | s = '<font color="{0}">{1} <b>[</b>{2}<b>]</b> {3}</font>'.format( |
b7aceb255831
First 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 | Preferences.getIrc("ServerMessageColour"), |
b7aceb255831
First 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 | ircTimestamp(), |
b7aceb255831
First 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 | msgType, |
b7aceb255831
First 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 | 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
|
323 | ) |
b7aceb255831
First 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 | self.messages.append(s) |
b7aceb255831
First 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 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
326 | 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
|
327 | """ |
b7aceb255831
First 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 | Public method to add an error message. |
b7aceb255831
First 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 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
330 | @param msgType txpe of the message (string) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
331 | @param msg message to be added (string) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
332 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
333 | s = '<font color="{0}">{1} <b>[</b>{2}<b>]</b> {3}</font>'.format( |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
334 | Preferences.getIrc("ErrorMessageColour"), |
b7aceb255831
First 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 | ircTimestamp(), |
b7aceb255831
First 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 | msgType, |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
337 | 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
|
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) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
340 | |
b7aceb255831
First 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. |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
344 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
345 | @param connected flag indicating the connection state (boolean) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
346 | """ |
b7aceb255831
First 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 | 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
|
348 | if self.__connected: |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2758
diff
changeset
|
349 | self.connectButton.setIcon( |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
350 | UI.PixmapCache.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( |
3190
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
352 | self.tr("Press to disconnect from the 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
|
353 | else: |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2758
diff
changeset
|
354 | self.connectButton.setIcon( |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
355 | UI.PixmapCache.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( |
3190
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
357 | self.tr("Press to connect to the selected network")) |
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
|
358 | |
688c7ef0a5b0
Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2446
diff
changeset
|
359 | 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
|
360 | """ |
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 | Public method to check, if the network is connected. |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
362 | |
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
|
363 | @return flag indicating a connected network (boolean) |
688c7ef0a5b0
Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2446
diff
changeset
|
364 | """ |
688c7ef0a5b0
Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2446
diff
changeset
|
365 | return self.__connected |
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 | |
2244
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2242
diff
changeset
|
367 | def setRegistered(self, registered): |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2242
diff
changeset
|
368 | """ |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2242
diff
changeset
|
369 | Public slot to set the registered state. |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2242
diff
changeset
|
370 | |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2758
diff
changeset
|
371 | @param registered flag indicating the registration state (boolean) |
2244
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2242
diff
changeset
|
372 | """ |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2242
diff
changeset
|
373 | self.__registered = registered |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2242
diff
changeset
|
374 | on = bool(self.channelCombo.currentText()) and self.__registered |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
375 | 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
|
376 | self.nickCombo.setEnabled(registered) |
2245
cbddacb4bc2e
Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2244
diff
changeset
|
377 | self.awayButton.setEnabled(registered) |
cbddacb4bc2e
Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2244
diff
changeset
|
378 | if registered: |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2758
diff
changeset
|
379 | self.awayButton.setIcon( |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
380 | UI.PixmapCache.getIcon("ircUserPresent")) |
2245
cbddacb4bc2e
Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2244
diff
changeset
|
381 | self.__away = False |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
382 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
383 | def __clearMessages(self): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
384 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
385 | 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
|
386 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
387 | self.messages.clear() |
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 | def __copyMessages(self): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
390 | """ |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2758
diff
changeset
|
391 | 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
|
392 | the clipboard. |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
393 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
394 | self.messages.copy() |
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 | def __copyAllMessages(self): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
397 | """ |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2758
diff
changeset
|
398 | 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
|
399 | the clipboard. |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
400 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
401 | txt = self.messages.toPlainText() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
402 | if txt: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
403 | cb = QApplication.clipboard() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
404 | cb.setText(txt) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
405 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
406 | def __cutAllMessages(self): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
407 | """ |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2758
diff
changeset
|
408 | 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
|
409 | the clipboard. |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
410 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
411 | txt = self.messages.toPlainText() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
412 | if txt: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
413 | cb = QApplication.clipboard() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
414 | cb.setText(txt) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
415 | self.messages.clear() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
416 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
417 | def __saveMessages(self): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
418 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
419 | 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
|
420 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
421 | 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
|
422 | if hasText: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
423 | if Utilities.isWindowsPlatform(): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
424 | htmlExtension = "htm" |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
425 | else: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
426 | 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
|
427 | 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
|
428 | self, |
3190
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
429 | 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
|
430 | "", |
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( |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2758
diff
changeset
|
432 | "HTML Files (*.{0});;Text Files (*.txt);;All Files (*)") |
3036
30c81c9e88b8
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3034
diff
changeset
|
433 | .format(htmlExtension), |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
434 | None, |
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
|
435 | EricFileDialog.DontConfirmOverwrite) |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
436 | if fname: |
9152
8a68afaf1ba2
Started replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
437 | fpath = pathlib.Path(fname) |
8a68afaf1ba2
Started replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
438 | 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
|
439 | 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
|
440 | if ex: |
9152
8a68afaf1ba2
Started replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
441 | 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
|
442 | 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
|
443 | res = EricMessageBox.yesNo( |
3020
542e97d4ecb3
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
444 | self, |
3190
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
445 | self.tr("Save Messages"), |
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
446 | self.tr("<p>The file <b>{0}</b> already exists." |
9152
8a68afaf1ba2
Started replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
447 | " Overwrite it?</p>").format(str(fpath)), |
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
|
448 | icon=EricMessageBox.Warning) |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
449 | if not res: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
450 | return |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
451 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
452 | 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
|
453 | 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
|
454 | self.messages.toHtml() |
9152
8a68afaf1ba2
Started replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
455 | if fpath.suffix.lower() in [".htm", ".html"] else |
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
|
456 | self.messages.toPlainText() |
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
|
457 | ) |
9152
8a68afaf1ba2
Started replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
458 | 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
|
459 | 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
|
460 | 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
|
461 | EricMessageBox.critical( |
3020
542e97d4ecb3
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
462 | self, |
3190
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
463 | 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
|
464 | 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
|
465 | """<p>The messages contents could not be written""" |
3034
7ce719013078
Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
466 | """ to <b>{0}</b></p><p>Reason: {1}</p>""") |
9152
8a68afaf1ba2
Started replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
467 | .format(str(fpath), str(err))) |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
468 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
469 | def __initMessagesMenu(self): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
470 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
471 | 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
|
472 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
473 | self.__messagesMenu = QMenu(self) |
7255
d595f6f9cbf8
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
474 | self.__copyMessagesAct = self.__messagesMenu.addAction( |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
475 | UI.PixmapCache.getIcon("editCopy"), |
7255
d595f6f9cbf8
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
476 | self.tr("Copy"), self.__copyMessages) |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
477 | self.__messagesMenu.addSeparator() |
7255
d595f6f9cbf8
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
478 | self.__cutAllMessagesAct = self.__messagesMenu.addAction( |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
479 | UI.PixmapCache.getIcon("editCut"), |
7255
d595f6f9cbf8
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
480 | self.tr("Cut all"), self.__cutAllMessages) |
d595f6f9cbf8
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
481 | self.__copyAllMessagesAct = self.__messagesMenu.addAction( |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
482 | UI.PixmapCache.getIcon("editCopy"), |
7255
d595f6f9cbf8
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
483 | self.tr("Copy all"), self.__copyAllMessages) |
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.__clearMessagesAct = self.__messagesMenu.addAction( |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
486 | UI.PixmapCache.getIcon("editDelete"), |
7255
d595f6f9cbf8
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
487 | self.tr("Clear"), self.__clearMessages) |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
488 | self.__messagesMenu.addSeparator() |
7255
d595f6f9cbf8
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
489 | self.__saveMessagesAct = self.__messagesMenu.addAction( |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
490 | UI.PixmapCache.getIcon("fileSave"), |
7255
d595f6f9cbf8
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
491 | self.tr("Save"), self.__saveMessages) |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
492 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
493 | self.on_messages_copyAvailable(False) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
494 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
495 | @pyqtSlot(bool) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
496 | 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
|
497 | """ |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2758
diff
changeset
|
498 | 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
|
499 | messages edit. |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
500 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
501 | @param yes flag signaling the availability of selected text (boolean) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
502 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
503 | self.__copyMessagesAct.setEnabled(yes) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
504 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
505 | @pyqtSlot(QPoint) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
506 | 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
|
507 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
508 | Private slot to show the context menu of the messages pane. |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2758
diff
changeset
|
509 | |
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2758
diff
changeset
|
510 | @param pos position the menu should be opened at (QPoint) |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
511 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
512 | 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
|
513 | self.__cutAllMessagesAct.setEnabled(enable) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
514 | self.__copyAllMessagesAct.setEnabled(enable) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
515 | self.__saveMessagesAct.setEnabled(enable) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
516 | self.__messagesMenu.popup(self.messages.mapToGlobal(pos)) |
2442
1dcfd570fa12
Fixed an issue in the IRC widget opening hyperlinks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
517 | |
1dcfd570fa12
Fixed an issue in the IRC widget opening hyperlinks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
518 | @pyqtSlot(QUrl) |
1dcfd570fa12
Fixed an issue in the IRC widget opening hyperlinks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
519 | 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
|
520 | """ |
1dcfd570fa12
Fixed an issue in the IRC widget opening hyperlinks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
521 | Private slot to open links in the default browser. |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2758
diff
changeset
|
522 | |
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2758
diff
changeset
|
523 | @param url URL to be opened (QUrl) |
2442
1dcfd570fa12
Fixed an issue in the IRC widget opening hyperlinks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
524 | """ |
1dcfd570fa12
Fixed an issue in the IRC widget opening hyperlinks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
525 | QDesktopServices.openUrl(url) |