Session mute and buffer mute has been added to their keyboard shorcuts

This commit is contained in:
Manuel Cortez 2015-03-11 17:17:29 -06:00
parent 4613b7ada1
commit d4fc809169
9 changed files with 33 additions and 16 deletions

View File

@ -16,7 +16,7 @@ announce_stream_status = boolean(default=True)
volume = float(default=1.0) volume = float(default=1.0)
input_device = string(default="Default") input_device = string(default="Default")
output_device = string(default="Default") output_device = string(default="Default")
global_mute = boolean(default=False) session_mute = boolean(default=False)
current_soundpack = string(default="default") current_soundpack = string(default="default")
sndup_api_key = string(default="") sndup_api_key = string(default="")

View File

@ -48,8 +48,8 @@ repeat_item = string(default="control+win+space")
copy_to_clipboard = string(default="control+win+c") copy_to_clipboard = string(default="control+win+c")
add_to_list = string(default="control+win+a") add_to_list = string(default="control+win+a")
remove_from_list = string(default="control+win+shift+a") remove_from_list = string(default="control+win+shift+a")
toggle_mute = string(default="control+win+shift+m") toggle_buffer_mute = string(default="control+win+shift+m")
toggle_global_mute = string(default="alt+win+m") toggle_session_mute = string(default="alt+win+m")
toggle_autoread = string(default="control+win+e") toggle_autoread = string(default="control+win+e")
search = string(default="control+win+-") search = string(default="control+win+-")
edit_keystrokes = string(default="control+win+k") edit_keystrokes = string(default="control+win+k")

View File

@ -285,7 +285,7 @@ class baseBufferController(bufferController):
self.buffer.list.insert_item(False, *tweet) self.buffer.list.insert_item(False, *tweet)
else: else:
self.buffer.list.insert_item(True, *tweet) self.buffer.list.insert_item(True, *tweet)
if self.name in self.session.settings["other_buffers"]["autoread_buffers"] and self.session.settings["sound"]["global_mute"] == False: if self.name in self.session.settings["other_buffers"]["autoread_buffers"] and self.name not in self.session.settings["other_buffers"]["muted_buffers"] and self.session.settings["sound"]["session_mute"] == False:
output.speak(" ".join(tweet[:2])) output.speak(" ".join(tweet[:2]))
def bind_events(self): def bind_events(self):
@ -454,7 +454,7 @@ class eventsBufferController(bufferController):
self.buffer.list.insert_item(False, *tweet) self.buffer.list.insert_item(False, *tweet)
else: else:
self.buffer.list.insert_item(True, *tweet) self.buffer.list.insert_item(True, *tweet)
if self.name in self.session.settings["other_buffers"]["autoread_buffers"] and self.session.settings["sound"]["global_mute"] == False: if self.name in self.session.settings["other_buffers"]["autoread_buffers"] and self.name not in self.session.settings["other_buffers"]["muted_buffers"] and self.session.settings["sound"]["session_mute"] == False:
output.speak(" ".join(tweet)) output.speak(" ".join(tweet))
def clear_list(self): def clear_list(self):
@ -547,7 +547,7 @@ class peopleBufferController(baseBufferController):
self.buffer.list.insert_item(False, *tweet) self.buffer.list.insert_item(False, *tweet)
else: else:
self.buffer.list.insert_item(True, *tweet) self.buffer.list.insert_item(True, *tweet)
if self.name in self.session.settings["other_buffers"]["autoread_buffers"] and self.session.settings["sound"]["global_mute"] == False: if self.name in self.session.settings["other_buffers"]["autoread_buffers"] and self.name not in self.session.settings["other_buffers"]["muted_buffers"] and self.session.settings["sound"]["session_mute"] == False:
output.speak(" ".join(tweet)) output.speak(" ".join(tweet))
def clear_list(self): def clear_list(self):

View File

