Different sounds for memos/pesters (though a better sound for memos is needed)

This commit is contained in:
Kiooeht 2011-04-28 02:02:15 -07:00
parent 90556079db
commit 15369b7577
13 changed files with 66 additions and 19 deletions

View file

@ -12,6 +12,7 @@ CHANGELOG
* More canon trollian theme timeline indicators - [binaryCabalist]
* By mood chum sorting - Kiooeht [evacipatedBox]
* Customizable idle time - Kiooeht [evacipatedBox]
* Different sound for memos - Kiooeht [evacipatedBox]
* Bug fixes
* Logviewer updates - Kiooeht [evacipatedBox]

View file

@ -3,7 +3,6 @@ Todo
Features
--------
* different sound for memos/pesters
* OOC
* log viewer needs to have BBCode/HTML/Text copy modes
* random pesters

View file

@ -568,11 +568,14 @@ class PesterOptions(QtGui.QDialog):
hr = QtGui.QFrame()
hr.setFrameShape(QtGui.QFrame.HLine)
hr.setFrameShadow(QtGui.QFrame.Sunken)
vr = QtGui.QFrame()
vr.setFrameShape(QtGui.QFrame.VLine)
vr.setFrameShadow(QtGui.QFrame.Sunken)
self.tabs = QtGui.QButtonGroup(self)
self.connect(self.tabs, QtCore.SIGNAL('buttonClicked(int)'),
self, QtCore.SLOT('changePage(int)'))
tabNames = ["Interface", "Chum List", "Conversations", "Logging", "Idle"]
tabNames = ["Chum List", "Conversations", "Sound", "Logging", "Idle"]
for t in tabNames:
button = QtGui.QPushButton(t)
self.tabs.addButton(button)
@ -587,8 +590,18 @@ class PesterOptions(QtGui.QDialog):
self.hideOffline.setChecked(True)
self.soundcheck = QtGui.QCheckBox("Sounds On", self)
self.connect(self.soundcheck, QtCore.SIGNAL('stateChanged(int)'),
self, QtCore.SLOT('soundChange(int)'))
self.chatsoundcheck = QtGui.QCheckBox("Pester Sounds", self)
self.chatsoundcheck.setChecked(self.config.chatSound())
self.memosoundcheck = QtGui.QCheckBox("Memo Sounds", self)
self.memosoundcheck.setChecked(self.config.memoSound())
if self.config.soundOn():
self.soundcheck.setChecked(True)
else:
self.chatsoundcheck.setEnabled(False)
self.memosoundcheck.setEnabled(False)
self.timestampcheck = QtGui.QCheckBox("Time Stamps", self)
if self.config.showTimeStamps():
@ -629,9 +642,9 @@ class PesterOptions(QtGui.QDialog):
layout_3.addWidget(sortLabel)
layout_3.addWidget(self.sortBox, 10)
self.logpesterscheck = QtGui.QCheckBox("Log all chats", self)
self.logpesterscheck = QtGui.QCheckBox("Log all Pesters", self)
self.logpesterscheck.setChecked(self.config.logPesters())
self.logmemoscheck = QtGui.QCheckBox("Log all memos", self)
self.logmemoscheck = QtGui.QCheckBox("Log all Memos", self)
self.logmemoscheck.setChecked(self.config.logMemos())
times = ["1", "5", "10", "15", "30"]
@ -654,14 +667,6 @@ class PesterOptions(QtGui.QDialog):
layout_2.addWidget(self.ok)
# Tab layouts
# Interface
widget = QtGui.QWidget()
layout_interface = QtGui.QVBoxLayout(widget)
layout_interface.setAlignment(QtCore.Qt.AlignTop)
layout_interface.addWidget(self.tabcheck)
layout_interface.addWidget(self.soundcheck)
self.pages.addWidget(widget)
# Chum List
widget = QtGui.QWidget()
layout_chumlist = QtGui.QVBoxLayout(widget)
@ -677,7 +682,7 @@ class PesterOptions(QtGui.QDialog):
widget = QtGui.QWidget()
layout_chat = QtGui.QVBoxLayout(widget)
layout_chat.setAlignment(QtCore.Qt.AlignTop)
layout_chat.addWidget(QtGui.QLabel("Time Stamps"))
layout_chat.addWidget(self.tabcheck)
layout_chat.addWidget(self.timestampcheck)
layout_chat.addWidget(self.timestampBox)
layout_chat.addWidget(self.secondscheck)
@ -687,6 +692,18 @@ class PesterOptions(QtGui.QDialog):
#layout_chat.addWidget(self.userlinkscheck)
self.pages.addWidget(widget)
# Sound
widget = QtGui.QWidget()
layout_sound = QtGui.QVBoxLayout(widget)
layout_sound.setAlignment(QtCore.Qt.AlignTop)
layout_sound.addWidget(self.soundcheck)
layout_indent = QtGui.QVBoxLayout()
layout_indent.addWidget(self.chatsoundcheck)
layout_indent.addWidget(self.memosoundcheck)
layout_indent.setContentsMargins(22,0,0,0)
layout_sound.addLayout(layout_indent)
self.pages.addWidget(widget)
# Logging
widget = QtGui.QWidget()
layout_logs = QtGui.QVBoxLayout(widget)
@ -705,6 +722,7 @@ class PesterOptions(QtGui.QDialog):
layout_0 = QtGui.QVBoxLayout()
layout_1 = QtGui.QHBoxLayout()
layout_1.addLayout(layout_4)
layout_1.addWidget(vr)
layout_1.addWidget(self.pages)
layout_0.addLayout(layout_1)
layout_0.addSpacing(30)
@ -717,6 +735,14 @@ class PesterOptions(QtGui.QDialog):
# What is this, I don't even. qt, fuck
page = -page - 2
self.pages.setCurrentIndex(page)
@QtCore.pyqtSlot(int)
def soundChange(self, state):
if state == 0:
self.chatsoundcheck.setEnabled(False)
self.memosoundcheck.setEnabled(False)
else:
self.chatsoundcheck.setEnabled(True)
self.memosoundcheck.setEnabled(True)
class PesterUserlist(QtGui.QDialog):
def __init__(self, config, theme, parent):

