src/eric7/Network/IRC/IrcNetworkWidget.py

branch
eric7
changeset 9413
80c06d472826
parent 9221
bf71ee032bb4
child 9473
3f23dbf37dbe
equal deleted inserted replaced
9412:45e7bb09c120 9413:80c06d472826
11 11
12 from PyQt6.QtCore import pyqtSlot, pyqtSignal, QPoint, QUrl, QThread 12 from PyQt6.QtCore import pyqtSlot, pyqtSignal, QPoint, QUrl, QThread
13 from PyQt6.QtGui import QDesktopServices 13 from PyQt6.QtGui import QDesktopServices
14 from PyQt6.QtWidgets import QWidget, QApplication, QMenu 14 from PyQt6.QtWidgets import QWidget, QApplication, QMenu
15 15
16 from EricWidgets import EricMessageBox, EricFileDialog 16 from eric7.EricWidgets import EricMessageBox, EricFileDialog
17 from EricWidgets.EricApplication import ericApp 17 from eric7.EricWidgets.EricApplication import ericApp
18 18
19 from .Ui_IrcNetworkWidget import Ui_IrcNetworkWidget 19 from .Ui_IrcNetworkWidget import Ui_IrcNetworkWidget
20 20
21 from .IrcUtilities import ircFilter, ircTimestamp 21 from .IrcUtilities import ircFilter, ircTimestamp
22 22
23 import UI.PixmapCache 23 from eric7.EricGui import EricPixmapCache
24 import Preferences 24 from eric7 import Preferences, Utilities
25 import Utilities
26 25
27 26
28 class IrcNetworkWidget(QWidget, Ui_IrcNetworkWidget): 27 class IrcNetworkWidget(QWidget, Ui_IrcNetworkWidget):
29 """ 28 """
30 Class implementing the network part of the IRC widget. 29 Class implementing the network part of the IRC widget.
54 @param parent reference to the parent widget (QWidget) 53 @param parent reference to the parent widget (QWidget)
55 """ 54 """
56 super().__init__(parent) 55 super().__init__(parent)
57 self.setupUi(self) 56 self.setupUi(self)
58 57
59 self.connectButton.setIcon(UI.PixmapCache.getIcon("ircConnect")) 58 self.connectButton.setIcon(EricPixmapCache.getIcon("ircConnect"))
60 self.editButton.setIcon(UI.PixmapCache.getIcon("ircConfigure")) 59 self.editButton.setIcon(EricPixmapCache.getIcon("ircConfigure"))
61 self.joinButton.setIcon(UI.PixmapCache.getIcon("ircJoinChannel")) 60 self.joinButton.setIcon(EricPixmapCache.getIcon("ircJoinChannel"))
62 self.awayButton.setIcon(UI.PixmapCache.getIcon("ircUserPresent")) 61 self.awayButton.setIcon(EricPixmapCache.getIcon("ircUserPresent"))
63 62
64 self.joinButton.setEnabled(False) 63 self.joinButton.setEnabled(False)
65 self.nickCombo.setEnabled(False) 64 self.nickCombo.setEnabled(False)
66 self.awayButton.setEnabled(False) 65 self.awayButton.setEnabled(False)
67 66
189 """ 188 """
190 if awayMessage and not self.__away: 189 if awayMessage and not self.__away:
191 # set being away 190 # set being away
192 # don't send away, if the status is already set 191 # don't send away, if the status is already set
193 self.sendData.emit("AWAY :" + awayMessage) 192 self.sendData.emit("AWAY :" + awayMessage)
194 self.awayButton.setIcon(UI.PixmapCache.getIcon("ircUserAway")) 193 self.awayButton.setIcon(EricPixmapCache.getIcon("ircUserAway"))
195 self.__away = True 194 self.__away = True
196 self.away.emit(self.__away) 195 self.away.emit(self.__away)
197 elif not awayMessage and self.__away: 196 elif not awayMessage and self.__away:
198 # cancel being away 197 # cancel being away
199 self.sendData.emit("AWAY") 198 self.sendData.emit("AWAY")
200 self.awayButton.setIcon(UI.PixmapCache.getIcon("ircUserPresent")) 199 self.awayButton.setIcon(EricPixmapCache.getIcon("ircUserPresent"))
201 self.__away = False 200 self.__away = False
202 self.away.emit(self.__away) 201 self.away.emit(self.__away)
203 202
204 @pyqtSlot() 203 @pyqtSlot()
205 def on_editButton_clicked(self): 204 def on_editButton_clicked(self):
333 332
334 @param connected flag indicating the connection state (boolean) 333 @param connected flag indicating the connection state (boolean)
335 """ 334 """
336 self.__connected = connected 335 self.__connected = connected
337 if self.__connected: 336 if self.__connected:
338 self.connectButton.setIcon(UI.PixmapCache.getIcon("ircDisconnect")) 337 self.connectButton.setIcon(EricPixmapCache.getIcon("ircDisconnect"))
339 self.connectButton.setToolTip( 338 self.connectButton.setToolTip(
340 self.tr("Press to disconnect from the network") 339 self.tr("Press to disconnect from the network")
341 ) 340 )
342 else: 341 else:
343 self.connectButton.setIcon(UI.PixmapCache.getIcon("ircConnect")) 342 self.connectButton.setIcon(EricPixmapCache.getIcon("ircConnect"))
344 self.connectButton.setToolTip( 343 self.connectButton.setToolTip(
345 self.tr("Press to connect to the selected network") 344 self.tr("Press to connect to the selected network")
346 ) 345 )
347 346
348 def isConnected(self): 347 def isConnected(self):
363 on = bool(self.channelCombo.currentText()) and self.__registered 362 on = bool(self.channelCombo.currentText()) and self.__registered
364 self.joinButton.setEnabled(on) 363 self.joinButton.setEnabled(on)
365 self.nickCombo.setEnabled(registered) 364 self.nickCombo.setEnabled(registered)
366 self.awayButton.setEnabled(registered) 365 self.awayButton.setEnabled(registered)
367 if registered: 366 if registered:
368 self.awayButton.setIcon(UI.PixmapCache.getIcon("ircUserPresent")) 367 self.awayButton.setIcon(EricPixmapCache.getIcon("ircUserPresent"))
369 self.__away = False 368 self.__away = False
370 369
371 def __clearMessages(self): 370 def __clearMessages(self):
372 """ 371 """
373 Private slot to clear the contents of the messages display. 372 Private slot to clear the contents of the messages display.
463 """ 462 """
464 Private slot to initialize the context menu of the messages pane. 463 Private slot to initialize the context menu of the messages pane.
465 """ 464 """
466 self.__messagesMenu = QMenu(self) 465 self.__messagesMenu = QMenu(self)
467 self.__copyMessagesAct = self.__messagesMenu.addAction( 466 self.__copyMessagesAct = self.__messagesMenu.addAction(
468 UI.PixmapCache.getIcon("editCopy"), self.tr("Copy"), self.__copyMessages 467 EricPixmapCache.getIcon("editCopy"), self.tr("Copy"), self.__copyMessages
469 ) 468 )
470 self.__messagesMenu.addSeparator() 469 self.__messagesMenu.addSeparator()
471 self.__cutAllMessagesAct = self.__messagesMenu.addAction( 470 self.__cutAllMessagesAct = self.__messagesMenu.addAction(
472 UI.PixmapCache.getIcon("editCut"), self.tr("Cut all"), self.__cutAllMessages 471 EricPixmapCache.getIcon("editCut"),
472 self.tr("Cut all"),
473 self.__cutAllMessages,
473 ) 474 )
474 self.__copyAllMessagesAct = self.__messagesMenu.addAction( 475 self.__copyAllMessagesAct = self.__messagesMenu.addAction(
475 UI.PixmapCache.getIcon("editCopy"), 476 EricPixmapCache.getIcon("editCopy"),
476 self.tr("Copy all"), 477 self.tr("Copy all"),
477 self.__copyAllMessages, 478 self.__copyAllMessages,
478 ) 479 )
479 self.__messagesMenu.addSeparator() 480 self.__messagesMenu.addSeparator()
480 self.__clearMessagesAct = self.__messagesMenu.addAction( 481 self.__clearMessagesAct = self.__messagesMenu.addAction(
481 UI.PixmapCache.getIcon("editDelete"), self.tr("Clear"), self.__clearMessages 482 EricPixmapCache.getIcon("editDelete"),
483 self.tr("Clear"),
484 self.__clearMessages,
482 ) 485 )
483 self.__messagesMenu.addSeparator() 486 self.__messagesMenu.addSeparator()
484 self.__saveMessagesAct = self.__messagesMenu.addAction( 487 self.__saveMessagesAct = self.__messagesMenu.addAction(
485 UI.PixmapCache.getIcon("fileSave"), self.tr("Save"), self.__saveMessages 488 EricPixmapCache.getIcon("fileSave"), self.tr("Save"), self.__saveMessages
486 ) 489 )
487 490
488 self.on_messages_copyAvailable(False) 491 self.on_messages_copyAvailable(False)
489 492
490 @pyqtSlot(bool) 493 @pyqtSlot(bool)

eric ide

mercurial