Different sound for when initials are mentioned in a memo

This commit is contained in:
Kiooeht 2011-06-20 08:22:54 -07:00
parent 903a12010f
commit 14b812b08c
6 changed files with 24 additions and 2 deletions

View file

@ -45,6 +45,7 @@ CHANGELOG
* Show and support giving kick reasons - Kiooeht [evacipatedBox] (Idea: Lexi [lexicalNuance]) * Show and support giving kick reasons - Kiooeht [evacipatedBox] (Idea: Lexi [lexicalNuance])
* Make adding quirks into multi-page wizard - Kiooeht [evacipatedBox] * Make adding quirks into multi-page wizard - Kiooeht [evacipatedBox]
* Flash the taskbar on new messages - Kiooeht [evacipatedBox] * Flash the taskbar on new messages - Kiooeht [evacipatedBox]
* Third beep sound for when your initials are mentioned in memos - Kiooeht [evacipatedBox] (Idea: Lexi [lexicalNuance])
* Bug fixes * Bug fixes
* Logviewer updates - Kiooeht [evacipatedBox] * Logviewer updates - Kiooeht [evacipatedBox]
* Memo scrollbar thing - Kiooeht [evacipatedBox] * Memo scrollbar thing - Kiooeht [evacipatedBox]

View file

@ -13,6 +13,7 @@ Features
* MSPA update notifier option * MSPA update notifier option
* Don't animate emotes not in current tab * Don't animate emotes not in current tab
* Show true bans? * Show true bans?
* Colour saving boxes things?
Bugs Bugs
---- ----

View file

@ -315,13 +315,13 @@ class MemoText(PesterText):
if msg.count("<c") > msg.count("</c>"): if msg.count("<c") > msg.count("</c>"):
for i in range(msg.count("<c") - msg.count("</c>")): for i in range(msg.count("<c") - msg.count("</c>")):
msg = msg + "</c>" msg = msg + "</c>"
return msg return "<span style=\"color:#000000\">" + msg + "</span>"
if type(lexmsg[0]) is mecmd: if type(lexmsg[0]) is mecmd:
memsg = chum.memsg(systemColor, lexmsg, time=time.getGrammar()) memsg = chum.memsg(systemColor, lexmsg, time=time.getGrammar())
window.chatlog.log(parent.channel, memsg) window.chatlog.log(parent.channel, memsg)
self.append(convertTags(memsg)) self.append(convertTags(memsg))
else: else:
self.append("<span style=\"color:#000000\">" + makeSafe(convertTags(lexmsg)) + "</span>") self.append(makeSafe(convertTags(lexmsg)))
window.chatlog.log(parent.channel, lexmsg) window.chatlog.log(parent.channel, lexmsg)
def changeTheme(self, theme): def changeTheme(self, theme):

View file

@ -941,11 +941,14 @@ class PesterOptions(QtGui.QDialog):
self.chatsoundcheck.setChecked(self.config.chatSound()) self.chatsoundcheck.setChecked(self.config.chatSound())
self.memosoundcheck = QtGui.QCheckBox("Memo Sounds", self) self.memosoundcheck = QtGui.QCheckBox("Memo Sounds", self)
self.memosoundcheck.setChecked(self.config.memoSound()) self.memosoundcheck.setChecked(self.config.memoSound())
self.namesoundcheck = QtGui.QCheckBox("Memo Mention (initials)", self)
self.namesoundcheck.setChecked(self.config.nameSound())
if self.config.soundOn(): if self.config.soundOn():
self.soundcheck.setChecked(True) self.soundcheck.setChecked(True)
else: else:
self.chatsoundcheck.setEnabled(False) self.chatsoundcheck.setEnabled(False)
self.memosoundcheck.setEnabled(False) self.memosoundcheck.setEnabled(False)
self.namesoundcheck.setEnabled(False)
self.timestampcheck = QtGui.QCheckBox("Time Stamps", self) self.timestampcheck = QtGui.QCheckBox("Time Stamps", self)
@ -1121,6 +1124,7 @@ class PesterOptions(QtGui.QDialog):
layout_indent = QtGui.QVBoxLayout() layout_indent = QtGui.QVBoxLayout()
layout_indent.addWidget(self.chatsoundcheck) layout_indent.addWidget(self.chatsoundcheck)
layout_indent.addWidget(self.memosoundcheck) layout_indent.addWidget(self.memosoundcheck)
layout_indent.addWidget(self.namesoundcheck)
layout_indent.setContentsMargins(22,0,0,0) layout_indent.setContentsMargins(22,0,0,0)
layout_sound.addLayout(layout_indent) layout_sound.addLayout(layout_indent)
self.pages.addWidget(widget) self.pages.addWidget(widget)
@ -1182,9 +1186,11 @@ class PesterOptions(QtGui.QDialog):
if state == 0: if state == 0:
self.chatsoundcheck.setEnabled(False) self.chatsoundcheck.setEnabled(False)
self.memosoundcheck.setEnabled(False) self.memosoundcheck.setEnabled(False)
self.namesoundcheck.setEnabled(False)
else: else:
self.chatsoundcheck.setEnabled(True) self.chatsoundcheck.setEnabled(True)
self.memosoundcheck.setEnabled(True) self.memosoundcheck.setEnabled(True)
self.namesoundcheck.setEnabled(True)
class PesterUserlist(QtGui.QDialog): class PesterUserlist(QtGui.QDialog):
def __init__(self, config, theme, parent): def __init__(self, config, theme, parent):

