1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

Added option to enable/disable other sound samples (the clock sound in Grandfather's Clock).

This commit is contained in:
Joe R 2021-06-26 11:00:39 -04:00
parent 2aec2ea9b1
commit e9b0675884
7 changed files with 27 additions and 6 deletions

View file

@ -1344,8 +1344,16 @@ class Game(object):
self._resizeHandlerID = self.canvas.after(250, self._resizeHandler)
def playSample(self, name, priority=0, loop=0):
if name in self.app.opt.sound_samples and \
not self.app.opt.sound_samples[name]:
if name.startswith('deal'):
sampleopt = 'deal'
elif name not in self.app.opt.sound_samples:
sampleopt = 'extra'
else:
sampleopt = name
if sampleopt in self.app.opt.sound_samples and \
not self.app.opt.sound_samples[sampleopt]:
return 0
if self.app.audio:
return self.app.audio.playSample(
@ -1366,8 +1374,7 @@ class Game(object):
a = self.app.opt.animations
if a and not self.preview:
self.canvas.update_idletasks()
if self.app.audio and self.app.opt.sound \
and self.app.opt.sound_samples['deal']:
if self.app.audio and self.app.opt.sound:
if a in (1, 2, 3, 10):
self.playSample("deal01", priority=100, loop=loop)
elif a == 4:

View file

@ -115,7 +115,8 @@ class GrandfathersClock(Game):
return clocks + cards
def startGame(self):
self.playSample("grandfathersclock", loop=1)
self.startDealSample()
self.playSample("grandfathersclock", loop=1, priority=200)
self._dealNumRows(4)
self.s.talon.dealRow()
self.s.talon.dealRow(rows=self.s.foundations)

View file

@ -776,6 +776,12 @@ class OptionsMenuDialog(LMenuDialog):
_('game won'),
self.menubar.tkopt.sound_sample_vars[key],
self.make_vars_command(self.menubar.mOptSoundSample, key))
key = 'extra'
self.addCheckNode(
tv, rg1,
_('Other'),
self.menubar.tkopt.sound_sample_vars[key],
self.make_vars_command(self.menubar.mOptSoundSample, key))
# -------------------------------------------
# Cardsets and card backside options

View file

@ -154,6 +154,7 @@ gamewon = boolean
droppair = boolean
redo = boolean
dealwaste = boolean
extra = boolean
[fonts]
sans = list
@ -366,7 +367,7 @@ class Options:
'dealwaste': True,
'droppair': True,
'drop': True,
# 'extra': True,
'extra': True,
'flip': True,
'move': True,
'nomove': True,

View file

@ -70,6 +70,8 @@ class SoundOptionsDialog:
('gamelost', _('Game lost')),
('gamewon', _('Game won')),
('gameperfect', _('Perfect game')),
('extra', _('Other')),
]
table = self.widgets_tree.get_widget('samples_table')

View file

@ -84,6 +84,8 @@ class SoundOptionsDialog(MfxDialog):
('gamelost', _('Game lost'), tkinter.BooleanVar()),
('gamewon', _('Game won'), tkinter.BooleanVar()),
('gameperfect', _('Perfect game'), tkinter.BooleanVar()),
('extra', _('Other'), tkinter.BooleanVar()),
]
#

View file

@ -84,6 +84,8 @@ class SoundOptionsDialog(MfxDialog):
('gamelost', _('Game lost'), tkinter.BooleanVar()),
('gamewon', _('Game won'), tkinter.BooleanVar()),
('gameperfect', _('Perfect game'), tkinter.BooleanVar()),
('extra', _('Other'), tkinter.BooleanVar()),
]
#