@ -899,7 +899,7 @@ class Controller(object):
pass pass
def notify(self, session, play_sound=None, message=None, notification=False): def notify(self, session, play_sound=None, message=None, notification=False):
if session.settings["sound"]["global_mute"] == True: return if session.settings["sound"]["session_mute"] == True: return
if play_sound != None: if play_sound != None:
session.sound.play(play_sound) session.sound.play(play_sound)
if message != None: if message != None:
@ -1097,5 +1097,24 @@ class Controller(object):
buffer.session.settings["other_buffers"]["autoread_buffers"].remove(buffer.name) buffer.session.settings["other_buffers"]["autoread_buffers"].remove(buffer.name)
output.speak(_(u"The auto-reading of new tweets is disabled for this buffer")) output.speak(_(u"The auto-reading of new tweets is disabled for this buffer"))
def toggle_session_mute(self, *args, **kwargs):
buffer = self.get_best_buffer()
if buffer.session.settings["sound"]["session_mute"] == False:
buffer.session.settings["sound"]["session_mute"] = True
output.speak(_(u"Session mute on"))
elif buffer.session.settings["sound"]["session_mute"] == True:
buffer.session.settings["sound"]["session_mute"] = False
output.speak(_(u"Global mute off"))
def toggle_buffer_mute(self, *args, **kwargs):
buffer = self.get_current_buffer()
if hasattr(buffer, "session") and buffer.session == None: return
if buffer.name not in buffer.session.settings["other_buffers"]["muted_buffers"]:
buffer.session.settings["other_buffers"]["muted_buffers"].append(buffer.name)
output.speak(_(u"Buffer mute on"))
elif buffer.name in buffer.session.settings["other_buffers"]["muted_buffers"]:
buffer.session.settings["other_buffers"]["muted_buffers"].remove(buffer.name)
output.speak(_(u"Buffer mute off"))
def __del__(self): def __del__(self):
config.app.write() config.app.write()

View File

@ -82,7 +82,7 @@ class accountSettingsController(globalSettingsController):
self.dialog.set_value("sound", "volumeCtrl", self.config["sound"]["volume"]*100) self.dialog.set_value("sound", "volumeCtrl", self.config["sound"]["volume"]*100)
self.dialog.set_value("sound", "input", self.config["sound"]["input_device"]) self.dialog.set_value("sound", "input", self.config["sound"]["input_device"])
self.dialog.set_value("sound", "output", self.config["sound"]["output_device"]) self.dialog.set_value("sound", "output", self.config["sound"]["output_device"])
self.dialog.set_value("sound", "global_mute", self.config["sound"]["global_mute"]) self.dialog.set_value("sound", "session_mute", self.config["sound"]["session_mute"])
self.dialog.set_value("sound", "soundpack", self.config["sound"]["current_soundpack"]) self.dialog.set_value("sound", "soundpack", self.config["sound"]["current_soundpack"])
self.dialog.create_audio_services() self.dialog.create_audio_services()
if self.config["services"]["dropbox_token"] == "": if self.config["services"]["dropbox_token"] == "":
@ -135,7 +135,7 @@ class accountSettingsController(globalSettingsController):
except: except:
self.config["sound"]["output_device"] = "default" self.config["sound"]["output_device"] = "default"
self.config["sound"]["volume"] = self.dialog.get_value("sound", "volumeCtrl")/100.0 self.config["sound"]["volume"] = self.dialog.get_value("sound", "volumeCtrl")/100.0
self.config["sound"]["global_mute"] = self.dialog.get_value("sound", "global_mute") self.config["sound"]["session_mute"] = self.dialog.get_value("sound", "session_mute")
self.config["sound"]["current_soundpack"] = self.dialog.sound.get("soundpack") self.config["sound"]["current_soundpack"] = self.dialog.sound.get("soundpack")
self.buffer.session.sound.config = self.config["sound"] self.buffer.session.sound.config = self.config["sound"]
self.buffer.session.sound.check_soundpack() self.buffer.session.sound.check_soundpack()

View File