View file

@ -503,6 +503,8 @@ class userConfig(object):
return self.config.get('chatSound', True) return self.config.get('chatSound', True)
def memoSound(self): def memoSound(self):
return self.config.get('memoSound', True) return self.config.get('memoSound', True)
def nameSound(self):
return self.config.get('nameSound', True)
def set(self, item, setting): def set(self, item, setting):
self.config[item] = setting self.config[item] = setting
try: try:
@ -1742,6 +1744,12 @@ class PesterWindow(MovingWindow):
msg = "<c=%s>%s</c>" % (systemColor.name(), msg) msg = "<c=%s>%s</c>" % (systemColor.name(), msg)
memo.addMessage(msg, handle) memo.addMessage(msg, handle)
if self.config.soundOn(): if self.config.soundOn():
if self.config.nameSound():
initials = self.userprofile.chat.initials()
search = r"\b[%s%s][%s%s]\b" % (initials[0].lower(), initials[0], initials[1].lower(), initials[1])
if re.search(search, convertTags(msg, "text")):
self.namesound.play()
return
if self.config.memoSound(): if self.config.memoSound():
self.memosound.play() self.memosound.play()
@ -1981,10 +1989,12 @@ class PesterWindow(MovingWindow):
try: try:
self.alarm = pygame.mixer.Sound(theme["main/sounds/alertsound"]) self.alarm = pygame.mixer.Sound(theme["main/sounds/alertsound"])
self.memosound = pygame.mixer.Sound(theme["main/sounds/memosound"]) self.memosound = pygame.mixer.Sound(theme["main/sounds/memosound"])
self.namesound = pygame.mixer.Sound("themes/namealarm.wav")
self.ceasesound = pygame.mixer.Sound(theme["main/sounds/ceasesound"]) self.ceasesound = pygame.mixer.Sound(theme["main/sounds/ceasesound"])
except Exception, e: except Exception, e:
self.alarm = NoneSound() self.alarm = NoneSound()
self.memosound = NoneSound() self.memosound = NoneSound()
self.namesound = NoneSound()
self.ceasesound = NoneSound() self.ceasesound = NoneSound()
def changeTheme(self, theme): def changeTheme(self, theme):
@ -2558,6 +2568,10 @@ class PesterWindow(MovingWindow):
curmemosound = self.config.memoSound() curmemosound = self.config.memoSound()
if memosoundsetting != curmemosound: if memosoundsetting != curmemosound:
self.config.set('memoSound', memosoundsetting) self.config.set('memoSound', memosoundsetting)
namesoundsetting = self.optionmenu.namesoundcheck.isChecked()
curnamesound = self.config.nameSound()
if namesoundsetting != curnamesound:
self.config.set('nameSound', namesoundsetting)
# timestamps # timestamps
timestampsetting = self.optionmenu.timestampcheck.isChecked() timestampsetting = self.optionmenu.timestampcheck.isChecked()
self.config.set("showTimeStamps", timestampsetting) self.config.set("showTimeStamps", timestampsetting)

BIN
themes/namealarm.wav Normal file

Binary file not shown.