View file

@ -415,6 +415,10 @@ class userConfig(object):
if not self.config.has_key('soundon'):
self.set('soundon', True)
return self.config['soundon']
def chatSound(self):
return self.config.get('chatSound', True)
def memoSound(self):
return self.config.get('memoSound', True)
def set(self, item, setting):
self.config[item] = setting
try:
@ -1513,10 +1517,11 @@ class PesterWindow(MovingWindow):
convo.addMessage(msg, False)
# play sound here
if self.config.soundOn():
if msg in ["PESTERCHUM:CEASE", "PESTERCHUM:BLOCK"]:
self.ceasesound.play()
else:
self.alarm.play()
if self.config.chatSound():
if msg in ["PESTERCHUM:CEASE", "PESTERCHUM:BLOCK"]:
self.ceasesound.play()
else:
self.alarm.play()
def newMemoMsg(self, chan, handle, msg):
if not self.memos.has_key(chan):
# silently ignore in case we forgot to /part
@ -1532,7 +1537,8 @@ class PesterWindow(MovingWindow):
msg = addTimeInitial(msg, memo.times[handle].getGrammar())
memo.addMessage(msg, handle)
if self.config.soundOn():
self.alarm.play()
if self.config.memoSound():
self.memosound.play()
def changeColor(self, handle, color):
# pesterconvo and chumlist
@ -1744,13 +1750,16 @@ class PesterWindow(MovingWindow):
# sounds
if not pygame.mixer:
self.alarm = NoneSound()
self.memosound = NoneSound()
self.ceasesound = NoneSound()
else:
try:
self.alarm = pygame.mixer.Sound(theme["main/sounds/alertsound"])
self.memosound = pygame.mixer.Sound(theme["main/sounds/memosound"])
self.ceasesound = pygame.mixer.Sound(theme["main/sounds/ceasesound"])
except Exception, e:
self.alarm = NoneSound()
self.memosound = NoneSound()
self.ceasesound = NoneSound()
def changeTheme(self, theme):
@ -2266,6 +2275,14 @@ class PesterWindow(MovingWindow):
# sound
soundsetting = self.optionmenu.soundcheck.isChecked()
self.config.set("soundon", soundsetting)
chatsoundsetting = self.optionmenu.chatsoundcheck.isChecked()
curchatsound = self.config.chatSound()
if chatsoundsetting != curchatsound:
self.config.set('chatSound', chatsoundsetting)
memosoundsetting = self.optionmenu.memosoundcheck.isChecked()
curmemosound = self.config.memoSound()
if memosoundsetting != curmemosound:
self.config.set('memoSound', memosoundsetting)
# timestamps
timestampsetting = self.optionmenu.timestampcheck.isChecked()
self.config.set("showTimeStamps", timestampsetting)

BIN
themes/gold/alarm2.wav Normal file

Binary file not shown.

View file

@ -16,6 +16,7 @@
"loc": [150,22]
},
"sounds": { "alertsound": "$path/alarm.wav",
"memosound": "$path/alarm2.wav",
"ceasesound": "$path/cease.wav" },
"menus": {"client": {"_name": "Client",
"options": "Options",

Binary file not shown.

View file

@ -16,6 +16,7 @@
"loc": [10,0]
},
"sounds": { "alertsound": "$path/alarm.wav",
"memosound": "$path/alarm2.wav",
"ceasesound": "$path/cease.wav" },
"menus": {"client": {"_name": "CLIENT",
"options": "OPTIONS",

Binary file not shown.

View file

@ -15,7 +15,8 @@
"menuitem": "margin-right:14px;",
"loc": [14,90]
},
"sounds": { "alertsound": "$path/alarm.wav" },
"sounds": { "alertsound": "$path/alarm.wav",
"memosound": "$path/alarm2.wav"},
"menus": {"client": {"_name": "Trollian",
"options": "Options",
"memos": "Memos",

Binary file not shown.

Binary file not shown.

View file

@ -16,6 +16,7 @@
"loc": [43,220]
},
"sounds": { "alertsound": "$path/alarm.wav",
"memosound": "$path/alarm2.wav",
"ceasesound": "$path/cease.wav" },
"menus": {"client": {"_name": "Typewriter",
"options": "Preferences",