@ -37,8 +37,8 @@ actions = {
"copy_to_clipboard": _(u"Copy to clipboard"), "copy_to_clipboard": _(u"Copy to clipboard"),
"add_to_list": _(u"Add to list"), "add_to_list": _(u"Add to list"),
"remove_from_list": _(u"Remove from list"), "remove_from_list": _(u"Remove from list"),
"toggle_mute": _(u"Mutes/unmutes the active buffer"), "toggle_buffer_mute": _(u"Mutes/unmutes the active buffer"),
"toggle_global_mute": _(u"Globally mute/unmute TW Blue"), "toggle_session_mute": _(u"Globally mute/unmute the current account in TWBlue"),
"toggle_autoread": _(u"toggles the automatic reading of incoming tweets in the active buffer"), "toggle_autoread": _(u"toggles the automatic reading of incoming tweets in the active buffer"),
"search": _(u"Search on twitter"), "search": _(u"Search on twitter"),
"edit_keystrokes": _(u"Shows the keystroke editor"), "edit_keystrokes": _(u"Shows the keystroke editor"),

View File

@ -87,7 +87,7 @@ class soundSystem(object):
def play(self, sound, argument=False): def play(self, sound, argument=False):
if self.soundpack_OK == False: return if self.soundpack_OK == False: return
if self.config["global_mute"] == True: return if self.config["session_mute"] == True: return
sound_object = sound_lib.stream.FileStream(file="%s/%s" % (self.path, sound)) sound_object = sound_lib.stream.FileStream(file="%s/%s" % (self.path, sound))
sound_object.volume = float(self.config["volume"]) sound_object.volume = float(self.config["volume"])
self.files.append(sound_object) self.files.append(sound_object)

View File

@ -111,8 +111,8 @@ class sound(wx.Panel):
volumeBox.Add(volume, 0, wx.ALL, 5) volumeBox.Add(volume, 0, wx.ALL, 5)
volumeBox.Add(self.volumeCtrl, 0, wx.ALL, 5) volumeBox.Add(self.volumeCtrl, 0, wx.ALL, 5)
sizer.Add(volumeBox, 0, wx.ALL, 5) sizer.Add(volumeBox, 0, wx.ALL, 5)
self.global_mute = wx.CheckBox(self, -1, _(u"Global mute")) self.session_mute = wx.CheckBox(self, -1, _(u"Session mute"))
sizer.Add(self.global_mute, 0, wx.ALL, 5) sizer.Add(self.session_mute, 0, wx.ALL, 5)
output_label = wx.StaticText(self, -1, _(u"Output device")) output_label = wx.StaticText(self, -1, _(u"Output device"))
self.output = wx.ComboBox(self, -1, choices=output_devices, style=wx.CB_READONLY) self.output = wx.ComboBox(self, -1, choices=output_devices, style=wx.CB_READONLY)
self.output.SetSize(self.output.GetBestSize()) self.output.SetSize(self.output.GetBestSize())

View File

@ -62,11 +62,9 @@ class mainFrame(wx.Frame):
buffer = wx.Menu() buffer = wx.Menu()
self.load_previous_items = buffer.Append(wx.NewId(), _(u"&Load previous items")) self.load_previous_items = buffer.Append(wx.NewId(), _(u"&Load previous items"))
self.mute = buffer.Append(wx.NewId(), _(u"&Mute")) self.mute = buffer.Append(wx.NewId(), _(u"&Mute"))
self.mute.Enable(False)
self.autoread = buffer.Append(wx.NewId(), _(u"&Autoread tweets for this buffer")) self.autoread = buffer.Append(wx.NewId(), _(u"&Autoread tweets for this buffer"))
self.clear = buffer.Append(wx.NewId(), _(u"&Clear buffer")) self.clear = buffer.Append(wx.NewId(), _(u"&Clear buffer"))
self.deleteTl = buffer.Append(wx.NewId(), _(u"&Remove buffer")) self.deleteTl = buffer.Append(wx.NewId(), _(u"&Remove buffer"))
# self.deleteTl.Enable(False)
# Help Menu # Help Menu
help = wx.Menu() help = wx.Menu()