Skip to content

Commit

Permalink
Completed documentations. The Active audio theme is muted when editin…
Browse files Browse the repository at this point in the history
…g or creating audio themes.
  • Loading branch information
mush42 committed Dec 12, 2019
1 parent 6b59b95 commit 6494949
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion addon/globalPlugins/audiothemes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def terminate(self):

def on_studio_item_clicked(self, event):
# Translators: title for the audio themes studio dialog
with AudioThemesStudioStartupDialog(_("Audio Themes Studio")) as dlg:
with AudioThemesStudioStartupDialog(self, _("Audio Themes Studio")) as dlg:
dlg.ShowModal()

def script_speakObject(self, gesture):
Expand Down
27 changes: 22 additions & 5 deletions addon/globalPlugins/audiothemes/studio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import wx
import config
import gui
from contextlib import contextmanager
from tempfile import TemporaryDirectory
from wx.adv import CommandLinkButton
from ..handler import AudioTheme, AudioThemesHandler, audiotheme_changed
Expand Down Expand Up @@ -35,7 +36,7 @@ def addControls(self, sizer, parent):
themeAuthorLabel = wx.StaticText(parent, -1, _("Theme Author"))
self.themeAuthorEdit = wx.TextCtrl(parent, -1, name="author")
# Translators: label for a text field
themeSummaryLabel = wx.StaticText(parent, -1, _("Theme Summary"))
themeSummaryLabel = wx.StaticText(parent, -1, _("Theme Description"))
self.themeSummaryEdit = wx.TextCtrl(
parent, -1, style=wx.TE_MULTILINE, name="summary"
)
Expand Down Expand Up @@ -96,6 +97,11 @@ def selected_theme(self):


class AudioThemesStudioStartupDialog(BaseDialog):

def __init__(self, plugin, *args, **kwargs):
self.plugin = plugin
super().__init__(*args, **kwargs)

def addControls(self, sizer, parent):
# Translators: instruction message in the audio themes studio startup dialog
dialogMessage = wx.StaticText(self, -1, _(WELCOME_MSG))
Expand Down Expand Up @@ -134,6 +140,15 @@ def getButtons(self, parent):
btnsizer.Realize()
return btnsizer

@contextmanager
def audio_theme_muted(self):
theme_state = self.plugin.handler.enabled
self.plugin.handler.enabled = False
try:
yield
finally:
self.plugin.handler.enabled = theme_state

def onCreateNewTheme(self, event):
self.Close()
theme_info = None
Expand All @@ -152,8 +167,9 @@ def onCreateNewTheme(self, event):
theme=new_theme,
editing=False,
)
with dlg:
dlg.ShowModal()
with self.audio_theme_muted():
with dlg:
dlg.ShowModal()

def onEditExistingTheme(self, event):
self.Close()
Expand All @@ -178,6 +194,7 @@ def onEditExistingTheme(self, event):
_("Editing Audio Theme: {name}").format(name=selected_theme.name),
theme=selected_theme,
)
with dlg:
dlg.ShowModal()
with self.audio_theme_muted():
with dlg:
dlg.ShowModal()
audiotheme_changed.notify()
2 changes: 1 addition & 1 deletion buildVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"addon_summary" : _("Audio Themes"),
# Add-on description
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
"addon_description" : _("""This add-on creates a virtual audio display that plays sounds when focusing or navigating objects, the audio will be played in a location that corresponds to the object's location in the visual display. The add-on also enables you to activate, install, remove, edit, create, and distribute audio theme packages."""),
"addon_description" : _("""This add-on creates a virtual audio display that plays sounds when focusing or navigating objects, the audio will be played in a location that corresponds to the object's location in the visual display. The add-on also enables you to add, remove, edit, create, and distribute audio theme packages."""),
# version
"addon_version" : "6.0",
# Author(s)
Expand Down

0 comments on commit 6494949

Please sign in to comment.