Cooperation/ChatWidget.py

changeset 3021
801289962f4e
parent 3020
542e97d4ecb3
child 3032
927a2f8b3669
child 3058
0a02c433f52d
equal deleted inserted replaced
3020:542e97d4ecb3 3021:801289962f4e
184 if not self.isVisible(): 184 if not self.isVisible():
185 self.__ui.showNotification( 185 self.__ui.showNotification(
186 UI.PixmapCache.getPixmap("cooperation48.png"), 186 UI.PixmapCache.getPixmap("cooperation48.png"),
187 self.trUtf8("New User"), self.trUtf8("{0} has joined.") 187 self.trUtf8("New User"), self.trUtf8("{0} has joined.")
188 .format(nick)) 188 .format(nick))
189
189 def __participantLeft(self, nick): 190 def __participantLeft(self, nick):
190 """ 191 """
191 Private slot handling a participant leaving the session. 192 Private slot handling a participant leaving the session.
192 193
193 @param nick nick name of the participant (string) 194 @param nick nick name of the participant (string)
226 """ 227 """
227 if from_ == "" or message == "": 228 if from_ == "" or message == "":
228 return 229 return
229 230
230 self.chatEdit.append( 231 self.chatEdit.append(
231 QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + \ 232 QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) +
232 " <" + from_ + ">:") 233 " <" + from_ + ">:")
233 self.chatEdit.append(message + "\n") 234 self.chatEdit.append(message + "\n")
234 bar = self.chatEdit.verticalScrollBar() 235 bar = self.chatEdit.verticalScrollBar()
235 bar.setValue(bar.maximum()) 236 bar.setValue(bar.maximum())
236 237
300 """ 301 """
301 if self.__client.isListening(): 302 if self.__client.isListening():
302 self.__client.close() 303 self.__client.close()
303 self.serverButton.setText(self.trUtf8("Start Server")) 304 self.serverButton.setText(self.trUtf8("Start Server"))
304 self.serverPortSpin.setEnabled(True) 305 self.serverPortSpin.setEnabled(True)
305 if (self.serverPortSpin.value() != 306 if (self.serverPortSpin.value() !=
306 Preferences.getCooperation("ServerPort")): 307 Preferences.getCooperation("ServerPort")):
307 self.serverPortSpin.setValue( 308 self.serverPortSpin.setValue(
308 Preferences.getCooperation("ServerPort")) 309 Preferences.getCooperation("ServerPort"))
309 self.serverLed.setColor(QColor(Qt.red)) 310 self.serverLed.setColor(QColor(Qt.red))
310 else: 311 else:
316 self.serverPortSpin.setEnabled(False) 317 self.serverPortSpin.setEnabled(False)
317 self.serverLed.setColor(QColor(Qt.green)) 318 self.serverLed.setColor(QColor(Qt.green))
318 else: 319 else:
319 self.__showErrorMessage( 320 self.__showErrorMessage(
320 self.trUtf8("! Server Error: {0}\n").format( 321 self.trUtf8("! Server Error: {0}\n").format(
321 self.__client.errorString()) 322 self.__client.errorString())
322 ) 323 )
323 324
324 def __setConnected(self, connected): 325 def __setConnected(self, connected):
325 """ 326 """
326 Private slot to set the connected state. 327 Private slot to set the connected state.
584 self, 585 self,
585 self.trUtf8("Error saving Chat"), 586 self.trUtf8("Error saving Chat"),
586 self.trUtf8("""<p>The chat contents could not be""" 587 self.trUtf8("""<p>The chat contents could not be"""
587 """ written to <b>{0}</b></p>""" 588 """ written to <b>{0}</b></p>"""
588 """<p>Reason: {1}</p>""") .format( 589 """<p>Reason: {1}</p>""") .format(
589 fname, str(err))) 590 fname, str(err)))
590 591
591 def __copyChat(self): 592 def __copyChat(self):
592 """ 593 """
593 Private slot to copy the contents of the chat display to the clipboard. 594 Private slot to copy the contents of the chat display to the clipboard.
594 """ 595 """
688 self.chatEdit.append( 689 self.chatEdit.append(
689 QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + 690 QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) +
690 ":") 691 ":")
691 self.chatEdit.append( 692 self.chatEdit.append(
692 self.trUtf8("* {0} has been banned and kicked.\n") 693 self.trUtf8("* {0} has been banned and kicked.\n")
693 .format( itm.text().split("@")[0])) 694 .format(itm.text().split("@")[0]))
694 self.chatEdit.setTextColor(color) 695 self.chatEdit.setTextColor(color)
695 696
696 def shutdown(self): 697 def shutdown(self):
697 """ 698 """
698 Public method to shut down the cooperation system. 699 Public method to shut down the cooperation system.

eric ide

mercurial