Network/IRC/IrcNetworkWidget.py

changeset 6514
f11a703e4664
parent 6048
82ad8ec9548c
child 6587
a04952159050
equal deleted inserted replaced
6513:e1fcd71fbda3 6514:f11a703e4664
165 def on_awayButton_clicked(self): 165 def on_awayButton_clicked(self):
166 """ 166 """
167 Private slot to toggle the away status. 167 Private slot to toggle the away status.
168 """ 168 """
169 if self.__away: 169 if self.__away:
170 self.sendData.emit("AWAY") 170 self.handleAwayCommand("")
171 self.awayButton.setIcon(
172 UI.PixmapCache.getIcon("ircUserPresent.png"))
173 self.__away = False
174 else: 171 else:
175 networkName = self.networkCombo.currentText() 172 networkName = self.networkCombo.currentText()
176 identityName = self.__manager.getNetwork(networkName)\ 173 identityName = self.__manager.getNetwork(networkName)\
177 .getIdentityName() 174 .getIdentityName()
178 awayMessage = self.__manager.getIdentity(identityName)\ 175 awayMessage = self.__manager.getIdentity(identityName)\
179 .getAwayMessage() 176 .getAwayMessage()
177 self.handleAwayCommand(awayMessage)
178
179 @pyqtSlot(str)
180 def handleAwayCommand(self, awayMessage):
181 """
182 Public slot to process an away command.
183
184 @param awayMessage message to be set for being away
185 @type str
186 """
187 if awayMessage and not self.__away:
188 # set being away
189 # don't send away, if the status is already set
180 self.sendData.emit("AWAY :" + awayMessage) 190 self.sendData.emit("AWAY :" + awayMessage)
181 self.awayButton.setIcon(UI.PixmapCache.getIcon("ircUserAway.png")) 191 self.awayButton.setIcon(UI.PixmapCache.getIcon("ircUserAway.png"))
182 self.__away = True 192 self.__away = True
183 self.away.emit(self.__away) 193 self.away.emit(self.__away)
194 elif not awayMessage and self.__away:
195 # cancel being away
196 self.sendData.emit("AWAY")
197 self.awayButton.setIcon(
198 UI.PixmapCache.getIcon("ircUserPresent.png"))
199 self.__away = False
200 self.away.emit(self.__away)
184 201
185 @pyqtSlot() 202 @pyqtSlot()
186 def on_editButton_clicked(self): 203 def on_editButton_clicked(self):
187 """ 204 """
188 Private slot to edit a network. 205 Private slot to edit a network.

eric ide

mercurial