Project

Profile

Help

Revision 84279362

ID84279362a58f83faa934b5fc1ce67f62a11c78fb
Parent 5e67e1a5
Child 060e5a35

Added by Vincent Le Goff over 2 years ago

Implement #89: add a menu item to disable trigger sounds

View differences:

src/game.py
74 74
        self.logger = logger("")
75 75
        begin()
76 76
        self.settings = Settings(self)
77
        self.sounds = True
77 78
        self.worlds = {}
78 79
        self.default_world = None
79 80
        self.level = Level.engine
src/sharp/functions/play.py
52 52
    def run(self, filename):
53 53
        """Play the audio file."""
54 54
        log = logger("sharp")
55
        log.debug("#play {}".format(filename))
55
        if self.engine.sounds:
56
            log.debug("#play {}".format(repr(filename)))
57
        else:
58
            log.debug("#play-silent {}".format(repr(filename)))
59
            return
60

  
56 61
        filename = self.find_abs_filename(filename)
57 62
        if os.path.exists(filename):
58 63
            log.debug("#play playing {}".format(repr(filename)))
src/translations/en/ui/menu.yml
16 16
notepad_world: "For this &world..."
17 17
notepad_character: "For this &character..."
18 18
character: Change this character's setting...
19
sounds: Play trigger sounds
19 20
connection: "&Connection"
20 21
disconnect: "&Disconnect from this world"
21 22
reconnect: "&Reconnect to this world"
src/translations/fr/ui/menu.yml
16 16
notepad_world: "Pour cet &univers..."
17 17
notepad_character: "Pour ce &personnage..."
18 18
character: Changer les options de ce personnage...
19
sounds: Jouer les sons des triggers
19 20
connection: "&Connexion"
20 21
disconnect: "Se &déconnecter de cet univers"
21 22
reconnect: "Se &reconnecter à cet univers"
src/ui/dialogs/preferences.py
394 394
        self.engine.TTS_outside  = accessibility.TTS_outside.GetValue()
395 395

  
396 396
        # Repercute screen reader support
397
        print "Turning srs", srs
398 397
        for tab in self.window.tabs.GetChildren():
399 398
            tab.screenreader_support = srs
400 399

  
src/ui/window.py
194 194
        self.Bind(wx.EVT_MENU, self.OnCharacter, character)
195 195
        gameMenu.AppendItem(character)
196 196

  
197
        # Play sounds
198
        self.chk_sounds = gameMenu.Append(wx.ID_ANY, t("ui.menu.sounds"),
199
                t("ui.menu.sounds"), kind=wx.ITEM_CHECK)
200
        gameMenu.Check(self.chk_sounds.GetId(), True)
201
        self.Bind(wx.EVT_MENU, self.ToggleSounds, self.chk_sounds)
202

  
197 203
        ## Connection menu
198 204
        # Disconnect
199 205
        disconnect = wx.MenuItem(connectionMenu, -1, t("ui.menu.disconnect"))
......
381 387
        dialog = CharacterDialog(self.engine, session)
382 388
        dialog.ShowModal()
383 389

  
390
    def ToggleSounds(self, e):
391
        """Toggle the "play sounds" checkbox."""
392
        self.engine.sounds = self.chk_sounds.IsChecked()
393

  
384 394
    def OnDisconnect(self, e):
385 395
        """Disconnect the current client."""
386 396
        panel = self.panel

Also available in: Unified diff