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:
parent
2aec2ea9b1
commit
e9b0675884
7 changed files with 27 additions and 6 deletions
|
@ -1344,8 +1344,16 @@ class Game(object):
|
||||||
self._resizeHandlerID = self.canvas.after(250, self._resizeHandler)
|
self._resizeHandlerID = self.canvas.after(250, self._resizeHandler)
|
||||||
|
|
||||||
def playSample(self, name, priority=0, loop=0):
|
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
|
return 0
|
||||||
if self.app.audio:
|
if self.app.audio:
|
||||||
return self.app.audio.playSample(
|
return self.app.audio.playSample(
|
||||||
|
@ -1366,8 +1374,7 @@ class Game(object):
|
||||||
a = self.app.opt.animations
|
a = self.app.opt.animations
|
||||||
if a and not self.preview:
|
if a and not self.preview:
|
||||||
self.canvas.update_idletasks()
|
self.canvas.update_idletasks()
|
||||||
if self.app.audio and self.app.opt.sound \
|
if self.app.audio and self.app.opt.sound:
|
||||||
and self.app.opt.sound_samples['deal']:
|
|
||||||
if a in (1, 2, 3, 10):
|
if a in (1, 2, 3, 10):
|
||||||
self.playSample("deal01", priority=100, loop=loop)
|
self.playSample("deal01", priority=100, loop=loop)
|
||||||
elif a == 4:
|
elif a == 4:
|
||||||
|
|
|
@ -115,7 +115,8 @@ class GrandfathersClock(Game):
|
||||||
return clocks + cards
|
return clocks + cards
|
||||||
|
|
||||||
def startGame(self):
|
def startGame(self):
|
||||||
self.playSample("grandfathersclock", loop=1)
|
self.startDealSample()
|
||||||
|
self.playSample("grandfathersclock", loop=1, priority=200)
|
||||||
self._dealNumRows(4)
|
self._dealNumRows(4)
|
||||||
self.s.talon.dealRow()
|
self.s.talon.dealRow()
|
||||||
self.s.talon.dealRow(rows=self.s.foundations)
|
self.s.talon.dealRow(rows=self.s.foundations)
|
||||||
|
|
|
@ -776,6 +776,12 @@ class OptionsMenuDialog(LMenuDialog):
|
||||||
_('game won'),
|
_('game won'),
|
||||||
self.menubar.tkopt.sound_sample_vars[key],
|
self.menubar.tkopt.sound_sample_vars[key],
|
||||||
self.make_vars_command(self.menubar.mOptSoundSample, 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
|
# Cardsets and card backside options
|
||||||
|
|
|
@ -154,6 +154,7 @@ gamewon = boolean
|
||||||
droppair = boolean
|
droppair = boolean
|
||||||
redo = boolean
|
redo = boolean
|
||||||
dealwaste = boolean
|
dealwaste = boolean
|
||||||
|
extra = boolean
|
||||||
|
|
||||||
[fonts]
|
[fonts]
|
||||||
sans = list
|
sans = list
|
||||||
|
@ -366,7 +367,7 @@ class Options:
|
||||||
'dealwaste': True,
|
'dealwaste': True,
|
||||||
'droppair': True,
|
'droppair': True,
|
||||||
'drop': True,
|
'drop': True,
|
||||||
# 'extra': True,
|
'extra': True,
|
||||||
'flip': True,
|
'flip': True,
|
||||||
'move': True,
|
'move': True,
|
||||||
'nomove': True,
|
'nomove': True,
|
||||||
|
|
|
@ -70,6 +70,8 @@ class SoundOptionsDialog:
|
||||||
('gamelost', _('Game lost')),
|
('gamelost', _('Game lost')),
|
||||||
('gamewon', _('Game won')),
|
('gamewon', _('Game won')),
|
||||||
('gameperfect', _('Perfect game')),
|
('gameperfect', _('Perfect game')),
|
||||||
|
|
||||||
|
('extra', _('Other')),
|
||||||
]
|
]
|
||||||
|
|
||||||
table = self.widgets_tree.get_widget('samples_table')
|
table = self.widgets_tree.get_widget('samples_table')
|
||||||
|
|
|
@ -84,6 +84,8 @@ class SoundOptionsDialog(MfxDialog):
|
||||||
('gamelost', _('Game lost'), tkinter.BooleanVar()),
|
('gamelost', _('Game lost'), tkinter.BooleanVar()),
|
||||||
('gamewon', _('Game won'), tkinter.BooleanVar()),
|
('gamewon', _('Game won'), tkinter.BooleanVar()),
|
||||||
('gameperfect', _('Perfect game'), tkinter.BooleanVar()),
|
('gameperfect', _('Perfect game'), tkinter.BooleanVar()),
|
||||||
|
|
||||||
|
('extra', _('Other'), tkinter.BooleanVar()),
|
||||||
]
|
]
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -84,6 +84,8 @@ class SoundOptionsDialog(MfxDialog):
|
||||||
('gamelost', _('Game lost'), tkinter.BooleanVar()),
|
('gamelost', _('Game lost'), tkinter.BooleanVar()),
|
||||||
('gamewon', _('Game won'), tkinter.BooleanVar()),
|
('gamewon', _('Game won'), tkinter.BooleanVar()),
|
||||||
('gameperfect', _('Perfect game'), tkinter.BooleanVar()),
|
('gameperfect', _('Perfect game'), tkinter.BooleanVar()),
|
||||||
|
|
||||||
|
('extra', _('Other'), tkinter.BooleanVar()),
|
||||||
]
|
]
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
Loading…
Add table
Reference in a new issue