250 def getNetworkChannels(self): |
253 def getNetworkChannels(self): |
251 """ |
254 """ |
252 Public method to get the list of channels associated with the |
255 Public method to get the list of channels associated with the |
253 selected network. |
256 selected network. |
254 |
257 |
255 @return associated channels (list of IrcChannel) |
258 @return associated channels |
|
259 @rtype list of IrcChannel |
256 """ |
260 """ |
257 networkName = self.networkCombo.currentText() |
261 networkName = self.networkCombo.currentText() |
258 network = self.__manager.getNetwork(networkName) |
262 network = self.__manager.getNetwork(networkName) |
259 return network.getChannels() |
263 return network.getChannels() |
260 |
264 |
263 def on_nickCombo_currentIndexChanged(self, nick=0): |
267 def on_nickCombo_currentIndexChanged(self, nick=0): |
264 """ |
268 """ |
265 Private slot to use another nick name. |
269 Private slot to use another nick name. |
266 |
270 |
267 @param nick index of the selected nick name (unused) |
271 @param nick index of the selected nick name (unused) |
|
272 @type int |
268 """ |
273 """ |
269 if self.__connected: |
274 if self.__connected: |
270 self.nickChanged.emit(self.nickCombo.currentText()) |
275 self.nickChanged.emit(self.nickCombo.currentText()) |
271 |
276 |
272 def getNickname(self): |
277 def getNickname(self): |
273 """ |
278 """ |
274 Public method to get the currently selected nick name. |
279 Public method to get the currently selected nick name. |
275 |
280 |
276 @return selected nick name (string) |
281 @return selected nick name |
|
282 @rtype str |
277 """ |
283 """ |
278 return self.nickCombo.currentText() |
284 return self.nickCombo.currentText() |
279 |
285 |
280 def setNickName(self, nick): |
286 def setNickName(self, nick): |
281 """ |
287 """ |
282 Public slot to set the nick name in use. |
288 Public slot to set the nick name in use. |
283 |
289 |
284 @param nick nick name in use (string) |
290 @param nick nick name in use |
|
291 @type str |
285 """ |
292 """ |
286 self.nickCombo.blockSignals(True) |
293 self.nickCombo.blockSignals(True) |
287 self.nickCombo.setEditText(nick) |
294 self.nickCombo.setEditText(nick) |
288 self.nickCombo.blockSignals(False) |
295 self.nickCombo.blockSignals(False) |
289 |
296 |
290 def addMessage(self, msg): |
297 def addMessage(self, msg): |
291 """ |
298 """ |
292 Public method to add a message. |
299 Public method to add a message. |
293 |
300 |
294 @param msg message to be added (string) |
301 @param msg message to be added |
|
302 @type str |
295 """ |
303 """ |
296 s = '<font color="{0}">{1} {2}</font>'.format( |
304 s = '<font color="{0}">{1} {2}</font>'.format( |
297 Preferences.getIrc("NetworkMessageColour"), ircTimestamp(), msg |
305 Preferences.getIrc("NetworkMessageColour"), ircTimestamp(), msg |
298 ) |
306 ) |
299 self.messages.append(s) |
307 self.messages.append(s) |
300 |
308 |
301 def addServerMessage(self, msgType, msg, filterMsg=True): |
309 def addServerMessage(self, msgType, msg, filterMsg=True): |
302 """ |
310 """ |
303 Public method to add a server message. |
311 Public method to add a server message. |
304 |
312 |
305 @param msgType txpe of the message (string) |
313 @param msgType txpe of the message |
306 @param msg message to be added (string) |
314 @type str |
307 @param filterMsg flag indicating to filter the message (boolean) |
315 @param msg message to be added |
|
316 @type str |
|
317 @param filterMsg flag indicating to filter the message |
|
318 @type bool |
308 """ |
319 """ |
309 if filterMsg: |
320 if filterMsg: |
310 msg = ircFilter(msg) |
321 msg = ircFilter(msg) |
311 s = '<font color="{0}">{1} <b>[</b>{2}<b>]</b> {3}</font>'.format( |
322 s = '<font color="{0}">{1} <b>[</b>{2}<b>]</b> {3}</font>'.format( |
312 Preferences.getIrc("ServerMessageColour"), ircTimestamp(), msgType, msg |
323 Preferences.getIrc("ServerMessageColour"), ircTimestamp(), msgType, msg |
315 |
326 |
316 def addErrorMessage(self, msgType, msg): |
327 def addErrorMessage(self, msgType, msg): |
317 """ |
328 """ |
318 Public method to add an error message. |
329 Public method to add an error message. |
319 |
330 |
320 @param msgType txpe of the message (string) |
331 @param msgType txpe of the message |
321 @param msg message to be added (string) |
332 @type str |
|
333 @param msg message to be added |
|
334 @type str |
322 """ |
335 """ |
323 s = '<font color="{0}">{1} <b>[</b>{2}<b>]</b> {3}</font>'.format( |
336 s = '<font color="{0}">{1} <b>[</b>{2}<b>]</b> {3}</font>'.format( |
324 Preferences.getIrc("ErrorMessageColour"), ircTimestamp(), msgType, msg |
337 Preferences.getIrc("ErrorMessageColour"), ircTimestamp(), msgType, msg |
325 ) |
338 ) |
326 self.messages.append(s) |
339 self.messages.append(s) |
327 |
340 |
328 def setConnected(self, connected): |
341 def setConnected(self, connected): |
329 """ |
342 """ |
330 Public slot to set the connection state. |
343 Public slot to set the connection state. |
331 |
344 |
332 @param connected flag indicating the connection state (boolean) |
345 @param connected flag indicating the connection state |
|
346 @type bool |
333 """ |
347 """ |
334 self.__connected = connected |
348 self.__connected = connected |
335 if self.__connected: |
349 if self.__connected: |
336 self.connectButton.setIcon(EricPixmapCache.getIcon("ircDisconnect")) |
350 self.connectButton.setIcon(EricPixmapCache.getIcon("ircDisconnect")) |
337 self.connectButton.setToolTip( |
351 self.connectButton.setToolTip( |
345 |
359 |
346 def isConnected(self): |
360 def isConnected(self): |
347 """ |
361 """ |
348 Public method to check, if the network is connected. |
362 Public method to check, if the network is connected. |
349 |
363 |
350 @return flag indicating a connected network (boolean) |
364 @return flag indicating a connected network |
|
365 @rtype bool |
351 """ |
366 """ |
352 return self.__connected |
367 return self.__connected |
353 |
368 |
354 def setRegistered(self, registered): |
369 def setRegistered(self, registered): |
355 """ |
370 """ |
356 Public slot to set the registered state. |
371 Public slot to set the registered state. |
357 |
372 |
358 @param registered flag indicating the registration state (boolean) |
373 @param registered flag indicating the registration state |
|
374 @type bool |
359 """ |
375 """ |
360 self.__registered = registered |
376 self.__registered = registered |
361 on = bool(self.channelCombo.currentText()) and self.__registered |
377 on = bool(self.channelCombo.currentText()) and self.__registered |
362 self.joinButton.setEnabled(on) |
378 self.joinButton.setEnabled(on) |
363 self.nickCombo.setEnabled(registered) |
379 self.nickCombo.setEnabled(registered) |
493 def on_messages_copyAvailable(self, yes): |
509 def on_messages_copyAvailable(self, yes): |
494 """ |
510 """ |
495 Private slot to react to text selection/deselection of the |
511 Private slot to react to text selection/deselection of the |
496 messages edit. |
512 messages edit. |
497 |
513 |
498 @param yes flag signaling the availability of selected text (boolean) |
514 @param yes flag signaling the availability of selected text |
|
515 @type bool |
499 """ |
516 """ |
500 self.__copyMessagesAct.setEnabled(yes) |
517 self.__copyMessagesAct.setEnabled(yes) |
501 |
518 |
502 @pyqtSlot(QPoint) |
519 @pyqtSlot(QPoint) |
503 def on_messages_customContextMenuRequested(self, pos): |
520 def on_messages_customContextMenuRequested(self, pos): |
504 """ |
521 """ |
505 Private slot to show the context menu of the messages pane. |
522 Private slot to show the context menu of the messages pane. |
506 |
523 |
507 @param pos position the menu should be opened at (QPoint) |
524 @param pos position the menu should be opened at |
|
525 @type QPoint |
508 """ |
526 """ |
509 enable = not self.messages.document().isEmpty() |
527 enable = not self.messages.document().isEmpty() |
510 self.__cutAllMessagesAct.setEnabled(enable) |
528 self.__cutAllMessagesAct.setEnabled(enable) |
511 self.__copyAllMessagesAct.setEnabled(enable) |
529 self.__copyAllMessagesAct.setEnabled(enable) |
512 self.__saveMessagesAct.setEnabled(enable) |
530 self.__saveMessagesAct.setEnabled(enable) |