diff -r 3733e2b23cf7 -r a071d4065202 src/eric7/Network/IRC/IrcChannelWidget.py --- a/src/eric7/Network/IRC/IrcChannelWidget.py Wed Dec 20 11:06:38 2023 +0100 +++ b/src/eric7/Network/IRC/IrcChannelWidget.py Wed Dec 20 14:58:58 2023 +0100 @@ -66,9 +66,10 @@ """ Constructor - @param name string with user name and privilege prefix (string) - @param parent reference to the parent widget (QListWidget or - QListWidgetItem) + @param name string with user name and privilege prefix + @type str + @param parent reference to the parent widget + @type QListWidget or QListWidgetItem """ super().__init__(name, parent) @@ -83,7 +84,8 @@ """ Public method to get the user name. - @return user name (string) + @return user name + @rtype str """ return self.__name @@ -91,7 +93,8 @@ """ Public method to set a new nick name. - @param name new nick name for the user (string) + @param name new nick name for the user + @type str """ self.__name = name self.__setText() @@ -100,7 +103,8 @@ """ Public method to set or unset a user privilege. - @param privilege privilege to set or unset (string) + @param privilege privilege to set or unset + @type str """ oper = privilege[0] priv = privilege[1] @@ -158,8 +162,10 @@ """ Private method to convert an icon to an away icon. - @param icon icon to be converted (QIcon) - @return away icon (QIcon) + @param icon icon to be converted + @type QIcon + @return away icon + @rtype QIcon """ pix1 = icon.pixmap(16, 16) pix2 = EricPixmapCache.getPixmap("ircAway") @@ -172,7 +178,8 @@ """ Public method to parse the user flags reported by a WHO command. - @param flags user flags as reported by WHO (string) + @param flags user flags as reported by WHO + @type str """ # H The user is not away. # G The user is set away. @@ -196,7 +203,8 @@ """ Public method to check, if the user is allowed to change the topic. - @return flag indicating that the topic can be changed (boolean) + @return flag indicating that the topic can be changed + @rtype bool """ return ( bool(self.__privilege & IrcUserItem.Operator) @@ -262,7 +270,8 @@ """ Constructor - @param parent reference to the parent widget (QWidget) + @param parent reference to the parent widget + @type QWidget """ super().__init__(parent) self.setupUi(self) @@ -573,7 +582,8 @@ """ Public method to get the name of the channel. - @return name of the channel (string) + @return name of the channel + @rtype str """ return self.__name @@ -581,7 +591,8 @@ """ Public method to set the name of the channel. - @param name of the channel (string) + @param name of the channel + @type str """ self.__name = name @@ -589,7 +600,8 @@ """ Public method to get the users count of the channel. - @return users count of the channel (integer) + @return users count of the channel + @rtype int """ return self.usersList.count() @@ -597,7 +609,8 @@ """ Public method to get the nick name of the user. - @return nick name of the user (string) + @return nick name of the user + @rtype str """ return self.__userName @@ -605,7 +618,8 @@ """ Public method to set the user name for the channel. - @param name user name for the channel (string) + @param name user name for the channel + @type str """ self.__userName = name @@ -613,7 +627,8 @@ """ Public method to get the part message. - @return part message (string) + @return part message + @rtype str """ return self.__partMessage @@ -621,7 +636,8 @@ """ Public method to set the part message. - @param message message to be used for PART messages (string) + @param message message to be used for PART messages + @type str """ self.__partMessage = message @@ -629,8 +645,10 @@ """ Public method to set the private chat mode. - @param private flag indicating private chat mode (boolean) - @param partner name of the partner user (string) + @param private flag indicating private chat mode + @type bool + @param partner name of the partner user + @type str """ self.__private = private self.__privatePartner = partner @@ -640,7 +658,8 @@ """ Public method to set some info text for private chat mode. - @param infoText info text to be shown (string) + @param infoText info text to be shown + @type str """ if self.__private: self.topicLabel.setText(infoText) @@ -649,8 +668,10 @@ """ Public method to handle the message sent by the server. - @param line server message (string) - @return flag indicating, if the message was handled (boolean) + @param line server message + @type str + @return flag indicating, if the message was handled + @rtype bool """ for patternRe, patternFunc in self.__patterns: match = patternRe.match(line) @@ -664,7 +685,9 @@ Private method to handle messages to the channel. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ # group(1) sender user name # group(2) sender user@host @@ -691,8 +714,10 @@ """ Public method to add a message from external. - @param sender nick name of the sender (string) - @param msg message received from sender (string) + @param sender nick name of the sender + @type str + @param msg message received from sender + @type str """ self.__appendMessage( '<font color="{0}">{2} <b><</b><font color="{1}">{3}</font>' @@ -721,7 +746,8 @@ """ Public method to add users to the channel. - @param users list of user names to add (list of string) + @param users list of user names to add + @type list of str """ for user in users: itm = self.__findUser(user) @@ -733,7 +759,9 @@ Private method to handle a user joining the channel. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ if match.group(3).lower() == self.__name.lower(): if self.__userName != match.group(1): @@ -762,7 +790,9 @@ Private method to handle a user leaving the channel. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ if match.group(2).lower() == self.__name.lower(): itm = self.__findUser(match.group(1)) @@ -795,7 +825,9 @@ Private method to handle a user logging off the server. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ itm = self.__findUser(match.group(1)) if itm: @@ -824,7 +856,9 @@ Private method to handle a nickname change of a user. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ itm = self.__findUser(match.group(1)) if itm: @@ -851,7 +885,9 @@ Private method to handle the receipt of a list of users of the channel. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ if match.group(1).lower() == self.__name.lower(): users = match.group(2).split() @@ -873,7 +909,9 @@ Private method to handle a topic change of the channel. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ if match.group(1).lower() == self.__name.lower(): self.__addManagementMessage( @@ -889,7 +927,9 @@ Private method to handle a topic change of the channel. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ if match.group(1).lower() == self.__name.lower(): self.topicLabel.setText(match.group(2)) @@ -908,7 +948,9 @@ Private method to handle a topic created message. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ if match.group(1).lower() == self.__name.lower(): self.__addManagementMessage( @@ -929,7 +971,9 @@ Private method to handle a channel URL message. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ if match.group(1).lower() == self.__name.lower(): self.__addManagementMessage( @@ -945,7 +989,9 @@ Private method to handle a message reporting the channel modes. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ if match.group(1).lower() == self.__name.lower(): modesDict = getChannelModesDict() @@ -980,7 +1026,9 @@ Private method to handle a channel created message. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ if match.group(1).lower() == self.__name.lower(): self.__addManagementMessage( @@ -1000,7 +1048,9 @@ Private method to handle a message reporting the channel modes. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ # group(1) user or server # group(2) channel @@ -1158,7 +1208,9 @@ Private method to handle a change of user privileges for the channel. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ if match.group(2).lower() == self.__name.lower(): itm = self.__findUser(match.group(4)) @@ -1180,7 +1232,9 @@ Private method to handle a channel message we are not interested in. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ if match.group(1).lower() == self.__name.lower(): return True @@ -1192,7 +1246,9 @@ Private method to handle a help message. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ self.__addManagementMessage( self.tr("Help"), "{0} {1}".format(match.group(1), ircFilter(match.group(2))) @@ -1204,7 +1260,9 @@ Private method to handle a CTCP channel command. @param match reference to the match object - @return flag indicating, if the message was handled (boolean) + @type re.Match + @return flag indicating, if the message was handled + @rtype bool """ # group(1) sender user name # group(2) sender user@host @@ -1260,6 +1318,7 @@ Public method to set the user privilege to prefix mapping. @param prefixes dictionary with privilege as key and prefix as value + @type dict """ self.__prefixToPrivilege = {} for privilege, prefix in prefixes.items(): @@ -1270,8 +1329,10 @@ """ Private method to find the user in the list of users. - @param name user name to search for (string) - @return reference to the list entry (QListWidgetItem) + @param name user name to search for + @type str + @return reference to the list entry + @rtype QListWidgetItem """ for row in range(self.usersList.count()): itm = self.usersList.item(row) @@ -1284,8 +1345,10 @@ """ Private method to extract the user privileges out of the name. - @param name user name and prefixes (string) - @return list of privileges and user name (list of string, string) + @param name user name and prefixes + @type str + @return tuple containing a list of privileges and user name + @rtype tuple of (list of str, str) """ privileges = [] while name[0] in self.__prefixToPrivilege: @@ -1301,8 +1364,10 @@ """ Private method to add a channel management message to the list. - @param indicator indicator to be shown (string) - @param message message to be shown (string) + @param indicator indicator to be shown + @type str + @param message message to be shown + @type str """ if indicator == self.JoinIndicator: color = Preferences.getIrc("JoinChannelColour") @@ -1320,7 +1385,8 @@ """ Private slot to append a message. - @param message message to be appended (string) + @param message message to be appended + @type str """ if ( self.__hidden @@ -1496,7 +1562,8 @@ Private slot to react to text selection/deselection of the messages edit. - @param yes flag signaling the availability of selected text (boolean) + @param yes flag signaling the availability of selected text + @type bool """ self.__copyMessagesAct.setEnabled(yes) @@ -1505,7 +1572,8 @@ """ Private slot to show the context menu of the messages pane. - @param pos the position of the mouse pointer (QPoint) + @param pos the position of the mouse pointer + @type QPoint """ enable = not self.messages.document().isEmpty() self.__cutAllMessagesAct.setEnabled(enable) @@ -1628,7 +1696,8 @@ """ Private slot to show the context menu of the users list. - @param pos the position of the mouse pointer (QPoint) + @param pos the position of the mouse pointer + @type QPoint """ enable = len(self.usersList.selectedItems()) > 0 enablePrivate = enable and not self.__private @@ -1649,7 +1718,8 @@ """ Protected method handling hide events. - @param evt reference to the hide event (QHideEvent) + @param evt reference to the hide event + @type QHideEvent """ self.__hidden = True @@ -1657,7 +1727,8 @@ """ Protected method handling show events. - @param evt reference to the show event (QShowEvent) + @param evt reference to the show event + @type QShowEvent """ self.__hidden = False @@ -1686,7 +1757,9 @@ requested automatically. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ # group(1) nick # group(2) user flags @@ -1703,7 +1776,9 @@ Private method to handle the end of the WHO list. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ if match.group(1).lower() == self.__name.lower(): if self.__autoWhoRequested: @@ -1724,7 +1799,9 @@ requested manually. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ # group(1) channel # group(2) user @@ -1749,7 +1826,9 @@ Private method to handle the WHOIS user reply. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ # group(1) nick # group(2) user @@ -1772,7 +1851,9 @@ Private method to handle the WHOIS channels reply. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ # group(1) nick # group(2) channels @@ -1856,7 +1937,9 @@ Private method to handle the WHOIS server reply. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ # group(1) nick # group(2) server @@ -1877,7 +1960,9 @@ Private method to handle the WHOIS operator reply. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ # group(1) nick # group(2) message @@ -1900,7 +1985,9 @@ Private method to handle the WHOIS idle reply. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ # group(1) nick # group(2) idle seconds @@ -1981,7 +2068,9 @@ Private method to handle the end of WHOIS reply. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ # group(1) nick # group(2) end message @@ -2000,7 +2089,9 @@ Private method to handle the WHOIS identify and identified replies. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ # group(1) nick # group(2) identified message @@ -2018,7 +2109,9 @@ Private method to handle the WHOIS helper reply. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ # group(1) nick # group(2) helper message @@ -2036,7 +2129,9 @@ Private method to handle the WHOIS account reply. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ # group(1) nick # group(2) login name @@ -2056,7 +2151,9 @@ Private method to handle the WHOIS actually reply. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ # group(1) nick # group(2) actual user@host @@ -2077,7 +2174,9 @@ Private method to handle the WHOIS secure reply. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ # group(1) nick if match.group(1) == self.__whoIsNick: @@ -2094,7 +2193,9 @@ Private method to handle the WHOIS connection reply. @param match match object that matched the pattern - @return flag indicating whether the message was handled (boolean) + @type re.Match + @return flag indicating whether the message was handled + @rtype bool """ # group(1) nick # group(2) host name @@ -2138,6 +2239,7 @@ """ Private slot to open links in the default browser. - @param url URL to be opened (QUrl) + @param url URL to be opened + @type QUrl """ QDesktopServices.openUrl(url)